:root {
  --ink: #1c1814;
  --ink-soft: #5a5248;
  --paper: #f4eee4;
  --paper-2: #ebe3d4;
  --cream: #fbf7f0;
  --sky: #c9d9ee;
  --sky-deep: #7fa3c9;
  --lilac: #cbb8e4;
  --gold: #c4a46a;
  --gold-2: #e4d3aa;
  --blush: #edd4c8;
  --night: #12131a;
  --night-2: #1c2230;
  --silk: #243049;
  --line: rgba(28, 24, 20, 0.12);
  --shadow: 0 24px 60px rgba(28, 24, 20, 0.12);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "Cormorant Garamond", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
input, select, textarea { font-size: 16px; }
img { max-width: 100%; display: block; }
button { cursor: pointer; touch-action: manipulation; }

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

/* Curtain */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  pointer-events: auto;
}
.curtain.gone { pointer-events: none; }
.panel {
  width: 50%;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(255, 220, 160, 0.08), transparent 18%, transparent 82%, rgba(255, 220, 160, 0.08)),
    linear-gradient(180deg, #1a2233, #12151f 40%, #2a3348);
  transition: transform 1.15s cubic-bezier(0.76, 0, 0.24, 1);
}
.panel.left { box-shadow: inset -18px 0 40px rgba(0,0,0,.28); }
.panel.right { box-shadow: inset 18px 0 40px rgba(0,0,0,.28); }
.curtain.open .panel.left { transform: translateX(-102%); }
.curtain.open .panel.right { transform: translateX(102%); }
.curtain-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  color: #f7f1e6;
  text-align: center;
  transition: opacity .5s ease;
}
.curtain.open .curtain-center { opacity: 0; }
.curtain-center img.kily {
  width: min(42vw, 220px);
  filter: drop-shadow(0 18px 30px rgba(0,0,0,.35));
  animation: float 3.2s ease-in-out infinite;
}
.wordmark {
  width: min(72vw, 340px);
  margin: 18px 0 8px;
  filter: invert(1);
}
.curtain-center p {
  margin: 0 0 28px;
  letter-spacing: 0.42em;
  font-size: 12px;
  color: var(--gold-2);
  font-family: var(--serif);
}
.open-btn {
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold-2);
  padding: 12px 28px;
  border-radius: 999px;
  letter-spacing: 0.28em;
  font-size: 13px;
}
.open-btn:hover { background: rgba(196, 164, 106, 0.16); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Home */
.home {
  position: relative;
  overflow-x: hidden;
}
.hero {
  padding: 18px 22px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(1200px 480px at 50% -10%, rgba(201, 217, 238, 0.7), transparent 60%),
    linear-gradient(180deg, #eef3f8, var(--paper) 70%);
}
.hero .brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  letter-spacing: 0.32em;
  font-size: 11px;
}
.hero .brand-row img { width: 36px; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(32px, 6vw, 52px);
  margin: 10px 0 6px;
  letter-spacing: 0.08em;
}
.hero .mission {
  font-family: var(--serif);
  font-size: clamp(15px, 3.4vw, 20px);
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.hero .quote {
  max-width: 520px;
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 13px;
  margin: 0;
}
.hero-kily {
  width: min(28vw, 108px);
  margin-top: 2px;
  animation: float 4s ease-in-out infinite;
  filter: drop-shadow(0 20px 30px rgba(90, 110, 140, 0.2));
}
.imbaby {
  width: min(36vw, 120px);
  margin: 2px 0 0;
  opacity: 0.9;
}

.section {
  padding: 4px 18px 48px;
  max-width: 1100px;
  margin: 0 auto;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 4px 18px;
}
.section-title h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  margin: 0;
}
.section-title span { color: var(--ink-soft); font-size: 12px; letter-spacing: 0.18em; }

.cats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cat {
  position: relative;
  min-height: 148px;
  border-radius: 22px;
  overflow: hidden;
  padding: 18px 16px;
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateZ(0);
  transition: transform .35s ease, box-shadow .35s ease;
}
.cat:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 28px 50px rgba(28,24,20,.16); }
.cat .en { font-size: 10px; letter-spacing: 0.28em; opacity: 0.55; }
.cat h3 { font-family: var(--serif); font-size: 28px; margin: 10px 0 4px; }
.cat .line { font-size: 13px; opacity: 0.72; }
.cat .count {
  position: absolute;
  left: 16px;
  bottom: 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.cat img.mascot {
  position: absolute;
  right: -8px;
  bottom: -18px;
  width: 46%;
  max-width: 130px;
  pointer-events: none;
}
.cat.wide { grid-column: span 2; min-height: 150px; }

.footer {
  padding: 28px 18px 40px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
}
.footer a { border-bottom: 1px solid var(--gold); }

/* Gallery */
.g-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(244, 238, 228, 0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.g-top img { width: 42px; }
.g-top h1 { font-family: var(--serif); font-size: 20px; margin: 0; }
.g-top p { margin: 0; font-size: 12px; color: var(--ink-soft); }
.back {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: white;
  display: grid;
  place-items: center;
}
.film {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 14px 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.film::-webkit-scrollbar { display: none; }
.film img, .film .ph {
  width: 108px;
  height: 136px;
  object-fit: cover;
  border-radius: 12px;
  scroll-snap-align: start;
  flex: 0 0 auto;
  background: var(--paper-2);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 14px 40px;
}
.card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: var(--paper-2);
  min-height: 210px;
  animation: rise .6s ease both;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 210px;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .5s ease, transform .7s ease;
}
.card img.on { opacity: 1; transform: scale(1); }
.card .blur {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(16px);
  transform: scale(1.1);
}
.sentinel, .status {
  text-align: center;
  padding: 8px 0 28px;
  color: var(--ink-soft);
  font-size: 13px;
}
.story-open, .beat, .story-end {
  grid-column: 1 / -1;
}
.story-open, .beat {
  margin: 6px 0 2px;
  padding: 18px 16px;
  border-radius: 18px;
  background: white;
}
.bridge {
  background:
    radial-gradient(420px 160px at 100% 0, rgba(196, 164, 106, 0.22), transparent 60%),
    #fffaf3;
}
.beat-kicker, .end-kicker {
  margin: 0 0 6px;
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--gold);
}
.beat h2, .story-open h2, .story-end h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.35;
  margin: 0 0 8px;
}
.beat p, .story-open p, .story-end .end-copy {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.85;
  font-size: 14px;
}
.story-end {
  margin: 8px 14px 28px;
  padding: 22px 18px 16px;
  border-radius: 22px;
  background:
    radial-gradient(420px 160px at 100% 0, rgba(196, 164, 106, 0.2), transparent 60%),
    white;
}
.next-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}
.next-card {
  display: block;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--ink);
}
.next-card strong { display: block; font-family: var(--serif); font-size: 20px; }
.next-card span { display: block; margin-top: 4px; font-size: 13px; color: var(--ink-soft); }

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.skel {
  background: linear-gradient(90deg, #e8dfd0, #f6f0e6, #e8dfd0);
  background-size: 200% 100%;
  animation: shine 1.2s linear infinite;
}
@keyframes shine { to { background-position: -200% 0; } }

/* Lightbox */
.lb {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 16, 0.92);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  color: #f7f1e6;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.lb.show { display: flex; }
.lb img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0,0,0,.45);
}
.lb-frame { position: relative; width: min(100%, 920px); padding: 0 18px; }
.lb-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
  color: var(--gold-2);
  font-family: var(--serif);
}
.lb .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.2);
  background: rgba(255,255,255,.08);
  color: white;
}
.lb .prev { left: 8px; }
.lb .next { right: 8px; }
.lb .close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  background: transparent;
  color: white;
  font-size: 22px;
}
.kily-mark {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 54px;
  opacity: 0.85;
}

/* Studio */
.studio-body { background: #efe8db; }
.login-wrap {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--cream);
  border-radius: 28px;
  padding: 32px 26px;
  text-align: center;
  box-shadow: var(--shadow);
}
.login-card img { width: 140px; margin: 0 auto 8px; }
.login-card h1 { font-family: var(--serif); margin: 0 0 6px; }
.login-card p { color: var(--ink-soft); font-size: 13px; }
.login-card input {
  width: 100%;
  margin: 18px 0 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
}
.login-err:not(:empty) {
  color: #9a3b2f;
  font-weight: 600;
}
.gold-btn {
  width: 100%;
  border: 0;
  background: linear-gradient(180deg, #d4b57c, #b8904e);
  color: #1c1814;
  padding: 13px 18px;
  border-radius: 999px;
  letter-spacing: 0.18em;
  font-weight: 600;
}
.studio {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 60px;
}
.studio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.studio-head h1 { font-family: var(--serif); font-size: 28px; margin: 0; }
.studio-logo { width: 140px; }
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 16px 0;
}
.tab {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
}
.tab.on { background: var(--ink); color: var(--cream); }
.panel-card {
  background: var(--cream);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.drop {
  border: 1.5px dashed rgba(196,164,106,.7);
  border-radius: 22px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(400px 140px at 50% 0, rgba(201,184,228,.25), transparent),
    white;
  padding: 20px;
}
.drop.over { border-color: var(--sky-deep); background: #f7fbff; }
.drop img { width: 92px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
select, .field {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}
.progress {
  height: 8px;
  background: #e8dfd0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky-deep), var(--gold)); }
.result-list { margin-top: 16px; display: grid; gap: 8px; }
.result-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  background: white;
  border-radius: 14px;
  padding: 8px;
  font-size: 13px;
}
.result-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; }
.ok { color: #3d6b46; }
.bad { color: #9a3b32; }
.share-grid, .oss-grid { display: grid; gap: 12px; }
.share-item, .oss-grid label {
  background: white;
  border-radius: 16px;
  padding: 14px;
}
.share-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#catForm input {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}
.wx-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 14px 10px;
  display: grid;
  grid-template-columns: 1fr 72px;
  grid-template-areas: "text cover" "foot foot";
  column-gap: 14px;
  row-gap: 10px;
  box-shadow: 0 8px 24px rgba(28, 24, 20, 0.06);
}
.wx-card-main { grid-area: text; min-width: 0; }
.wx-card-title {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.4;
  color: #111;
}
.wx-card-desc {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #8a8a8a;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wx-card-cover {
  grid-area: cover;
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #f3f0ea;
}
.wx-card-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #f0f0f0;
  padding-top: 8px;
  color: #b0b0b0;
  font-size: 12px;
}
.wx-card-foot span { letter-spacing: 0.04em; }
.copy {
  border: 0;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  padding: 8px 14px;
}
.oss-grid label { display: grid; gap: 6px; font-size: 13px; }
.oss-grid input[type="text"], .oss-grid input[type="password"] {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.toggle { display: flex; align-items: center; gap: 10px; }
.hint { color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.lib {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lib .cell {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  font-size: 12px;
}
.lib img { width: 100%; height: 150px; object-fit: cover; }
.lib .meta { padding: 8px 10px 12px; }
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
}

@media (min-width: 880px) {
  .cats { grid-template-columns: repeat(3, 1fr); }
  .cat.wide { grid-column: auto; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; padding-left: 28px; padding-right: 28px; }
  .lib { grid-template-columns: repeat(4, 1fr); }
  .g-top, .film { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 720px) {
  .g-top {
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .section-title { align-items: flex-start; }
  .section-title h2 { font-size: 20px; }
  .section-title span { letter-spacing: 0.04em; text-align: right; }
  .cat { min-height: 132px; padding: 14px 12px 36px; }
  .cat h3 { font-size: 22px; margin: 6px 0 2px; }
  .cat .line { font-size: 12px; }
  .cat .count { left: 12px; bottom: 10px; }
  .beat h2, .story-open h2, .story-end h2 { font-size: 22px; }
  .lb img { max-height: 72vh; }
  .lb .nav { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); transform: none; }
  .lb .close { top: max(12px, env(safe-area-inset-top)); width: 44px; height: 44px; }
  .studio { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .studio-head h1 { font-size: 22px; }
  .studio-logo { width: 92px; }
  .wx-card { grid-template-columns: 1fr 56px; }
  .wx-card-cover { width: 56px; height: 56px; }
  .footer { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
}
