/* ============ 《打回原形 · 地府专送》 夜班主题 ============ */
:root {
  --bg: #101b1d;
  --bg-deep: #0a1214;
  --panel: #16242a;
  --panel-2: #1b2d33;
  --line: #2a3d42;
  --ink: #e8f0ec;
  --ink-dim: #8fa8a4;
  --seal: #c44f36;
  --seal-deep: #7d2f20;
  --gold: #efd397;
  --cream: #fff1d8;
  --jade: #92c3bd;
  --shadow: 0 18px 40px rgba(4, 8, 10, .55);
  --radius: 14px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

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

html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(1200px 600px at 70% -10%, #17282e 0%, transparent 60%),
    radial-gradient(900px 500px at 10% 110%, #131f22 0%, transparent 55%);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { image-rendering: pixelated; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: .1em .45em;
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: #0e191c;
  color: var(--gold);
  font: 600 .82em var(--font);
  text-align: center;
}

/* ============ 顶栏 ============ */
#app { max-width: 1180px; margin: 0 auto; padding: 0 20px 32px; }

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 4px;
  margin-bottom: 26px;
  background: linear-gradient(180deg, rgba(13, 21, 24, .96), rgba(13, 21, 24, .82));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 6px 6px;
  border: none;
  background: none;
  color: var(--ink);
}
.brand-seal {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(160deg, var(--seal), var(--seal-deep));
  color: var(--cream);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.05;
  text-align: center;
  box-shadow: inset 0 0 0 2px rgba(255, 241, 216, .25), 0 4px 10px rgba(196, 79, 54, .35);
}
.brand > span:last-child {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .12em;
}
.brand small { font-size: 9px; font-weight: 500; letter-spacing: .32em; color: var(--ink-dim); }

.main-nav { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.main-nav button {
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--ink-dim);
  font-size: 15px;
  transition: color .15s, background .15s;
}
.main-nav button:hover { color: var(--cream); background: rgba(255, 241, 216, .06); }
.main-nav button.active { color: var(--gold); background: rgba(239, 211, 151, .1); font-weight: 600; }

.head-actions { display: flex; align-items: center; gap: 10px; }
.merit-balance {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.merit-balance i { color: var(--gold); font-style: normal; }
.merit-balance b { font-size: 17px; color: var(--cream); }
.merit-balance small { color: var(--ink-dim); font-size: 11px; }

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
  transition: border-color .15s, color .15s;
}
.icon-button:hover { border-color: var(--gold); color: var(--gold); }
.icon-button.muted { color: var(--ink-dim); text-decoration: line-through; }

/* ============ 页脚 ============ */
#footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 4px;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: 13px;
}
#footer span { display: flex; align-items: center; gap: 8px; }
#footer small { letter-spacing: .25em; font-size: 10px; }

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fd08c;
  box-shadow: 0 0 8px #6fd08c;
  animation: pulse 2.2s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

/* ============ 通用组件 ============ */
.eyebrow {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .35em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--cream);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .05em;
  transition: transform .12s, border-color .15s, background .15s, opacity .15s;
}
.button:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--jade); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .38; cursor: not-allowed; }
.button span { color: var(--gold); }
.button.gold {
  background: linear-gradient(160deg, #f3dca6, var(--gold) 55%, #cfa95e);
  border-color: #a8853f;
  color: #2b2312;
}
.button.gold span { color: #7a5a1c; }
.button.red {
  background: linear-gradient(160deg, #d8674c, var(--seal) 60%, var(--seal-deep));
  border-color: var(--seal-deep);
  color: var(--cream);
}
.button.red span { color: var(--cream); }

.text-button {
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--ink-dim);
  font-size: 13px;
  letter-spacing: .08em;
  transition: color .15s;
}
.text-button:hover { color: var(--gold); }

.stars { color: var(--gold); letter-spacing: .2em; font-size: 14px; white-space: nowrap; }

.page-head { margin-bottom: 26px; }
.page-head h2 { margin: 0 0 4px; font-size: 30px; letter-spacing: .1em; }
.page-head p { margin: 0; color: var(--ink-dim); font-size: 14px; }

.boot-error { padding: 60px 20px; text-align: center; color: #ff8f7a; }

/* ============ 首页 ============ */
.home-hero {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 28px;
  align-items: center;
  padding: 44px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(10, 18, 20, .96) 30%, rgba(10, 18, 20, .55) 70%, rgba(10, 18, 20, .2)),
    url("assets/scenes/S12.webp") center 30% / cover no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.home-copy h1 { margin: 4px 0 14px; font-size: 54px; letter-spacing: .14em; line-height: 1.15; }
.home-copy h1 .accent { color: var(--seal); text-shadow: 0 4px 18px rgba(196, 79, 54, .45); }
.home-copy > p { max-width: 40em; margin: 0 0 22px; color: var(--ink-dim); font-size: 15px; }

.home-progress { display: flex; gap: 30px; margin-bottom: 26px; }
.home-progress div { display: flex; flex-direction: column; }
.home-progress b { font-size: 26px; color: var(--gold); }
.home-progress small { color: var(--ink-dim); font-size: 12px; }

.home-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.home-art { margin: 0; text-align: center; }
.home-art img {
  width: auto;
  max-width: 100%;
  max-height: 400px;
  filter: drop-shadow(0 18px 30px rgba(4, 8, 10, .6));
}

.home-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 200px;
  gap: 14px;
  margin-top: 22px;
  padding-bottom: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.strip-card {
  position: relative;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  text-align: left;
  transition: transform .15s, border-color .15s;
}
.strip-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--gold); }
.strip-card img { display: block; width: 100%; height: 96px; object-fit: cover; }
.strip-card span {
  display: block;
  padding: 8px 10px;
  color: var(--ink-dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.strip-card.locked { opacity: .45; }
.strip-card.locked img { filter: grayscale(.8) brightness(.6); }

/* ============ 接单出发 ============ */
.order-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }

.order-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.order-card:hover:not(.locked) { transform: translateY(-4px); border-color: var(--gold); box-shadow: var(--shadow); }
.order-card.locked { opacity: .55; filter: saturate(.6); }

.order-art { position: relative; margin: 0; }
.order-art img { display: block; width: 100%; height: 168px; object-fit: cover; border-bottom: 1px solid var(--line); }
.order-art figcaption {
  position: absolute;
  left: 12px;
  bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(8, 14, 16, .78);
  backdrop-filter: blur(4px);
}
.order-art b { color: var(--gold); font-size: 15px; letter-spacing: .05em; }
.order-art span { color: var(--ink-dim); font-size: 12px; }

.order-body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 16px 18px 18px; }
.order-body header { display: flex; align-items: center; justify-content: space-between; }
.chapter {
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(146, 195, 189, .14);
  color: var(--jade);
  font-size: 12px;
  letter-spacing: .15em;
}
.diff { padding: 3px 10px; border-radius: 6px; font-size: 12px; letter-spacing: .1em; }
.diff.跑单 { background: rgba(146, 195, 189, .14); color: var(--jade); }
.diff.爆单 { background: rgba(239, 211, 151, .16); color: var(--gold); }
.diff.地狱单 { background: rgba(196, 79, 54, .2); color: #ff9a86; }
.diff.特别单 { background: rgba(178, 140, 216, .18); color: #cdb2f0; }

.order-body h3 { margin: 0; font-size: 22px; letter-spacing: .12em; }
.order-body .desc { margin: 0; color: var(--ink-dim); font-size: 13.5px; }
.order-body .objective { margin: 2px 0 0; color: var(--cream); font-size: 13.5px; }
.order-body .objective i { color: var(--gold); font-style: normal; margin-right: 4px; }
.order-body footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.order-body footer small { color: var(--ink-dim); font-size: 12px; }

/* ============ 土地庙(商店) ============ */
.shop-head {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 28px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(10, 18, 20, .94) 20%, rgba(10, 18, 20, .35)),
    url("assets/boards/S02.webp") center 25% / cover no-repeat;
  box-shadow: var(--shadow);
}
.shop-keeper { margin: 0; flex-shrink: 0; }
.shop-keeper img { height: 190px; filter: drop-shadow(0 10px 24px rgba(4, 8, 10, .6)); }

.shop-grid { display: grid; gap: 16px; margin-top: 20px; }
.shop-card {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .15s;
}
.shop-card:hover { border-color: var(--gold); }
.shop-icon {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(196, 79, 54, .25), rgba(125, 47, 32, .2));
  border: 1px solid rgba(239, 211, 151, .3);
  color: var(--gold);
  font-size: 30px;
  font-weight: 700;
}
.shop-body h3 { margin: 0 0 2px; font-size: 19px; letter-spacing: .08em; }
.shop-body p { margin: 0 0 10px; color: var(--ink-dim); font-size: 13.5px; }
.pips { display: flex; gap: 5px; }
.pips i { width: 22px; height: 7px; border-radius: 4px; background: #223438; }
.pips i.on { background: var(--gold); box-shadow: 0 0 6px rgba(239, 211, 151, .5); }

.shop-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.shop-buy b { color: var(--gold); font-size: 15px; letter-spacing: .05em; }

/* ============ 异闻图鉴 ============ */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.codex-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.codex-card:hover { transform: translateY(-3px); border-color: var(--jade); }
.codex-card figure {
  display: grid;
  place-items: end center;
  height: 190px;
  margin: 0;
  padding: 14px 10px;
  background:
    radial-gradient(200px 130px at 50% 90%, rgba(146, 195, 189, .12), transparent 70%),
    var(--bg-deep);
}
.codex-card img { max-height: 100%; max-width: 100%; }
.codex-card > div { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.codex-card h3 { margin: 0; font-size: 17px; letter-spacing: .1em; }
.codex-card > div > span { color: var(--gold); font-size: 12px; letter-spacing: .2em; }
.codex-card p { margin: 8px 0 0; color: var(--ink-dim); font-size: 12.5px; }

/* ============ 战斗界面 ============ */
#play-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px 14px;
  background: var(--bg-deep);
}

.play-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.play-topline > span { color: var(--gold); font-size: 14px; letter-spacing: .2em; }
.play-topline > div { display: flex; gap: 4px; }

.arena {
  position: relative;
  width: min(100%, calc((100vh - 130px) * 16 / 9));
  max-width: 1200px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}
#game-canvas { display: block; width: 100%; height: 100%; outline: none; }

.battle-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  color: var(--ink-dim);
  font-size: 12.5px;
}
.battle-bottom > span { display: flex; align-items: center; gap: 8px; }

/* --- 战斗 HUD --- */
.battle-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}
.rider-hud {
  display: flex;
  gap: 10px;
  padding: 8px 14px 10px 10px;
  border: 1px solid rgba(255, 241, 216, .16);
  border-radius: 12px;
  background: rgba(8, 14, 16, .62);
  backdrop-filter: blur(4px);
}
.mini-seal {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: linear-gradient(160deg, var(--seal), var(--seal-deep));
  color: var(--cream);
  font-size: 12px;
  font-weight: 700;
  writing-mode: vertical-rl;
  letter-spacing: .2em;
}
.rider-vitals { display: flex; flex-direction: column; gap: 4px; }
.vital-label { display: flex; justify-content: space-between; gap: 18px; font-size: 12px; }
.vital-label b { letter-spacing: .1em; }
.vital-label span { color: var(--ink-dim); }
.vital-label.subtle { font-size: 10.5px; letter-spacing: .05em; }
#eye-label.on { color: #ff9a86; text-shadow: 0 0 8px rgba(255, 107, 94, .6); }

.hp-track, .energy-track {
  width: 172px;
  height: 9px;
  border-radius: 6px;
  background: rgba(255, 241, 216, .1);
  overflow: hidden;
}
.energy-track { height: 6px; }
#hp-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #e05545, #ff8f7a);
  transition: width .18s ease-out;
}
#hp-fill.low { animation: hp-low 1s infinite; }
@keyframes hp-low { 50% { filter: brightness(1.6); } }
#energy-fill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #5da8a0, var(--jade));
  transition: width .12s linear;
}

.mission-hud {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 241, 216, .16);
  border-radius: 12px;
  background: rgba(8, 14, 16, .62);
  backdrop-filter: blur(4px);
  font-size: 12px;
}
.mission-hud span { color: var(--ink-dim); }
.mission-hud b { color: var(--gold); font-size: 14px; letter-spacing: .08em; }
.mission-hud small { color: var(--ink-dim); letter-spacing: .2em; }

/* --- Boss 血条 --- */
.boss-hud {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(440px, 52%);
  padding: 8px 16px 10px;
  border: 1px solid rgba(196, 79, 54, .5);
  border-radius: 12px;
  background: rgba(8, 14, 16, .68);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.boss-hud small { color: var(--ink-dim); font-size: 10px; letter-spacing: .3em; }
.boss-hud b { margin-left: 8px; color: var(--cream); font-size: 15px; letter-spacing: .1em; }
.boss-hud span { float: right; color: #ff9a86; font-size: 11px; letter-spacing: .1em; }
.boss-track { height: 8px; margin-top: 6px; border-radius: 6px; background: rgba(255, 241, 216, .1); overflow: hidden; }
#boss-fill { display: block; height: 100%; background: linear-gradient(90deg, #e05545, #ff8f7a); transition: width .2s; }
#boss-fill.skin { background: linear-gradient(90deg, #cfa95e, var(--gold)); }

/* --- 公告 --- */
.announcement {
  position: absolute;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}
.announcement small {
  display: block;
  color: var(--jade);
  font-size: 13px;
  letter-spacing: .5em;
  margin-bottom: 4px;
}
.announcement strong {
  font-size: 34px;
  letter-spacing: .3em;
  color: var(--cream);
  text-shadow: 0 4px 22px rgba(196, 79, 54, .8), 0 2px 4px rgba(0, 0, 0, .8);
}
.announcement.big strong { font-size: 44px; color: var(--gold); }
.announcement.show { animation: announce 1.7s ease forwards; }
@keyframes announce {
  0% { opacity: 0; transform: translateX(-50%) scale(1.35); }
  12% { opacity: 1; transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* --- 连击 --- */
.combo {
  position: absolute;
  right: 26px;
  top: 34%;
  text-align: center;
  pointer-events: none;
  animation: combo-pop .28s ease;
}
.combo strong {
  display: block;
  font-size: 52px;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 4px 18px rgba(239, 211, 151, .5), 0 2px 3px rgba(0, 0, 0, .8);
}
.combo span { color: var(--cream); font-size: 13px; letter-spacing: .6em; }
@keyframes combo-pop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }

/* --- 押送提示 --- */
.escort-hint {
  position: absolute;
  bottom: 17%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(8, 14, 16, .8);
  color: var(--gold);
  font-size: 14px;
  letter-spacing: .1em;
  pointer-events: none;
  animation: hint-bob 1.1s ease-in-out infinite;
}
@keyframes hint-bob { 50% { transform: translateX(-50%) translateY(-5px); } }

/* --- QTE 盖章 --- */
.qte-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 84%);
  padding: 22px 26px 24px;
  border: 1px solid var(--gold);
  border-radius: 16px;
  background: rgba(10, 17, 19, .92);
  box-shadow: 0 24px 60px rgba(4, 8, 10, .7), inset 0 0 30px rgba(196, 79, 54, .12);
  text-align: center;
}
.qte-panel .eyebrow { color: #ff9a86; }
.qte-panel h2 { margin: 2px 0 6px; font-size: 28px; letter-spacing: .22em; }
.qte-panel p { margin: 0 0 16px; color: var(--ink-dim); font-size: 13px; }
.qte-track {
  position: relative;
  height: 22px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #0d1719;
  border: 1px solid var(--line);
  overflow: hidden;
}
.qte-zone {
  position: absolute;
  left: 34%;
  width: 32%;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(196, 79, 54, .55), rgba(125, 47, 32, .55));
  border-left: 1px solid var(--gold);
  border-right: 1px solid var(--gold);
}
.qte-zone::after {
  content: "朱砂区";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--cream);
  font-size: 11px;
  letter-spacing: .3em;
}
#qte-cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  width: 5px;
  border-radius: 3px;
  background: var(--cream);
  box-shadow: 0 0 10px rgba(255, 241, 216, .9);
}

/* --- 关卡开场 --- */
.intro-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  padding: 24px;
  background:
    radial-gradient(700px 380px at 50% 40%, rgba(10, 17, 19, .55), rgba(6, 10, 12, .92)),
    rgba(6, 10, 12, .82);
  backdrop-filter: blur(3px);
}
.intro-portrait { margin: 0; flex-shrink: 0; }
.intro-portrait img { height: min(300px, 42vh); filter: drop-shadow(0 14px 26px rgba(4, 8, 10, .7)); }
.intro-copy {
  max-width: 480px;
  padding: 26px 30px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--seal);
  border-radius: 14px;
  background: rgba(13, 21, 24, .88);
}
.intro-copy h2 { margin: 2px 0 12px; font-size: 24px; letter-spacing: .1em; line-height: 1.35; }
.intro-copy p { margin: 0 0 16px; color: var(--ink-dim); font-size: 14.5px; }
.intro-target {
  margin-bottom: 20px;
  padding: 10px 14px;
  border: 1px dashed rgba(239, 211, 151, .4);
  border-radius: 10px;
  color: var(--gold);
  font-size: 13.5px;
}
.intro-target i { font-style: normal; margin-right: 6px; }
.intro-target em { display: block; margin-top: 4px; color: var(--ink-dim); font-style: normal; font-size: 12px; }
.intro-copy > small { display: block; margin-top: 12px; color: var(--ink-dim); font-size: 11.5px; letter-spacing: .05em; }

/* --- 触屏控制 --- */
.touch-controls { display: none; }

body.touch .touch-controls {
    position: absolute;
    inset: auto 0 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 18px 16px;
    pointer-events: none;
}
body.touch .touch-controls button {
    pointer-events: auto;
    border: 1px solid rgba(255, 241, 216, .3);
    border-radius: 50%;
    background: rgba(8, 14, 16, .55);
    color: var(--cream);
    font-size: 15px;
    font-weight: 600;
    touch-action: none;
    user-select: none;
}
body.touch .touch-controls button:active { background: rgba(196, 79, 54, .6); }
body.touch .dpad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 54px); gap: 6px; }
body.touch .dpad button[data-key="KeyW"] { grid-column: 2; }
body.touch .dpad button[data-key="KeyA"] { grid-column: 1; grid-row: 2; }
body.touch .dpad button[data-key="KeyS"] { grid-column: 2; grid-row: 2; }
body.touch .dpad button[data-key="KeyD"] { grid-column: 3; grid-row: 2; }
body.touch .touch-actions { display: grid; grid-template-columns: repeat(3, 58px); gap: 8px; }
body.touch .touch-actions button { width: 58px; height: 58px; }
body.touch .touch-actions .attack { border-color: rgba(224, 85, 69, .7); color: #ff9a86; }
body.touch .touch-actions .stamp { border-color: rgba(239, 211, 151, .8); color: var(--gold); }

/* ============ 弹窗 ============ */
dialog {
  width: min(440px, calc(100vw - 40px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 9, 11, .65); backdrop-filter: blur(4px); }
#modal-content { padding: 26px 28px 26px; }
#modal-content h3 { margin: 0 0 12px; font-size: 21px; letter-spacing: .1em; }
.modal-note { margin: 0 0 18px; color: var(--ink-dim); font-size: 13.5px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }

.help-table, .result-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.help-table td { padding: 7px 4px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.help-table td:first-child { width: 110px; white-space: nowrap; }
.help-table td:last-child { color: var(--ink-dim); }

.result-stars { margin-bottom: 6px; color: var(--gold); font-size: 30px; letter-spacing: .3em; text-shadow: 0 4px 16px rgba(239, 211, 151, .4); }
.result-table td { padding: 8px 4px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.result-table td:first-child { color: var(--ink-dim); }
.result-table td:last-child { text-align: right; }
.result-table b { color: var(--gold); font-size: 16px; }

/* ============ Toast ============ */
#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(16px);
  z-index: 60;
  padding: 11px 22px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(10, 17, 19, .94);
  color: var(--cream);
  font-size: 14px;
  letter-spacing: .05em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; padding: 30px 26px; }
  .home-art { display: none; }
  .shop-head { flex-direction: column; align-items: flex-start; }
  .order-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .masthead { flex-wrap: wrap; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; margin-left: 0; }
  .main-nav button { flex: 1; padding: 8px 4px; font-size: 14px; }
  .home-copy h1 { font-size: 40px; }
  .home-progress { gap: 18px; flex-wrap: wrap; }
  .shop-card { grid-template-columns: 1fr; text-align: left; }
  .shop-buy { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
  .intro-overlay { flex-direction: column; gap: 16px; overflow-y: auto; }
  .intro-portrait img { height: 180px; }
  #footer { flex-direction: column; gap: 4px; text-align: center; }
  #footer span { justify-content: center; }
  .battle-bottom { display: none; }
}

/* ============ 夜班界面精修 ============ */
::selection { color: var(--bg-deep); background: var(--gold); }
button { -webkit-tap-highlight-color: transparent; }
#content { min-height: 65vh; padding-bottom: 32px; }
#content[aria-busy="true"] { cursor: progress; }
#content[aria-busy="true"] button { pointer-events: none; opacity: .55; }
.masthead { gap: 14px; padding-block: 18px; }
.main-nav button { position: relative; }
.main-nav button.active::after {
  content: ""; position: absolute; bottom: 2px; left: 35%; right: 35%;
  height: 2px; background: var(--gold); border-radius: 2px;
}
.home-hero { position: relative; min-height: 450px; padding: 54px 46px; border-color: #3d4942; }
.home-hero::before {
  content: ""; position: absolute; inset: 12px; pointer-events: none;
  border: 1px solid rgba(239, 211, 151, .12); border-radius: 8px;
}
.home-copy { position: relative; z-index: 1; }
.home-copy h1 { font-family: "STKaiti", "KaiTi", var(--font); font-size: clamp(42px, 5vw, 68px); letter-spacing: .12em; }
.home-copy h1 .accent { color: #e87858; }
.home-copy > p { max-width: 31em; line-height: 1.95; color: #b6c7c1; }
.home-copy .eyebrow { border-left: 3px solid var(--seal); padding-left: 12px; margin-bottom: 18px; }
.home-art { position: relative; align-self: end; }
.home-art::before {
  content: "夜班出勤"; position: absolute; right: 0; top: 14px;
  writing-mode: vertical-rl; letter-spacing: .45em; font-size: 12px;
  color: var(--gold); border: 1px solid #665c42; padding: 14px 8px;
}
.home-art img { max-height: 365px; filter: drop-shadow(0 18px 25px #050d10); }
.home-actions .button { min-height: 48px; }
.home-strip { scroll-snap-type: x proximity; padding: 8px 0 14px; gap: 16px; }
.strip-card { scroll-snap-align: start; }
.strip-card img { height: 110px; }
.strip-card span { color: #c5d1ca; padding: 11px 12px; }
.page-head { padding: 10px 0 18px; border-bottom: 1px solid var(--line); }
.page-head h2 { font-family: "STKaiti", "KaiTi", var(--font); font-size: 36px; }
.page-head p { line-height: 1.9; }
.order-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr)); gap: 22px; }
.order-card, .shop-card, .codex-card { background: linear-gradient(145deg, #1b2a2e, #121f23); }
.order-card.locked { opacity: .72; }
.order-card.locked .order-art img { filter: grayscale(.7) brightness(.65); }
.order-art img { height: 184px; }
.order-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 50%, #101b1d99); pointer-events: none; }
.order-art figcaption { z-index: 1; }
.order-body { padding: 20px; gap: 12px; }
.order-body h3 { font-size: 24px; }
.order-body .desc { line-height: 1.85; }
.order-body .objective { padding: 10px 12px; background: #0c171a88; border-left: 2px solid #857345; border-radius: 0 6px 6px 0; }
.order-body footer { flex-wrap: wrap; }
.order-body footer .button { margin-left: auto; min-width: 76px; }
.shop-head { padding: 28px 32px; }
.shop-card { border-left: 3px solid #857345; }
.shop-buy .button { min-width: 112px; }
.codex-card figure { height: 218px; background-image: radial-gradient(ellipse at 50% 100%, #33524d66, transparent 70%); }
.codex-card > div { padding: 18px; }
.codex-card p { line-height: 1.85; font-size: 13px; }
.icon-button { min-width: 40px; min-height: 40px; }
.button:focus-visible, .strip-card:focus-visible { outline-offset: 4px; }
.boss-hud { top: 108px; width: min(440px, 64%); }
.announcement { max-width: 90%; white-space: normal; }
.announcement small { letter-spacing: .12em; line-height: 1.7; }
.escort-hint { white-space: nowrap; max-width: 96%; }
.intro-overlay { z-index: 4; }
.qte-panel { z-index: 5; }
#toast { max-width: calc(100vw - 32px); width: max-content; text-align: center; }
#modal-content { max-height: calc(100dvh - 48px); overflow-y: auto; }
.modal-actions .button { flex: 1; }
.arena { width: min(100%, calc((100dvh - 130px) * 16 / 9)); flex-shrink: 0; }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; min-height: 380px; padding: 36px; }
  .shop-head { flex-direction: row; }
  .shop-keeper img { height: 150px; }
  .head-actions { margin-left: auto; gap: 6px; }
  .main-nav button { padding-inline: 10px; }
}
@media (max-width: 720px) {
  #app { padding-inline: 16px; }
  .masthead { gap: 8px; padding: 10px 0; margin-bottom: 18px; }
  .brand { gap: 8px; padding: 0; }
  .brand > span:last-child { font-size: 17px; }
  .brand small { font-size: 8px; letter-spacing: .14em; }
  .brand-seal { width: 36px; height: 40px; }
  .merit-balance { padding: 5px 9px; gap: 4px; }
  .merit-balance small { display: none; }
  .main-nav { flex-basis: 100%; gap: 2px; }
  .main-nav button { min-height: 44px; padding: 8px 3px; }
  .home-hero { min-height: 0; padding: 30px 24px; }
  .home-copy > p { font-size: 14px; }
  .home-actions .button { flex: 1 1 130px; }
  .home-strip { grid-auto-columns: 164px; }
  .shop-head { padding: 22px; gap: 16px; }
  .shop-keeper img { height: 110px; }
  .page-head h2 { font-size: 28px; }
  .shop-card { grid-template-columns: 54px minmax(0, 1fr); gap: 14px; padding: 18px; }
  .shop-icon { width: 52px; height: 58px; font-size: 24px; }
  .shop-buy { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; }
  .codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .codex-card figure { height: 160px; }
  .codex-card > div { padding: 12px; }
  #play-screen { padding: 8px; gap: 6px; overflow-y: auto; }
  .play-topline { gap: 2px; flex-wrap: wrap; }
  .play-topline > span { font-size: 11px; letter-spacing: 0; }
  .play-topline .text-button { min-height: 40px; padding-inline: 6px; }
  .battle-hud { top: 6px; left: 6px; right: 6px; }
  .rider-hud { padding: 6px 8px; gap: 0; }
  .mini-seal { display: none; }
  .hp-track, .energy-track { width: 112px; }
  .vital-label { font-size: 10px; gap: 8px; }
  .mission-hud { padding: 5px 8px; font-size: 10px; }
  .mission-hud b { font-size: 11px; }
  .boss-hud { top: 84px; padding: 4px 8px; width: 70%; }
  .boss-hud b { font-size: 11px; }
  .boss-hud small { display: none; }
  .boss-hud span { font-size: 9px; }
  .announcement { top: 46%; }
  .announcement strong, .announcement.big strong { font-size: 21px; }
  .announcement small { font-size: 10px; }
  .combo { right: 14px; top: 50%; }
  .combo strong { font-size: 32px; }
  .escort-hint { font-size: 11px; padding: 5px 10px; letter-spacing: 0; }
  .intro-overlay { position: fixed; inset: 60px 8px 8px; padding: 18px; justify-content: flex-start; }
  .intro-portrait { display: none; }
  .intro-copy { padding: 22px; width: 100%; margin: auto; flex-shrink: 0; }
  .qte-panel { position: fixed; width: min(420px, calc(100vw - 32px)); }
}
@media (pointer: coarse) and (orientation: portrait), (max-width: 720px) and (orientation: portrait) {
  #play-screen { justify-content: flex-start; }
  .arena { width: 100%; aspect-ratio: auto; padding-bottom: 168px; }
  #game-canvas { height: auto; aspect-ratio: 16 / 9; }
  body.touch .touch-controls { padding: 16px 10px; background: linear-gradient(#16242a, #0a1214); border-top: 1px solid var(--line); }
  body.touch .dpad { grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 48px); gap: 4px; }
  body.touch .touch-actions { grid-template-columns: repeat(3, 44px); gap: 6px; }
  body.touch .touch-actions button { width: 44px; height: 48px; font-size: 12px; }
  .escort-hint { bottom: 175px; }
  .announcement { top: 30%; }
}
@media (pointer: coarse) and (orientation: landscape), (max-height: 500px) and (orientation: landscape) {
  #play-screen { padding: 4px 8px; }
  .arena { width: min(100%, calc((100dvh - 58px) * 16 / 9)); }
  .battle-bottom { display: none; }
  body.touch .touch-controls { padding: 0 10px 8px; }
  body.touch .dpad { grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(2, 42px); gap: 4px; }
  body.touch .touch-actions { grid-template-columns: repeat(3, 44px); gap: 4px; }
  body.touch .touch-actions button { width: 44px; height: 44px; font-size: 12px; }
  .intro-overlay { overflow-y: auto; align-items: flex-start; }
  .intro-portrait { display: none; }
  .intro-copy { padding: 16px 20px; margin: auto; }
}
@media (max-width: 380px) {
  .brand small { display: none; }
  .brand > span:last-child { font-size: 15px; }
  .icon-button { min-width: 34px; width: 34px; }
  .shop-head { flex-direction: column; align-items: flex-start; }
}

/* ============ 动效偏好 ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
