:root {
  --bg: #0b0806;
  --panel: #15100a;
  --panel-2: #1c150d;
  --ink: #efe4cf;
  --ink-2: #c8b89c;
  --ink-3: #8d7d65;
  --gold: #d8b86a;
  --gold-2: #c9a227;
  --line: rgba(216, 184, 106, .22);
  --line-soft: rgba(255, 255, 255, .07);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 600px at 82% -10%, rgba(90, 68, 38, .30), transparent 62%),
    radial-gradient(760px 620px at 4% 28%, rgba(46, 60, 60, .18), transparent 60%),
    #080605;
}

body.modal-open, body.sheet-open { overflow: hidden; }

.phone {
  position: relative;
  width: min(100%, 520px);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

@media (max-width: 599px) {
  body { display: block; }
  .phone {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (min-width: 600px) {
  .phone {
    height: min(920px, 94dvh);
    border: 1px solid var(--line);
    border-radius: 30px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  }
}

.stage { position: absolute; inset: 0; overflow: hidden; background: #171a1f; }

.pager {
  position: absolute;
  inset: 0;
  overflow-y: hidden;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background: #171a1f;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pager:active { cursor: grabbing; }
.pager::-webkit-scrollbar { display: none; }

.page {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: #171a1f;
}

.page-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.page-bg.video {
  opacity: 0;
  transition: opacity .55s ease;
}
.page-bg.video.show { opacity: 1; }

.page-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 5, 4, .52) 0%, rgba(6, 5, 4, .05) 32%, rgba(6, 5, 4, .12) 58%, rgba(6, 5, 4, .82) 84%, #080605 100%),
    radial-gradient(120% 80% at 50% 100%, rgba(0, 0, 0, .55), transparent 62%);
}

.page-copy {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: calc(env(safe-area-inset-bottom) + 84px);
  z-index: 6;
  pointer-events: none;
}

/* ── 顶部 ───────────────────────────────────────────── */
.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  background: linear-gradient(180deg, rgba(8, 6, 5, .78), transparent);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.seal {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1;
  box-shadow: 0 0 24px rgba(216, 184, 106, .16);
}

.brand-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.brand-copy b {
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: 4px;
  font-weight: 600;
  color: var(--ink);
}
.brand-copy small { font-size: 9.5px; letter-spacing: 1.5px; color: var(--ink-3); }

.download-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(20, 15, 9, .55);
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

/* ── 场景文案 ───────────────────────────────────────── */
.theme {
  font-size: 10.5px;
  letter-spacing: 4px;
  color: var(--gold);
  margin-bottom: 10px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
}

.page-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(28px, 8vw, 36px);
  font-weight: 600;
  letter-spacing: 3px;
  line-height: 1.15;
  color: var(--ink);
  text-shadow: 0 4px 30px rgba(0, 0, 0, .85);
}

.page-copy p {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--ink-2);
  text-shadow: 0 2px 16px rgba(0, 0, 0, .9);
}

.copy-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  pointer-events: auto;
}
.copy-actions .detail-btn { margin-top: 0; }

.swipe-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  margin-top: 12px;
  padding: 6px 11px;
  border: 1px solid rgba(216, 184, 106, .28);
  border-radius: 999px;
  background: rgba(10, 7, 5, .42);
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.swipe-hint svg {
  width: 13px;
  height: 13px;
  animation: hint-bob 1.7s ease-in-out infinite;
}
@keyframes hint-bob {
  0%, 100% { transform: translateY(-1px); opacity: .55; }
  50%      { transform: translateY(3px);  opacity: 1; }
}
.sleep-btn {
  border-color: rgba(216, 184, 106, .55);
  color: var(--gold);
  background: rgba(20, 15, 9, .62);
}

.detail-btn {
  pointer-events: auto;
  margin-top: 14px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 9, 6, .45);
  color: var(--ink-2);
  font-size: 10.5px;
  letter-spacing: 2px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* ── 声音提示 ───────────────────────────────────────── */
.sound-hint {
  position: absolute;
  left: 50%;
  bottom: 178px;
  transform: translateX(-50%);
  z-index: 7;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(8, 6, 5, .55);
  border: 1px solid var(--line-soft);
  color: var(--ink-3);
  font-size: 10px;
  letter-spacing: 1.5px;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .4s ease;
}
body.unlocked .sound-hint { opacity: 0; }

/* ── 场景条 ─────────────────────────────────────────── */
.pager-dots {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.pager-dots .dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(239, 228, 207, .22);
  transition: background .25s ease, box-shadow .25s ease, transform .25s ease;
}
.pager-dots .dot.active {
  background: var(--gold);
  box-shadow: 0 0 8px rgba(216, 184, 106, .8);
  transform: scale(1.25);
}

/* ── 底部菜单 ───────────────────────────────────────── */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px 12px calc(env(safe-area-inset-bottom) + 8px);
  background: linear-gradient(0deg, rgba(6, 5, 4, .98), rgba(6, 5, 4, .72) 70%, transparent);
  border-top: 1px solid rgba(216, 184, 106, .10);
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.tabbar span {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--ink);
  line-height: 1.1;
}
.tabbar small { font-size: 9px; letter-spacing: 1.5px; }
.tabbar button:active span { color: var(--gold); }

/* ── 详情面板 ───────────────────────────────────────── */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(5px);
}
.sheet {
  position: relative;
  width: min(100%, 520px);
  max-height: 80dvh;
  overflow: auto;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  background: linear-gradient(180deg, #17120c, #100c08);
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .55);
  animation: sheet-up .32s cubic-bezier(.2, .8, .2, 1);
}

@keyframes sheet-up {
  from { transform: translateY(40px); opacity: .4; }
  to { transform: translateY(0); opacity: 1; }
}

.handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: rgba(216, 184, 106, .28);
}

.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.kicker { font-size: 10px; letter-spacing: 3px; color: var(--gold); margin-bottom: 6px; }
.sheet h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 2px;
}
.sheet-head p { margin: 6px 0 0; font-size: 11.5px; color: var(--ink-3); letter-spacing: 1px; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 16px;
  cursor: pointer;
}

.desc {
  margin: 14px 0 18px;
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--ink-2);
}

.opening-row {
  margin: 0 0 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
}
.opening-row .label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.opening-row p {
  margin: 0;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-2);
}

.music-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.music-row .label { font-size: 10px; letter-spacing: 2px; color: var(--ink-3); margin-bottom: 3px; }
#sheetMusic { font-size: 13px; color: var(--ink); }

.range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 2px 0;
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 1px;
}
.range-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--gold);
}
.range-row b { width: 38px; text-align: right; font-weight: 500; color: var(--ink-2); }

.sheet .primary { width: 100%; margin-top: 18px; }

/* ── 下载弹窗 ───────────────────────────────────────── */
.modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(4px);
}
.modal {
  position: relative;
  width: min(88vw, 360px);
  max-height: min(88dvh, 640px);
  overflow-y: auto;
  padding: 28px 22px 20px;
  text-align: center;
  background: linear-gradient(180deg, #1b140d, #120d08);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 34px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  animation: modal-in .32s cubic-bezier(.2, .8, .2, 1);
}

@keyframes modal-in {
  from { transform: translateY(14px) scale(.97); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-brand {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 7px;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(216, 184, 106, .28);
}

.modal h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
}
.modal p {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.85;
  color: var(--ink-2);
}

.modal-points {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
  display: grid;
  gap: 8px;
}
.modal-points li {
  position: relative;
  padding-left: 14px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.6;
}
.modal-points li::before {
  content: '';
  position: absolute;
  left: 0;
  top: .6em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .85;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.primary, .ghost {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  letter-spacing: 1.5px;
  cursor: pointer;
}
.primary {
  border: 0;
  background: linear-gradient(135deg, #ecd493, #d8b86a 52%, #c9a227);
  color: #241a0c;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(216, 184, 106, .18);
}
.primary:focus, .ghost:focus, .link-btn:focus { outline: none; }
.primary:focus-visible, .ghost:focus-visible, .link-btn:focus-visible {
  outline: 2px solid rgba(216, 184, 106, .6);
  outline-offset: 2px;
}

.primary:disabled {
  background: rgba(216, 184, 106, .14);
  color: var(--ink-3);
  box-shadow: none;
  cursor: default;
}
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
}
.link-btn {
  margin-top: 2px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 11.5px;
  letter-spacing: 1px;
  text-decoration: underline;
  cursor: pointer;
}
.modal-foot {
  margin-top: 13px;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .5px;
  color: var(--ink-3);
}

@media (max-width: 380px) {
  .brand-copy small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .page-bg, .pager-dots .dot, .sheet, .modal { transition: none !important; animation: none !important; }
}
