/* ===========================================================
   REELBOUND · 转轮远征 —— 界面样式
   像素风（8px 栅格）+ 复古机台质感
   =========================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

:root {
  color-scheme: dark;
  --ink: #08060f;
  --ink-2: #100c1e;
  --panel: #171029;
  --panel-2: #1e1636;
  --line: #2f2350;
  --line-2: #46356f;
  --fg: #f3ecff;
  --fg-dim: #b6a8d4;
  --fg-mute: #8577a8;
  --gold: #f4c15a;
  --gold-2: #ffe6a6;
  --gold-deep: #a8761f;
  --teal: #5fd6c4;
  --rose: #e2648b;
  --violet: #8f7bda;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(0, 0, 0, .55);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

html, body { margin: 0; padding: 0; }

body {
  min-height: 100dvh;
  font-family: var(--sans);
  color: var(--fg);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景氛围 ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 380px at 18% -8%, rgba(143, 123, 218, .28), transparent 70%),
    radial-gradient(520px 320px at 92% 6%, rgba(244, 193, 90, .16), transparent 72%),
    radial-gradient(760px 520px at 50% 108%, rgba(226, 100, 139, .16), transparent 70%),
    linear-gradient(#0a0713, #0c0817 45%, #08060f);
}
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 32px 32px, 32px 32px;
  mask-image: radial-gradient(circle at 50% 30%, #000 20%, transparent 78%);
}

/* ---------- 布局 ---------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 顶部 HUD ---------- */
.hud {
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(38, 28, 64, .92), rgba(18, 13, 32, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 22px rgba(0, 0, 0, .4);
}

.hud__label {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--fg-mute);
  line-height: 1;
}

.hud__num {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.15;
  color: var(--gold-2);
  text-shadow: 0 0 12px rgba(244, 193, 90, .45);
}

.hud__wave { display: flex; flex-direction: column; gap: 3px; }

.hud__hearts { display: flex; flex-direction: column; gap: 4px; }

.hearts { display: flex; gap: 3px; }
.hearts .heart {
  width: 14px;
  height: 13px;
  display: block;
  transition: transform .2s ease, opacity .2s ease;
}
.hearts .heart svg { width: 100%; height: 100%; display: block; }
.hearts .heart--lost { opacity: .26; filter: grayscale(1); }

.hud__gold {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.coin {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  display: inline-block;
  background: radial-gradient(circle at 34% 30%, #ffe6a6, var(--gold) 52%, var(--gold-deep));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 0 8px rgba(244, 193, 90, .5);
  flex: none;
}
.coin--sm { width: 10px; height: 10px; }

.iconbtn {
  width: 32px;
  height: 32px;
  padding: 6px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(20, 14, 34, .9);
  color: var(--fg-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
  transition: color .15s, border-color .15s, background .15s;
}
.iconbtn svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.iconbtn svg path:first-child:not(.wave) { fill: currentColor; stroke: none; }
.iconbtn[aria-pressed="false"] .wave { opacity: .18; }
.iconbtn:hover { color: var(--gold-2); border-color: var(--gold-deep); }
.iconbtn:active { transform: translateY(1px); }

/* ---------- 战场 ---------- */
.stage { display: flex; flex-direction: column; gap: 5px; }

.stage__frame {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid #4a3568;
  padding: 4px;
  background:
    linear-gradient(180deg, #3a2a54, #1b1330 55%, #120d22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    inset 0 -2px 0 rgba(0, 0, 0, .5),
    0 16px 34px rgba(0, 0, 0, .5);
  overflow: hidden;
}

.stage__frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(244, 193, 90, .16), transparent 34%);
}

#field {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(186px, 24.5dvh);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  background: #0b0817;
  image-rendering: pixelated;
  touch-action: manipulation;
  cursor: pointer;
}
#field:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.stage__scan {
  position: absolute;
  inset: 4px;
  border-radius: 10px;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(8, 5, 16, .55));
  mix-blend-mode: multiply;
}

.stage__wave {
  position: absolute;
  top: 10px;
  left: 10px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  padding: 3px 7px;
  border-radius: 5px;
  color: var(--gold-2);
  background: rgba(9, 6, 18, .72);
  border: 1px solid rgba(244, 193, 90, .38);
  pointer-events: none;
}

.stage__banner {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%) scale(.9);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #1a1226;
  padding: 6px 16px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border: 1px solid #fff3cf;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .55);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  max-width: 88%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity .18s ease, transform .18s ease;
}
.stage__banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.stage {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage__prog {
  position: relative;
  margin: 2px 4px 0;
  height: 4px;
  border-radius: 3px;
  background: rgba(9, 6, 18, .7);
  border: 1px solid rgba(143, 123, 218, .3);
  overflow: hidden;
  pointer-events: none;
}
.stage__prog i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  transition: width .25s ease;
}

.stage__ticker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1.3;
  color: var(--fg-dim);
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}
.stage__ticker span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage__dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
  animation: pulse 1.6s steps(2, end) infinite;
}

.hint {
  margin: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--fg-mute);
}

/* ---------- 九宫 ---------- */
.console {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  padding: 4px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background:
    linear-gradient(180deg, #241a3d, #171026);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .07), inset 0 -3px 0 rgba(0, 0, 0, .45);
}

.paylines {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  pointer-events: none;
  z-index: 3;
}

.reel {
  position: relative;
  aspect-ratio: 1 / 0.93;
  border-radius: 9px;
  border: 1px solid #34264f;
  background:
    radial-gradient(110% 90% at 50% 8%, rgba(143, 123, 218, .22), transparent 62%),
    linear-gradient(180deg, #1a1330, #100b1d);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .2s, background .2s, transform .12s;
}
.reel canvas {
  width: 62%;
  height: auto;
  aspect-ratio: 1 / 1;
  image-rendering: pixelated;
  display: block;
}
.reel__name {
  font-size: 10px;
  line-height: 1;
  letter-spacing: .04em;
  color: var(--fg-dim);
  height: 10px;
}
.reel__stars {
  font-size: 9px;
  line-height: 1;
  height: 9px;
  color: var(--gold);
  letter-spacing: -.5px;
}
.reel--spin canvas { animation: reelSpin .12s steps(2, end) infinite; }
.reel--pop { animation: pop .26s cubic-bezier(.2, 1.5, .4, 1); }
.reel--lit {
  border-color: var(--gold);
  background:
    radial-gradient(110% 90% at 50% 10%, rgba(244, 193, 90, .3), transparent 62%),
    linear-gradient(180deg, #2a1e38, #150e22);
  box-shadow: 0 0 0 1px rgba(244, 193, 90, .5), 0 0 18px rgba(244, 193, 90, .35);
}
.reel--near {
  border-color: rgba(95, 214, 196, .75);
  box-shadow: 0 0 0 1px rgba(95, 214, 196, .3), 0 0 12px rgba(95, 214, 196, .22);
}
.reel--coin {
  border-color: rgba(244, 193, 90, .55);
  background:
    radial-gradient(110% 90% at 50% 10%, rgba(244, 193, 90, .22), transparent 62%),
    linear-gradient(180deg, #251a30, #140e20);
}
.reel--empty {
  opacity: .45;
  border-style: dashed;
}

.reels::after {
  content: '';
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .3em;
  color: rgba(247, 241, 255, .5);
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.reels--blank::after {
  content: '转 动 下 注';
  opacity: 1;
}
.reels--blank .reel--empty { opacity: .3; }

/* ---------- 兵团名册 / 战技 ---------- */
.roster {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(18, 13, 32, .8);
}

.chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 4px 1px 3px;
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-mute);
  font-family: inherit;
  cursor: default;
  overflow: hidden;
  transition: border-color .15s, background .15s, color .15s;
}
.chip canvas {
  width: 22px;
  height: 22px;
  image-rendering: pixelated;
  display: block;
  filter: grayscale(1) brightness(.7);
}
.chip__label {
  font-size: 9px;
  line-height: 1.1;
  letter-spacing: .02em;
  white-space: nowrap;
}
.chip__star {
  font-size: 8px;
  line-height: 1;
  color: var(--gold);
  height: 9px;
}
.chip--on { color: var(--fg-dim); border-color: var(--line-2); background: rgba(40, 30, 66, .55); }
.chip--on canvas { filter: none; }

.chip--cast { cursor: pointer; color: var(--fg); border-color: rgba(95, 214, 196, .5); }
.chip--cast canvas { filter: none; }
.chip--cast:active { transform: translateY(1px); }
.chip--ready { box-shadow: 0 0 0 1px rgba(95, 214, 196, .28), 0 0 12px rgba(95, 214, 196, .18); }
.chip--cool { color: var(--fg-mute); }
.chip--cool::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 14, .62);
  clip-path: polygon(0 0, 100% 0, 100% var(--cut, 100%), 0 var(--cut, 100%));
  pointer-events: none;
}
.chip--dead { opacity: .38; }
.chip__cd {
  position: absolute;
  inset: auto 2px 12px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
  pointer-events: none;
}
.chip__cd i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

/* ---------- 按钮 ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: 10px;
  align-items: stretch;
  margin: 1px 0 2px;
}

.btn {
  position: relative;
  font-family: inherit;
  font-size: 13px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #221835, #150f26);
  color: var(--fg);
  padding: 8px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 54px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 6px 16px rgba(0, 0, 0, .4);
  transition: transform .12s, filter .15s, border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn[hidden] { display: none; }
.btn:active:not(:disabled) { transform: translateY(2px); }
.btn:disabled { cursor: default; filter: saturate(.35) brightness(.72); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn__k { font-weight: 700; letter-spacing: .06em; }
.btn__sub {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .22em;
  color: var(--fg-mute);
}
.btn--side .btn__k { font-size: 13px; }
.btn__cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--gold);
}

.btn--primary {
  border: 1px solid #ffe6a6;
  background: linear-gradient(180deg, var(--gold-2) 0%, var(--gold) 46%, #d79a2c 100%);
  color: #241705;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .55),
    inset 0 -3px 0 rgba(120, 74, 8, .38),
    0 10px 24px rgba(244, 193, 90, .28);
}
.btn--primary .btn__k { font-size: 17px; letter-spacing: .18em; text-indent: .18em; }
.btn--primary .btn__sub { color: rgba(52, 34, 6, .62); }
.btn--primary:hover:not(:disabled) { filter: brightness(1.05); }

.btn--shop {
  border-color: rgba(95, 214, 196, .38);
  background: linear-gradient(180deg, #1c2f33, #121a26);
}
.btn--shop .btn__k { color: #c8f5ec; }
.btn--shop .btn__sub { color: var(--teal); }
.btn--shop:not(:disabled) { box-shadow: inset 0 1px 0 rgba(95, 214, 196, .2), 0 6px 16px rgba(0, 0, 0, .4); }

.btn--wide { width: 100%; min-height: 54px; }

.btn--continue {
  margin-bottom: 9px;
  border: 1px solid rgba(95, 214, 196, .5);
  background: linear-gradient(180deg, #1b3736, #101f24);
  box-shadow: inset 0 1px 0 rgba(95, 214, 196, .22), 0 8px 20px rgba(0, 0, 0, .42);
}
.btn--continue[hidden] { display: none; }
.btn--continue .btn__k { font-size: 15px; letter-spacing: .16em; color: #d9fff6; }
.btn--continue .btn__sub { color: var(--teal); }
.btn--continue:hover { border-color: var(--teal); }

/* ---------- 远征纪录 ---------- */
.hist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 2px 0 16px;
  max-height: 44dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.hist__row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(20, 14, 34, .78);
}
.hist__no {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-mute);
}
.hist__wave { font-size: 12.5px; font-weight: 700; color: var(--gold-2); }
.hist__meta { font-size: 11px; color: var(--fg-dim); }
.hist__when {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .04em;
  color: var(--fg-mute);
}
.hist__empty {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px dashed var(--line-2);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--fg-mute);
}

/* ---------- 底部 ---------- */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .18em;
  color: #5c4f7c;
  padding: 0 2px 2px;
  min-height: 18px;
}
.foot__mark { opacity: .7; }
.foot__link {
  font-family: inherit;
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--fg-mute);
  background: none;
  border: 0;
  padding: 4px 6px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* ---------- 补给台 ---------- */
.shopwallet {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(244, 193, 90, .28);
  background: rgba(38, 27, 12, .6);
}
.shopwallet strong {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--gold-2);
}
.shopwallet span {
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--fg-mute);
}
.shop {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 10px;
  max-height: 42dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.shopcard {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #221836, #150f26);
  color: var(--fg);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.shopcard:active:not(:disabled) { transform: translateY(1px); }
.shopcard:disabled { cursor: default; filter: saturate(.4) brightness(.72); }
.shopcard:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.shopcard canvas { width: 26px; height: 26px; image-rendering: pixelated; display: block; }
.shopcard__name { font-size: 13px; font-weight: 700; color: var(--gold-2); }
.shopcard__desc { margin: 1px 0 0; font-size: 11px; line-height: 1.45; color: var(--fg-dim); }
.shopcard__cost {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  white-space: nowrap;
}
.shopcard--sold .shopcard__name { color: var(--fg-mute); }
.shoppick {
  padding: 10px;
  border-radius: 11px;
  border: 1px solid rgba(95, 214, 196, .34);
  background: rgba(20, 34, 38, .66);
}
.shoppick__hint { margin: 0 0 8px; font-size: 11px; color: #b7e8e0; }
.shoppick__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.unitpick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px 4px;
  min-height: 54px;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: rgba(24, 17, 40, .9);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.unitpick:active:not(:disabled) { transform: translateY(1px); }
.unitpick:disabled { opacity: .45; cursor: default; }
.unitpick canvas { width: 22px; height: 22px; image-rendering: pixelated; }
.unitpick__name { font-size: 9px; line-height: 1.1; white-space: nowrap; }
.unitpick__star { font-size: 8px; color: var(--gold); height: 9px; }
.shoppick__cancel {
  margin-top: 8px;
  width: 100%;
  padding: 6px;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  background: none;
  color: var(--fg-mute);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.shop__note {
  margin: 0 0 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--fg-mute);
}

/* ---------- 弹层 ---------- */
.sheet {
  width: min(94vw, 400px);
  max-height: 88dvh;
  padding: 0;
  border: 1px solid #4a3568;
  border-radius: 18px;
  background: linear-gradient(180deg, #241a3d, #130e22);
  color: var(--fg);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .1);
  overflow: auto;
}
.sheet::backdrop {
  background: rgba(4, 2, 10, .72);
  backdrop-filter: blur(6px);
}
.sheet__inner { padding: 22px 20px 20px; }

.sheet__kicker {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .28em;
  color: var(--gold);
}
.sheet__title {
  margin: 0 0 10px;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: .06em;
  font-weight: 800;
  background: linear-gradient(180deg, #fff8e6, var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sheet__lead {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.72;
  color: #d8cdea;
}
.sheet__note {
  margin: 12px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--fg-mute);
}
.sheet__record {
  margin: 12px 0 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--fg-mute);
}

.rules {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rules li {
  position: relative;
  padding-left: 14px;
  font-size: 12.5px;
  line-height: 1.62;
  color: #cdc0e2;
}
.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(244, 193, 90, .7);
}
.rules b { color: var(--gold-2); font-weight: 700; }

.manual p {
  margin: 0 0 11px;
  font-size: 12.5px;
  line-height: 1.72;
  color: #cdc0e2;
}
.manual b { color: var(--gold-2); }

.upgrades {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upcard {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #291d44, #191129);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.upcard:active { transform: translateY(1px); }
.upcard:hover { border-color: var(--gold-deep); box-shadow: 0 0 0 1px rgba(244, 193, 90, .2); }
.upcard canvas {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  flex: none;
}
.upcard__name { margin: 0 0 2px; font-size: 13.5px; font-weight: 700; color: var(--gold-2); }
.upcard__desc { margin: 0; font-size: 11.5px; line-height: 1.5; color: var(--fg-dim); }

.tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 6px 0 4px;
}
.tally > div {
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(20, 14, 34, .8);
  text-align: center;
}
.tally span {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .18em;
  color: var(--fg-mute);
  margin-bottom: 3px;
}
.tally strong { font-size: 19px; color: var(--gold-2); font-family: var(--mono); }

/* ---------- 吐司 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(.94);
  z-index: 50;
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 12px;
  color: #f7f1ff;
  background: rgba(30, 20, 52, .96);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 动画 ---------- */
@keyframes pop {
  0% { transform: scale(.86); }
  60% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes reelSpin {
  0% { transform: translateY(-2px); opacity: .75; }
  100% { transform: translateY(2px); opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* ---------- 矮屏（如 iPhone SE 667） ---------- */
@media (max-height: 700px) {
  .app { gap: 4px; }
  #field { max-height: min(150px, 23dvh); }
  .hud { padding: 5px 6px; }
  .reels { padding: 5px; gap: 5px; }
  .chip { min-height: 40px; padding: 2px 1px; }
  .chip canvas { width: 19px; height: 19px; }
  .foot { min-height: 14px; padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* ---------- 宽屏 ---------- */
@media (min-width: 720px) {
  .app { max-width: 640px; padding: 16px 18px 18px; gap: 12px; }
  .reels { gap: 8px; padding: 8px; }
  .hud__num { font-size: 19px; }
  .chip { min-height: 52px; }
  .chip canvas { width: 26px; height: 26px; }
  .chip__label { font-size: 10px; }
  .btn--primary .btn__k { font-size: 19px; }
  .stage__banner { font-size: 20px; }
}

/* ---------- 手机横屏 ---------- */
@media (orientation: landscape) and (max-height: 620px) and (min-width: 520px) {
  body { overflow: hidden; }
  .app {
    max-width: none;
    width: 100%;
    height: 100dvh;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "hud console" "stage console" "foot console";
    gap: 6px 8px;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .hud { grid-area: hud; padding: 4px 7px; }
  .stage { grid-area: stage; min-height: 0; }
  .console {
    grid-area: console;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    gap: 6px;
    overflow: hidden;
  }
  .foot { grid-area: foot; }

  .stage__frame {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
  }
  #field {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
  }
  .hint { font-size: 10px; }
  .stage__banner { font-size: 16px; }
  .stage__ticker { font-size: 9px; }

  .reels {
    min-height: 0;
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 3px;
  }
  .reel { aspect-ratio: auto; min-height: 0; gap: 0; }
  .reel canvas { height: 54%; width: auto; max-width: 78%; }
  .reel__name { font-size: 8px; height: 8px; }
  .controls { gap: 5px; }
  .btn--primary { min-height: 50px; }
  .btn--primary .btn__k { font-size: 16px; }
  .btn--side { min-height: 46px; }
  .roster { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .chip { min-height: 44px; padding: 2px 1px; }
  .chip canvas { width: 20px; height: 20px; }
  .chip__label { font-size: 8px; }
  .hud__num { font-size: 15px; }
  .hearts .heart { width: 12px; height: 11px; }
}

@media (max-width: 340px) {
  .app { padding: 8px 8px 12px; }
  .hud { gap: 6px; padding: 6px 7px; }
  .roster { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chip__label { font-size: 8px; }
  .controls { grid-template-columns: 1fr 1.35fr 1fr; gap: 9px; }
  .btn--primary .btn__k { font-size: 15px; }
}
