:root {
  --bg: #0e0e10;
  --panel: #1a1a1f;
  --line: #333;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #ff9800;
  --spin: #43a047;
  --stop: #e53935;
  --restart: #ff9800;
  --hp: #66bb6a;
  --hp-enemy: #ef5350;
  --reel-size: 96px;
  --sprite-px: 200px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(1200px 600px at 50% -10%, #1c1408 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.page {
  height: 100dvh;
  height: 100svh;
  max-width: none;
  margin: 0 auto;
  padding: 8px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chrome-slot {
  flex-shrink: 0;
}
body.is-ls-compact .page {
  padding: 0;
  gap: 0;
}
body.is-ls-compact .chrome-slot-top,
body.is-ls-compact .chrome-slot-foot {
  display: none !important;
}
body.is-ls-compact .stage-viewport {
  border-radius: 0;
  flex: 1 1 auto;
  min-height: 0;
}

/* 收纳浮钮 */
.chrome-fab {
  position: fixed;
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 183, 77, 0.55);
  background: rgba(26, 26, 31, 0.92);
  color: #ffb74d;
  font-size: 1.35rem;
  font-family: inherit;
  font-weight: 700;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  user-select: none;
  -webkit-user-select: none;
  display: grid;
  place-items: center;
  padding: 0;
}
.chrome-fab:active {
  cursor: grabbing;
}
.chrome-fab.is-dragging {
  opacity: 0.85;
}
.chrome-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 12px;
}
.chrome-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.chrome-panel-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(86vh, 640px);
  overflow: auto;
  background: #17171c;
  border: 1px solid #444;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  -webkit-overflow-scrolling: touch;
}
.chrome-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  background: #17171c;
  z-index: 2;
}
.chrome-panel-body {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chrome-panel-body .topbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chrome-panel-body .top-nav-right,
.chrome-panel-body .top-actions {
  flex-wrap: wrap;
}
.chrome-panel-body .foot {
  text-align: left;
  font-size: 0.78rem;
}

/* 竖屏菜单：底部抽屉 + 紧凑网格，尽量一屏看完 */
@media (orientation: portrait), (max-aspect-ratio: 10/11) {
  .chrome-panel {
    place-items: end stretch;
    padding: 0;
    align-content: end;
  }
  .chrome-panel-card {
    width: 100%;
    max-width: none;
    max-height: min(78vh, 560px);
    border-radius: 16px 16px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
  .chrome-panel-head {
    padding: 10px 14px;
  }
  .chrome-panel-head strong {
    font-size: 0.95rem;
  }
  .chrome-panel-body {
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }
  .chrome-panel-body .topbar {
    gap: 8px;
  }
  .chrome-panel-body .top-nav-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-height: 0;
  }
  .chrome-panel-body .back {
    font-size: 0.85rem;
  }
  .chrome-panel-body .top-nav-right {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .chrome-panel-body .top-nav-right > * {
    width: 100%;
    min-width: 0;
    height: 40px;
    justify-content: center;
    box-sizing: border-box;
  }
  .chrome-panel-body .btn-icon {
    width: 100%;
    min-width: 0;
    height: 40px;
  }
  .chrome-panel-body .top-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .chrome-panel-body .titles h1 {
    font-size: 1.05rem;
    margin: 0;
  }
  .chrome-panel-body .titles .sub {
    display: none;
  }
  .chrome-panel-body .top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .chrome-panel-body .top-actions .btn-help {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
  }
  .chrome-panel-body .top-actions .quota-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }
  .chrome-panel-body .quota-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .chrome-panel-body .quota,
  .chrome-panel-body .btn-replay {
    width: 100%;
    justify-content: center;
  }
  .chrome-panel-body .foot > p:first-child {
    display: none;
  }
  .chrome-panel-body .foot-related {
    margin: 0 !important;
    line-height: 1.35;
  }
}

.topbar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.top-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 32px;
}
.top-nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.btn-icon,
.btn-stats,
.btn-gb,
.btn-share,
.btn-reload,
.btn-sfx,
.btn-fs {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #555;
  border-radius: 8px;
  background: #1a1a1f;
  color: #ddd;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.btn-stats {
  width: auto;
  min-width: 36px;
  padding: 0 8px;
  cursor: default;
  color: #aaa;
  border-color: #444;
  font-size: 0.78rem;
  gap: 4px;
}
.btn-gb:hover,
.btn-share:hover,
.btn-reload:hover,
.btn-sfx:hover,
.btn-fs:hover,
.btn-help:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-share.is-copied {
  border-color: #66bb6a;
  color: #81c784;
}
.btn-reload.is-busy {
  opacity: 0.65;
  pointer-events: none;
}
.btn-sfx[aria-checked="false"] {
  color: #777;
  border-color: #444;
  opacity: 0.85;
}
.btn-fs:hover,
.btn-fs[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
@media (max-width: 420px) {
  .btn-icon,
  .btn-gb,
  .btn-share,
  .btn-reload,
  .btn-sfx,
  .btn-fs {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }
  .btn-stats {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    font-size: 0.72rem;
  }
}
.top-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.back {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
}
.back:hover { color: var(--accent); }
.titles h1 {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: #fff;
}
.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn-help {
  border: 1px solid #555;
  background: #1a1a1f;
  color: #ddd;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
  flex-shrink: 0;
}
.btn-help:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.quota-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.quota {
  font-size: 0.8rem;
  color: var(--accent);
  border: 1px solid rgba(255,152,0,.35);
  padding: 5px 9px;
  border-radius: 8px;
  white-space: nowrap;
  background: transparent;
  cursor: default;
  font-family: inherit;
}
.quota.is-replay { cursor: pointer; }
.quota.is-replay:hover {
  border-color: var(--accent);
  background: rgba(255, 152, 0, 0.12);
}
.btn-replay {
  border: 1px solid rgba(255,152,0,.55);
  background: rgba(255, 152, 0, 0.16);
  color: #ffb74d;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.btn-replay:hover {
  background: rgba(255, 152, 0, 0.28);
  color: #ffe0a8;
}

/* —— 舞台视口：外壳按「缩放后」尺寸占位，舞台从左上角缩放 —— */
.stage-viewport {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 14px;
}

.stage-shell {
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  /* 宽高由 JS 设为 design × scale */
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.stage {
  --stage-w: 1080px;
  --stage-h: 620px;
  --sprite-px: 200px;
  --stage-scale: 1;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--stage-w);
  height: var(--stage-h);
  transform: scale(var(--stage-scale));
  transform-origin: 0 0;
  /* 舞台整块缩放时尽量用邻近采样，减轻角色发糊 */
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.stage[data-layout="portrait"] {
  --stage-w: 390px;
  --stage-h: 680px;
  --sprite-px: 108px;
}


.arena {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  overflow: hidden;
}

/* 横屏：顶栏血条 + 左玩家 · 中转轴 · 右敌人 */
.stage[data-layout="landscape"] .arena {
  grid-template-columns: 1fr 1.35fr 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "hud hud hud"
    "player center enemy";
  align-items: stretch;
}

.versus-hud { grid-area: hud; }
.player-side { grid-area: player; }
.enemy-side { grid-area: enemy; }
.center-panel { grid-area: center; }

.fighter {
  position: relative;
  display: block;
  padding: 0;
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid #2a2a2a;
  min-width: 0;
  min-height: 0;
  height: 100%;
  box-sizing: border-box;
  overflow: visible;
}
.stage[data-layout="portrait"] .fighter {
  padding: 0;
}
.stage[data-layout="portrait"] .arena {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto minmax(200px, 0.4fr) minmax(0, 1fr);
  grid-template-areas:
    "hud hud"
    "player enemy"
    "center center";
  gap: 8px;
  padding: 8px;
}

/* —— 格斗游戏式对战 HUD —— */
.versus-hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px 10px;
  align-items: end;
  padding: 4px 2px 2px;
  min-width: 0;
}
.hud-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding-bottom: 2px;
  min-width: 44px;
}
.hud-vs {
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #ffca28;
  text-shadow: 0 0 8px rgba(255, 152, 0, 0.45);
}
.hud-round {
  font-size: 0.68rem;
  color: #aaa;
  white-space: nowrap;
}
.hud-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-height: 1.1em;
}
.hud-player .hud-meta { justify-content: flex-start; }
.hud-enemy .hud-meta { justify-content: flex-end; }
.hud-name {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0,0,0,.75);
}
.hud-hp-num {
  font-size: 0.68rem;
  color: #bbb;
  font-variant-numeric: tabular-nums;
}
.hp-bar {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: #0a0a0c;
  border: 1px solid #555;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.55), 0 2px 0 rgba(0,0,0,.35);
  overflow: hidden;
}
.hp-bar .hp-ghost,
.hp-bar .hp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  display: block;
  height: 100%;
  max-width: 100%;
  pointer-events: none;
}
/* 玩家：剩余血量靠中（右），外侧先空 → 从两边往中间扣 */
.hp-bar-p1 .hp-ghost,
.hp-bar-p1 .hp-fill {
  right: 0;
  left: auto;
}
.hp-bar-p2 .hp-ghost,
.hp-bar-p2 .hp-fill {
  left: 0;
  right: auto;
}
.hp-ghost {
  background: rgba(255, 255, 255, 0.55);
  transition: width 0.55s ease-out;
  z-index: 1;
}
.hp-fill {
  z-index: 2;
  transition: width 0.22s ease-out, background 0.25s ease;
  background: linear-gradient(180deg, #9cff57 0%, #43a047 55%, #2e7d32 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.hp-bar.is-mid .hp-fill {
  background: linear-gradient(180deg, #ffe082 0%, #ffb300 55%, #f57f17 100%);
}
.hp-bar.is-low .hp-fill {
  background: linear-gradient(180deg, #ff8a80 0%, #e53935 55%, #b71c1c 100%);
  animation: hpPulse 0.7s ease-in-out infinite;
}
@keyframes hpPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.hp-bar.is-hit {
  animation: hpBarHit 0.28s ease-out;
}
.hp-bar.is-hit .hp-fill {
  filter: brightness(2.4) saturate(0.2);
}
@keyframes hpBarHit {
  0% { transform: translateX(0); filter: brightness(1); }
  20% { transform: translateX(-3px); filter: brightness(1.8); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
  100% { transform: translateX(0); filter: brightness(1); }
}
.hp-bar-p2.is-hit {
  animation-name: hpBarHitFlip;
}
@keyframes hpBarHitFlip {
  0% { transform: translateX(0); filter: brightness(1); }
  20% { transform: translateX(3px); filter: brightness(1.8); }
  40% { transform: translateX(-3px); }
  60% { transform: translateX(2px); }
  80% { transform: translateX(-2px); }
  100% { transform: translateX(0); filter: brightness(1); }
}
.stage[data-layout="portrait"] .hp-bar { height: 12px; }
.stage[data-layout="portrait"] .hud-name { font-size: 0.74rem; }
.stage[data-layout="portrait"] .versus-hud { gap: 4px 6px; }

/* 连击 / Round 过场 */
.arena { position: relative; }
.fight-fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: block;
  overflow: visible;
}
.combo-pop {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translate(-50%, 0);
  text-align: center;
  z-index: 22;
  animation: comboPop 1.05s ease-out forwards;
}
.combo-pop.hidden { display: none; }
.combo-num {
  display: block;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow:
    0 0 2px #000,
    3px 3px 0 #e53935,
    -1px -1px 0 #ffca28;
}
.combo-label {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #ffca28;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.6); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.15); }
  55% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1); }
}
.round-banner {
  position: absolute;
  top: 36%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 24;
  text-align: center;
  padding: 0.55em 1.1em;
  border: 2px solid rgba(255, 202, 40, 0.75);
  background: rgba(0, 0, 0, 0.72);
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: roundIn 1.55s ease forwards;
  min-width: 160px;
}
.round-banner.hidden { display: none; }
.round-title {
  font-size: clamp(1.35rem, 4.5vw, 1.9rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  color: #ffca28;
  text-shadow: 0 2px 10px rgba(0,0,0,.6);
}
.round-sub {
  margin-top: 0.25em;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #eee;
  text-transform: uppercase;
}
@keyframes roundIn {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.85); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(1); }
}

.sprite {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  font-size: 3.2rem;
  border-radius: 18px;
  background: linear-gradient(160deg, #2a2a32, #151518);
  border: 1px solid #3a3a42;
  transition: transform .15s ease, filter .15s ease;
  overflow: hidden;
}
.sprite.is-sheet {
  width: var(--sprite-px);
  height: var(--sprite-px);
  font-size: 0;
  color: transparent;
  background-color: transparent;
  background-image: none !important;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.sprite-canvas {
  width: var(--sprite-px);
  height: var(--sprite-px);
  display: block;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}
.player-sprite { box-shadow: 0 0 24px rgba(255,152,0,.12); }
.enemy-sprite { box-shadow: 0 0 24px rgba(239,83,80,.12); }
.player-sprite.is-sheet,
.enemy-sprite.is-sheet {
  box-shadow: none;
}
.sprite.hit { transform: translateX(6px); filter: brightness(1.3); }
.sprite.hurt { transform: translateX(-6px); filter: saturate(1.4); }
.sprite.heal { filter: drop-shadow(0 0 10px #66bb6a); }
.player-sprite.is-sheet.hit,
.player-sprite.is-sheet.hurt,
.player-sprite.is-sheet.heal,
.enemy-sprite.is-sheet.hit,
.enemy-sprite.is-sheet.hurt,
.enemy-sprite.is-sheet.heal {
  transform: none;
  filter: none;
}

.center-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 6px 4px;
  min-width: 0;
  min-height: 0;
}
.stage[data-layout="portrait"] .center-panel {
  gap: 8px;
  justify-content: flex-start;
  padding-top: 4px;
}

.prize-box {
  width: min(100%, 360px);
  border: 1px solid rgba(255,183,77,.45);
  background: linear-gradient(145deg, rgba(255,152,0,.14), rgba(0,0,0,.35));
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  text-align: center;
}
.stage[data-layout="portrait"] .prize-box {
  width: 100%;
  padding: 8px 10px;
}
.prize-box:hover { border-color: var(--accent); }
.prize-hint {
  display: block;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 4px;
  text-align: center;
}
.prize-text {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: #ffb74d;
  text-align: center;
}
.prize-blurb {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #aaa;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
  text-align: center;
}

.reels {
  --reels-w: min(100%, 360px);
  width: var(--reels-w);
  display: flex;
  gap: 10px;
  justify-content: stretch;
}
.stage[data-layout="portrait"] .reels {
  --reels-w: 100%;
  gap: 8px;
}
.reel {
  --cell: 96px;
  flex: 1 1 0;
  width: auto;
  height: auto;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid #4a3a5a;
  background: #2a1848;
  box-shadow: inset 0 0 18px rgba(0,0,0,.45), 0 6px 16px rgba(0,0,0,.35);
  overflow: hidden;
  position: relative;
}
.reel::before,
.reel::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 18px;
  z-index: 2;
  pointer-events: none;
}
.reel::before {
  top: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.reel::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.55), transparent);
}
.reel-strip {
  will-change: transform;
  display: block;
}
.reel-cell {
  height: var(--cell);
  min-height: var(--cell);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  line-height: 1;
  background: linear-gradient(180deg, #c46bff 0%, #7b3fe4 45%, #4a1f8c 100%);
  border-bottom: 1px solid rgba(0,0,0,.25);
  user-select: none;
  box-sizing: border-box;
}
.stage[data-layout="portrait"] .reel-cell {
  font-size: 2rem;
}
.reel-cell.win-flash {
  animation: winBlink 0.5s linear forwards;
}
.reel-cell.is-win {
  background: linear-gradient(180deg, #fff6c2 0%, #ffe082 45%, #ffca28 100%) !important;
}
@keyframes winBlink {
  0%, 10% { background: linear-gradient(180deg, #fff6c2 0%, #ffe082 45%, #ffca28 100%); }
  10%, 20% { background: linear-gradient(180deg, #c46bff 0%, #7b3fe4 45%, #4a1f8c 100%); }
  20%, 30% { background: linear-gradient(180deg, #fff6c2 0%, #ffe082 45%, #ffca28 100%); }
  30%, 40% { background: linear-gradient(180deg, #c46bff 0%, #7b3fe4 45%, #4a1f8c 100%); }
  40%, 50% { background: linear-gradient(180deg, #fff6c2 0%, #ffe082 45%, #ffca28 100%); }
  50%, 100% { background: linear-gradient(180deg, #fff6c2 0%, #ffe082 45%, #ffca28 100%); }
}
.reel-cell.wild-morph {
  animation: wildPop 0.45s ease;
}
@keyframes wildPop {
  0% { transform: scale(1); filter: brightness(1); }
  40% { transform: scale(1.18); filter: brightness(1.35); }
  100% { transform: scale(1); filter: brightness(1); }
}

.reel-curtain {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #ffe0a8;
  background:
    linear-gradient(180deg, rgba(60, 36, 12, 0.95), rgba(28, 16, 8, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(255, 180, 80, 0.06) 8px 9px);
  border-radius: 11px;
  transform: translateY(0);
  transition: transform 0.55s cubic-bezier(0.22, 0.8, 0.25, 1);
  pointer-events: none;
}
.reel-curtain.is-up {
  transform: translateY(-110%);
}

.bonus-line {
  margin: 0;
  text-align: center;
  color: #ffd54f;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.bonus-line strong {
  color: #fff;
  font-size: 1.15em;
}

.sprite-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  z-index: 1;
  overflow: visible;
}
.float-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
  z-index: 3;
}
.floater {
  position: absolute;
  left: 50%;
  top: 35%;
  transform: translate(-50%, 0);
  font-weight: 800;
  font-size: 1.05rem;
  text-shadow: 0 2px 6px rgba(0,0,0,.65);
  animation: floatUp 1.05s ease-out forwards;
  white-space: nowrap;
}
.floater.dmg { color: #ff7043; }
.floater.basic { color: #ffab91; }
.floater.heal { color: #69f0ae; }
.floater.block { color: #82b1ff; }
.floater.hurt { color: #ef5350; }
.floater.crit {
  color: #ffd54f;
  font-size: 1.15em;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 213, 79, 0.45);
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 8px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -42px); }
}

.banner-toast {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 4;
  padding: 0.3em 0.6em;
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255, 183, 77, 0.65);
  text-shadow: 0 2px 10px rgba(0,0,0,.5);
  animation: bannerIn 1.6s ease forwards;
  pointer-events: none;
  white-space: nowrap;
}
.banner-toast.heal-ban {
  border-color: rgba(105, 240, 174, 0.7);
  color: #b9f6ca;
}
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.85); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1); }
}

.stage-line, .fx-line {
  margin: 0;
  min-height: 1.15em;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.fx-line { color: #ffcc80; min-height: 1.3em; }
.stage[data-layout="portrait"] .fx-line,
.stage[data-layout="portrait"] .stage-line {
  font-size: 0.8rem;
}

.controls {
  display: flex;
  width: min(100%, 280px);
}
.stage[data-layout="portrait"] .prize-blurb {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-height: 2.6em;
}
.stage[data-layout="portrait"] .prize-hint {
  display: none;
}
.stage[data-layout="portrait"] .controls {
  width: 100%;
  margin-top: 4px;
}
.controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}
.quota-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}
.quota-line {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f0e6c8;
  letter-spacing: 0.04em;
}
.quota-sub {
  font-size: 0.72rem;
  color: var(--muted);
}
.btn-more-plays {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 152, 0, 0.55);
  border-radius: 8px;
  background: rgba(255, 152, 0, 0.14);
  color: #ffb74d;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
}
.btn-more-plays:hover {
  background: rgba(255, 152, 0, 0.28);
  color: #ffe0a8;
}
.btn-more-plays.hidden,
.btn-replay.hidden {
  display: none !important;
}
.stage[data-layout="portrait"] .btn-main {
  min-height: 46px;
}
.btn-main {
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 10px;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
  background: var(--spin);
  color: #061008;
  transition: background .15s, transform .1s;
}
.btn-main:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-main.is-stop {
  background: var(--stop);
  color: #fff;
}
.btn-main.is-start,
.btn-main.is-claim {
  background: var(--restart);
  color: #111;
}

.foot {
  flex-shrink: 0;
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: center;
}
.foot p { margin: 0; }
.foot-related {
  margin-top: 4px !important;
}
.foot-related a {
  color: #ffb74d;
  text-decoration: none;
}
.foot-related a:hover {
  text-decoration: underline;
}
.foot-reload {
  margin-top: 4px !important;
  color: #666;
  font-size: 0.7rem;
}
.jackpot-note { color: #ffb74d; }
.hidden { display: none !important; }

/* 极窄顶栏 */
@media (max-width: 560px) {
  .top-main {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 6px;
  }
  .top-actions { justify-content: center; }
  .sub { max-width: 90vw; margin-left: auto; margin-right: auto; }
  /* 竖屏保留页脚关键链接，隐藏说明性长文以免挤舞台 */
  .foot {
    display: block;
    flex-shrink: 0;
    font-size: 0.68rem;
    line-height: 1.35;
    padding: 0 2px 2px;
  }
  .foot > p:first-child,
  .foot-reload {
    display: none;
  }
  .foot-related {
    margin-top: 0 !important;
  }
}

/* 无 Fullscreen API 时的类全屏兜底（微信等） */
body.is-fs-fallback {
  background: #0e0e10;
}
body.is-fs-fallback .page {
  max-width: none;
  padding: 8px 8px 12px;
  min-height: 100dvh;
  min-height: 100vh;
}
body.is-fs-fallback .back {
  display: none;
}
body.is-fs-fallback .foot {
  display: block;
  flex-shrink: 0;
}
body.is-fs-fallback .foot > p:first-child,
body.is-fs-fallback .foot-reload {
  display: none;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  overflow: auto;
  background: #17171c;
  border: 1px solid #444;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #333;
  position: sticky;
  top: 0;
  background: #17171c;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #ffb74d;
}
.modal-x {
  border: none;
  background: transparent;
  color: #aaa;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.modal-body {
  padding: 16px;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #ccc;
}
.modal-body h3 {
  margin: 1.1em 0 0.45em;
  color: #fff;
  font-size: 1rem;
}
.modal-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin: 8px 0 12px;
}
.modal-body th,
.modal-body td {
  border: 1px solid #333;
  padding: 8px 10px;
  text-align: left;
}
.modal-body th {
  background: #222;
  color: #ffb74d;
}
.modal-body ul {
  margin: 0.4em 0 0.8em;
  padding-left: 1.2em;
}
.modal-card-stats {
  width: min(420px, 100%);
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 14px;
}
.stats-cell {
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #121218;
}
.stats-cell .k {
  display: block;
  font-size: 0.72rem;
  color: #888;
  margin-bottom: 4px;
}
.stats-cell .v {
  display: block;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: #f0f0f0;
}
.stats-note {
  margin: 0;
  font-size: 0.78rem;
  color: #777;
  line-height: 1.45;
}
.stats-loading {
  margin: 0;
  color: #999;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 10, 0.92);
  padding: 24px;
}
.loading-overlay.is-done {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.loading-card {
  width: min(360px, 100%);
  text-align: center;
  color: #ddd;
}
.loading-card h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
  color: #ffb74d;
}
.loading-card p {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: #999;
}
.loading-bar {
  height: 10px;
  border-radius: 999px;
  background: #222;
  border: 1px solid #444;
  overflow: hidden;
}
.loading-bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff9800, #ffca28);
  transition: width 0.15s ease;
}
.loading-pct {
  margin-top: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffb74d;
  font-variant-numeric: tabular-nums;
}
.loading-count {
  margin-top: 4px;
  font-size: 0.8rem;
  color: #888;
  font-variant-numeric: tabular-nums;
}
