/* ═══════════════════════════════════════════════════════
   牛来 · Web 版 — 影院外壳样式
   水墨海报 + 黑盒影院 + 字幕 + 弹幕 + 屏摄彩蛋
   ═══════════════════════════════════════════════════════ */
:root {
  --ink: #1a1a1a;
  --paper: #f5f2ea;
  --gold: #c9a227;
  --red: #a02c2c;
  --bar-h: clamp(48px, 9vh, 84px);
  --ui: rgba(16, 16, 18, .78);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: #000; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--paper);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ═══════════ 舞台 ═══════════ */
#stage { position: fixed; inset: 0; background: #000; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#stage.wobble #gl { animation: camWobble 6s ease-in-out infinite; }
@keyframes camWobble {
  0%,100% { transform: scale(1.03) translate(0,0) rotate(0deg); }
  25%     { transform: scale(1.035) translate(.4%, -.3%) rotate(.15deg); }
  50%     { transform: scale(1.03) translate(-.3%, .35%) rotate(-.12deg); }
  75%     { transform: scale(1.036) translate(.25%, .3%) rotate(.1deg); }
}

.letterbox { position: absolute; left: 0; right: 0; height: var(--bar-h); background: #000; z-index: 5; pointer-events: none; transition: transform .8s ease; }
.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }
#stage.open .letterbox.top { transform: translateY(-100%); }
#stage.open .letterbox.bottom { transform: translateY(100%); }

/* ═══════════ 后期叠层 ═══════════ */
#fx-vignette { position: absolute; inset: 0; z-index: 6; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.42) 100%); }
#fx-grain { position: absolute; inset: -50%; width: 200%; height: 200%; z-index: 7; pointer-events: none; opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
  animation: grain .45s steps(4) infinite; }
#stage.nograin #fx-grain { display: none; }
@keyframes grain {
  0% { transform: translate(0,0); } 25% { transform: translate(-1.6%, 1.2%); }
  50% { transform: translate(1.4%, -1.5%); } 75% { transform: translate(-1.1%, -1%); } 100% { transform: translate(0,0); }
}
#fx-flash { position: absolute; inset: 0; z-index: 8; background: #fff; opacity: 0; pointer-events: none; transition: opacity .12s; }
#fx-fade { position: absolute; inset: 0; z-index: 9; background: #000; opacity: 0; pointer-events: none; transition: opacity .6s ease; }
#fx-iris { position: absolute; inset: 0; z-index: 9; pointer-events: none; opacity: 0; }
#fx-iris circle { transition: r .9s cubic-bezier(.6,0,.3,1); }

/* ═══════════ 弹幕 ═══════════ */
#danmaku { position: absolute; inset: 0 0 var(--bar-h) 0; overflow: hidden; z-index: 10; pointer-events: none; }
.dm { position: absolute; white-space: nowrap; font-size: clamp(14px, 2.2vh, 22px); font-weight: 600;
  color: #fff; text-shadow: 0 0 4px rgba(0,0,0,.9), 0 2px 3px rgba(0,0,0,.8);
  will-change: transform; animation: dmFly linear forwards; }
.dm.gold { color: #ffd75e; } .dm.red { color: #ff7b6b; } .dm.green { color: #7dff9e; } .dm.blue { color: #7cc7ff; }
@keyframes dmFly { from { transform: translateX(100vw); } to { transform: translateX(var(--dm-end, -100%)); } }

/* ═══════════ 观众剪影（屏摄模式） ═══════════ */
#audience { position: absolute; left: 0; right: 0; bottom: 0; height: 22vh; z-index: 11; pointer-events: none; opacity: .96; }
#audience svg { width: 100%; height: 100%; }
#audience .ph glow { }

/* ═══════════ 字幕 ═══════════ */
#subtitle { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 4.5vh);
  z-index: 12; text-align: center; pointer-events: none; width: min(86vw, 1000px); }
#sub-who { display: block; font-size: clamp(13px, 1.9vh, 19px); letter-spacing: .35em; color: var(--gold);
  text-shadow: 0 1px 4px #000; margin-bottom: .45em; }
#sub-who:empty { display: none; }
#sub-line { display: inline-block; font-size: clamp(18px, 3.4vh, 34px); line-height: 1.55; font-weight: 600; color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,.95), 0 3px 6px rgba(0,0,0,.85), 0 0 2px #000;
  padding: .1em .6em; border-radius: 6px; }
#sub-echo { position: absolute; left: 50%; transform: translateX(-50%); bottom: 100%; width: 100%;
  font-size: clamp(15px, 2.6vh, 26px); color: rgba(255,255,255,.4); text-shadow: 0 0 8px #000; pointer-events: none; }

/* ═══════════ 章节卡 ═══════════ */
#chapter-card { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); z-index: 13;
  text-align: center; pointer-events: none; opacity: 0; transition: opacity .7s ease; }
#chapter-card.show { opacity: 1; }
#cc-num { font-size: clamp(13px, 2vh, 18px); letter-spacing: .6em; color: var(--gold); margin-bottom: .8em; text-shadow: 0 1px 6px #000; }
#cc-title { font-family: "STKaiti", "KaiTi", "STSong", serif;
  font-size: clamp(26px, 5.4vh, 52px); font-weight: 700; letter-spacing: .18em;
  color: #f3ead2; text-shadow: 0 0 14px rgba(0,0,0,.9), 0 2px 8px #000; }
.cc-stroke { width: 120px; height: 2px; margin: 14px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* ═══════════ 加载 ═══════════ */
#loader { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
#loader .spin { font-size: 44px; animation: spin 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loader-text { font-size: 15px; letter-spacing: .2em; color: #ddd; }

/* ═══════════ HUD ═══════════ */
#hud { position: absolute; top: calc(var(--bar-h) + 10px); left: 16px; z-index: 12; pointer-events: none; opacity: 0; transition: opacity .4s; }
#hud.show { opacity: 1; }
#hud-title { font-size: 13px; letter-spacing: .3em; color: rgba(255,255,255,.75); text-shadow: 0 1px 3px #000; }
#hud-renderer { font-size: 11px; letter-spacing: .12em; color: rgba(255,255,255,.4); margin-top: 4px; }

/* ═══════════ 控制栏 ═══════════ */
#controls { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 0 14px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.82) 40%); transition: transform .35s ease, opacity .35s; }
#controls.hide { transform: translateY(110%); opacity: 0; }
#progress-wrap { padding: 10px 4px 6px; }
#progress { position: relative; height: 5px; background: rgba(255,255,255,.16); border-radius: 3px; cursor: pointer; }
#progress:hover { height: 8px; }
#progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: linear-gradient(90deg, #9c3428, var(--red)); border-radius: 3px; }
#progress-head { position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%; background: #e8d9b0;
  transform: translate(-50%,-50%); box-shadow: 0 0 6px rgba(0,0,0,.8); }
#progress-chapters { position: absolute; inset: 0; }
.pc-tick { position: absolute; top: -2px; width: 2px; height: calc(100% + 4px); background: rgba(255,255,255,.45); }
#controls-row { display: flex; align-items: center; gap: 10px; }
.c-group { display: flex; align-items: center; gap: 6px; }
.c-group.center { flex: 1; justify-content: center; min-width: 0; }
.c-group.right { flex-wrap: wrap; justify-content: flex-end; }
#now-chapter { font-size: 14px; letter-spacing: .18em; color: #e9e2cf; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#time-code { font-size: 12px; color: rgba(255,255,255,.55); letter-spacing: .1em; margin-left: 6px; min-width: 64px; }
.c-btn { background: rgba(255,255,255,.09); color: #eee; border: 1px solid rgba(255,255,255,.14); border-radius: 8px;
  min-width: 38px; height: 34px; padding: 0 10px; font-size: 15px; transition: all .15s; }
.c-btn:hover { background: rgba(255,255,255,.2); }
.c-btn.big { min-width: 46px; height: 40px; font-size: 18px; }
.c-btn.text { font-size: 13px; letter-spacing: .08em; }
.c-btn.on { background: rgba(201,162,39,.32); border-color: rgba(201,162,39,.65); color: #ffe9a8; }

/* ═══════════ 章节目录 ═══════════ */
#menu { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.72); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; }
.menu-panel { width: min(92vw, 640px); max-height: 86vh; overflow: auto; background: linear-gradient(160deg, #171512, #0d0c0a);
  border: 1px solid rgba(201,162,39,.35); border-radius: 14px; padding: 22px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu-brand { font-family: "STKaiti","KaiTi",serif; font-size: 30px; letter-spacing: .2em; color: #f0e6cc; }
.menu-brand i { font-style: normal; font-size: 13px; letter-spacing: .4em; color: var(--gold); margin-left: 10px; }
.menu-sub { font-size: 12px; color: rgba(255,255,255,.45); letter-spacing: .2em; margin: 6px 0 14px; }
#menu-list { list-style: none; }
#menu-list li { border-bottom: 1px solid rgba(255,255,255,.07); }
#menu-list button { width: 100%; display: flex; align-items: baseline; gap: 12px; text-align: left;
  background: none; border: none; color: #ddd; padding: 10px 6px; font-size: 15px; transition: all .15s; border-radius: 8px; }
#menu-list button:hover { background: rgba(201,162,39,.12); color: #fff; }
#menu-list button.cur { color: var(--gold); }
.mi-num { font-size: 11px; letter-spacing: .15em; color: rgba(255,255,255,.4); min-width: 52px; }
.mi-title { letter-spacing: .1em; }
.mi-dur { margin-left: auto; font-size: 11px; color: rgba(255,255,255,.35); }
.menu-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.menu-tip { font-size: 11px; color: rgba(255,255,255,.35); letter-spacing: .08em; }

/* ═══════════ 海报 ═══════════ */
#poster { position: fixed; inset: 0; z-index: 50; background:
  radial-gradient(1200px 700px at 68% 30%, #fdfcf7 0%, #f2eee2 45%, #e2ddcc 100%);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: opacity 1.1s ease, visibility 1.1s; }
#poster.gone { opacity: 0; visibility: hidden; }
.poster-ink { position: absolute; inset: 0; pointer-events: none; }
.ink-mountain { position: absolute; border-radius: 50%; filter: blur(26px); }
.ink-mountain.m1 { width: 60vw; height: 34vh; left: -12vw; top: -8vh; background: radial-gradient(closest-side, rgba(40,60,58,.5), transparent 70%); }
.ink-mountain.m2 { width: 46vw; height: 26vh; right: -8vw; top: 4vh; background: radial-gradient(closest-side, rgba(60,84,80,.38), transparent 70%); }
.ink-mountain.m3 { width: 70vw; height: 30vh; left: 18vw; bottom: -6vh; background: radial-gradient(closest-side, rgba(52,74,66,.3), transparent 72%); }
.ink-path { position: absolute; left: 30%; top: 18%; width: 46%; height: 60%;
  background: radial-gradient(60% 34% at 50% 30%, rgba(63,122,96,.55), transparent 70%),
              radial-gradient(50% 30% at 40% 62%, rgba(63,122,96,.4), transparent 70%),
              radial-gradient(46% 26% at 62% 82%, rgba(63,122,96,.3), transparent 72%);
  filter: blur(14px); border-radius: 50%; }
.ink-bird { position: absolute; font-size: 15px; opacity: .55; animation: birdfly 14s linear infinite; }
.ink-bird.b1 { top: 16%; animation-delay: 0s; } .ink-bird.b2 { top: 24%; animation-delay: -7s; font-size: 11px; }
@keyframes birdfly { from { left: -6%; } to { left: 106%; } }
.ink-bull { position: absolute; left: 56%; top: 30%; font-size: clamp(30px, 5vw, 54px); filter: saturate(.85) drop-shadow(0 4px 8px rgba(0,0,0,.25));
  animation: bullbob 5s ease-in-out infinite; }
@keyframes bullbob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(2deg); } }

.poster-main { position: relative; z-index: 2; text-align: center; padding: 0 20px; max-width: 720px; }
.poster-title { font-family: "STKaiti","KaiTi","STSong",serif; font-size: clamp(88px, 19vh, 190px); line-height: 1;
  color: #17150f; letter-spacing: .06em; text-shadow: 3px 4px 0 rgba(23,21,15,.12); }
.poster-latin { font-size: clamp(14px, 2.2vh, 20px); letter-spacing: 1.1em; text-indent: 1.1em; color: #6b6353; margin: 8px 0 20px; }
.poster-slogan { font-size: clamp(14px, 2.2vh, 18px); color: #3c382e; letter-spacing: .12em; margin-bottom: 8px; }
.poster-meta { font-size: 13px; color: #7a7261; letter-spacing: .15em; margin-bottom: 4px; }
.poster-credit { font-size: 12px; color: #97907e; letter-spacing: .1em; margin-bottom: 30px; }
#btn-enter { font-size: clamp(17px, 2.6vh, 22px); letter-spacing: .55em; text-indent: .55em; color: var(--paper);
  background: linear-gradient(160deg, #2a2721, #14120e); border: 1px solid rgba(201,162,39,.6);
  padding: 16px 46px; border-radius: 999px; transition: all .25s; box-shadow: 0 10px 30px rgba(20,18,14,.35); }
#btn-enter:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(20,18,14,.45); border-color: var(--gold); }
.poster-tips { margin-top: 18px; font-size: 12px; color: #8d8674; letter-spacing: .18em; }
.poster-side { position: absolute; right: 3vw; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl;
  font-family: "STKaiti","KaiTi",serif; font-size: 15px; letter-spacing: .5em; color: rgba(60,56,46,.55); }
.poster-disclaimer { position: absolute; bottom: 2.4vh; left: 0; right: 0; text-align: center; font-size: 11px; letter-spacing: .2em; color: #a49c88; }

/* ═══════════ Toast / 截图 ═══════════ */
#toast { position: fixed; top: calc(var(--bar-h) + 18px); left: 50%; transform: translateX(-50%); z-index: 60;
  background: rgba(10,10,12,.85); border: 1px solid rgba(201,162,39,.4); color: #f0e6cc;
  padding: 10px 22px; border-radius: 999px; font-size: 14px; letter-spacing: .15em; pointer-events: none;
  animation: toastIn .3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%,-8px); } }

/* 窄屏适配 */
@media (max-width: 760px) {
  .c-group.right .c-btn { min-width: 32px; height: 30px; padding: 0 7px; font-size: 13px; }
  #now-chapter { display: none; }
  .poster-side { display: none; }
}
