:root {
  --bg: #050a16;
  --cabinet: #0b152c;
  --panel: #071024;
  --panel-head: linear-gradient(180deg, #3c5782 0%, #223659 100%);
  --panel-head-ink: #eef6ff;
  --line: rgba(94, 180, 232, 0.34);
  --line-strong: rgba(114, 218, 255, 0.68);
  --ink: #eef5ff;
  --muted: #8ea5cc;
  --accent: #ff6b4a;
  --accent-hover: #ff8266;
  --accent-soft: rgba(255, 107, 74, 0.18);
  --lit: #5ee7ff;
  --gold: #ffbe44;
  --board-frame: #060e21;
  --board-border: #7fe8ff;
  --board-glow: rgba(94, 231, 255, 0.25);
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.68);
  --frame: 6px;
  --chamfer: 18px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-pop: cubic-bezier(0.34, 1.36, 0.64, 1);
  --sans: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Orbitron", "JetBrains Mono", sans-serif;
  --pixel: "Silkscreen", "JetBrains Mono", monospace;
  --ctl-bg: #101e3c;
  --ctl-hover: #172b54;
  --modal-bg: #0c1733;
  --slot-hi-bg: #0c1b3b;
  --chip-bg: rgba(255, 255, 255, 0.05);
  --bezel-fill: rgba(9, 17, 38, 0.94);
  --bezel-outer: #56b8e8;
  --bezel-inner: rgba(94, 180, 232, 0.36);
  --fever-bg: #060d1c;
  --fever-cell: #182948;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #dde5ef;
  --cabinet: #f4f7fb;
  --panel: #edf2f8;
  --panel-head: linear-gradient(180deg, #dce6f4 0%, #cad8ec 100%);
  --panel-head-ink: #14213d;
  --line: rgba(42, 82, 148, 0.25);
  --line-strong: rgba(42, 82, 148, 0.65);
  --ink: #14213d;
  --muted: #516485;
  --accent: #e05336;
  --accent-hover: #c94126;
  --accent-soft: rgba(224, 83, 54, 0.14);
  --lit: #1882b8;
  --gold: #c98612;
  --board-frame: #edf2f8;
  --board-border: #3b6eb5;
  --board-glow: rgba(59, 110, 181, 0.16);
  --shadow: 0 20px 44px rgba(20, 33, 61, 0.16);
  --ctl-bg: #ffffff;
  --ctl-hover: #eaf0f8;
  --modal-bg: #ffffff;
  --slot-hi-bg: #ffffff;
  --chip-bg: rgba(20, 33, 61, 0.05);
  --bezel-fill: rgba(244, 247, 251, 0.96);
  --bezel-outer: #3b6eb5;
  --bezel-inner: rgba(59, 110, 181, 0.28);
  --fever-bg: #dce5f0;
  --fever-cell: #c3d1e2;
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 50% 24%, rgba(28, 60, 122, 0.42) 0%, rgba(5, 10, 22, 0) 64%),
    var(--bg);
  transition: background-color 200ms ease, color 200ms ease;
}

:root[data-theme="light"] body {
  background: var(--bg);
}

button:focus-visible {
  outline: 2px solid var(--lit);
  outline-offset: 2px;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 5px;
  font-size: 0.72rem;
  font-family: var(--mono);
  text-align: center;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.app-shell {
  min-height: 100dvh;
  max-width: max(920px, calc(960px * var(--layout-zoom, 1)));
  margin: 0 auto;
  padding: 10px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.brand-mobile {
  display: none;
  align-items: center;
  gap: 6px;
}

.brand-mark {
  width: 22px;
  height: 15px;
  flex-shrink: 0;
}

.brand-zh-mobile {
  white-space: nowrap;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctl-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ctl-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, transform 140ms var(--ease-out);
}

.ctl-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--ctl-hover);
}

.ctl-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.ctl-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ctl-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lit);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--lit) 25%, transparent);
}

.ctl-state {
  font-size: 0.72rem;
  color: var(--lit);
}

.ctl-toggle[aria-pressed="false"] {
  color: var(--muted);
}

.ctl-toggle[aria-pressed="false"] .ctl-dot {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--muted);
}

.ctl-toggle[aria-pressed="false"] .ctl-dot::after {
  content: "";
  position: absolute;
  left: -2px;
  top: 3px;
  width: 12px;
  height: 1.5px;
  background: var(--muted);
  transform: rotate(-45deg);
}

.ctl-toggle[aria-pressed="false"] .ctl-state {
  color: var(--muted);
}

.mobile-hud {
  display: none;
}

.cabinet {
  position: relative;
  padding: 14px 36px 26px;
  isolation: isolate;
}

.cabinet-bezel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.bezel-outer {
  fill: var(--bezel-fill);
  stroke: var(--bezel-outer);
  stroke-width: 2;
  filter: drop-shadow(0 0 10px var(--board-glow));
}

.bezel-inner {
  fill: none;
  stroke: var(--bezel-inner);
  stroke-width: 1.25;
}

.cabinet-marquee {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.marquee-title {
  margin: 0;
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1;
  white-space: nowrap;
}

.brand-accent {
  color: var(--lit);
  text-shadow: 0 0 16px var(--board-glow);
}

.brand-main {
  color: var(--ink);
}

.wing-tag {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 4px 16px;
  background: var(--panel-head);
  border: 1.5px solid var(--line-strong);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--panel-head-ink);
  white-space: nowrap;
}

.wing-level {
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 100%, 10px 100%);
}

.game-layout {
  zoom: var(--layout-zoom, 1);
  display: grid;
  grid-template-columns: 184px auto 184px;
  justify-content: center;
  align-items: start;
  gap: 24px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 26px;
}

.arcade-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}

.slot-label {
  margin: 0;
  font-family: var(--pixel);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--ink);
}

.slot-box {
  width: 100%;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.25);
}

:root[data-theme="light"] .slot-box {
  box-shadow: inset 0 2px 6px rgba(20, 33, 61, 0.06);
}

.panel {
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

:root[data-theme="light"] .panel {
  box-shadow: 0 4px 12px rgba(20, 33, 61, 0.08);
}

.panel-head {
  margin: 0;
  padding: 5px 10px 4px;
  background: var(--panel-head);
  border-bottom: 1px solid var(--line);
  font-family: var(--pixel);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  color: var(--panel-head-ink);
}

.panel-body {
  margin: 0;
  padding: 9px 10px;
}

.preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

#hold-canvas,
#next-canvas-1 {
  display: block;
  width: 120px;
  height: 84px;
}

#next-canvas-2,
#next-canvas-3 {
  display: block;
  width: 88px;
  height: 56px;
}

.stat-panel .panel-body {
  text-align: center;
}

.stat-big,
.stat-mid {
  margin: 0;
  font-family: var(--mono);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.15;
}

.stat-big {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  width: 100%;
  text-align: center;
}

.stat-mid {
  font-size: 1.3rem;
  letter-spacing: -0.01em;
}

.tick {
  display: inline-block;
  animation: value-tick 320ms var(--ease-out);
}

@keyframes value-tick {
  0% {
    transform: scale(1);
    color: var(--accent);
  }
  35% {
    transform: scale(1.1);
    color: var(--accent);
  }
  100% {
    transform: scale(1);
  }
}

.next-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.next-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 6px 10px;
}

.next-first {
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  border: 2px solid #d4f8ff;
  background: var(--slot-hi-bg);
  box-shadow: 0 0 16px var(--board-glow);
}

:root[data-theme="light"] .next-first {
  border-color: var(--board-border);
}

:root[data-theme="light"] .next-first {
  border-color: var(--line-strong);
  background: var(--panel);
}

.next-index {
  position: absolute;
  top: 2px;
  left: 5px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--muted);
}

.next-first .next-index {
  color: var(--ink);
}

.level-panel .panel-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 220ms var(--ease-out);
}

.progress-text {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.level-panel.flash .progress-track {
  animation: track-flash 700ms ease-out;
}

@keyframes track-flash {
  from {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  to {
    box-shadow: 0 0 0 6px transparent;
  }
}

.board-stage {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.board-status {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(300px + var(--frame) * 2);
  min-height: 20px;
  padding: 2px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: transparent;
  text-align: center;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.board-status[data-tone="rune"],
.board-status[data-tone="fever"],
.board-status[data-tone="danger"] {
  background: var(--panel);
}

.board-status[data-tone="rune"] {
  color: var(--ink);
  border-color: var(--line-strong);
}

.board-status[data-tone="fever"] {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) 60%, transparent);
}

.board-status[data-tone="danger"] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

.board-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.board-wrap {
  --pulse-color: #f8f5ef;
  position: relative;
  padding: var(--frame);
  background: var(--board-frame);
  border: 2px solid var(--board-border);
  border-radius: 8px;
  box-shadow: var(--shadow), 0 0 26px var(--board-glow);
}

:root[data-theme="light"] .board-wrap {
  border: 2px solid var(--board-frame);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.board-wrap::before,
.board-wrap::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.board-wrap::before {
  background: linear-gradient(to bottom, rgba(232, 92, 70, 0.5), rgba(232, 92, 70, 0) 18%);
  box-shadow: inset 0 3px 0 rgba(240, 110, 90, 0.9), 0 -8px 26px -6px rgba(232, 92, 70, 0.55);
  transition: opacity 240ms var(--ease-out);
}

.board-wrap.danger::before {
  opacity: 1;
  animation: danger-breathe 900ms var(--ease-in-out) infinite alternate;
}

.board-wrap.pulse-major::after {
  animation: board-pulse 720ms ease-out;
}

.board-wrap.is-fever {
  border-color: var(--gold);
  box-shadow: var(--shadow), 0 0 0 2px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 30px color-mix(in srgb, var(--gold) 40%, transparent);
}

.board-wrap.is-fever .scanlines {
  animation: fever-glow 1100ms var(--ease-in-out) infinite alternate;
}

.board-wrap.drop-bump {
  animation: board-drop-bump 120ms ease-out;
}

.board-wrap.shake {
  animation: board-shake 300ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes danger-breathe {
  from {
    opacity: 0.45;
  }
  to {
    opacity: 1;
  }
}

@keyframes fever-glow {
  from {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold) 30%, transparent), inset 0 0 16px color-mix(in srgb, var(--gold) 12%, transparent);
  }
  to {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gold) 65%, transparent), inset 0 0 34px color-mix(in srgb, var(--gold) 28%, transparent);
  }
}

@keyframes board-pulse {
  0% {
    opacity: 1;
    box-shadow: 0 0 0 0 var(--pulse-color), inset 0 0 0 2px var(--pulse-color);
  }
  100% {
    opacity: 0;
    box-shadow: 0 0 0 16px transparent, inset 0 0 0 2px transparent;
  }
}

@keyframes board-drop-bump {
  0%,
  100% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(3px);
  }
}

@keyframes board-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3px, 2px);
  }
  40% {
    transform: translate(3px, -1px);
  }
  60% {
    transform: translate(-2px, 1px);
  }
  80% {
    transform: translate(1px, 0);
  }
}

#board-canvas {
  display: block;
  width: 300px;
  height: 600px;
  border-radius: 4px;
}

.scanlines {
  position: absolute;
  inset: var(--frame);
  border-radius: 4px;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.024) 0 1px, transparent 1px 3px);
}

:root[data-theme="light"] .scanlines {
  display: none;
}

.fever {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 34px;
}

.fever.is-off {
  visibility: hidden;
}

.fever-label {
  font-family: var(--pixel);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--lit);
}

.fever-track {
  position: relative;
  flex: 1;
  width: 20px;
  padding: 2px;
  border: 1.5px solid var(--line-strong);
  border-radius: 4px;
  background: var(--fever-bg);
  overflow: hidden;
}

.fever-led-bg {
  position: absolute;
  inset: 2px;
  background: repeating-linear-gradient(
    to top,
    var(--fever-cell) 0 calc(4.166% - 2.5px),
    var(--fever-bg) calc(4.166% - 2.5px) 4.166%
  );
}

.fever-fill {
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 2px;
  height: calc(var(--fever, 0) * (100% - 4px));
  background: linear-gradient(
    to top,
    #ff731d 0%,
    #ffad33 38%,
    #ffe066 64%,
    #48e5ff 100%
  );
  background-size: 100% var(--fever-full, 580px);
  background-position: bottom;
  box-shadow: 0 0 10px var(--board-glow);
  transition: height 220ms var(--ease-out);
}

.fever-led-mask {
  position: absolute;
  inset: 2px;
  background: repeating-linear-gradient(
    to top,
    transparent 0 calc(4.166% - 2.5px),
    var(--fever-bg) calc(4.166% - 2.5px) 4.166%
  );
  pointer-events: none;
}

.fever-key {
  opacity: 0.35;
  transition: opacity 160ms ease;
}

.fever.is-ready .fever-key {
  opacity: 1;
}

.fever.is-ready .fever-track {
  border-color: var(--gold);
  animation: fever-ready 900ms var(--ease-in-out) infinite alternate;
}

.fever.is-active .fever-fill {
  transition: height 120ms linear;
}

@keyframes fever-ready {
  from {
    box-shadow: 0 0 0 0 transparent;
  }
  to {
    box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 70%, transparent);
  }
}

.action-banner {
  position: absolute;
  top: 22%;
  left: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 16px 7px;
  border-radius: 4px;
  background: rgba(12, 16, 34, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f3f1ea;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -6px);
  transition: opacity 180ms var(--ease-out), transform 220ms var(--ease-out);
}

.action-banner.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.banner-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.banner-sub {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(243, 241, 234, 0.7);
}

.action-banner[data-tier="major"] {
  padding: 8px 20px 9px;
  border-color: var(--banner-tone, rgba(255, 255, 255, 0.3));
  box-shadow: 0 0 0 1px var(--banner-tone, transparent), 0 10px 30px rgba(0, 0, 0, 0.35);
}

.action-banner[data-tier="major"] .banner-title {
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: var(--banner-tone, #f3f1ea);
}

.action-banner[data-tier="major"].visible {
  animation: banner-pop 380ms var(--ease-pop);
}

.action-banner[data-tier="level"] {
  top: 36%;
  background: var(--accent);
  border-color: transparent;
}

.action-banner[data-tier="level"] .banner-sub {
  color: rgba(255, 255, 255, 0.85);
}

.action-banner[data-tone="combo"] .banner-title {
  color: var(--banner-tone);
}

@keyframes banner-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.board-overlay {
  position: absolute;
  inset: var(--frame);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-radius: 3px;
  background: rgba(10, 14, 30, 0.72);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  transition: opacity 200ms var(--ease-out), visibility 200ms var(--ease-out);
}

.board-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay-card {
  width: 100%;
  max-width: 266px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 16px 15px;
  text-align: center;
  background: var(--modal-bg);
  color: var(--ink);
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.board-overlay:not(.hidden) .overlay-card {
  animation: card-in 260ms var(--ease-out);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  margin-bottom: 12px;
}

.mode-switch button {
  appearance: none;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--chip-bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

.mode-switch button[aria-checked="true"] {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mode-warning {
  margin: -4px 0 8px;
  font-size: 0.7rem;
  color: var(--muted);
}

.challenge-note {
  margin: 0 0 10px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.45;
}

.challenge-note.is-win {
  background: rgba(103, 199, 186, 0.14);
  color: var(--lit);
}

.overlay-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe066 0%, #ff9d2e 100%);
  color: #1f1403;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 0 14px rgba(255, 190, 68, 0.45);
}

.overlay-badge:not([hidden]) {
  animation: badge-pop 420ms var(--ease-pop);
}

@keyframes badge-pop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

.overlay-title {
  margin: 0 0 6px;
  font-size: 1.18rem;
  font-weight: 800;
}

.overlay-subtitle {
  margin: 0 0 10px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
}

.overlay-score {
  margin: 0 0 2px;
  font-size: 1.9rem;
  font-weight: 800;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.overlay-meta {
  margin: 0 0 12px;
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.primary-btn {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-hover) 0%, var(--accent) 100%);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 11px 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #9e2c17, 0 8px 18px rgba(224, 83, 54, 0.3);
  transition: transform 90ms ease, box-shadow 90ms ease, filter 140ms ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
}

.primary-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #9e2c17;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.result-actions:not(:has(button:not([hidden]))) {
  display: none;
}

.text-btn {
  appearance: none;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--ctl-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.text-btn:hover {
  border-color: var(--lit);
  background: var(--ctl-hover);
}

.share-status {
  margin: 6px 0 0;
  max-width: 100%;
  font-size: 0.72rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.share-status:not([hidden]) {
  animation: fade-up 220ms var(--ease-out);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
}

.overlay-hint {
  margin: 10px 0 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.overlay-hint kbd {
  font-size: 0.62rem;
  padding: 0 4px;
}

.controls-strip {
  display: flex;
  justify-content: center;
  opacity: 0.72;
}

.controls-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
}

.controls-list li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--muted);
}

.controls-list kbd {
  border: 0;
  background: var(--chip-bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.68rem;
}

.controls-list .keys {
  display: inline-flex;
  gap: 3px;
}

.touch-controls,
.touch-fever {
  display: none;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}

.enter {
  animation: enter-up 460ms var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.board-stage.enter {
  animation-name: enter-board;
  animation-duration: 560ms;
}

@keyframes enter-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes enter-board {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .ctl-btn:hover:not(:disabled),
  .mode-switch button:hover {
    border-color: var(--line-strong);
    color: var(--ink);
  }

  .primary-btn:hover {
    background: var(--accent-hover);
  }

  .text-btn:hover,
  .site-footer a:hover {
    color: var(--accent);
    border-color: currentColor;
  }
}

@media (max-width: 1000px) {
  .tag {
    display: none;
  }
}

@media (max-width: 767px) {
  .app-shell {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .top-bar {
    justify-content: space-between;
    gap: 6px;
  }

  .brand-mobile {
    display: flex;
  }

  .cabinet-bezel,
  .cabinet-marquee,
  .ctl-state {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .ctl-btn {
    gap: 4px;
    padding: 5px 7px;
    font-size: 0.72rem;
  }

  .mobile-hud {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
  }

  .mobile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    padding: 3px 2px 4px;
  }

  .mobile-stat + .mobile-stat {
    border-left: 1px solid var(--line);
  }

  .mobile-stat .stat-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--muted);
  }

  .mobile-stat .stat-value {
    max-width: 100%;
    font-family: var(--mono);
    font-size: 0.98rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cabinet {
    --chamfer: 10px;
    padding: 8px;
  }

  .game-layout {
    grid-template-columns: auto auto;
    grid-template-areas:
      "hold next"
      "board board";
    justify-content: center;
    gap: 8px 10px;
  }

  .side-panel {
    display: contents;
  }

  .hold-card {
    grid-area: hold;
  }

  .next-card {
    grid-area: next;
  }

  .board-stage {
    grid-area: board;
    align-items: center;
  }

  .stat-panel {
    display: none;
  }

  .panel-head {
    padding: 2px 8px 1px;
    font-size: 0.6rem;
  }

  .panel-body {
    padding: 4px 8px;
  }

  #hold-canvas,
  #next-canvas-1 {
    width: 64px;
    height: 44px;
  }

  #next-canvas-2,
  #next-canvas-3 {
    width: 46px;
    height: 30px;
  }

  .next-list {
    flex-direction: row;
    gap: 6px;
    padding: 4px 6px;
  }

  .next-slot {
    padding: 2px 3px;
  }

  .next-index {
    display: none;
  }

  .board-status {
    width: auto;
    align-self: stretch;
    min-height: 24px;
    font-size: 0.68rem;
  }

  .board-row {
    gap: 6px;
  }

  #board-canvas {
    width: var(--board-w, min(300px, calc((100dvh - 400px) / 2)));
    height: auto;
    aspect-ratio: 1 / 2;
  }

  .fever {
    width: 16px;
    gap: 4px;
  }

  .fever-label,
  .fever-key {
    display: none;
  }

  .fever-track {
    width: 12px;
  }

  .board-overlay {
    padding: 8px;
  }

  .overlay-card {
    padding: 10px 9px;
  }

  .overlay-title {
    font-size: 1.02rem;
  }

  .overlay-subtitle {
    font-size: 0.72rem;
  }

  .overlay-score {
    font-size: 1.45rem;
  }

  .mode-switch button {
    font-size: 0.7rem;
    padding: 6px 2px;
  }

  .action-banner .banner-title {
    font-size: 0.82rem;
  }

  .action-banner[data-tier="major"] .banner-title {
    font-size: 1.1rem;
  }

  .controls-strip,
  .overlay-hint {
    display: none;
  }

  .site-footer {
    order: 10;
    font-size: 0.64rem;
  }
}

@media (max-width: 767px) and (max-height: 700px) {
  .site-footer {
    display: none;
  }

}

@media (min-width: 340px) and (max-width: 767px) and (max-height: 760px) {
  .game-layout {
    grid-template-columns: auto auto auto;
    grid-template-areas: "hold board next";
    gap: 6px;
  }

  .hold-card,
  .next-card {
    width: 58px;
  }

  #hold-canvas,
  #next-canvas-1 {
    width: 50px;
    height: 34px;
  }

  #next-canvas-2,
  #next-canvas-3 {
    width: 42px;
    height: 27px;
  }

  .next-list {
    flex-direction: column;
    gap: 4px;
    padding: 4px;
  }

  .preview {
    padding: 4px 2px;
  }

  .board-status {
    height: 32px;
    font-size: 0.62rem;
    line-height: 1.3;
    overflow: hidden;
  }
}

@media (max-width: 767px) and (max-height: 620px) {
  .app-shell {
    gap: 5px;
    padding-top: 5px;
  }

  .hold-card .slot-label,
  .next-card .slot-label {
    display: none;
  }

  .slot-box {
    padding: 4px 6px;
  }

  .mobile-stat {
    padding: 1px 2px 2px;
  }

  .mobile-stat .stat-value {
    font-size: 0.86rem;
  }

  .cabinet {
    padding: 6px;
  }

  .board-status {
    min-height: 20px;
    padding: 1px 8px;
  }

  .touch-pad {
    --size: 36px;
  }

  .touch-move {
    gap: 4px 4px;
  }

  .touch-act {
    gap: 6px;
  }
}

@media (max-width: 767px) {
  .board-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    padding: 20px;
    border-radius: 0;
  }

  .overlay-card {
    max-width: 320px;
  }
}

@media (max-width: 379px) {
  .brand-title,
  .brand-zh-mobile {
    display: none;
  }
}

@media (max-width: 767px), (pointer: coarse) {
  .touch-controls {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: 8px;
    margin-top: auto;
  }

  .touch-pad {
    --size: clamp(44px, calc((100vw - 126px) / 5), 54px);
    display: grid;
    gap: 10px;
  }

  .touch-move {
    grid-template-columns: repeat(3, var(--size));
    grid-template-areas:
      "left . right"
      ". down .";
    gap: 6px 4px;
  }

  .touch-move [data-action="left"] {
    grid-area: left;
  }

  .touch-move [data-action="right"] {
    grid-area: right;
  }

  .touch-move [data-action="down"] {
    grid-area: down;
  }

  .touch-act {
    grid-template-columns: repeat(2, var(--size));
    grid-template-areas:
      "ccw cw"
      "hold drop";
  }

  .touch-act [data-action="rotate-ccw"] {
    grid-area: ccw;
  }

  .touch-act [data-action="rotate-cw"] {
    grid-area: cw;
  }

  .touch-hold {
    grid-area: hold;
  }

  .touch-drop {
    grid-area: drop;
  }

  .touch-btn {
    appearance: none;
    width: var(--size);
    height: var(--size);
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    transition: transform 120ms var(--ease-out), background-color 120ms ease;
  }

  .touch-hold {
    font-size: 0.74rem;
  }

  .touch-btn:active {
    transform: scale(0.94);
    background: var(--panel-head);
  }

  .touch-drop {
    background: var(--accent);
    border-color: var(--accent-hover);
    color: #ffffff;
    font-size: 1.02rem;
  }

  .touch-drop:active {
    background: var(--accent-hover);
  }

  .touch-fever {
    display: block;
    justify-self: center;
    align-self: center;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--panel);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .touch-fever:not(:disabled) {
    border-color: var(--gold);
    color: var(--gold);
    animation: fever-ready 900ms var(--ease-in-out) infinite alternate;
  }

  .touch-fever.is-off {
    visibility: hidden;
  }
}

@media (pointer: coarse) and (min-width: 768px) {
  .controls-strip,
  .overlay-hint {
    display: none;
  }

  .touch-controls {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
  }

  .touch-pad {
    --size: 58px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .ctl-btn,
  .primary-btn,
  .text-btn,
  .touch-btn,
  .action-banner,
  .board-overlay,
  .progress-fill,
  .fever-fill,
  .board-status,
  .mode-switch button {
    transition: none;
  }

  .ctl-btn:active:not(:disabled),
  .primary-btn:active,
  .touch-btn:active {
    transform: none;
  }

  .board-wrap.danger::before {
    animation: none;
    opacity: 0.85;
  }

  .board-wrap.is-fever .scanlines,
  .fever.is-ready .fever-track,
  .touch-fever:not(:disabled) {
    animation: none;
  }

  .enter,
  .board-stage.enter {
    animation: fade-in 200ms ease both;
    animation-delay: 0ms;
  }

  .board-wrap.drop-bump,
  .board-wrap.shake,
  .board-wrap.pulse-major::after,
  .tick,
  .level-panel.flash .progress-track,
  .action-banner[data-tier="major"].visible,
  .board-overlay:not(.hidden) .overlay-card,
  .overlay-badge:not([hidden]),
  .share-status:not([hidden]) {
    animation: none;
  }
}

.gesture-hint {
  display: none;
}

@media (max-width: 767px), (pointer: coarse) {
  .touch-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    align-self: center;
    gap: 8px;
  }

  .touch-style {
    appearance: none;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
  }

  .controls-gesture .gesture-hint {
    display: block;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.55;
  }

  .controls-gesture .overlay-hint {
    display: none;
  }

  .controls-gesture .board-wrap {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
  }

  .controls-gesture .touch-move,
  .controls-gesture .touch-act [data-action="rotate-ccw"],
  .controls-gesture .touch-act [data-action="rotate-cw"] {
    display: none;
  }

  .controls-gesture .touch-controls {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .controls-gesture .touch-mid {
    flex-direction: row;
    justify-self: start;
  }

  .controls-gesture .touch-act {
    grid-template-columns: repeat(2, var(--size));
    grid-template-areas: "hold drop";
  }
}

@media (max-width: 767px) {
  .controls-gesture .game-layout {
    grid-template-columns: auto auto;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "board hold"
      "board next";
    align-items: start;
    gap: 6px;
  }

  .controls-gesture .hold-card,
  .controls-gesture .next-card {
    width: 58px;
  }

  .controls-gesture #hold-canvas,
  .controls-gesture #next-canvas-1 {
    width: 50px;
    height: 34px;
  }

  .controls-gesture #next-canvas-2,
  .controls-gesture #next-canvas-3 {
    width: 42px;
    height: 27px;
  }

  .controls-gesture .next-list {
    flex-direction: column;
    gap: 4px;
    padding: 4px;
  }

  .controls-gesture .preview {
    padding: 4px 2px;
  }

  .controls-gesture .board-status {
    height: 32px;
    font-size: 0.62rem;
    line-height: 1.3;
    overflow: hidden;
  }
}


@media (max-width: 767px) {
  .app-shell {
    padding: 6px 8px max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

    .top-bar {
    gap: 6px;
    min-height: 28px;
  }

  .brand-mobile {
    gap: 5px;
  }

  .brand-mark {
    width: 18px;
    height: 12px;
  }

  .brand-zh-mobile {
    font-size: 0.84rem;
    letter-spacing: 0.02em;
  }

  .top-actions {
    gap: 4px;
  }

  .ctl-btn {
    position: relative;
    min-height: 28px;
    padding: 3px 7px;
    gap: 4px;
    border-radius: 6px;
    font-size: 0.7rem;
    line-height: 1;
  }

  .ctl-btn::before {
    content: "";
    position: absolute;
    inset: -8px 0;
  }

  .ctl-dot {
    width: 6px;
    height: 6px;
  }

  .ctl-toggle[aria-pressed="false"] .ctl-dot::after {
    left: -1.5px;
    top: 2.25px;
    width: 9px;
  }

    .mobile-hud {
    grid-template-columns: 1.35fr 0.9fr 0.85fr 0.9fr;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--lit) 14%, transparent);
    overflow: hidden;
  }

  :root[data-theme="light"] .mobile-hud {
    box-shadow: 0 1px 3px rgba(20, 33, 61, 0.06);
  }

  .mobile-stat {
    padding: 3px 4px 4px;
    gap: 1px;
  }

  .mobile-stat .stat-label {
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.15;
    color: var(--muted);
  }

  .mobile-stat .stat-value {
    font-size: 0.86rem;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  .mobile-stat:first-child .stat-value {
    font-size: 0.9rem;
  }

    .cabinet {
    width: 100%;
    padding: 0;
    margin-block: 0;
    isolation: auto;
  }

  .board-stage {
    position: relative;
    z-index: 20;
    gap: 0;
    align-items: center;
  }

    .board-status,
  .controls-gesture .board-status {
    position: absolute;
    top: 8px;
    left: 10px;
    right: 25px;
    z-index: 3;
    width: auto;
    height: 0;
    min-height: 0;
    padding: 0;
    border-width: 0;
    border-radius: 6px;
    font-size: 0.64rem;
    line-height: 1.25;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
  }

  .board-status[data-tone="rune"],
  .board-status[data-tone="fever"],
  .board-status[data-tone="danger"],
  .controls-gesture .board-status[data-tone="rune"],
  .controls-gesture .board-status[data-tone="fever"],
  .controls-gesture .board-status[data-tone="danger"] {
    height: auto;
    min-height: 24px;
    padding: 3px 10px;
    border-width: 1px;
    opacity: 1;
    background: var(--panel);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  }

  :root[data-theme="light"] .board-status[data-tone="rune"],
  :root[data-theme="light"] .board-status[data-tone="fever"],
  :root[data-theme="light"] .board-status[data-tone="danger"] {
    box-shadow: 0 3px 10px rgba(20, 33, 61, 0.14);
  }

  .board-row {
    gap: 5px;
  }

  .board-wrap {
    --frame: 4px;
    border-radius: 7px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  }

  :root[data-theme="light"] .board-wrap:not(.is-fever) {
    border: 1.5px solid var(--board-border);
    box-shadow: 0 6px 16px rgba(20, 33, 61, 0.12);
  }

  .fever {
    width: 10px;
  }

  .fever-track {
    width: 10px;
    border-width: 1px;
    border-radius: 4px;
  }

    .controls-gesture .game-layout {
    width: 100%;
    grid-template-columns: auto 72px;
    grid-template-rows: minmax(0, 1fr) minmax(0, 3fr);
    grid-template-areas:
      "board hold"
      "board next";
    justify-content: center;
    align-items: stretch;
    gap: 8px 7px;
  }

  .controls-gesture .hold-card,
  .controls-gesture .next-card {
    width: 72px;
    min-height: 0;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    overflow: hidden;
  }

  :root[data-theme="light"] .controls-gesture .hold-card,
  :root[data-theme="light"] .controls-gesture .next-card {
    box-shadow: 0 1px 3px rgba(20, 33, 61, 0.06);
  }

  .controls-gesture .hold-card .slot-label,
  .controls-gesture .next-card .slot-label {
    display: block;
    width: 100%;
    padding: 4px 2px 3px;
    background: var(--panel-head);
    border-bottom: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    line-height: 1.1;
    text-align: center;
    color: var(--panel-head-ink);
  }

  .controls-gesture .hold-card .slot-box {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    padding: 6px 4px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .controls-gesture .next-list {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    padding: 5px 4px;
    gap: 5px;
    align-items: stretch;
  }

  .controls-gesture .next-slot {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    padding: 6px 2px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: color-mix(in srgb, var(--ctl-bg) 55%, var(--panel));
  }

  :root[data-theme="light"] .controls-gesture .next-slot {
    background: var(--panel);
  }

  .controls-gesture .next-slot:not(.next-first) {
    opacity: 0.9;
  }

  .controls-gesture .next-first {
    flex: 1.25 1 0;
    padding: 6px 2px;
    border: 1.5px solid var(--board-border);
    background: var(--slot-hi-bg);
    box-shadow: none;
  }

  :root[data-theme="light"] .controls-gesture .next-first {
    border-color: var(--board-border);
    background: var(--slot-hi-bg);
  }

  .controls-gesture .next-index {
    display: block;
    top: 2px;
    left: 4px;
    font-size: 0.54rem;
    line-height: 1;
    opacity: 0.78;
  }

  .controls-gesture #hold-canvas,
  .controls-gesture #next-canvas-1 {
    width: 56px;
    height: 39px;
    max-width: 100%;
  }

  .controls-gesture #next-canvas-2,
  .controls-gesture #next-canvas-3 {
    width: 48px;
    height: 31px;
    max-width: 100%;
  }

    .touch-controls {
    margin-top: auto;
    width: 100%;
  }

  .touch-fever,
  .touch-style {
    position: relative;
    border-radius: 6px;
    background: var(--ctl-bg);
    color: var(--ink);
    white-space: nowrap;
  }

  .touch-fever::before,
  .touch-style::before {
    content: "";
    position: absolute;
    inset: -4px 0;
  }

  .touch-style {
    min-width: 44px;
    min-height: 36px;
    padding: 4px 6px;
    font-size: 0.7rem;
    line-height: 1;
  }

  .touch-fever {
    min-width: 44px;
    min-height: 36px;
    padding: 4px 6px;
    line-height: 1;
  }

  .controls-gesture .touch-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.5fr);
    align-items: stretch;
    gap: 7px;
    width: 100%;
  }

  .controls-gesture .touch-mid,
  .controls-gesture .touch-act {
    display: contents;
  }

  .controls-gesture .touch-fever::before,
  .controls-gesture .touch-style::before {
    content: none;
  }

  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    grid-area: auto;
    justify-self: stretch;
    align-self: stretch;
    width: 100%;
    min-width: 44px;
    height: 46px;
    min-height: 44px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    white-space: nowrap;
    line-height: 1;
    transition: transform 90ms var(--ease-out), background-color 140ms ease, border-color 140ms ease, box-shadow 90ms ease;
  }

  .controls-gesture .touch-fever {
    background: var(--ctl-bg);
    border: 1.5px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 0 color-mix(in srgb, var(--line) 55%, transparent);
  }

  .controls-gesture .touch-fever:disabled {
    opacity: 0.68;
    box-shadow: none;
  }

  .controls-gesture .touch-fever:not(:disabled) {
    opacity: 1;
    border: 1.5px solid var(--gold);
    color: var(--gold);
    background: color-mix(in srgb, var(--gold) 14%, var(--ctl-bg));
    box-shadow: 0 2px 0 color-mix(in srgb, var(--gold) 45%, transparent);
  }

  .controls-gesture .touch-fever:not(:disabled):active {
    transform: translateY(1px);
    box-shadow: none;
  }

  .controls-gesture .touch-style {
    background: var(--ctl-bg);
    border: 1.5px solid var(--line);
    color: var(--ink);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0;
    box-shadow: 0 2px 0 color-mix(in srgb, var(--line) 55%, transparent);
  }

  .controls-gesture .touch-style:active {
    transform: translateY(1px);
    background: var(--ctl-hover);
    box-shadow: none;
  }

  .controls-gesture .touch-hold {
    background: var(--ctl-bg);
    border: 1.5px solid var(--line-strong);
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 0 color-mix(in srgb, var(--line-strong) 45%, transparent);
  }

  .controls-gesture .touch-hold:active {
    transform: translateY(1px);
    background: var(--ctl-hover);
    box-shadow: none;
  }

  .controls-gesture .touch-drop {
    background: var(--accent);
    border: 1.5px solid var(--accent-hover);
    color: #ffffff;
    font-size: 0.94rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 55%, #000000);
  }

  .controls-gesture .touch-drop:active {
    transform: translateY(1px);
    background: var(--accent-hover);
    box-shadow: none;
  }

    .site-footer {
    display: none;
  }
}

@media (max-width: 767px) and (max-height: 620px) {
  .app-shell {
    padding: 4px 8px max(6px, env(safe-area-inset-bottom));
    gap: 5px;
  }

  .top-bar {
    min-height: 26px;
  }

  .ctl-btn {
    min-height: 26px;
    padding: 2px 6px;
  }

  .mobile-stat {
    padding: 2px 3px 3px;
  }

  .mobile-stat .stat-label {
    font-size: 0.56rem;
  }

  .mobile-stat .stat-value,
  .mobile-stat:first-child .stat-value {
    font-size: 0.82rem;
  }

  .controls-gesture .game-layout {
    gap: 6px 7px;
  }

  .controls-gesture .hold-card .slot-label,
  .controls-gesture .next-card .slot-label {
    display: block;
    padding: 3px 2px 2px;
    font-size: 0.56rem;
  }

  .controls-gesture .hold-card .slot-box {
    padding: 4px 3px;
  }

  .controls-gesture .next-list {
    padding: 4px;
    gap: 4px;
  }

  .controls-gesture .next-slot,
  .controls-gesture .next-first {
    padding: 4px 2px;
  }

  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    height: 44px;
  }
}

@media (max-width: 767px) and (max-width: 359px) {
  .app-shell {
    padding-inline: 6px;
  }

  .top-bar {
    gap: 4px;
  }

  .top-actions {
    gap: 3px;
  }

  .ctl-btn {
    padding: 2px 5px;
    gap: 3px;
    font-size: 0.65rem;
  }

  .controls-gesture .game-layout {
    grid-template-columns: auto 64px;
    column-gap: 6px;
  }

  .controls-gesture .hold-card,
  .controls-gesture .next-card {
    width: 64px;
  }

  .controls-gesture .next-list {
    padding: 4px 3px;
  }

  .controls-gesture #hold-canvas,
  .controls-gesture #next-canvas-1 {
    width: 50px;
    height: 35px;
  }

  .controls-gesture #next-canvas-2,
  .controls-gesture #next-canvas-3 {
    width: 42px;
    height: 27px;
  }

  .controls-gesture .touch-controls {
    gap: 6px;
  }

  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    padding: 0 4px;
  }

  .controls-gesture .touch-fever {
    font-size: 0.7rem;
  }

  .controls-gesture .touch-style {
    font-size: 0.72rem;
  }

  .controls-gesture .touch-hold {
    font-size: 0.8rem;
  }

  .controls-gesture .touch-drop {
    font-size: 0.88rem;
  }
}

@media (max-width: 767px) and (max-aspect-ratio: 1/2) {
  .app-shell {
    gap: 10px;
  }

  .mobile-stat {
    padding: 5px 4px;
  }

  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    height: 50px;
  }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    transition: none;
  }

  .controls-gesture .touch-fever:not(:disabled):active,
  .controls-gesture .touch-style:active,
  .controls-gesture .touch-hold:active,
  .controls-gesture .touch-drop:active {
    transform: none;
  }
}

.rotate-hint {
  display: none;
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-hint {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--bg);
  }

  .rotate-card {
    display: grid;
    justify-items: center;
    gap: 6px;
    text-align: center;
  }

  .rotate-phone {
    width: 30px;
    height: 50px;
    margin-bottom: 10px;
    border: 2px solid var(--line-strong);
    border-radius: 6px;
    box-shadow: inset 0 -6px 0 -4px var(--line-strong);
  }

  .rotate-title {
    margin: 0;
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 800;
  }

  .rotate-sub {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
  }

  html,
  body {
    overflow: hidden;
  }
}

@media (min-width: 768px) {
  .board-row::before {
    content: "";
    flex: none;
    width: 34px;
  }

  .board-status {
    margin-left: 44px;
  }
}

@media (max-width: 767px) {
  :root:not(.controls-gesture) .touch-mid .touch-fever,
  :root:not(.controls-gesture) .touch-mid .touch-style {
    min-height: 44px;
  }
}

@media (max-width: 767px) {
  html:root .board-status.board-status[data-tone] {
    transition: opacity 220ms var(--ease-out);
  }

  html:root .board-status.board-status[data-tone]:not(.pop) {
    opacity: 0;
  }
}

@media (min-width: 768px) {
    .cabinet-bezel .bezel-outer {
    filter: drop-shadow(0 0 6px var(--board-glow));
  }

  :root[data-theme="light"] .cabinet-bezel .bezel-outer {
    filter: none;
  }

  .cabinet-marquee {
    position: relative;
    z-index: 1;
    height: 36px;
    margin-bottom: 6px;
    gap: clamp(6px, 0.8vw, 10px);
    transform: translateY(calc(18.94px * var(--layout-zoom, 1) - 32.1px));
  }

  .marquee-title {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding-inline-start: clamp(10px, 1.3vw, 16px);
    padding-inline-end: calc(clamp(10px, 1.3vw, 16px) - 0.14em);
    font-size: clamp(1.5rem, 3.1vw, 2rem);
    line-height: 1;
  }

    .marquee-title::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 8.5px;
    height: 28px;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      transparent 0,
      #0c1a36 3px 11.5px,
      #091227 12.5px 25px,
      transparent 28px
    );
  }

  :root[data-theme="light"] .marquee-title::before {
    background: linear-gradient(
      to bottom,
      transparent 0,
      var(--bg) 3px 11.5px,
      color-mix(in srgb, var(--cabinet) 96%, var(--bg)) 12.5px 25px,
      transparent 28px
    );
  }

  .marquee-title .brand-accent {
    text-shadow: 0 0 8px color-mix(in srgb, var(--lit) 24%, transparent);
  }

  :root[data-theme="light"] .marquee-title .brand-accent {
    text-shadow: none;
  }

  .wing-tag {
    z-index: 1;
    flex: 0 0 auto;
    width: clamp(86px, 10.2vw, 104px);
    min-width: 0;
    height: 26px;
    padding: 0 clamp(10px, 1.25vw, 14px);
    font-size: clamp(0.66rem, 0.9vw, 0.74rem);
    line-height: 1;
  }
}

@media (max-width: 767px) and (min-height: 700px) {
  .app-shell {
    justify-content: space-evenly;
  }

  .touch-controls {
    margin-top: 0;
  }
}

@media (max-width: 767px) and (min-height: 800px) and (max-aspect-ratio: 1/2),
       (max-width: 767px) and (min-height: 830px) {
  .controls-gesture .app-shell {
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    gap: 12px;
  }

  .controls-gesture .top-bar {
    min-height: 32px;
  }

  .controls-gesture .ctl-btn {
    min-height: 32px;
    padding-block: 5px;
  }

  .controls-gesture .ctl-btn::before {
    inset: -6px 0;
  }

  .controls-gesture .mobile-hud {
    border-radius: 8px;
  }

  .controls-gesture .mobile-stat {
    padding: 7px 4px 8px;
    gap: 2px;
  }

  .controls-gesture .mobile-stat .stat-label {
    font-size: 0.62rem;
  }

  .controls-gesture .mobile-stat .stat-value {
    font-size: 0.94rem;
  }

  .controls-gesture .mobile-stat:first-child .stat-value {
    font-size: 1.02rem;
  }

  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    height: 56px;
    border-radius: 10px;
  }

  .controls-gesture .touch-fever:not(:disabled) {
    box-shadow: 0 3px 0 color-mix(in srgb, var(--gold) 45%, transparent);
  }

  .controls-gesture .touch-style {
    box-shadow: 0 3px 0 color-mix(in srgb, var(--line) 55%, transparent);
  }

  .controls-gesture .touch-hold {
    box-shadow: 0 3px 0 color-mix(in srgb, var(--line-strong) 45%, transparent);
  }

  .controls-gesture .touch-drop {
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 55%, #000000);
  }
}

@media (min-width: 360px) and (max-width: 767px) and (min-height: 800px) and (max-aspect-ratio: 1/2),
       (min-width: 360px) and (max-width: 767px) and (min-height: 830px) {
  .controls-gesture .touch-controls {
    gap: 8px;
  }

  .controls-gesture .touch-fever {
    font-size: 0.76rem;
  }

  .controls-gesture .touch-style {
    font-size: 0.78rem;
  }

  .controls-gesture .touch-hold {
    font-size: 0.88rem;
  }

  .controls-gesture .touch-drop {
    font-size: 1rem;
  }
}

@media (max-width: 767px) and (min-height: 880px) {
  .controls-gesture .touch-fever,
  .controls-gesture .touch-style,
  .controls-gesture .touch-hold,
  .controls-gesture .touch-drop {
    height: 60px;
  }
}

.app-shell {
  -webkit-user-select: none;
  user-select: none;
}

.app-shell input,
.app-shell textarea,
.share-status {
  -webkit-user-select: text;
  user-select: text;
}

.controls-list kbd {
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
}

.ctl-toggle[aria-pressed="false"],
.ctl-toggle[aria-pressed="false"] .ctl-state {
  color: color-mix(in srgb, var(--muted) 65%, var(--ink));
}

@media (max-width: 767px), (pointer: coarse) {
  :root:not(.controls-gesture) .touch-mid {
    align-items: stretch;
  }

  :root:not(.controls-gesture) .touch-mid .touch-fever,
  :root:not(.controls-gesture) .touch-mid .touch-style {
    width: 64px;
    padding-inline: 4px;
  }
}

@media (min-width: 768px) and (pointer: coarse) {
  .touch-mid .touch-fever,
  .touch-mid .touch-style {
    min-height: 44px;
  }
}
