:root {
  --ink: #fff3dd;
  --gold: #ffd166;
  --coral: #ff7f8f;
  --blue: #8fc8ff;
  --violet: #b98bff;
  --mint: #7fe0c0;
  --deep: #160a2c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--deep);
  color: var(--ink);
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.wrap {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(6, 2, 16, .55) 100%);
}

/* ---------- 顶栏 ---------- */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: linear-gradient(rgba(10, 4, 22, .82), rgba(10, 4, 22, 0));
  z-index: 6;
  transition: opacity .45s ease;
}

.back {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--ink);
}
.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.brand { flex: none; display: flex; flex-direction: column; line-height: 1.15; }
.brand b { font-size: 15px; letter-spacing: .02em; }
.brand span { font-size: 10.5px; opacity: .55; margin-top: 1px; }

.chapters {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  justify-content: center;
  padding: 2px;
}
.chapters::-webkit-scrollbar { display: none; }

.chapter {
  flex: none;
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 243, 221, .18);
  background: rgba(255, 255, 255, .06);
  color: rgba(255, 243, 221, .75);
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}
.chapter:hover { background: rgba(255, 255, 255, .13); }
.chapter.on {
  background: var(--gold);
  color: #2a1444;
  border-color: var(--gold);
  font-weight: 800;
}

.tools { flex: none; display: flex; gap: 6px; }
.tool {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.tool svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="false"] { color: rgba(255, 243, 221, .4); }
.tool .snd-off, .tool .fs-exit { display: none; }
.tool[aria-pressed="false"] .snd-on { display: none; }
.tool[aria-pressed="false"] .snd-off { display: block; }
.tool[aria-pressed="true"] .fs-exit { display: none; }
.tool[aria-pressed="true"] .fs-enter { display: block; }
:fullscreen .tool .fs-enter { display: none; }
:fullscreen .tool .fs-exit { display: block; }

/* ---------- 字幕 & 互动 ---------- */
.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  z-index: 5;
  pointer-events: none;
  transition: opacity .45s ease;
}

.interactions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  pointer-events: none;
}
.interactions > * { pointer-events: auto; }

.action-btn {
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #2a1444;
  background: linear-gradient(#ffe08a, var(--gold));
  border: 0;
  border-radius: 999px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 5px 0 #b8862a, 0 10px 24px rgba(0, 0, 0, .35);
  animation: popIn .42s cubic-bezier(.2, .9, .2, 1) both,
             pulse 1.9s ease-in-out .42s infinite;
}
.action-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b8862a; }
.action-btn small { display: block; font-size: 10.5px; font-weight: 700; opacity: .65; margin-top: 1px; }
.action-btn.on {
  background: linear-gradient(#fff6cf, #ffe08a);
  box-shadow: 0 5px 0 #b8862a, 0 0 0 3px rgba(255, 243, 221, .5), 0 10px 24px rgba(0, 0, 0, .35);
}
.action-btn.on::before { content: "✓ "; font-weight: 900; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.72) translateY(10px); }
  60% { opacity: 1; transform: scale(1.06) translateY(0); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.slider-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 4, 22, .78);
  border: 1px solid rgba(127, 224, 192, .55);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
}
.slider-box input[type="range"] {
  width: 150px;
  accent-color: var(--mint);
}
.slider-box b { color: var(--mint); font-size: 14px; min-width: 46px; text-align: center; }

.sub {
  max-width: min(880px, 100%);
  background: rgba(10, 4, 22, .66);
  border: 1px solid rgba(255, 243, 221, .1);
  border-radius: 14px;
  padding: 9px 18px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.sub.show { opacity: 1; transform: none; }
.sub p {
  margin: 0;
  font-size: clamp(14px, 2vw, 18px);
  line-height: 1.55;
  text-align: center;
  letter-spacing: .01em;
  text-wrap: balance;
}
body.no-sub .sub { display: none; }

/* ---------- 底部控制 ---------- */
.bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px env(safe-area-inset-bottom);
  background: linear-gradient(rgba(10, 4, 22, 0), rgba(10, 4, 22, .88));
  z-index: 7;
  transition: opacity .45s ease;
}

.ctrl {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .12);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.ctrl svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ctrl.play { width: 42px; height: 42px; background: var(--gold); color: #2a1444; border-color: var(--gold); }
.ctrl.play svg { width: 19px; height: 19px; fill: currentColor; stroke: none; }
.ctrl.play .ic-pause { display: none; }
.ctrl.play.is-playing .ic-play { display: none; }
.ctrl.play.is-playing .ic-pause { display: block; }

.track {
  position: relative;
  flex: 1;
  height: 26px;
  cursor: pointer;
  min-width: 60px;
  display: flex;
  align-items: center;
}
.track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
}
.fill {
  position: absolute;
  left: 0;
  height: 5px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--coral), var(--gold));
}
.marks { position: absolute; inset: 0; }
.marks i {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 11px;
  margin-top: -5.5px;
  background: rgba(255, 243, 221, .35);
  border-radius: 2px;
}

.time {
  flex: none;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 243, 221, .62);
  min-width: 78px;
  text-align: center;
}

/* ---------- 卡片 ---------- */
.card-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 3, 18, .74);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 12;
}
.card-wrap[hidden] { display: none; }

.card {
  width: min(520px, 100%);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 26px 22px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(165deg, #32175e, #1c0c39 70%);
  border: 1px solid rgba(255, 209, 102, .28);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .55);
}
.kicker { font-size: 11px; letter-spacing: .16em; color: var(--gold); }
.card h1 { margin: 10px 0 8px; font-size: clamp(23px, 5vw, 32px); line-height: 1.25; }
.lead { margin: 0; font-size: clamp(14px, 2.4vw, 16px); line-height: 1.7; opacity: .9; }
.small { margin: 8px 0 0; font-size: 11.5px; opacity: .5; }
.resume-note { margin: 10px 0 0; font-size: 12px; color: var(--mint); opacity: .85; }

.card-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.card-actions.col { flex-direction: column; align-items: stretch; }

.big {
  display: inline-block;
  font: inherit;
  font-size: 15.5px;
  font-weight: 800;
  color: #2a1444;
  background: linear-gradient(#ffe08a, var(--gold));
  border: 0;
  border-radius: 14px;
  padding: 12px 20px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 #b8862a;
}
.big:active { transform: translateY(3px); box-shadow: 0 2px 0 #b8862a; }
.big.alt { background: linear-gradient(#bfe0ff, var(--blue)); box-shadow: 0 5px 0 #4f7fa8; }

.ghost {
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(255, 243, 221, .28);
  border-radius: 14px;
  padding: 12px 20px;
  cursor: pointer;
}
.ghost:hover { background: rgba(255, 255, 255, .07); }
a.ghost { display: block; text-align: center; text-decoration: none; }

.toast {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: rgba(10, 4, 22, .9);
  border: 1px solid rgba(255, 243, 221, .14);
  padding: 8px 15px;
  border-radius: 999px;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 20;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 看电影时收起控件 ---------- */
.wrap.idle .top,
.wrap.idle .bar { opacity: 0; pointer-events: none; }
.wrap.idle { cursor: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 780px) {
  .brand span { display: none; }
  .chapters { justify-content: flex-start; }
  .time { min-width: 66px; font-size: 11px; }
}

@media (max-width: 520px) {
  .top { height: 50px; gap: 7px; padding: 0 8px; }
  .brand b { font-size: 13.5px; }
  .chapter { font-size: 11px; padding: 4px 9px; }
  .tool, .back { width: 30px; height: 30px; border-radius: 9px; }
  .tool svg, .back svg { width: 15px; height: 15px; }
  .bar { height: 56px; gap: 6px; padding: 0 8px env(safe-area-inset-bottom); }
  .ctrl { width: 32px; height: 32px; }
  .ctrl.play { width: 38px; height: 38px; }
  .dock { bottom: 62px; padding: 0 10px; }
  .sub { padding: 8px 12px; border-radius: 12px; }
  .action-btn { font-size: 14px; padding: 9px 16px; }
  .slider-box { font-size: 12px; padding: 7px 12px; }
  .slider-box input[type="range"] { width: 110px; }
}

@media (max-height: 520px) {
  .top { height: 44px; }
  .brand span { display: none; }
  .bar { height: 52px; }
  .dock { bottom: 56px; gap: 6px; }
  .sub p { font-size: 13.5px; line-height: 1.45; }
  .card { padding: 18px; }
  .card h1 { font-size: 22px; margin: 6px 0; }
  .lead { font-size: 13px; }
  .small { display: none; }
  .card-actions { margin-top: 12px; }
  .big, .ghost { padding: 9px 16px; font-size: 14px; }
}

@media (max-height: 420px) {
  .brand { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .action-btn { animation: none; }
  .sub { transition: none; }
}
