:root {
  color-scheme: dark;
  --bg: #090d14;
  --panel: #10151f;
  --muted: #737d90;
  --text: #edf3f6;
  --mint: #b6f86c;
  --cyan: #64e5e2;
  --red: #ff647c;
  --line: #222a36;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
button {
  transition:
    background 0.2s,
    transform 0.2s,
    border-color 0.2s;
}
button:hover:not(:disabled) {
  filter: brightness(1.13);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 5px;
}
button:disabled {
  opacity: 0.3;
  cursor: default;
}
a {
  color: inherit;
  text-decoration: none;
}
.ambient {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.055;
}
.ambient-one {
  background: #66f2c6;
  width: 500px;
  height: 500px;
  top: 120px;
  left: 20%;
}
.ambient-two {
  background: #5a6cff;
  width: 400px;
  height: 400px;
  right: 0;
  bottom: 0;
}
.topbar {
  height: 92px;
  border-bottom: 1px solid #ffffff0b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: auto;
  padding: 0 54px;
}
.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  font-size: 23px;
  font-weight: 850;
  letter-spacing: 2px;
}
.brand-icon {
  color: var(--mint);
  font-size: 39px;
  font-weight: 400;
}
.brand-en {
  font-size: 9px;
  letter-spacing: 2.7px;
  display: block;
  margin-top: 2px;
  color: #a3adbb;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 28px;
}
.online {
  font-size: 9px;
  letter-spacing: 1.8px;
  color: #879180;
  display: flex;
  align-items: center;
  gap: 8px;
}
.online i,
.eyebrow > span,
.tiny-dot {
  width: 5px;
  height: 5px;
  display: inline-block;
  border-radius: 50%;
  background: var(--mint);
}
.icon-button {
  border: 1px solid var(--line);
  background: transparent;
  color: #a4aebe;
  padding: 8px 11px;
  border-radius: 7px;
  font-size: 11px;
}
main {
  max-width: 1332px;
  margin: auto;
  padding: 0 36px;
}
.intro {
  text-align: center;
  padding: 42px 0 31px;
}
.eyebrow {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 2.4px;
  color: var(--mint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.intro h1 {
  font-size: 38px;
  letter-spacing: -1.8px;
  margin: 14px 0 10px;
  font-weight: 800;
}
.intro h1 em {
  font-style: normal;
  color: var(--mint);
}
.intro > p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 3px;
  margin: 0;
}
.layout {
  display: grid;
  grid-template-columns: 235px minmax(320px, 580px) 235px;
  gap: 22px;
  justify-content: center;
  align-items: start;
}
.side {
  padding-top: 16px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(140deg, #141a24c9, #10151fc9);
  padding: 22px;
}
.section-label {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.mode-tabs {
  display: flex;
  border-radius: 7px;
  padding: 4px;
  background: #090e16;
  margin: 19px 0 23px;
  gap: 2px;
}
.mode-tabs button {
  border: 0;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  flex: 1;
  padding: 9px 2px;
}
.mode-tabs .active {
  background: #283329;
  color: var(--mint);
}
.challenge-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
}
.panel p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.9;
}
.seed-row {
  border-top: 1px solid var(--line);
  margin-top: 19px;
  padding-top: 17px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}
.seed-row strong {
  font-family: monospace;
  color: #b8c3cf;
  letter-spacing: 1px;
}
.text-button {
  border: 0;
  padding: 14px 0 0;
  color: var(--mint);
  background: none;
  font-size: 11px;
}
.record-panel {
  margin-top: 16px;
}
.best-score {
  margin-top: 18px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.best-score > span {
  font-size: 39px;
  letter-spacing: -2px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.best-score small {
  color: var(--muted);
  font-size: 9px;
}
.record-meta {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-top: 7px;
}
.mini-bars {
  height: 36px;
  display: flex;
  align-items: end;
  gap: 4px;
  margin-top: 20px;
}
.mini-bars i {
  flex: 1;
  background: #b6f86c23;
  height: 20%;
}
.mini-bars i:nth-child(3n) {
  height: 45%;
}
.mini-bars i:nth-child(4n) {
  height: 65%;
}
.mini-bars i:nth-child(5n) {
  height: 90%;
  background: #b6f86c55;
}
.quote {
  font-size: 12px;
  color: #a2abba;
  padding: 25px 12px;
  font-style: italic;
}
.quote span {
  display: block;
  font-size: 9px;
  color: #525e70;
  margin-top: 10px;
  text-align: right;
}
.game-shell {
  border: 1px solid #333f47;
  background: #0d131c;
  border-radius: 19px;
  overflow: hidden;
  box-shadow: 0 24px 80px #0004;
  position: relative;
}
.game-top {
  height: 83px;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #ffffff06;
}
.game-top > div {
  min-width: 75px;
}
.game-top strong {
  display: block;
  font-size: 25px;
  letter-spacing: 2px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
}
.timer-block {
  display: flex;
  align-items: baseline;
  gap: 4px;
  justify-content: center;
}
.timer-block > span {
  font-size: 25px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
}
.timer-block small {
  font-size: 9px;
  color: var(--muted);
}
.health-block {
  text-align: right;
}
.health-block > div {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--mint);
  margin-top: 7px;
}
.canvas-wrap {
  position: relative;
  aspect-ratio: 1.12;
  min-height: 365px;
  touch-action: manipulation;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #16212b55, transparent 70%);
}
canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}
.arena-caption {
  position: absolute;
  top: 15px;
  left: 23px;
  right: 23px;
  display: flex;
  justify-content: space-between;
  color: #526171;
  font-family: monospace;
  font-size: 8px;
  letter-spacing: 1px;
  pointer-events: none;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #0b111cbe;
  backdrop-filter: blur(5px);
  padding: 22px;
  z-index: 2;
}
.hidden {
  display: none !important;
}
.orbit-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #b6f86c13;
  border: 1px solid #b6f86c45;
  border-radius: 14px;
  color: var(--mint);
  font-size: 25px;
  margin-bottom: 19px;
  transform: rotate(-8deg);
}
.overlay h2 {
  font-size: 32px;
  letter-spacing: -1px;
  line-height: 1.4;
  margin: 13px 0 10px;
}
.overlay p {
  font-size: 12px;
  color: #929dad;
  line-height: 1.9;
  margin: 0 0 22px;
}
.primary-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 65px;
  border: 0;
  border-radius: 8px;
  background: var(--mint);
  padding: 15px 22px;
  min-width: 220px;
  color: #17210d;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 0 28px #b6f86c13;
}
.primary-button span {
  font-size: 20px;
  line-height: 16px;
}
.start-hint {
  font-size: 9px;
  letter-spacing: 1px;
  color: #667386;
  margin-top: 15px;
}
.game-bottom {
  padding: 17px 21px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #ffffff08;
  color: var(--muted);
  font-size: 10px;
  gap: 8px;
}
.game-bottom kbd {
  font-family: monospace;
  font-size: 9px;
  border: 1px solid #3b4553;
  background: #1b2330;
  padding: 3px 5px;
  border-radius: 4px;
  margin-right: 5px;
}
.game-bottom .icon-button {
  border: 0;
  padding: 4px;
}
.game-bottom > span:nth-child(2) {
  color: var(--mint);
  font-size: 10px;
}
.progress-track {
  height: 3px;
  background: #1a2230;
}
.progress-track > div {
  height: 100%;
  width: 0;
  background: var(--mint);
  transition: width 0.1s linear;
}
.how-panel h3 {
  font-size: 20px;
  line-height: 1.6;
  margin: 19px 0 25px;
  letter-spacing: -0.6px;
}
.how-panel h3 span {
  color: #84909e;
}
.instruction {
  display: flex;
  gap: 12px;
  margin: 22px 0;
}
.instruction-icon {
  flex: 0 0 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 19px;
}
.player-icon {
  color: var(--cyan);
  background: #64e5e213;
}
.danger-icon {
  color: var(--red);
  background: #ff647c13;
}
.energy-icon {
  color: var(--mint);
  background: #b6f86c13;
}
.instruction strong {
  font-size: 12px;
  font-weight: 600;
}
.instruction p {
  font-size: 10px;
  margin: 5px 0 0;
  line-height: 1.8;
}
.tip {
  border-top: 1px solid var(--line);
  padding-top: 17px;
  margin-top: 24px;
}
.tip > span {
  color: var(--mint);
  font-size: 8px;
  letter-spacing: 1.5px;
}
.tip p {
  font-size: 10px;
  margin-bottom: 0;
}
.tip b {
  color: #bec7d2;
  font-weight: 500;
}
.share-note {
  display: flex;
  gap: 13px;
  padding: 20px 12px;
  align-items: center;
}
.share-note > span {
  font-size: 25px;
  color: var(--mint);
}
.share-note p {
  font-size: 10px;
  line-height: 1.9;
  color: #717f90;
}
.share-note strong {
  font-weight: 400;
  color: #a6b2c0;
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #ffffff08;
  margin-top: 37px;
  padding: 23px 0;
  color: #536071;
  font-size: 9px;
  letter-spacing: 1px;
}
footer i {
  font-style: normal;
  color: var(--mint);
  font-size: 14px;
}
.result-score {
  font-size: 58px;
  line-height: 1.1;
  letter-spacing: -3px;
  font-weight: 750;
  color: var(--mint);
  font-variant-numeric: tabular-nums;
}
.result-unit {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 3px;
  margin-top: 5px;
}
.result-stats {
  display: flex;
  margin: 18px 0;
  gap: 35px;
}
.result-stats strong {
  display: block;
  font-size: 18px;
}
.result-stats span {
  font-size: 9px;
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
#result-overlay h2 {
  font-size: 25px;
  margin: 8px 0;
}
#result-message {
  font-size: 10px;
  margin-bottom: 13px;
}
.global-rank {
  margin: 6px 0 0;
  color: #b6f86c;
  font: 700 11px monospace;
  letter-spacing: 0.08em;
}
.secondary-button {
  border: 1px solid #354237;
  border-radius: 7px;
  background: #b6f86c08;
  color: #bed3ac;
  padding: 10px 13px;
  font-size: 11px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 15px);
  padding: 13px 22px;
  border: 1px solid #b6f86c44;
  background: #1a251e;
  color: #d8efc3;
  z-index: 10;
  font-size: 12px;
  border-radius: 9px;
  opacity: 0;
  transition: 0.2s;
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 1500px) {
  .intro {
    padding-top: 55px;
    padding-bottom: 40px;
  }
  .layout {
    gap: 28px;
  }
  .canvas-wrap {
    aspect-ratio: 1.08;
  }
}
@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 190px minmax(320px, 580px);
    gap: 18px;
  }
  .right-side {
    display: none;
  }
  .panel {
    padding: 18px;
  }
  .topbar {
    padding: 0 30px;
  }
  main {
    max-width: 940px;
  }
  .intro {
    padding: 30px 0;
  }
  .intro h1 {
    font-size: 34px;
  }
}
@media (max-width: 680px) {
  .topbar {
    height: 67px;
    padding: 0 20px;
  }
  .brand {
    font-size: 19px;
  }
  .brand-icon {
    font-size: 31px;
  }
  .brand-en {
    font-size: 7px;
  }
  .online {
    display: none;
  }
  main {
    padding: 0 14px;
  }
  .intro {
    padding: 24px 0 22px;
  }
  .intro h1 {
    font-size: 28px;
    margin-top: 11px;
    letter-spacing: -1px;
  }
  .eyebrow {
    font-size: 7px;
    letter-spacing: 1.8px;
  }
  .intro > p {
    font-size: 10px;
    letter-spacing: 2px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .game-shell {
    width: 100%;
    order: 0;
    border-radius: 15px;
  }
  .left-side {
    width: 100%;
    order: 1;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .challenge-panel,
  .record-panel {
    margin: 0;
    padding: 15px;
  }
  .challenge-panel .section-label,
  .record-panel .section-label {
    font-size: 8px;
    letter-spacing: 0.5px;
  }
  .mode-tabs {
    margin: 13px 0;
  }
  .challenge-title {
    font-size: 11px;
  }
  .challenge-panel > p,
  .quote,
  .text-button,
  .mini-bars {
    display: none;
  }
  .seed-row {
    margin-top: 12px;
    padding-top: 10px;
    font-size: 9px;
  }
  .record-meta {
    display: block;
    font-size: 9px;
  }
  .record-meta > span {
    display: block;
    margin-top: 5px;
  }
  .best-score {
    margin-top: 17px;
  }
  .best-score > span {
    font-size: 33px;
  }
  .game-top {
    height: 72px;
    padding: 15px 19px;
  }
  .canvas-wrap {
    aspect-ratio: 1.05;
    min-height: 350px;
  }
  .overlay h2 {
    font-size: 28px;
  }
  .orbit-badge {
    margin-bottom: 14px;
    width: 38px;
    height: 38px;
  }
  .overlay p {
    font-size: 11px;
    margin-bottom: 17px;
  }
  .game-bottom {
    padding: 14px 15px;
  }
  .game-bottom > span:first-child {
    font-size: 9px;
  }
  footer {
    margin-top: 24px;
    padding: 19px 0;
    justify-content: center;
  }
  footer > span:first-child,
  footer > span:last-child {
    display: none;
  }
  .result-score {
    font-size: 48px;
  }
  .result-stats {
    margin: 13px 0;
  }
  .arena-caption {
    left: 19px;
    right: 19px;
  }
  .primary-button {
    padding: 13px 20px;
  }
  #result-overlay {
    padding: 15px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
  .ambient {
    display: none;
  }
}

/* V3 score sharing and volume. */
.result-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
#result-qr-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
#result-qr-link[hidden] {
  display: none;
}
#result-qr {
  width: 76px;
  height: 76px;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 0;
}
#result-qr-link small {
  font-size: 9px;
  color: #c7d8e8;
}
.task-hud {
  position: absolute;
  top: 38px;
  right: 19px;
  width: 150px;
  padding: 8px 10px;
  border: 1px solid #ffffff10;
  border-radius: 8px;
  background: #0b111bb8;
  color: #9eabba;
  font-size: 9px;
  pointer-events: none;
  z-index: 1;
}
.task-heading {
  display: block;
  margin-bottom: 5px;
  color: #b6f86c;
  font-family: monospace;
  letter-spacing: 1px;
  font-size: 8px;
}
.task-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.65;
  white-space: nowrap;
}
.task-row strong {
  color: #dce7ef;
  font-weight: 600;
}
.task-row.complete span,
.task-row.complete strong {
  color: #b6f86c;
}
.game-shell > .task-hud {
  position: static;
  width: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 19px;
  border-top: 1px solid #ffffff06;
  border-bottom: 1px solid #ffffff06;
  border-radius: 0;
  background: #0b111b;
  color: #9eabba;
  pointer-events: none;
}
.game-shell > .task-hud .task-heading {
  margin: 0;
  flex: 0 0 auto;
}
.game-shell > .task-hud #task-list {
  display: flex;
  flex: 1;
  justify-content: space-between;
  gap: 14px;
}
.result-task-summary {
  font-size: 10px !important;
  color: #b6f86c !important;
  margin: 0 0 5px !important;
}
#ghost-status {
  color: #c39bff;
  font-size: 8px;
  letter-spacing: 1px;
}
body[data-universe="0"] .canvas-wrap {
  background: radial-gradient(ellipse at center, #0e596688, #10232f 72%);
}
body[data-universe="1"] .canvas-wrap {
  background: radial-gradient(ellipse at center, #7a345d88, #2f1e32 72%);
}
body[data-universe="2"] .canvas-wrap {
  background: radial-gradient(ellipse at center, #23668c99, #132936 72%);
}
body[data-universe="3"] .canvas-wrap {
  background: radial-gradient(ellipse at center, #603d9a99, #211738 72%);
}
body[data-universe="1"] .game-shell {
  box-shadow: 0 24px 80px #ff78b522;
}
body[data-universe="2"] .game-shell {
  box-shadow: 0 24px 80px #6bdcff22;
}
body[data-universe="3"] .game-shell {
  box-shadow: 0 24px 80px #b48cff22;
}
@media (max-width: 680px) {
  .game-shell > .task-hud {
    padding: 4px 15px;
    gap: 8px;
    font-size: 8px;
    min-height: 28px;
  }
  .game-shell > .task-hud .task-heading {
    font-size: 7px;
  }
  .game-shell > .task-hud #task-list {
    gap: 8px;
  }
  .game-shell > .task-hud .task-row {
    line-height: 1.25;
  }
  .canvas-wrap {
    min-height: 320px;
  }
}
.volume-control {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  font-size: 9px;
  color: #9bafc1;
}
#volume {
  width: 66px;
  height: 28px;
  margin: 0;
  accent-color: #b6f86c;
  cursor: pointer;
}
#volume:focus-visible {
  outline: 2px solid #b6f86c;
  outline-offset: 2px;
}
#control-hint {
  display: none;
}
/* Touch-first controls and viewport-safe, single-screen play. */
button,
select {
  touch-action: manipulation;
}
.icon-button,
#language {
  min-height: 44px;
}
#language {
  color: #bac6d4;
  background: #111925;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  max-width: 100px;
}
.header-right {
  gap: 10px;
}
.menu-button {
  min-height: 44px;
  color: #95a8bb;
  background: none;
  border: 0;
  font-size: 12px;
  margin-top: 4px;
  padding: 8px 20px;
}
.shift-button {
  display: none;
}
.overlay {
  overflow-y: auto;
  justify-content: safe center;
}
.overlay > * {
  flex-shrink: 0;
}
.primary-button,
.secondary-button,
.mode-tabs button {
  min-height: 44px;
}
.game-bottom .icon-button {
  min-width: 64px;
  min-height: 44px;
}
.start-hint {
  letter-spacing: 0;
  line-height: 1.5;
}
html[lang="en"] .intro h1 {
  letter-spacing: -1.3px;
  font-size: 34px;
}
html[lang="en"] .how-panel h3 {
  font-size: 19px;
}
html[lang="en"] .challenge-title {
  font-size: 11px;
}
@media (max-width: 900px) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior-y: contain;
  }
  .topbar {
    height: 64px;
    padding: 0 14px;
    position: relative;
    z-index: 7;
    background: #090d14;
  }
  .brand {
    font-size: 17px;
    gap: 7px;
    letter-spacing: 1px;
  }
  .brand-icon {
    font-size: 29px;
  }
  .brand-en {
    font-size: 6px;
    letter-spacing: 1.5px;
  }
  .header-right {
    gap: 5px;
  }
  .header-right .icon-button {
    font-size: 10px;
    padding: 7px;
    white-space: nowrap;
  }
  #language {
    font-size: 10px;
    width: 70px;
    padding: 0 3px;
  }
  main {
    padding: 0 12px;
  }
  .intro {
    padding: 16px 0 18px;
  }
  .intro h1,
  html[lang="en"] .intro h1 {
    font-size: 25px;
    margin: 10px 0 8px;
  }
  .intro > p {
    font-size: 9px;
    letter-spacing: 1px;
  }
  .intro .eyebrow {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .game-shell {
    width: 100%;
    order: 0;
    border-radius: 15px;
  }
  .left-side {
    width: 100%;
    order: 1;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .right-side {
    display: none;
  }
  .challenge-panel,
  .record-panel {
    padding: 15px;
    margin: 0;
    min-width: 0;
  }
  .challenge-panel > p,
  .quote,
  .mini-bars {
    display: none;
  }
  .challenge-panel > .section-label,
  .record-panel > .section-label {
    font-size: 8px;
    letter-spacing: 0.4px;
  }
  .mode-tabs {
    margin: 12px 0;
  }
  .challenge-title {
    font-size: 11px;
  }
  .seed-row {
    font-size: 9px;
    gap: 4px;
  }
  .seed-row strong {
    letter-spacing: 0;
  }
  .record-meta {
    display: block;
    font-size: 10px;
  }
  .record-meta > span {
    display: block;
    margin-top: 5px;
  }
  .text-button {
    display: block;
    min-height: 44px;
    padding: 10px 0 0;
    font-size: 11px;
  }
  .game-top {
    height: 64px;
    padding: 10px 17px;
  }
  .game-top strong {
    font-size: 23px;
  }
  .game-top > .timer-block {
    min-width: 60px;
  }
  .game-top .section-label {
    font-size: 9px;
  }
  .canvas-wrap {
    height: clamp(340px, 52svh, 480px);
    aspect-ratio: auto;
    min-height: 0;
  }
  .game-bottom {
    height: 48px;
    padding: 0 14px;
  }
  .game-bottom #control-hint {
    display: none;
  }
  .game-bottom > span:nth-child(2) {
    font-size: 12px;
  }
  .shift-button {
    display: grid;
    grid-template-columns: auto auto;
    grid-template-rows: auto auto;
    align-content: center;
    justify-content: center;
    column-gap: 13px;
    row-gap: 4px;
    width: calc(100% - 24px);
    margin: 0 12px 10px;
    min-height: 66px;
    max-height: 66px;
    background: #b6f86c;
    color: #182211;
    border: 0;
    border-radius: 11px;
    box-shadow: 0 0 24px #b6f86c12;
    user-select: none;
    -webkit-user-select: none;
  }
  .shift-button > span {
    grid-row: 1/3;
    align-self: center;
    font-size: 29px;
  }
  .shift-button strong {
    font-size: 15px;
    letter-spacing: 1px;
  }
  .shift-button small {
    font-size: 10px;
    opacity: 0.7;
  }
  .shift-button:disabled {
    opacity: 0.22;
  }
  .overlay {
    padding: 18px 14px;
    backdrop-filter: blur(3px);
  }
  .overlay h2 {
    font-size: 27px;
  }
  .overlay p {
    font-size: 12px;
    line-height: 1.7;
  }
  .overlay .primary-button {
    min-width: 220px;
    min-height: 48px;
  }
  .result-stats {
    gap: 25px;
  }
  .share-actions {
    gap: 7px;
  }
  .share-actions .secondary-button {
    font-size: 11px;
    padding: 9px 10px;
  }
  #result-overlay h2 {
    font-size: 23px;
  }
  .result-score {
    font-size: 46px;
  }
  #result-message {
    max-width: 290px;
    font-size: 11px;
    line-height: 1.5;
  }
  footer {
    justify-content: center;
    margin-top: 22px;
  }
  footer > span:first-child,
  footer > span:last-child {
    display: none;
  }
  body.in-run {
    overflow: hidden;
  }
  .in-run .game-shell {
    position: fixed;
    z-index: 6;
    top: calc(64px + env(safe-area-inset-top));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .in-run .topbar {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    right: 0;
  }
  .in-run .canvas-wrap {
    height: auto;
    min-height: 240px;
    flex: 1 1 auto;
    align-self: stretch;
  }
  .in-run canvas {
    min-height: 0;
  }
  .in-run .game-top,
  .in-run .game-bottom,
  .in-run .progress-track {
    flex: 0 0 auto;
  }
  .in-run .task-hud,
  .in-run .arena-caption,
  .in-run .shift-button {
    display: none !important;
  }
  .in-run .game-bottom {
    height: 40px;
    padding: 0 10px;
  }
  .in-run .game-bottom #combo-label {
    font-size: 10px;
  }
  .in-run .game-bottom .volume-control span {
    display: none;
  }
  .in-run[data-state="result"] .game-shell,
  .in-run[data-state="paused"] .game-shell {
    height: auto;
    min-height: 0;
  }
}
@media (max-width: 360px) {
  .topbar {
    padding: 0 10px;
  }
  .brand {
    gap: 4px;
    font-size: 15px;
  }
  .brand-icon {
    font-size: 24px;
  }
  .brand-en {
    font-size: 5px;
  }
  .header-right .icon-button {
    padding: 5px;
    font-size: 9px;
  }
  #language {
    width: 62px;
  }
  .intro h1,
  html[lang="en"] .intro h1 {
    font-size: 22px;
  }
  .share-actions .secondary-button {
    font-size: 10px;
  }
  .overlay h2 {
    font-size: 24px;
  }
  .result-stats {
    gap: 20px;
  }
}
@media (max-width: 900px) and (max-height: 650px) {
  .in-run .overlay {
    padding: 10px;
  }
  .in-run #result-overlay h2 {
    font-size: 20px;
    margin: 6px 0;
  }
  .in-run .result-score {
    font-size: 36px;
  }
  .in-run .result-stats {
    margin: 9px 0;
  }
  .in-run #result-message {
    margin-bottom: 8px;
    font-size: 10px;
  }
  .in-run .result-stats strong {
    font-size: 16px;
  }
  .in-run .result-stats span {
    font-size: 9px;
  }
  .in-run .overlay .primary-button {
    min-height: 44px;
    padding: 10px 17px;
  }
  .in-run .share-actions {
    margin-top: 6px;
  }
  .in-run .menu-button {
    margin-top: 0;
    min-height: 40px;
  }
  .in-run .overlay p {
    margin-bottom: 12px;
  }
}
@media (max-width: 900px) and (max-height: 450px) {
  .in-run .game-shell {
    display: grid;
    left: 8px;
    right: 8px;
    grid-template-columns: minmax(0, 1fr) 145px;
    grid-template-rows: 1fr 3px;
    top: calc(54px + env(safe-area-inset-top));
  }
  .in-run .topbar {
    height: 54px;
  }
  .in-run .canvas-wrap {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  .in-run .game-top {
    grid-column: 2;
    grid-row: 1;
    flex-direction: column;
    height: 140px;
    padding: 10px;
    gap: 7px;
    align-self: start;
  }
  .in-run .game-top .health-block {
    text-align: center;
  }
  .in-run .game-top strong {
    font-size: 20px;
  }
  .in-run .game-top .section-label {
    display: none;
  }
  .in-run .game-bottom {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    justify-content: center;
    margin-bottom: 70px;
  }
  .in-run .game-bottom #combo-label {
    display: none;
  }
  .in-run .shift-button {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    font-size: 12px;
    min-height: 56px;
    max-height: 56px;
  }
  .in-run .shift-button > span,
  .in-run .shift-button small {
    display: none;
  }
  .in-run .shift-button strong {
    font-size: 11px;
  }
  .in-run .progress-track {
    grid-column: 1/3;
    grid-row: 2;
  }
  .in-run[data-state="result"] .game-shell,
  .in-run[data-state="paused"] .game-shell {
    grid-template-rows: 1fr 3px;
  }
  .in-run[data-state="result"] .game-bottom,
  .in-run[data-state="paused"] .game-bottom {
    margin-bottom: 5px;
  }
  .in-run #result-overlay .eyebrow,
  .in-run .result-unit,
  .in-run #result-message {
    display: none;
  }
  .in-run .result-stats {
    margin: 5px;
  }
  .in-run #result-overlay h2 {
    font-size: 17px;
    margin: 2px;
  }
  .in-run .result-score {
    font-size: 28px;
  }
  .in-run .share-actions {
    margin-top: 3px;
  }
  .in-run .menu-button {
    min-height: 32px;
  }
  .in-run .overlay .primary-button {
    min-height: 38px;
    padding: 8px 15px;
  }
}
@media (max-width: 900px) and (max-height: 450px) {
  .in-run .menu-button,
  .in-run .overlay .primary-button {
    min-height: 44px;
  }
}

/* Final small-screen tuning: keep result actions and safe areas visible. */
@media (max-width: 900px) {
  .result-score-row {
    gap: 12px;
  }
  .result-score-row #result-qr {
    width: 68px;
    height: 68px;
  }
  .result-score-row small {
    font-size: 8px;
  }
  .in-run .game-shell {
    min-height: 0;
    height: calc(100svh - 72px);
    max-height: calc(100dvh - 72px);
  }
  .canvas-wrap {
    height: clamp(380px, 60svh, 600px);
  }
  .in-run .game-shell {
    left: 0;
    right: 0;
    border-radius: 0;
  }
}
@media (max-width: 360px) {
  .result-score-row {
    gap: 8px;
  }
  .result-score-row #result-qr {
    width: 60px;
    height: 60px;
  }
  .result-score {
    font-size: 42px;
  }
  .result-stats {
    gap: 13px;
  }
  .result-stats strong {
    font-size: 16px;
  }
  .result-stats span {
    font-size: 8px;
  }
  .share-actions .secondary-button {
    padding: 8px 7px;
  }
  .volume-control {
    display: none;
  }
}
@media (max-width: 900px) and (orientation: landscape) {
  .intro,
  .left-side,
  footer {
    display: none;
  }
  .layout {
    gap: 0;
  }
  .game-shell {
    min-height: calc(100svh - 76px);
  }
  .in-run .game-shell {
    top: calc(54px + env(safe-area-inset-top));
    bottom: env(safe-area-inset-bottom);
    left: 8px;
    right: 8px;
  }
}
/* Game surfaces should never become selectable during fast double taps. */
*,
*::before,
*::after {
  -webkit-user-select: none;
  user-select: none;
}
input,
select,
textarea {
  -webkit-user-select: text;
  user-select: text;
}
#global-leaderboard {
  color: #e8eef5;
  background: #111923;
  border: 1px solid #536579;
  border-radius: 18px;
  padding: 24px;
  width: min(520px, calc(100vw - 32px));
  height: min(660px, calc(100dvh - 32px));
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
#global-leaderboard[open] { display: flex; flex-direction: column; }
#global-leaderboard::backdrop { background: #03070bcc; }
#global-leaderboard p { color: #b5c3d2; margin: 12px 0; }
#global-top-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 4px 0 0; padding: 0; list-style: none; overscroll-behavior: contain; }
#global-top-list li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 1px solid #2b3948; }
#global-top-list .global-position { color: #fff; font: 700 12px monospace; }
#global-top-list span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #b5c3d2; }
#global-top-list strong { display: block; color: #b6f86c; white-space: nowrap; }
#close-global-top { flex: 0 0 auto; margin-top: 16px; min-height: 44px; }
@media (max-width: 420px) {
  #global-leaderboard { padding: 18px; width: calc(100vw - 20px); height: calc(100dvh - 20px); max-height: calc(100dvh - 20px); }
  #global-top-list li { grid-template-columns: 34px minmax(0, 1fr); }
  #global-top-list strong { grid-column: 2; font-size: 12px; }
}
