:root {
  color-scheme: dark;
  --bg: #0a1019;
  --panel: #101b29;
  --line: #253548;
  --muted: #9bafc3;
  --text: #e8f2fa;
  --mint: #68efd0;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 48% 0%, #14253a 0%, var(--bg) 57%);
  color: var(--text);
}
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }

.masthead {
  min-height: 64px;
  padding: 0 max(24px, calc((100% - 1160px) / 2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #0a111bd9;
  font: 700 12px var(--mono);
  letter-spacing: .12em;
}
.wordmark { display: flex; align-items: center; gap: 8px; }
.wordmark span, .edition b, footer b { color: var(--mint); }
.brand-icon { color: var(--mint); }
.edition { color: var(--muted); white-space: nowrap; }
.shell { width: min(1160px, calc(100% - 48px)); margin: auto; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  align-items: end;
  gap: 16px 20px;
  padding: 38px 0 26px;
}
.eyebrow { color: var(--muted); font: 700 11px/1.5 var(--mono); letter-spacing: .14em; }
.slash { padding: 0 4px; color: var(--mint); }
.signal {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 12px #68efd090;
  margin-right: 6px;
}
h1 {
  margin: 5px 0 8px;
  font-size: clamp(2.25rem, 6.4vw, 4.5rem);
  line-height: 1.14;
  font-weight: 850;
  letter-spacing: -.045em;
}
h1 span { color: var(--mint); }
.subtitle { color: var(--muted); line-height: 1.7; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 256px; gap: 20px; align-items: start; }
.machine, .card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.machine { overflow: hidden; }
.console-bar, .controls {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
}
.console-bar { justify-content: space-between; border-bottom: 1px solid var(--line); }
.telemetry, .controls, .scores span {
  font: 700 12px var(--mono);
  color: var(--muted);
  white-space: nowrap;
}
.scores { display: flex; gap: clamp(10px, 3vw, 25px); margin-left: auto; }
.scores div { display: flex; align-items: center; gap: 7px; }
.scores strong { color: var(--mint); font: 700 17px var(--mono); font-variant-numeric: tabular-nums; }
.pause, .touch button {
  border: 1px solid #364a60;
  border-radius: 5px;
  background: #162436;
  color: var(--text);
}
.pause { padding: 6px 10px; min-height: 44px; min-width: 44px; font-size: 12px; white-space: nowrap; }
.pause:disabled { color: #8da2b7; opacity: .65; }
.pause:enabled:hover, .touch button:hover, .touch button:active { border-color: var(--mint); }
.viewport { position: relative; background: #091323; }
canvas { display: block; width: 100%; aspect-ratio: 720 / 460; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
canvas:focus-visible { outline-offset: -3px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(#07101be8 8%, #07101b44 77%); }
.overlay[hidden] { display: none; }
.brief { text-align: center; }
.emblem { display: block; color: var(--mint); font: 48px/.9 var(--mono); text-shadow: 0 0 22px #68efd0b0; margin-bottom: 12px; }
.brief h2 { margin: 3px 0 5px; font-size: clamp(22px, 4vw, 42px); letter-spacing: .02em; }
#hint { color: var(--muted); font-size: 14px; }
.launch {
  margin-top: 18px;
  border: 0;
  border-radius: 6px;
  padding: 10px 26px;
  min-height: 44px;
  color: #09221d;
  background: var(--mint);
  box-shadow: 0 0 22px #68efd025;
  font-weight: 800;
}
.launch:hover { background: #a5ffe9; }
.controls { border-top: 1px solid var(--line); }
.keyboard { display: flex; align-items: center; gap: 4px; }
.keyboard span { padding: 0 4px; }
kbd { min-width: 23px; text-align: center; border: 1px solid #354961; border-radius: 4px; color: var(--text); padding: 3px; }
.touch { display: none; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); gap: 5px; flex-shrink: 0; }
.touch button { min-width: 48px; min-height: 48px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; font-size: 21px; }
.touch [data-direction="up"] { grid-column: 2; grid-row: 1; }
.touch [data-direction="left"] { grid-column: 1; grid-row: 2; }
.touch [data-direction="down"] { grid-column: 2; grid-row: 2; }
.touch [data-direction="right"] { grid-column: 3; grid-row: 2; }
.touch button.is-held { border-color: var(--mint); background: #24574f; color: var(--mint); }
#touch-hint { display: none; font: 400 11px/1.7 system-ui, sans-serif; white-space: normal; margin-top: 6px; }
.control-label { min-width: 0; }
body.game-focus { overflow: hidden; overscroll-behavior: none; }
.game-focus .machine {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  border: 0; border-radius: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.game-focus .viewport { flex: 1; min-height: 0; }
.game-focus .viewport canvas { width: 100%; height: 100%; min-height: 0; aspect-ratio: auto; object-fit: contain; }
.game-focus .console-bar, .game-focus .controls { flex-shrink: 0; }
.side { display: grid; gap: 16px; }
.card { padding: 20px; }
.card h2 { font-size: 19px; margin: 6px 0 12px; }
.guide-item { display: flex; align-items: center; gap: 11px; padding: 12px 0; border-top: 1px solid var(--line); }
.guide-item:last-child { padding-bottom: 0; }
.guide-icon { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 6px; font-size: 23px; }
.crystal { color: #82d7ff; background: #15354b; }
.rock { color: #ffad8e; background: #3b2c37; }
.guide h3 { font-size: 13px; margin-bottom: 3px; }
.guide-item p { font-size: 12px; color: var(--muted); line-height: 1.45; }
.sponsor {
  background: repeating-linear-gradient(130deg, #191c32 0 16px, #1b2036 16px 32px);
  border-color: #373a59;
}
.sponsor h2 { margin-top: 12px; }
.sponsor-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 14px;
}
.sponsor-strip h2 { margin: 5px 0 0; font-size: 15px; }
.sponsor-footer { margin-top: 20px; padding: 14px 20px; }
.ad-tag { color: #dcd4ff; border: 1px solid #625b91; border-radius: 3px; background: #332e50; padding: 2px 5px; margin-right: 4px; }
.ad-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #625b91;
  border-radius: 5px;
  background: #282441;
  color: #e0d8ff;
  padding: 9px 12px;
  text-decoration: none;
  font-size: 13px;
}
.ad-button:hover { background: #383057; }
.demo { padding: 56px 0; max-width: 620px; }
.demo .ad-button { width: 150px; margin-top: 18px; }
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding: 15px 0 22px;
  color: var(--muted);
  font: 700 10px var(--mono);
  letter-spacing: .1em;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .intro { grid-template-columns: minmax(0, 1fr); }
}
@media (any-pointer: coarse), (max-width: 520px) {
  .keyboard { display: none; }
  .touch { display: grid; }
  #touch-hint { display: block; }
  .controls { justify-content: space-between; }
}
@media (max-width: 520px) {
  .shell { width: calc(100% - 24px); }
  .masthead { padding-inline: 12px; }
  .intro { padding-top: 26px; }
  .side { grid-template-columns: minmax(0, 1fr); }
  .console-bar, .controls { padding-inline: 10px; gap: 7px; }
  .scores div { gap: 4px; }
  .scores strong { font-size: 15px; }
  .console-bar { flex-wrap: wrap; }
  .telemetry { flex-basis: calc(100% - 160px); }
  .scores { flex: 1; justify-content: flex-end; }
  .console-bar .pause { flex: 1; }
  .viewport canvas { min-height: 225px; object-fit: contain; }
  .emblem { font-size: 34px; margin-bottom: 7px; }
  .launch { margin-top: 12px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .game-focus .controls { position: absolute; inset: auto 0 env(safe-area-inset-bottom); border: 0; background: transparent; pointer-events: none; }
  .game-focus .touch { pointer-events: auto; }
  .game-focus .control-label { visibility: hidden; }
  .game-focus .touch button { background: #162436d9; }
  .game-focus .touch button.is-held { background: #24574f; }
}
