:root {
  --bg: #03050c;
  --bg-deep: #010207;
  --text: #eafcff;
  --muted: #8ba3bd;
  --dim: #526b82;
  --faint: #2c4053;
  --cyan: #4df5ff;
  --cyan-soft: #a9fbff;
  --cyan-deep: #0796b5;
  --magenta: #ff5bda;
  --violet: #9a6cff;
  --amber: #ffd166;
  --acid: #f2e600;
  --danger: #ff496c;
  --line: rgba(92, 218, 255, 0.16);
  --line-strong: rgba(92, 232, 255, 0.34);
  --panel: rgba(5, 12, 24, 0.58);
  --panel-deep: rgba(4, 9, 19, 0.84);
  --display: "Bahnschrift", "DIN Alternate", "Segoe UI Variable Display", "Microsoft YaHei", sans-serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SFMono-Regular", monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% 62%, #07152a 0%, #040812 42%, #02040a 74%, #010207 100%);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border: 1px solid rgba(151, 226, 248, 0.22);
  border-bottom-color: rgba(151, 226, 248, 0.12);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(25, 47, 66, 0.6), rgba(6, 15, 27, 0.6));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.07);
  color: #a9c8d8;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
}

::selection {
  color: #021017;
  background: var(--cyan);
}

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.scene canvas:active {
  cursor: grabbing;
}

.ambient-wash {
  position: fixed;
  inset: -10%;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 34%, rgba(24, 186, 218, 0.1), transparent 34%),
    radial-gradient(circle at 84% 64%, rgba(255, 44, 205, 0.07), transparent 38%),
    radial-gradient(circle at 50% 92%, rgba(68, 77, 255, 0.055), transparent 42%);
  filter: blur(34px);
  mix-blend-mode: screen;
  opacity: 0.56;
  will-change: transform, opacity;
  animation: ambientWash 22s ease-in-out infinite alternate;
}

@keyframes ambientWash {
  0% {
    transform: translate3d(-1.5%, 1%, 0) scale(1.02);
    opacity: 0.42;
    filter: blur(34px) hue-rotate(-4deg);
  }
  50% {
    transform: translate3d(1%, -0.5%, 0) scale(1.06);
    opacity: 0.62;
    filter: blur(38px) hue-rotate(3deg);
  }
  100% {
    transform: translate3d(1.8%, -1.2%, 0) scale(1.03);
    opacity: 0.5;
    filter: blur(35px) hue-rotate(8deg);
  }
}

body.danger .ambient-wash {
  opacity: 0.92;
  background:
    radial-gradient(circle at 15% 50%, rgba(255, 33, 76, 0.14), transparent 34%),
    radial-gradient(circle at 82% 40%, rgba(255, 47, 143, 0.1), transparent 40%),
    radial-gradient(circle at 50% 94%, rgba(255, 77, 55, 0.1), transparent 44%);
}

.screen-grain,
.screen-scanlines {
  position: fixed;
  inset: 0;
  z-index: 55;
  pointer-events: none;
}

.screen-grain {
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.screen-scanlines {
  opacity: 0.12;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.34) 3px 4px);
}

.screen-flash {
  position: fixed;
  inset: 0;
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.danger-vignette {
  position: fixed;
  inset: 0;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 52%, transparent 38%, rgba(255, 32, 80, 0.1) 68%, rgba(255, 22, 70, 0.3) 100%);
  box-shadow: inset 0 0 130px rgba(255, 30, 80, 0.4);
  transition: opacity 0.8s ease;
}

body.danger .danger-vignette {
  opacity: 1;
  animation: dangerPulse 1.7s ease-in-out infinite;
}

@keyframes dangerPulse {
  0%, 100% { opacity: 0.52; }
  45% { opacity: 1; }
}

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px clamp(20px, 3.2vw, 54px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(1, 3, 8, 0.9) 0%, rgba(1, 4, 10, 0.44) 54%, transparent 100%);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(242, 230, 0, 0.18) 28%,
    rgba(77, 245, 255, 0.08) 58%,
    rgba(255, 42, 125, 0.15) 78%,
    transparent 100%
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.brand-cube {
  width: 42px;
  height: 42px;
  filter: drop-shadow(0 0 14px rgba(77, 245, 255, 0.34)) drop-shadow(0 0 22px rgba(255, 91, 218, 0.16));
}

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

.eyebrow {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.eyebrow i {
  color: var(--cyan);
  font-style: normal;
  opacity: 0.7;
}

.brand h1 {
  margin: 0;
  color: #f1feff;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.17em;
  text-shadow: 0 0 24px rgba(77, 245, 255, 0.2);
}

.sector-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  color: #607c93;
  font-size: 9px;
  letter-spacing: 0.16em;
  white-space: nowrap;
}

.sector-readout .dim {
  color: #385269;
}

.sector-readout .rule {
  width: 30px;
  height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}

.signal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 8px var(--acid), 0 0 18px rgba(242, 230, 0, 0.55);
  animation: signalBlink 2.6s ease-in-out infinite;
}

@keyframes signalBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.26; }
}

.mono {
  font-family: var(--mono);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.chip-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(117, 207, 232, 0.16);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(13, 28, 43, 0.55), rgba(5, 12, 21, 0.52));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
  color: #7294a9;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.11em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease, transform 0.25s var(--ease);
}

.chip-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chip-btn:hover {
  border-color: rgba(242, 230, 0, 0.46);
  background: rgba(32, 33, 12, 0.6);
  color: var(--acid);
  transform: translateY(-1px);
}

.chip-btn:active {
  transform: translateY(0);
}

.chip-btn b {
  color: #b7eff5;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.chip-btn.is-off {
  color: #4b6578;
}

.chip-btn.is-off b {
  color: #536d7f;
}

.chip-btn.icon-only {
  width: 34px;
  justify-content: center;
  padding: 0;
}

#pauseBtn svg {
  stroke-width: 2.2;
}

body[data-state="intro"] #pauseBtn,
body[data-state="over"] #pauseBtn {
  opacity: 0.36;
  pointer-events: none;
}

/* ---------- stage label ---------- */

.stage-label {
  position: fixed;
  top: 101px;
  left: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateX(-50%);
  color: #4f7087;
  font-size: 8px;
  letter-spacing: 0.18em;
  opacity: 0.8;
  pointer-events: none;
  transition: opacity 0.7s ease;
}

.stage-label b {
  color: var(--cyan);
  font-weight: 500;
}

.stage-line {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(100, 219, 247, 0.32));
}

.stage-line:last-child {
  transform: scaleX(-1);
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  top: 50%;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: opacity 0.7s ease, transform 0.7s var(--ease);
}

.hud-left {
  left: clamp(22px, 3.4vw, 48px);
  width: 450px;
  transform: translateY(-47%);
}

.hud-right {
  right: clamp(22px, 3.1vw, 54px);
  width: 258px;
  transform: translateY(-50%);
}

body[data-state="intro"] .hud,
body[data-state="over"] .hud {
  opacity: 0;
  pointer-events: none;
}

body[data-state="intro"] .hud-left {
  transform: translateY(-47%) translateX(-12px);
}

body[data-state="intro"] .hud-right {
  transform: translateY(-50%) translateX(12px);
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 2px;
  background:
    linear-gradient(140deg, rgba(19, 42, 60, 0.26), transparent 44%),
    linear-gradient(180deg, rgba(6, 15, 28, 0.7), rgba(3, 9, 18, 0.55));
  box-shadow:
    inset 0 1px rgba(171, 247, 255, 0.055),
    0 16px 38px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(13px);
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  pointer-events: none;
  opacity: 0.65;
}

.panel::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
}

.panel::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid rgba(255, 91, 218, 0.55);
  border-bottom: 1px solid rgba(255, 91, 218, 0.55);
}

.score-panel {
  padding: 18px 20px 15px;
  overflow: hidden;
  border-left: 2px solid rgba(242, 230, 0, 0.58);
  background:
    linear-gradient(145deg, rgba(242, 230, 0, 0.055), transparent 34%),
    linear-gradient(140deg, rgba(19, 42, 60, 0.3), transparent 48%),
    linear-gradient(180deg, rgba(6, 15, 28, 0.78), rgba(3, 9, 18, 0.62));
  box-shadow:
    inset 0 1px rgba(171, 247, 255, 0.055),
    inset 0 -3px rgba(242, 230, 0, 0.08),
    0 16px 38px rgba(0, 0, 0, 0.2);
}

.score-panel::before {
  border-color: var(--acid);
}

.score-panel .panel-tag {
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(242, 230, 0, 0.13);
}

.score-hazard {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  opacity: 0.42;
  background: repeating-linear-gradient(
    135deg,
    rgba(242, 230, 0, 0.8) 0 7px,
    transparent 7px 14px
  );
  pointer-events: none;
}

.score-panel::after {
  width: 86px;
  height: 86px;
  top: auto;
  right: -42px;
  bottom: -46px;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(77, 245, 255, 0.13), transparent 68%);
  filter: blur(6px);
  animation: scoreAura 7s ease-in-out infinite;
}

@keyframes scoreAura {
  0%, 100% { opacity: 0.5; transform: scale(0.94); }
  50% { opacity: 0.95; transform: scale(1.08); }
}

.panel-tag {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7894a9;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.panel-tag .cn {
  color: #435d72;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.type-label {
  margin-left: auto;
  color: #4b6a7d;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  white-space: nowrap;
  text-shadow: 0 0 10px currentColor;
  transition: color 0.35s ease;
}

.tiny-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.score-value {
  --score-base: 168px;
  --score-font-scale: 1;
  --type-accent: #4df5ff;
  margin: 8px 0 7px;
  color: #f4ffe8;
  font-family: var(--display);
  font-size: calc(var(--score-base) * var(--score-font-scale));
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow:
    0.018em 0 0 rgba(255, 42, 77, 0.38),
    -0.018em 0 0 rgba(0, 240, 255, 0.32),
    0 0 30px color-mix(in srgb, var(--type-accent) 39%, transparent);
  transition: color 0.2s ease, text-shadow 0.35s ease, transform 0.2s var(--ease);
}

.score-value > span {
  display: inline-block;
  white-space: nowrap;
  transform-origin: left center;
  transition: transform 0.25s var(--ease);
}

.score-value.bump {
  animation: scoreBump 0.38s var(--ease);
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  35% {
    transform: scale(1.055);
    color: #fff;
    text-shadow: 0 0 34px rgba(77, 245, 255, 0.75);
    text-shadow: 0 0 38px color-mix(in srgb, var(--type-accent) 75%, transparent);
  }
  100% { transform: scale(1); }
}

#scoreDisplay.type-shift,
#mobileScore.type-shift {
  animation: typeShift 0.72s var(--ease);
}

@keyframes typeShift {
  0% { opacity: 1; filter: blur(0); transform: scale(1); }
  18% { opacity: 0.25; filter: blur(4px); transform: scale(1.045); }
  48% { opacity: 1; filter: blur(0); transform: scale(1.018); }
  100% { opacity: 1; filter: blur(0); transform: scale(1); }
}

.score-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid rgba(91, 190, 218, 0.11);
  color: #4b687c;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.13em;
}

.score-foot b {
  color: #8fc4cf;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.mini-panel {
  padding: 13px 15px 12px;
}

.mini-panel span {
  display: block;
  color: #638196;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.mini-panel strong {
  display: inline-block;
  margin-top: 5px;
  color: #d9f8fc;
  font-family: var(--display);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.mini-panel small {
  margin-left: 6px;
  color: #3e5a6e;
  font-size: 9px;
}

.combo-panel {
  padding: 10px 13px 11px;
  opacity: 0.44;
  transition: opacity 0.35s ease, border-color 0.35s ease;
}

.combo-panel.is-active {
  opacity: 1;
  border-color: rgba(255, 91, 218, 0.28);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 0 30px rgba(255, 91, 218, 0.08);
}

.combo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7a8fa3;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.combo-head b {
  color: var(--magenta);
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-shadow: 0 0 15px rgba(255, 91, 218, 0.5);
}

.combo-track {
  height: 2px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(108, 166, 189, 0.13);
}

.combo-track i {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--magenta));
  box-shadow: 0 0 10px rgba(255, 91, 218, 0.7);
  transition: width 0.32s var(--ease);
}

.b2b-badge {
  display: none;
  margin-top: 7px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.combo-panel.has-b2b .b2b-badge {
  display: block;
  animation: badgeIn 0.4s var(--ease);
}

@keyframes badgeIn {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}

.danger-indicator {
  display: none;
  align-items: center;
  gap: 7px;
  padding: 8px 0 2px;
  color: #ff8398;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 73, 108, 0.65);
}

body.danger .danger-indicator {
  display: flex;
  animation: dangerText 1.2s step-end infinite;
}

.danger-stripe {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 73, 108, 0.55));
}

.danger-stripe:last-child {
  transform: scaleX(-1);
}

@keyframes dangerText {
  0%, 100% { opacity: 1; }
  52% { opacity: 0.38; }
}

/* right panels */

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7d99ae;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.18em;
}

.panel-heading em {
  margin-left: 5px;
  color: #3e586c;
  font-family: var(--sans);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.08em;
}

.panel-heading kbd {
  border-color: rgba(126, 199, 219, 0.15);
  background: rgba(14, 28, 42, 0.4);
  color: #607e91;
}

.hold-panel {
  padding: 12px 14px 14px;
}

.preview-hold {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  margin-top: 8px;
  border-top: 1px solid rgba(100, 188, 216, 0.08);
  background:
    linear-gradient(90deg, transparent 49.7%, rgba(94, 176, 201, 0.055) 50%, transparent 50.3%),
    linear-gradient(0deg, transparent 49.7%, rgba(94, 176, 201, 0.055) 50%, transparent 50.3%);
}

.preview-hold.is-empty {
  border: 1px dashed rgba(108, 177, 198, 0.14);
  border-top: 1px solid rgba(100, 188, 216, 0.08);
}

.empty-preview {
  color: #304a5d;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.22em;
}

.preview-hold .mini-piece {
  --u: 19px;
}

.next-panel {
  padding: 12px 14px 11px;
}

.queue-count {
  color: #4d6d82;
  font-size: 8px;
}

.next-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 7px;
}

.next-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  border-top: 1px solid rgba(95, 183, 210, 0.08);
  overflow: hidden;
}

.next-slot:first-child {
  height: 78px;
  background: radial-gradient(ellipse at 50% 50%, rgba(55, 190, 220, 0.08), transparent 66%);
}

.next-slot .sheet-index {
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  color: #2f485b;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  writing-mode: vertical-rl;
}

.next-slot:first-child .sheet-index {
  color: #5d93a7;
}

.next-list .mini-piece {
  --u: 15px;
}

.mini-piece {
  --u: 16px;
  --gap: 3px;
  display: grid;
  grid-template-columns: repeat(var(--w), var(--u));
  grid-template-rows: repeat(var(--h), var(--u));
  gap: var(--gap);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--c) 55%, transparent));
}

.mini-piece i {
  position: relative;
  display: block;
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), transparent 38%),
    linear-gradient(315deg, rgba(0, 0, 0, 0.34), transparent 58%),
    var(--c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 0 9px color-mix(in srgb, var(--c) 48%, transparent);
}

.mini-piece i::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1px;
}

.keys-panel {
  padding: 12px 14px 13px;
}

.key-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 9px;
  margin-top: 11px;
}

.key-grid span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #648194;
  font-size: 8px;
  letter-spacing: 0.02em;
}

.key-grid span i {
  margin-left: 3px;
  color: #4a6578;
  font-style: normal;
  white-space: nowrap;
}

.key-grid kbd.wide {
  min-width: 47px;
}

.orbit-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(103, 185, 208, 0.08);
  color: #3f5c70;
  font-size: 8px;
  letter-spacing: 0.03em;
}

.mouse-icon {
  position: relative;
  width: 10px;
  height: 14px;
  border: 1px solid #456174;
  border-radius: 5px;
}

.mouse-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 1px;
  height: 4px;
  transform: translateX(-50%);
  background: #5e879b;
}

/* ---------- mobile stats / touch ---------- */

.mobile-strip {
  display: none;
}

.touch-controls {
  display: none;
}

/* ---------- flash / toast / ribbon ---------- */

.flash-layer {
  position: fixed;
  left: 50%;
  top: 30%;
  z-index: 24;
  width: min(760px, 90vw);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  opacity: 0;
}

.flash-layer.show {
  animation: flashBurst 1.45s var(--ease) forwards;
}

.flash-title {
  color: #fff;
  font-family: var(--display);
  font-size: clamp(34px, 4.7vw, 67px);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.075em;
  text-shadow:
    0 0 10px color-mix(in srgb, var(--flash-color, #4df5ff) 85%, transparent),
    0 0 44px color-mix(in srgb, var(--flash-color, #4df5ff) 64%, transparent),
    0 2px 0 rgba(0, 0, 0, 0.55);
}

.flash-sub {
  margin-top: 12px;
  color: var(--flash-color, #bffcff);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow: 0 0 16px color-mix(in srgb, var(--flash-color, #4df5ff) 55%, transparent);
}

@keyframes flashBurst {
  0% { opacity: 0; transform: translateX(-50%) translateY(18px) scale(0.92); filter: blur(5px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.015); filter: blur(0); }
  22% { transform: translateX(-50%) translateY(0) scale(1); }
  74% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(1.025); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  z-index: 35;
  padding: 8px 14px;
  transform: translate(-50%, 8px);
  border: 1px solid rgba(110, 216, 239, 0.22);
  border-radius: 2px;
  background: rgba(4, 12, 22, 0.78);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35), inset 0 1px rgba(255, 255, 255, 0.05);
  color: #a7d7e0;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  transition: opacity 0.25s ease, transform 0.25s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bottom-ribbon {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 32px;
  padding: 0 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(97, 192, 217, 0.1);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(5, 14, 25, 0.54), rgba(3, 9, 17, 0.4));
  color: #486376;
  font-size: 8px;
  letter-spacing: 0.1em;
  backdrop-filter: blur(12px);
  transition: opacity 0.5s ease, transform 0.5s var(--ease);
}

.bottom-ribbon > i {
  width: 1px;
  height: 10px;
  background: rgba(103, 179, 201, 0.14);
}

.ribbon-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ribbon-item .mono {
  color: #3f5b6e;
  font-size: 7px;
  letter-spacing: 0.15em;
}

.ribbon-item kbd {
  height: 17px;
  min-width: 17px;
  font-size: 8px;
}

.ribbon-live {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 2px;
  color: #5c8497;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.14em;
}

.ribbon-live span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #58f6b1;
  box-shadow: 0 0 7px #58f6b1;
  animation: signalBlink 2s ease-in-out infinite;
}

body[data-state="intro"] .bottom-ribbon,
body[data-state="over"] .bottom-ribbon {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
  pointer-events: none;
}

/* ---------- overlay shells ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* intro */

.intro-overlay {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(4, 12, 24, 0.1) 0%, rgba(2, 6, 13, 0.35) 48%, rgba(1, 3, 8, 0.82) 100%),
    linear-gradient(90deg, rgba(1, 4, 10, 0.72) 0%, transparent 24%, transparent 76%, rgba(1, 4, 10, 0.55) 100%);
}

.intro-glow {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 720px;
  height: 560px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(31, 155, 180, 0.15), transparent 62%),
    radial-gradient(ellipse at 38% 42%, rgba(110, 63, 210, 0.08), transparent 64%);
  filter: blur(30px);
  pointer-events: none;
  will-change: transform, opacity;
  animation: introBreathe 9s ease-in-out infinite alternate;
}

@keyframes introBreathe {
  0% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 0.57;
    filter: blur(30px) hue-rotate(-5deg);
  }
  55% {
    transform: translate(-50%, -52%) scale(1.04);
    opacity: 0.9;
    filter: blur(36px) hue-rotate(4deg);
  }
  100% {
    transform: translate(-50%, -48%) scale(1.08);
    opacity: 0.68;
    filter: blur(33px) hue-rotate(10deg);
  }
}

.intro-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(760px, 90vw);
  margin-top: -3vh;
  text-align: center;
  animation: introRise 1.1s var(--ease) both;
}

.intro-content::before {
  content: "";
  position: absolute;
  inset: -70px -110px -60px;
  z-index: -1;
  background: radial-gradient(ellipse at 50% 43%, rgba(2, 6, 14, 0.62) 0%, rgba(2, 6, 14, 0.28) 46%, transparent 74%);
  filter: blur(18px);
  pointer-events: none;
}

@keyframes introRise {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-kicker {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #7495a9;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.25em;
}

.intro-kicker span {
  width: 35px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(104, 220, 246, 0.46));
}

.intro-kicker span:last-child {
  transform: scaleX(-1);
}

.intro-title-wrap {
  position: relative;
  margin-top: 23px;
  padding: 5px 0;
}

.intro-ghost-title {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  color: rgba(185, 246, 255, 0.04);
  font-family: var(--display);
  font-size: clamp(92px, 13vw, 176px);
  font-weight: 800;
  line-height: 0.8;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}

.intro-title-wrap h2 {
  position: relative;
  margin: 0;
  color: #f2feff;
  font-family: var(--display);
  font-size: clamp(68px, 8.8vw, 126px);
  font-weight: 750;
  line-height: 0.9;
  letter-spacing: 0.09em;
  text-shadow:
    0 0 20px rgba(184, 252, 255, 0.18),
    0 0 90px rgba(68, 225, 255, 0.17),
    0 6px 30px rgba(0, 0, 0, 0.4);
}

.intro-title-wrap h2 span {
  color: var(--cyan);
  background: linear-gradient(180deg, #d8feff 0%, #62f5ff 38%, #1ac4dd 78%, #0c7a9c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 25px rgba(77, 245, 255, 0.32));
  animation: titlePulse 6.5s ease-in-out infinite;
}

@keyframes titlePulse {
  0%, 100% {
    filter: drop-shadow(0 0 20px rgba(77, 245, 255, 0.24));
  }
  48% {
    filter: drop-shadow(0 0 38px rgba(77, 245, 255, 0.48)) drop-shadow(0 0 64px rgba(255, 91, 218, 0.12));
  }
}

.intro-en {
  margin-top: 17px;
  color: #7ca3b6;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.48em;
  text-indent: 0.48em;
}

.intro-en b {
  display: inline-block;
  margin-left: 9px;
  padding: 3px 5px;
  border: 1px solid rgba(255, 91, 218, 0.3);
  color: var(--magenta);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-indent: 0;
  vertical-align: 2px;
  box-shadow: 0 0 16px rgba(255, 91, 218, 0.1);
}

.intro-genre {
  margin-top: 10px;
  color: #658a9f;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
}

.intro-lead {
  margin: 32px 0 0;
  color: #9bb6c6;
  font-size: 14px;
  font-weight: 300;
  line-height: 2.05;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.intro-start {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 31px;
}

.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-width: 214px;
  height: 54px;
  padding: 0 26px;
  overflow: hidden;
  border: 1px solid rgba(123, 247, 255, 0.58);
  border-radius: 2px;
  background:
    linear-gradient(110deg, rgba(31, 232, 255, 0.16), rgba(12, 79, 99, 0.06) 55%, rgba(255, 91, 218, 0.1)),
    rgba(4, 17, 27, 0.8);
  box-shadow:
    0 0 0 1px rgba(5, 26, 36, 0.8),
    0 0 30px rgba(40, 223, 249, 0.12),
    inset 0 0 24px rgba(55, 236, 255, 0.08);
  color: #e9ffff;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.17em;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-110%);
  background: linear-gradient(100deg, transparent 24%, rgba(216, 255, 255, 0.22) 48%, transparent 70%);
  transition: transform 0.65s var(--ease);
}

.btn-primary:hover {
  border-color: var(--cyan);
  background:
    linear-gradient(110deg, rgba(31, 232, 255, 0.26), rgba(12, 79, 99, 0.08) 55%, rgba(255, 91, 218, 0.16)),
    rgba(5, 23, 35, 0.9);
  box-shadow:
    0 0 0 1px rgba(30, 97, 117, 0.6),
    0 0 46px rgba(50, 231, 255, 0.22),
    inset 0 0 28px rgba(55, 236, 255, 0.14);
  transform: translateY(-2px);
}

.btn-primary:hover::before {
  transform: translateX(110%);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--cyan-soft);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.press-enter {
  color: #517185;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.11em;
}

.press-enter kbd {
  margin: 0 2px;
}

.intro-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 32px;
  color: #5f7c8f;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.intro-controls span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.intro-controls kbd {
  margin-right: 3px;
}

.intro-mobile-hint {
  display: none;
}

.intro-side {
  position: absolute;
  right: clamp(34px, 5vw, 88px);
  top: 50%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 18px;
  transform: translateY(-50%);
  color: #3f6174;
}

.side-index {
  color: rgba(126, 232, 247, 0.22);
  font-family: var(--display);
  font-size: 86px;
  font-weight: 600;
  line-height: 0.8;
  letter-spacing: -0.03em;
}

.side-rule {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(105, 224, 247, 0.28));
}

.side-copy {
  font-family: var(--mono);
  font-size: 7px;
  line-height: 2;
  letter-spacing: 0.14em;
  text-align: right;
}

.intro-footer {
  position: absolute;
  left: clamp(20px, 3.2vw, 54px);
  right: clamp(20px, 3.2vw, 54px);
  bottom: 25px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #314b5d;
  font-size: 7px;
  letter-spacing: 0.13em;
}

/* pause */

.pause-overlay {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(4, 12, 23, 0.35), rgba(1, 4, 10, 0.78)),
    rgba(2, 6, 13, 0.32);
  backdrop-filter: blur(9px);
}

.pause-card,
.result-card {
  position: relative;
  width: min(430px, 90vw);
  padding: 38px 42px 32px;
  border: 1px solid rgba(104, 221, 246, 0.22);
  background:
    linear-gradient(145deg, rgba(23, 55, 72, 0.22), transparent 50%),
    rgba(4, 11, 21, 0.88);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px rgba(175, 253, 255, 0.06);
  text-align: center;
  backdrop-filter: blur(20px);
}

.pause-card::before,
.pause-card::after,
.result-card::before,
.result-card::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.pause-card::before,
.result-card::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid var(--cyan);
  border-left: 1px solid var(--cyan);
}

.pause-card::after,
.result-card::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid rgba(255, 91, 218, 0.7);
  border-bottom: 1px solid rgba(255, 91, 218, 0.7);
}

.pause-card .eyebrow,
.result-card .eyebrow {
  color: #60859a;
  font-size: 8px;
  letter-spacing: 0.24em;
}

.pause-card h2,
.result-card h2 {
  margin: 15px 0 0;
  color: #f1feff;
  font-family: var(--display);
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.1em;
  text-shadow: 0 0 36px rgba(77, 245, 255, 0.2);
}

.pause-card p {
  margin: 14px 0 26px;
  color: #748fa2;
  font-size: 11px;
  letter-spacing: 0.1em;
}

.pause-card .btn-primary {
  min-width: 190px;
  height: 48px;
  font-size: 13px;
}

.pause-card .press-enter {
  display: block;
  margin-top: 17px;
}

/* game over */

.gameover-overlay {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(43, 6, 25, 0.22), rgba(2, 4, 10, 0.82)),
    rgba(2, 4, 10, 0.42);
  backdrop-filter: blur(8px);
}

.result-card {
  width: min(472px, 91vw);
  padding: 32px 38px 30px;
  border-color: rgba(255, 111, 170, 0.2);
}

.result-card::before {
  border-color: var(--magenta);
}

.result-topline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #b16a86;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.24em;
}

.result-topline span {
  width: 44px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 91, 218, 0.4));
}

.result-topline span:last-child {
  transform: scaleX(-1);
}

.result-card h2 {
  margin-top: 18px;
  font-size: 52px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 40px rgba(255, 91, 218, 0.18);
}

.result-lead {
  margin: 13px 0 0;
  color: #8399ab;
  font-size: 11px;
  letter-spacing: 0.07em;
}

.result-lead b {
  color: var(--magenta);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.new-best {
  display: none;
  width: fit-content;
  margin: 15px auto 0;
  padding: 5px 10px;
  border: 1px solid rgba(255, 209, 102, 0.35);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.18em;
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.08);
}

.new-best.show {
  display: block;
  animation: badgeIn 0.5s var(--ease);
}

.result-stats {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 1px;
  margin: 24px 0 25px;
  border: 1px solid rgba(111, 194, 220, 0.12);
  background: rgba(87, 157, 183, 0.12);
}

.result-stats div {
  padding: 14px 10px 12px;
  background: rgba(4, 11, 20, 0.82);
}

.result-stats span {
  display: block;
  color: #546f83;
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.result-stats strong {
  display: block;
  margin-top: 7px;
  color: #eafcff;
  font-family: var(--display);
  font-size: 23px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.result-stats div:first-child strong {
  color: var(--cyan-soft);
  font-size: 28px;
  text-shadow: 0 0 24px rgba(77, 245, 255, 0.28);
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.result-actions .btn-primary {
  width: 214px;
  height: 50px;
  font-size: 13px;
}

.btn-ghost {
  width: 214px;
  padding: 10px 12px;
  border: 1px solid rgba(111, 177, 199, 0.2);
  border-radius: 2px;
  background: rgba(8, 20, 32, 0.4);
  color: #809daf;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-ghost:hover {
  border-color: rgba(111, 220, 241, 0.42);
  background: rgba(14, 38, 51, 0.6);
  color: #c9f6fb;
}

.result-card .press-enter {
  display: block;
  margin-top: 16px;
}

.error-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 5, 11, 0.94);
  text-align: center;
}

.error-overlay[hidden] {
  display: none;
}

.error-overlay strong {
  color: #ffb1c2;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.error-overlay p {
  max-width: 420px;
  color: #6f899b;
  font-size: 12px;
  line-height: 1.9;
}

/* focus */

button:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 3px;
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .hud-left {
    width: 400px;
  }

  .hud-right {
    width: 232px;
  }

  .score-value {
    --score-base: 136px;
  }

  .next-slot {
    height: 63px;
  }

  .next-slot:first-child {
    height: 70px;
  }

  .intro-side {
    display: none;
  }
}

@media (max-width: 1040px) {
  .hud-left {
    width: 330px;
  }

  .hud-right {
    width: 210px;
  }

  .score-value {
    --score-base: 108px;
  }

  .keys-panel {
    display: none;
  }

  .next-slot {
    height: 60px;
  }

  .next-slot:first-child {
    height: 66px;
  }

  .bottom-ribbon {
    gap: 9px;
  }

  .ribbon-item .mono {
    display: none;
  }
}

@media (max-height: 820px) and (min-width: 901px) {
  .keys-panel {
    display: none;
  }

  .hud {
    gap: 7px;
  }

  .score-panel {
    padding-top: 13px;
  }

  .score-value {
    margin-top: 6px;
  }

  .preview-hold {
    min-height: 68px;
  }

  .next-slot {
    height: 57px;
  }

  .next-slot:first-child {
    height: 62px;
  }

  .intro-lead {
    margin-top: 24px;
  }

  .intro-start {
    margin-top: 24px;
  }
}

@media (max-width: 900px) {
  body {
    background: radial-gradient(ellipse at 50% 48%, #07172b 0%, #030711 55%, #010206 100%);
  }

  .topbar {
    padding: 14px 16px;
    align-items: center;
  }

  .brand {
    gap: 9px;
  }

  .brand-cube {
    width: 33px;
    height: 33px;
  }

  .brand h1 {
    font-size: 19px;
    letter-spacing: 0.13em;
  }

  .brand .eyebrow {
    font-size: 6.5px;
    letter-spacing: 0.17em;
  }

  .sector-readout {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .chip-btn {
    height: 32px;
    padding: 0 9px;
    font-size: 7px;
  }

  .chip-btn .chip-label {
    display: none;
  }

  .chip-btn b {
    display: none;
  }

  .chip-btn.icon-only {
    width: 32px;
  }

  .hud,
  .stage-label,
  .bottom-ribbon {
    display: none;
  }

  .mobile-strip {
    position: fixed;
    top: 68px;
    left: 14px;
    right: 14px;
    z-index: 16;
    display: grid;
    grid-template-columns: 1.4fr 0.6fr 0.6fr 0.95fr;
    gap: 1px;
    border: 1px solid rgba(98, 200, 226, 0.13);
    background: rgba(84, 157, 184, 0.1);
    backdrop-filter: blur(14px);
    transition: opacity 0.6s ease;
  }

  .mobile-strip > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
    background: rgba(4, 12, 22, 0.7);
  }

  .mobile-strip span {
    color: #4d6f83;
    font-family: var(--mono);
    font-size: 6px;
    letter-spacing: 0.13em;
  }

  .mobile-strip b {
    color: #dbfbff;
    font-family: var(--display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.05em;
    font-variant-numeric: tabular-nums;
  }

  .mobile-strip > div:first-child b {
    color: var(--cyan-soft);
    font-size: calc(22px * var(--score-font-scale, 1) * var(--score-length-scale, 1));
  }

  .mobile-strip > div.mobile-next {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 4px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .mobile-next-list {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 19px;
  }

  .mobile-next-list .mini-piece {
    --u: 6px;
    --gap: 2px;
  }

  body[data-state="intro"] .mobile-strip,
  body[data-state="over"] .mobile-strip {
    opacity: 0;
  }

  .touch-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    z-index: 25;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 14px;
    pointer-events: none;
    transition: opacity 0.45s ease;
  }

  body[data-state="intro"] .touch-controls,
  body[data-state="over"] .touch-controls,
  body[data-state="paused"] .touch-controls {
    opacity: 0;
    pointer-events: none;
  }

  .touch-side {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    pointer-events: auto;
  }

  .touch-side.center {
    gap: 7px;
  }

  .touch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 55px;
    height: 55px;
    padding: 0;
    border: 1px solid rgba(119, 219, 242, 0.22);
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(13, 32, 48, 0.72), rgba(4, 11, 21, 0.76));
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.07), 0 8px 24px rgba(0, 0, 0, 0.22);
    color: #8dc7d6;
    cursor: pointer;
    backdrop-filter: blur(12px);
    touch-action: none;
  }

  .touch-btn svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .touch-btn:active,
  .touch-btn.is-pressed {
    border-color: rgba(125, 251, 255, 0.74);
    background: rgba(23, 79, 93, 0.82);
    color: #e8ffff;
    transform: scale(0.94);
  }

  .touch-btn.small {
    width: 45px;
    height: 44px;
    border-radius: 3px;
    font-family: var(--mono);
    font-size: 7px;
    letter-spacing: 0.08em;
  }

  .touch-btn .mini-piece {
    --u: 6px;
    --gap: 2px;
  }

  .touch-btn .mini-piece i::after {
    inset: 1px;
  }

  .touch-btn.rotate {
    border-color: rgba(255, 112, 224, 0.24);
    color: #e5a4d9;
  }

  .touch-btn.drop {
    border-color: rgba(255, 91, 218, 0.45);
    background: linear-gradient(180deg, rgba(92, 21, 80, 0.65), rgba(20, 6, 19, 0.8));
    color: #ffd0f4;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 0 24px rgba(255, 91, 218, 0.12);
  }

  .flash-layer {
    top: 27%;
  }

  .flash-sub {
    font-size: 8px;
    letter-spacing: 0.15em;
  }

  .toast {
    bottom: 88px;
  }

  .intro-overlay {
    background:
      radial-gradient(ellipse at 50% 40%, rgba(5, 14, 27, 0.16) 0%, rgba(2, 6, 13, 0.52) 57%, rgba(1, 3, 8, 0.9) 100%);
    padding: 28px 0;
  }

  .intro-glow {
    width: 92vw;
    height: 58vh;
  }

  .intro-content {
    width: min(540px, 90vw);
    margin-top: 3vh;
  }

  .intro-kicker {
    gap: 9px;
    font-size: 6.5px;
    letter-spacing: 0.16em;
  }

  .intro-kicker span {
    width: 20px;
  }

  .intro-title-wrap {
    margin-top: 18px;
  }

  .intro-title-wrap h2 {
    font-size: clamp(62px, 16vw, 88px);
    letter-spacing: 0.06em;
  }

  .intro-en {
    margin-top: 13px;
    font-size: 9px;
    letter-spacing: 0.36em;
    text-indent: 0.36em;
  }

  .intro-ghost-title {
    display: none;
  }

  .intro-lead {
    margin-top: 23px;
    font-size: 12px;
    line-height: 1.9;
    letter-spacing: 0.08em;
  }

  .intro-start {
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
  }

  .btn-primary {
    min-width: 200px;
    height: 49px;
    font-size: 13px;
  }

  .intro-controls {
    display: none;
  }

  .intro-mobile-hint {
    display: block;
    margin-top: 22px;
    color: #4c6c80;
    font-family: var(--mono);
    font-size: 7px;
    letter-spacing: 0.13em;
  }

  .intro-start .press-enter,
  .pause-card .press-enter,
  .result-card .press-enter {
    display: none;
  }

  .intro-footer {
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: none;
  }

  .pause-card,
  .result-card {
    padding: 30px 24px 27px;
  }

  .pause-card h2 {
    font-size: 34px;
  }

  .result-card h2 {
    font-size: 43px;
  }

  .result-stats strong {
    font-size: 19px;
  }

  .result-stats div:first-child strong {
    font-size: 23px;
  }

  .screen-scanlines {
    opacity: 0.08;
  }

  .ambient-wash {
    animation: none;
    opacity: 0.44;
    filter: blur(24px);
  }
}

@media (max-width: 420px) {
  .brand .eyebrow {
    display: none;
  }

  .brand h1 {
    font-size: 18px;
  }

  .top-actions {
    gap: 4px;
  }

  .chip-btn {
    width: 31px;
    padding: 0;
    justify-content: center;
  }

  .chip-btn b {
    display: none;
  }

  .mobile-strip {
    left: 10px;
    right: 10px;
  }

  .mobile-strip > div {
    padding: 8px 9px;
  }

  .mobile-strip span {
    font-size: 5.5px;
  }

  .mobile-strip b {
    font-size: 13px;
  }

  .mobile-strip > div:first-child b {
    font-size: calc(21px * var(--score-font-scale, 1) * var(--score-length-scale, 1));
  }

  .touch-controls {
    padding: 0 10px;
  }

  .touch-btn {
    width: 51px;
    height: 51px;
  }

  .touch-btn.small {
    width: 42px;
    height: 41px;
  }

  .touch-side {
    gap: 7px;
  }

  .intro-title-wrap h2 {
    font-size: 58px;
  }

  .intro-lead {
    font-size: 11px;
  }

  .intro-controls {
    gap: 9px;
  }

  .result-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  .result-stats strong {
    font-size: 17px;
  }

  .result-stats div:first-child strong {
    font-size: 21px;
  }
}

@media (max-height: 620px) and (max-width: 900px) {
  .intro-lead,
  .intro-controls {
    display: none;
  }

  .intro-start {
    margin-top: 20px;
  }

  .intro-title-wrap h2 {
    font-size: 52px;
  }

  .intro-title-wrap {
    margin-top: 12px;
  }

  .mobile-strip {
    top: 62px;
  }

  .touch-btn {
    width: 47px;
    height: 47px;
  }

  .touch-btn.small {
    width: 38px;
    height: 37px;
  }
}

@media (max-width: 900px) and (max-height: 540px) and (orientation: landscape) {
  .topbar {
    padding: 9px 13px;
  }

  .brand-cube {
    width: 29px;
    height: 29px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .brand .eyebrow {
    display: none;
  }

  .chip-btn {
    height: 30px;
  }

  .chip-btn.icon-only {
    width: 30px;
  }

  .mobile-strip {
    top: 52px;
    left: 12px;
    right: auto;
    width: 132px;
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

  .mobile-strip > div {
    justify-content: space-between;
    padding: 5px 8px;
    min-height: 22px;
  }

  .mobile-strip span {
    font-size: 5.5px;
    letter-spacing: 0.1em;
  }

  .mobile-strip b {
    font-size: 11px;
  }

  .mobile-strip > div:first-child b {
    font-size: calc(18px * var(--score-font-scale, 1) * var(--score-length-scale, 1));
  }

  .mobile-strip > div.mobile-next {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  .mobile-next-list {
    height: 14px;
  }

  .mobile-next-list .mini-piece {
    --u: 4px;
    --gap: 2px;
  }

  .touch-controls {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 0 10px;
  }

  .touch-side {
    gap: 7px;
  }

  .touch-btn {
    width: 48px;
    height: 48px;
  }

  .touch-btn.small {
    width: 40px;
    height: 39px;
  }

  .touch-btn svg {
    width: 21px;
    height: 21px;
  }

  .toast {
    bottom: 66px;
  }

  .flash-layer {
    top: 24%;
  }

  .pause-card,
  .result-card {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }

  .pause-card {
    padding: 18px 28px 16px;
    width: min(520px, 86vw);
  }

  .pause-card h2 {
    font-size: 30px;
    margin-top: 8px;
  }

  .pause-card p {
    margin: 8px 0 14px;
  }

  .pause-card .btn-primary {
    height: 38px;
  }

  .result-card {
    width: min(690px, 88vw);
    padding: 14px 28px 13px;
  }

  .result-card h2 {
    font-size: 33px;
    margin-top: 8px;
  }

  .result-topline {
    font-size: 7px;
  }

  .result-lead {
    display: none;
  }

  .new-best {
    margin-top: 6px;
    padding: 3px 8px;
  }

  .result-stats {
    margin: 10px 0 10px;
  }

  .result-stats div {
    padding: 8px 8px 6px;
  }

  .result-stats strong {
    margin-top: 3px;
    font-size: 18px;
  }

  .result-stats div:first-child strong {
    font-size: 22px;
  }

  .result-actions {
    flex-direction: row;
    justify-content: center;
    gap: 10px;
  }

  .result-actions .btn-primary {
    width: 180px;
    height: 39px;
  }

  .btn-ghost {
    width: 150px;
    padding: 9px 12px;
  }

  .result-card .press-enter {
    display: none;
  }

  .intro-content {
    margin-top: 0;
  }

  .intro-kicker,
  .intro-start .press-enter,
  .intro-mobile-hint {
    display: none;
  }

  .intro-title-wrap {
    margin-top: 0;
  }

  .intro-title-wrap h2 {
    font-size: 47px;
  }

  .intro-en {
    margin-top: 8px;
  }

  .intro-genre {
    margin-top: 6px;
    font-size: 8px;
  }

  .intro-start {
    margin-top: 15px;
  }

  .btn-primary {
    height: 43px;
  }

  .intro-glow {
    height: 80vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
