/* 打工猫 — 游戏 HUD 语言：半透明深色面板 + 细描边 + 大字号数字；赤陶只做危险信号色 */
:root {
  --bg: #FAF7F2;
  --paper: #FFFFFF;
  --panel: #F4F0E9;
  --rule: #E8E2D9;
  --rule-soft: #F0EBE3;
  --ink: #2A2723;
  --ink-2: #6F6A62;
  --ink-3: #8C857A;
  --terracotta: #BC5230;
  --terracotta-deep: #9E4226;
  --tint: #F3E3DA;
  --amber: #C08A2E;
  --green: #4E7A52;

  /* HUD（深色面板） */
  --hud-bg: rgba(16, 19, 22, .74);
  --hud-bg-solid: rgba(16, 19, 22, .9);
  --hud-rule: rgba(255, 255, 255, .16);
  --hud-ink: #F4EFE7;
  --hud-ink-2: rgba(244, 239, 231, .62);
  --hud-hot: #E0673F;

  --r: 8px;
  --sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Songti TC", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #14181c; color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  overscroll-behavior: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

#boot {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: #14181c; color: rgba(244, 239, 231, .7); font-size: 14px; z-index: 90;
  letter-spacing: .04em;
}
#boot.is-hidden { display: none; }

/* ── 顶部 HUD ── */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  pointer-events: none;
}
.hud__row { display: flex; align-items: center; gap: 8px; }
.hud__score {
  display: flex; align-items: baseline; gap: 6px;
  background: var(--hud-bg); border: 1px solid var(--hud-rule);
  border-radius: 6px; padding: 5px 10px; min-width: 84px;
  backdrop-filter: blur(6px);
}
.hud__label { font-size: 10px; color: var(--hud-ink-2); letter-spacing: .1em; }
.hud__score b { font-size: 19px; color: var(--hud-ink); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hud__time { flex: 1; display: flex; align-items: center; gap: 8px; }
.hud__timebar {
  flex: 1; height: 5px; background: rgba(255, 255, 255, .18); border-radius: 999px; overflow: hidden;
}
.hud__timebar i {
  display: block; height: 100%; width: 100%; background: #D8D2C6;
  border-radius: 999px; transition: width .2s linear, background .3s;
}
.hud__timebar i.is-low { background: var(--hud-hot); }
.hud__time span { font-size: 11px; color: var(--hud-ink-2); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.hud__right { display: flex; align-items: center; gap: 6px; }
.hud__lives { display: flex; gap: 2px; }
.paw { width: 18px; height: 18px; display: block; color: var(--hud-hot); }
.paw svg { width: 100%; height: 100%; fill: currentColor; }
.paw--lost { color: rgba(255, 255, 255, .18); }
.iconbtn {
  pointer-events: auto; width: 30px; height: 30px; padding: 0; border: 1px solid var(--hud-rule);
  background: var(--hud-bg); border-radius: 6px; color: var(--hud-ink-2);
  display: grid; place-items: center; cursor: pointer;
}
.iconbtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.iconbtn.is-muted { color: rgba(255, 255, 255, .25); }
.iconbtn.is-muted .wave { display: none; }

.hud__hint {
  margin: 8px auto 0; max-width: 300px; text-align: center;
  font-size: 12px; color: var(--hud-ink); background: var(--hud-bg);
  border: 1px solid var(--hud-rule); border-radius: 999px; padding: 4px 12px;
  transition: opacity .2s; backdrop-filter: blur(6px);
}
.hud__hint.is-empty { opacity: 0; }

/* ── 任务卡（右上角常驻） ── */
.taskcard {
  position: fixed; z-index: 26;
  top: calc(60px + var(--safe-t)); right: calc(12px + var(--safe-r));
  width: 178px; padding: 9px 11px 10px;
  background: var(--hud-bg); border: 1px solid var(--hud-rule);
  border-left: 2px solid var(--terracotta);
  border-radius: 7px; backdrop-filter: blur(7px);
  color: var(--hud-ink); pointer-events: none;
  transition: opacity .25s, transform .25s, border-color .2s;
}
.taskcard.is-empty { opacity: 0; transform: translateX(10px); }
.taskcard__top { display: flex; justify-content: space-between; align-items: baseline; }
.taskcard__kicker { font-size: 9.5px; letter-spacing: .18em; color: var(--hud-ink-2); }
.taskcard__index { font-size: 10px; color: var(--hud-ink-2); font-variant-numeric: tabular-nums; }
.taskcard__name {
  font-size: 15px; font-weight: 700; line-height: 1.25; margin-top: 3px;
  letter-spacing: .02em;
}
.taskcard__where { font-size: 10px; color: var(--hud-ink-2); margin-top: 2px; letter-spacing: .04em; }
.taskcard__prog {
  display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px;
}
.taskcard__prog b {
  font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: .02em;
  color: var(--hud-ink); transition: color .2s;
}
.taskcard__prog b.is-bump { animation: bump .3s ease-out; }
@keyframes bump { 0% { transform: scale(1.35); color: var(--hud-hot); } 100% { transform: scale(1); } }
.taskcard__timer { font-size: 11px; color: var(--hud-ink-2); font-variant-numeric: tabular-nums; }
.taskcard__timer.is-low { color: var(--hud-hot); font-weight: 700; }
.taskcard__bar { height: 2px; background: rgba(255, 255, 255, .14); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.taskcard__bar i { display: block; height: 100%; width: 100%; background: #C9C2B5; }
.taskcard__bar i.is-low { background: var(--hud-hot); }
.taskcard__check {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 40px; color: #7FB07A; opacity: 0; transform: scale(.5);
  background: rgba(10, 14, 12, .55); border-radius: 6px;
}
.taskcard.is-done { border-left-color: #7FB07A; }
.taskcard.is-done .taskcard__check { opacity: .92; transform: scale(1); animation: checkin .62s ease-out; }
@keyframes checkin {
  0% { opacity: 0; transform: scale(.4); }
  35% { opacity: 1; transform: scale(1.08); }
  100% { opacity: .9; transform: scale(1); }
}
.taskcard.is-fail { animation: failshake .42s ease-out; border-left-color: var(--hud-hot); }
@keyframes failshake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-7px); }
  35% { transform: translateX(6px); }
  55% { transform: translateX(-4px); }
  75% { transform: translateX(2px); }
}

/* ── 视野外指引箭头 ── */
.guide-arrow {
  position: fixed; left: 0; top: 0; width: 34px; height: 34px; z-index: 24;
  opacity: 0; transition: opacity .18s; pointer-events: none;
  filter: drop-shadow(0 0 8px rgba(224, 103, 63, .55));
}
.guide-arrow.is-on { opacity: .95; }
.guide-arrow svg { width: 100%; height: 100%; fill: none; stroke: #E0673F; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

/* ── 开场教学字幕 ── */
.tutorial {
  position: fixed; left: 0; right: 0; top: 44%; z-index: 28;
  background: rgba(0, 0, 0, .82); color: #fff; padding: 12px 0;
  opacity: 0; transition: opacity .55s ease; pointer-events: none;
}
.tutorial.is-on { opacity: 1; }
.tutorial p {
  margin: 0; text-align: center; font-size: 14px; letter-spacing: .14em;
  line-height: 1.9; opacity: 0;
}
.tutorial.is-on p { animation: tutin .5s ease forwards; }
.tutorial.is-on p:nth-child(1) { animation-delay: .05s; }
.tutorial.is-on p:nth-child(2) { animation-delay: .55s; }
.tutorial.is-on p:nth-child(3) { animation-delay: 1.05s; }
.tutorial p b { font-weight: 700; margin-right: 10px; color: #fff; }
@keyframes tutin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── 底部常驻目标 ── */
.goalline {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(162px + var(--safe-b)); z-index: 23;
  font-size: 10.5px; letter-spacing: .16em; color: rgba(244, 239, 231, .72);
  background: var(--hud-bg); border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px; padding: 4px 12px; white-space: nowrap; pointer-events: none;
  backdrop-filter: blur(6px);
}

/* ── 提示条 / 飘字 ── */
.banner {
  position: fixed; left: 50%; top: 38%; transform: translate(-50%, -8px);
  background: var(--terracotta); color: #fff; border-radius: 6px;
  padding: 8px 16px; text-align: center; z-index: 30; opacity: 0; pointer-events: none;
  transition: opacity .12s, transform .12s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
}
.banner.is-on { opacity: 1; transform: translate(-50%, 0); animation: pulse .55s ease-in-out infinite; }
.banner__title { font-size: 15px; font-weight: 700; letter-spacing: .04em; }
.banner__sub { font-size: 11px; opacity: .85; margin-top: 2px; }
@keyframes pulse { 0%,100% { box-shadow: 0 6px 18px rgba(0,0,0,.3); } 50% { box-shadow: 0 6px 26px rgba(188,82,48,.6); } }

.toast {
  position: fixed; left: 50%; bottom: calc(196px + var(--safe-b)); transform: translate(-50%, 6px);
  background: var(--hud-bg-solid); color: var(--hud-ink); font-size: 12px; padding: 6px 14px;
  border: 1px solid var(--hud-rule); border-radius: 999px; z-index: 25; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; white-space: nowrap; max-width: 88vw;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .3);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.flash { position: fixed; inset: 0; background: var(--terracotta); opacity: 0; z-index: 40; pointer-events: none; }
.flash.is-on { animation: flash .5s ease-out; }
.flash.is-on-fail { animation: flashfail .38s ease-out; }
@keyframes flash { 0% { opacity: .5; } 100% { opacity: 0; } }
@keyframes flashfail { 0% { opacity: .28; } 100% { opacity: 0; } }

.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 22; }
.floater {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 700; color: #FFD9C6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  animation: floatup .9s ease-out forwards;
}
@keyframes floatup {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.8); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

.diag {
  position: fixed; left: 8px; bottom: calc(8px + var(--safe-b)); z-index: 50;
  font: 11px/1.35 ui-monospace, monospace; color: rgba(244, 239, 231, .75);
  background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 4px; padding: 4px 6px; pointer-events: none; display: none;
}
body.diag-on .diag { display: block; }

/* ── 控件 ── */
.controls { position: fixed; inset: auto 0 0 0; z-index: 24; pointer-events: none; }
.joy {
  position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(22px + var(--safe-b));
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(16, 19, 22, .34); border: 1px solid rgba(255, 255, 255, .2);
  pointer-events: auto; touch-action: none;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .06);
}
.joy__knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(244, 239, 231, .9);
  border: 1px solid rgba(255, 255, 255, .4); box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  transition: transform .04s linear;
}
.actions {
  position: absolute; right: calc(18px + var(--safe-r)); bottom: calc(22px + var(--safe-b));
  display: flex; gap: 12px; pointer-events: auto;
}
.abtn {
  width: 76px; height: 76px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(16, 19, 22, .55); color: var(--hud-ink);
  font-family: var(--sans); font-size: 16px; font-weight: 700;
  display: grid; place-items: center; gap: 0; cursor: pointer; touch-action: none;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .3); backdrop-filter: blur(6px);
}
.abtn small { font-size: 10px; font-weight: 500; color: rgba(244, 239, 231, .55); letter-spacing: .08em; }
.abtn--claw { background: var(--terracotta); color: #fff; border-color: rgba(255, 255, 255, .35); }
.abtn--claw small { color: rgba(255, 255, 255, .75); }
.abtn.is-down { transform: scale(.94); }
.abtn--sleep.is-down { background: rgba(188, 82, 48, .35); }

/* 交互按钮：只在任务点 2 米内出现，比其它按钮大一圈 */
.abtn--act {
  width: 88px; height: 88px; background: var(--terracotta); color: #fff;
  border-color: rgba(255, 255, 255, .4); font-size: 15px;
  box-shadow: 0 4px 18px rgba(188, 82, 48, .45);
  transition: opacity .16s, transform .16s;
}
.abtn--act small { color: rgba(255, 255, 255, .7); }
.abtn--act.is-hidden { display: none; }
.abtn--jump { width: 70px; height: 70px; font-size: 15px; }
.abtn--sleep { width: 70px; height: 70px; font-size: 13px; }
.abtn--sleep small { font-size: 9px; }

/* 超时计数 */
.tp {
  width: 10px; height: 10px; border-radius: 2px; display: block;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22);
}
.tp--on { background: var(--terracotta); border-color: var(--terracotta); }
.hud__label--late { font-size: 10px; letter-spacing: .1em; color: rgba(244, 239, 231, .5); }

/* ── 小地图 ── */
.minimap {
  position: fixed; z-index: 21; pointer-events: none;
  top: calc(52px + var(--safe-t)); left: calc(12px + var(--safe-l));
  width: 120px; height: 90px; box-sizing: content-box;  /* 画布区正好 120×90 */
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 6px;
  overflow: hidden; background: rgba(16, 19, 22, .5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.minimap canvas { display: block; width: 100%; height: 100%; }
@media (min-width: 900px) {
  .minimap { width: 160px; height: 120px; }
}

/* ── 页面（开始 / 结算） ── */
.screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: rgba(12, 15, 18, .9);
  overflow-y: auto;
}
.screen.is-hidden { display: none; }
.card {
  width: 100%; max-width: 380px; background: rgba(22, 26, 30, .96);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 26px 22px 22px; color: var(--hud-ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.brandline { display: flex; align-items: center; gap: 8px; }
.catmark { width: 30px; height: 30px; fill: var(--terracotta); }
.catmark .eye { fill: none; stroke: #16191d; stroke-width: 3; stroke-linecap: round; }
.eyebrow { font-size: 10.5px; letter-spacing: .2em; color: rgba(244, 239, 231, .45); }
h1 {
  font-family: var(--serif); font-size: 40px; line-height: 1.1; margin: 14px 0 8px;
  letter-spacing: .06em; color: #F6F1E9;
}
h2 { font-family: var(--serif); font-size: 24px; margin: 10px 0 6px; letter-spacing: .04em; color: #F6F1E9; }
.lead { font-size: 13px; line-height: 1.7; color: rgba(244, 239, 231, .66); margin: 0 0 16px; }
.howto { list-style: none; margin: 0 0 20px; padding: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.howto li {
  font-size: 12.5px; color: rgba(244, 239, 231, .72); padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .07); line-height: 1.5;
}
.howto b { color: #F6F1E9; margin-right: 6px; font-weight: 700; }
.btn {
  width: 100%; min-height: 48px; border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); color: var(--hud-ink);
  font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer;
  letter-spacing: .08em;
}
.btn--primary { background: var(--terracotta); border-color: var(--terracotta-deep); color: #fff; }
.btn:active { transform: translateY(1px); }
.fineprint { font-size: 10.5px; color: rgba(244, 239, 231, .4); text-align: center; margin: 12px 0 0; letter-spacing: .06em; }
.btnrow { display: flex; gap: 10px; margin-top: 18px; }
.btnrow .btn { flex: 1; }

.scoreline {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, .1); border-bottom: 1px solid rgba(255, 255, 255, .1);
  padding: 10px 0; margin: 12px 0;
}
.scoreline span { font-size: 11px; color: rgba(244, 239, 231, .45); letter-spacing: .12em; }
.scoreline b { font-family: var(--serif); font-size: 34px; color: var(--terracotta); font-variant-numeric: tabular-nums; }
.res-stats { display: grid; gap: 6px; }
.res-row { display: flex; justify-content: space-between; font-size: 12.5px; color: rgba(244, 239, 231, .6); }
.res-row b { color: #F6F1E9; font-variant-numeric: tabular-nums; }

.stamp {
  position: fixed; left: 50%; bottom: calc(4px + var(--safe-b)); transform: translateX(-50%);
  font-size: 9px; color: rgba(244, 239, 231, .25); letter-spacing: .1em; z-index: 5;
  pointer-events: none;
}

/* 横屏 / 宽屏：控件缩一点，别挡画面 */
@media (min-height: 620px) and (min-width: 900px) {
  .joy { width: 116px; height: 116px; }
  .joy__knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .abtn { width: 72px; height: 72px; }
}
@media (max-height: 480px) {
  .joy { width: 96px; height: 96px; }
  .joy__knob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .abtn { width: 62px; height: 62px; font-size: 14px; }
  h1 { font-size: 30px; }
  .card { padding: 18px 18px 16px; }
  .howto li { padding: 6px 0; font-size: 12px; }
  .goalline { bottom: calc(120px + var(--safe-b)); }
  .toast { bottom: calc(150px + var(--safe-b)); }
}

/* ── 觉醒模式：第一人称 HUD ── */
body.is-fp .taskcard,
body.is-fp #guide-arrow,
body.is-fp #goalline,
body.is-fp #tutorial,
body.is-fp #controls .abtn--sleep,
body.is-fp #controls .abtn--jump,
body.is-fp #controls .abtn--act { display: none !important; }
body.is-fp .hud__right { opacity: .35; }

.fp { position: fixed; inset: 0; z-index: 26; pointer-events: none; }
.fp.is-hidden { display: none; }

.crosshair {
  position: absolute; left: 50%; top: 50%; width: 24px; height: 24px;
  transform: translate(-50%, -50%); transition: transform .08s ease-out;
}
.crosshair i {
  position: absolute; background: rgba(255, 255, 255, .85);
  box-shadow: 0 0 4px rgba(0, 0, 0, .7);
}
.crosshair i:nth-child(1) { left: 50%; top: 0; width: 1.5px; height: 8px; transform: translateX(-50%); }
.crosshair i:nth-child(2) { left: 50%; bottom: 0; width: 1.5px; height: 8px; transform: translateX(-50%); }
.crosshair i:nth-child(3) { top: 50%; left: 0; height: 1.5px; width: 8px; transform: translateY(-50%); }
.crosshair i:nth-child(4) { top: 50%; right: 0; height: 1.5px; width: 8px; transform: translateY(-50%); }
.crosshair.is-hit { transform: translate(-50%, -50%) scale(1.45); }
.crosshair.is-hit i { background: var(--hud-hot); }

.hpbar {
  position: absolute; left: calc(12px + var(--safe-l)); top: calc(152px + var(--safe-t));
  display: flex; align-items: center; gap: 6px; width: 120px;
}
.hpbar__k { font-size: 9px; color: var(--hud-ink-2); letter-spacing: .14em; }
.hpbar__track {
  flex: 1; height: 5px; border-radius: 3px; overflow: hidden;
  background: rgba(16, 19, 22, .6); border: 1px solid var(--hud-rule);
}
.hpbar__track i { display: block; height: 100%; width: 100%; background: #7FB07A; transition: width .18s ease-out; }
.hpbar__track i.is-low { background: var(--hud-hot); }

.wavelabel {
  position: absolute; left: 50%; top: calc(58px + var(--safe-t)); transform: translateX(-50%);
  font-size: 10px; letter-spacing: .34em; color: rgba(244, 239, 231, .78);
  text-transform: uppercase; white-space: nowrap; opacity: 0; transition: opacity .3s;
}
.wavelabel.is-on { opacity: 1; }

.bossbar {
  position: absolute; left: 50%; top: calc(78px + var(--safe-t)); transform: translateX(-50%);
  width: min(420px, 66vw); display: flex; align-items: center; gap: 8px;
}
.bossbar.is-hidden { display: none; }
.bossbar__k { font-size: 10px; letter-spacing: .2em; color: var(--hud-hot); }
.bossbar__track {
  flex: 1; height: 8px; border-radius: 4px; overflow: hidden;
  background: rgba(16, 19, 22, .72); border: 1px solid rgba(224, 103, 63, .5);
}
.bossbar__track i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #E0673F, #8F3A22); transition: width .2s; }

.abtn--fire {
  position: fixed; right: calc(18px + var(--safe-r)); bottom: calc(150px + var(--safe-b));
  width: 92px; height: 92px; pointer-events: auto;
  background: radial-gradient(circle at 50% 38%, rgba(224, 103, 63, .95), rgba(158, 66, 38, .92));
  border: 1px solid rgba(255, 220, 200, .45);
  box-shadow: 0 6px 22px rgba(188, 82, 48, .5);
  z-index: 27;
}
.abtn--fire.is-hidden { display: none; }
.abtn--fire span { font-size: 19px; }
.abtn--fire small { font-size: 9px; }
#btn-pick {
  position: fixed; right: calc(18px + var(--safe-r)); bottom: calc(150px + var(--safe-b));
  z-index: 27;
}

/* 波次字幕：trama 排版 —— 居中、宽字距、细线 */
.subtitle {
  position: fixed; left: 0; right: 0; bottom: 24%; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; opacity: 0; transform: translateY(6px);
  transition: opacity .5s ease-out, transform .5s ease-out;
}
.subtitle.is-on { opacity: 1; transform: translateY(0); }
.subtitle b {
  font-family: var(--serif); font-weight: 400; font-size: 19px; letter-spacing: .26em;
  color: #FBF7F0; text-shadow: 0 2px 14px rgba(0, 0, 0, .75); text-indent: .26em;
}
.subtitle s {
  display: block; width: 46px; height: 1px; background: rgba(251, 247, 240, .5); text-decoration: none;
}
.subtitle em {
  font-style: normal; font-size: 9px; letter-spacing: .42em; color: rgba(251, 247, 240, .6);
  text-transform: uppercase; text-indent: .42em;
}

/* 片名卡 */
.titlecard {
  position: fixed; inset: 0; z-index: 34; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; pointer-events: none;
}
.titlecard.is-hidden { display: none; }
.titlecard h2 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 8vw, 44px);
  letter-spacing: .2em; color: #FBF7F0; text-indent: .2em; margin: 0;
  text-shadow: 0 4px 26px rgba(0, 0, 0, .85);
}
.titlecard h2 span { opacity: 0; display: inline-block; animation: tchar .5s ease-out forwards; }
@keyframes tchar { from { opacity: 0; transform: translateY(10px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.titlecard p {
  margin: 0; font-size: 10px; letter-spacing: .5em; text-transform: uppercase;
  color: rgba(251, 247, 240, .62); opacity: 0; animation: tsub 1s ease-out .9s forwards;
}
@keyframes tsub { to { opacity: 1; } }

/* 黑场 */
.blackout {
  position: fixed; inset: 0; z-index: 33; background: #000; opacity: 0;
  pointer-events: none; transition: opacity .45s ease-in-out;
}
.blackout.is-on { opacity: 1; }
