:root {
  color-scheme: dark;
  --ink: #f3f8ff;
  --muted: #8da0b9;
  --deep: #050912;
  --navy: #07101f;
  --panel: rgba(16, 31, 53, 0.78);
  --panel-strong: #101f35;
  --line: rgba(170, 207, 255, 0.14);
  --mint: #69f6d1;
  --cyan: #49a9ff;
  --violet: #a78bfa;
  --amber: #ffbf69;
  --red: #ff6b7a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", sans-serif;
  background: var(--deep);
  color: var(--ink);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--deep);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 8%, rgba(73, 169, 255, 0.12), transparent 26rem),
    radial-gradient(circle at 88% 28%, rgba(105, 246, 209, 0.08), transparent 24rem),
    linear-gradient(160deg, #07101f 0%, #050912 60%, #090a18 100%);
}

body.game-open {
  overflow: hidden;
  overscroll-behavior: none;
}

button,
dialog {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}

.ambient-one {
  top: 12%;
  left: -12rem;
  background: var(--cyan);
}

.ambient-two {
  right: -12rem;
  bottom: 18%;
  background: var(--violet);
}

.portal {
  width: min(100%, 1120px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 12px) 18px calc(var(--safe-bottom) + 30px);
}

.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(105, 246, 209, 0.35);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(105, 246, 209, 0.16), rgba(73, 169, 255, 0.08));
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -0.04em;
  box-shadow: inset 0 0 18px rgba(105, 246, 209, 0.08), 0 8px 30px rgba(0, 0, 0, 0.18);
}

.brand > span:last-child {
  display: grid;
  line-height: 0.85;
}

.brand strong {
  font-size: 12px;
  letter-spacing: 0.14em;
}

.brand small {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.36em;
}

.cache-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 18, 32, 0.75);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.status-light {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 191, 105, 0.08), 0 0 14px rgba(255, 191, 105, 0.55);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.cache-status.is-ready {
  border-color: rgba(105, 246, 209, 0.24);
  color: var(--mint);
}

.cache-status.is-ready .status-light {
  background: var(--mint);
  box-shadow: 0 0 0 4px rgba(105, 246, 209, 0.08), 0 0 14px rgba(105, 246, 209, 0.55);
  animation: none;
}

.cache-status.is-offline .status-light {
  background: var(--cyan);
}

.cache-status.has-error,
.cache-status.has-error .status-light {
  color: var(--red);
}

@keyframes status-pulse {
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero {
  display: grid;
  min-height: min(56vh, 520px);
  align-content: center;
  padding: 54px 0 42px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -58px;
  top: 42px;
  width: 205px;
  height: 205px;
  border: 1px solid rgba(73, 169, 255, 0.1);
  border-radius: 50%;
  box-shadow: inset 0 0 0 34px rgba(73, 169, 255, 0.015), inset 0 0 0 68px rgba(73, 169, 255, 0.018);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(42px, 9vw, 84px);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

.hero h1 span {
  color: transparent;
  background: linear-gradient(90deg, var(--mint), #8ed8ff 55%, #c5b8ff);
  background-clip: text;
  -webkit-background-clip: text;
}

.hero > p:not(.eyebrow) {
  max-width: 560px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-stats strong {
  color: var(--ink);
  font-size: 14px;
}

.text-button {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid rgba(105, 246, 209, 0.4);
  background: none;
  color: var(--mint);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.game-section {
  padding: 14px 0 52px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.icon-button,
.back-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(13, 26, 45, 0.88);
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--mint);
  font-size: 18px;
}

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

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.game-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 260px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(20, 42, 69, 0.98), rgba(8, 15, 27, 0.98));
  text-align: left;
  cursor: pointer;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
  transition: transform 160ms ease, border-color 160ms ease;
}

.game-card:active {
  transform: scale(0.975);
}

.game-card:hover {
  border-color: rgba(105, 246, 209, 0.28);
}

.card-art {
  position: relative;
  display: grid;
  min-height: 132px;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--card-accent) 22%, transparent), transparent 48%),
    linear-gradient(150deg, color-mix(in srgb, var(--card-accent) 10%, transparent), transparent 60%);
}

.card-art::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--card-accent) 35%, transparent), transparent);
}

.art-orbit {
  position: absolute;
  width: 94px;
  height: 94px;
  border: 1px solid color-mix(in srgb, var(--card-accent) 22%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 18px rgba(255, 255, 255, 0.012), inset 0 0 0 36px rgba(255, 255, 255, 0.012);
}

.art-symbol {
  z-index: 2;
  color: var(--card-accent);
  font-size: 48px;
  font-weight: 800;
  text-shadow: 0 0 26px color-mix(in srgb, var(--card-accent) 48%, transparent);
  transform: rotate(-7deg);
}

.art-grid {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 24px 24px;
  transform: perspective(120px) rotateX(48deg) scale(1.25) translateY(38px);
}

.game-card-1 { --card-accent: var(--cyan); }
.game-card-2 { --card-accent: var(--mint); }
.game-card-3 { --card-accent: var(--violet); }
.game-card-4 { --card-accent: #58e3ff; }
.game-card-5 { --card-accent: var(--amber); }
.game-card-6 { --card-accent: var(--red); }

.card-copy {
  display: grid;
  align-content: start;
  padding: 15px 15px 8px;
}

.card-number {
  margin-bottom: 7px;
  color: var(--card-accent);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.card-copy strong {
  overflow: hidden;
  font-size: 19px;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-copy > span:last-child {
  min-height: 32px;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  align-items: center;
  align-self: end;
  justify-content: space-between;
  padding: 9px 15px 13px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-meta span:last-child {
  color: var(--card-accent);
  font-size: 16px;
}

.portal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-shell {
  position: fixed;
  z-index: 20;
  inset: 0;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(73, 169, 255, 0.12), transparent 21rem),
    linear-gradient(180deg, #081426, #050912);
  animation: shell-in 180ms ease-out;
}

.game-shell[hidden] {
  display: none;
}

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

.game-header {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  height: calc(66px + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) 14px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 18, 0.76);
  backdrop-filter: blur(20px);
}

.back-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
}

.back-button span {
  transform: translateY(-2px);
}

.game-heading {
  display: grid;
  min-width: 0;
}

.game-heading small,
.game-live small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.game-heading strong {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-live {
  display: grid;
  min-width: 58px;
  justify-items: end;
}

.game-live strong {
  color: var(--mint);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.game-host {
  position: relative;
  height: calc(100dvh - 66px - var(--safe-top));
  overflow: hidden;
}

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

.game-panel {
  position: absolute;
  z-index: 10;
  inset: 50% auto auto 50%;
  width: min(calc(100% - 40px), 390px);
  padding: 26px 22px 22px;
  border: 1px solid rgba(152, 197, 255, 0.19);
  border-radius: 25px;
  background: rgba(8, 17, 31, 0.94);
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(22px);
  transform: translate(-50%, -50%);
}

.game-panel .panel-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  place-items: center;
  border: 1px solid rgba(105, 246, 209, 0.3);
  border-radius: 15px;
  background: rgba(105, 246, 209, 0.08);
  color: var(--mint);
  font-size: 19px;
}

.game-panel h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.04em;
}

.game-panel p {
  margin: 9px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 19px;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--mint), #7bc7ff);
  color: #061322;
  box-shadow: 0 12px 35px rgba(105, 246, 209, 0.16);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(17, 34, 56, 0.8);
  color: var(--ink);
}

.game-hint {
  position: absolute;
  z-index: 4;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 14px);
  left: 16px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(5, 11, 21, 0.72);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

.flight-dialog {
  width: min(calc(100% - 32px), 440px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #0b1729;
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
}

.flight-dialog::backdrop {
  background: rgba(1, 4, 10, 0.78);
  backdrop-filter: blur(8px);
}

.flight-dialog form {
  position: relative;
  padding: 30px 24px 24px;
}

.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  color: var(--muted);
  font-size: 24px;
}

.dialog-icon {
  display: block;
  margin-bottom: 18px;
  color: var(--mint);
  font-size: 40px;
}

.flight-dialog h2 {
  margin: 0 0 12px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.flight-dialog ol {
  margin: 0 0 24px;
  padding-left: 21px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.flight-dialog li + li {
  margin-top: 9px;
}

.flight-dialog .primary-button {
  width: 100%;
}

/* Sky Ace */
.sky-canvas {
  background: #06101e;
}

/* Fairway Nine */
.golf-canvas {
  background: #071710;
}

.golf-wind {
  position: absolute;
  z-index: 3;
  top: 13px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(4, 15, 11, 0.68);
  color: rgba(240,255,247,.72);
  font-size: 10px;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}

.golf-wind-arrow {
  display: inline-block;
  color: var(--mint);
  font-size: 16px;
}

/* Reactor Stack */
.reactor-layout {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  padding: 10px 10px calc(var(--safe-bottom) + 10px);
  background:
    radial-gradient(circle at 50% 30%, rgba(167, 139, 250, 0.12), transparent 45%),
    #050912;
}

.reactor-board-wrap {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
}

.reactor-canvas {
  width: auto;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 14px;
  background: rgba(5, 8, 18, 0.88);
  box-shadow: 0 0 55px rgba(108, 74, 190, 0.12);
  aspect-ratio: 10 / 18;
}

.reactor-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding-top: 10px;
}

.reactor-controls button {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 27, 48, 0.92);
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  touch-action: manipulation;
}

.reactor-controls button:last-child {
  border-color: rgba(105, 246, 209, 0.22);
  color: var(--mint);
}

/* Signal Circuit */
.circuit-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: 16px 14px calc(var(--safe-bottom) + 16px);
  background:
    radial-gradient(circle at 50% 42%, rgba(73, 169, 255, 0.13), transparent 55%),
    linear-gradient(#07101f, #040913);
}

.circuit-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 13px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.circuit-status strong {
  color: var(--ink);
}

.circuit-board-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
}

.circuit-board {
  display: grid;
  width: min(100%, 540px);
  padding: 7px;
  gap: 3px;
  border: 1px solid rgba(73, 169, 255, 0.16);
  border-radius: 20px;
  background: rgba(4, 10, 20, 0.68);
  box-shadow: inset 0 0 40px rgba(73, 169, 255, 0.035);
}

.circuit-tile {
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  aspect-ratio: 1;
  border: 0;
  border-radius: 9px;
  background: rgba(93, 131, 173, 0.055);
  color: #2b4664;
  cursor: pointer;
  touch-action: manipulation;
}

.circuit-tile.is-powered {
  background: rgba(73, 169, 255, 0.1);
  color: #66c9ff;
  box-shadow: inset 0 0 16px rgba(73, 169, 255, 0.08);
}

.circuit-tile.is-source {
  color: var(--mint);
}

.circuit-tile svg {
  width: 78%;
  height: 78%;
  overflow: visible;
  filter: drop-shadow(0 0 5px currentColor);
}

.circuit-tile line {
  stroke: currentColor;
  stroke-width: 13;
  stroke-linecap: round;
}

.circuit-tile circle {
  fill: currentColor;
}

.circuit-message {
  min-height: 50px;
  padding-top: 13px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.circuit-message .primary-button {
  min-height: 44px;
}

/* Kodeknekker */
.code-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: 13px 13px calc(var(--safe-bottom) + 12px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 191, 105, 0.1), transparent 36%),
    #060a12;
}

.code-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.feedback-example {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
}

.feedback-example.exact { background: var(--mint); }
.feedback-example.partial { border: 1px solid var(--amber); }

.code-board {
  display: grid;
  min-height: 0;
  align-content: center;
  gap: 5px;
}

.code-row {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 7px;
  min-height: 35px;
  padding: 3px 7px;
  border-radius: 10px;
  color: rgba(141, 160, 185, 0.58);
}

.code-row.is-current {
  background: rgba(255, 191, 105, 0.065);
  color: var(--amber);
}

.code-row-number {
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.code-slots,
.code-feedback {
  display: flex;
  align-items: center;
  gap: 7px;
}

.code-feedback {
  flex-wrap: wrap;
  justify-content: end;
  gap: 3px;
}

.code-slot,
.palette-key {
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}

.code-slot {
  width: clamp(25px, 8vw, 35px);
  aspect-ratio: 1;
  border: 1px solid rgba(255,255,255,.11);
  background: rgba(255,255,255,.03);
  color: transparent;
  font-size: 13px;
}

.code-slot.has-value {
  color: rgba(3, 9, 16, 0.72);
  box-shadow: inset 0 2px 5px rgba(255,255,255,.22), 0 4px 9px rgba(0,0,0,.2);
}

.feedback-pin {
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
}

.feedback-pin.exact { border-color: var(--mint); background: var(--mint); }
.feedback-pin.partial { border-color: var(--amber); }

.code-controls {
  display: grid;
  gap: 9px;
  padding-top: 10px;
}

.code-palette {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.palette-key {
  width: 100%;
  padding: 0;
  border: 0;
  aspect-ratio: 1.15;
  color: rgba(3, 9, 16, 0.75);
  font-size: 17px;
  cursor: pointer;
}

.code-actions {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 8px;
}

.code-actions button {
  min-height: 45px;
}

.token-0 { background: #67d8ff; }
.token-1 { background: #69f6d1; }
.token-2 { background: #ffbf69; }
.token-3 { background: #ff7183; }
.token-4 { background: #b89aff; }
.token-5 { background: #f5f2aa; }

/* Night Shift */
.mine-layout {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  padding: 14px 12px calc(var(--safe-bottom) + 14px);
  background:
    radial-gradient(circle at 50% 43%, rgba(255, 107, 122, 0.08), transparent 50%),
    #060a12;
}

.mine-toolbar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 3px 12px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.mine-toolbar strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.mine-board-wrap {
  display: grid;
  min-height: 0;
  place-items: center;
}

.mine-board {
  display: grid;
  width: min(100%, 480px);
  padding: 6px;
  gap: 3px;
  border: 1px solid rgba(255, 107, 122, 0.12);
  border-radius: 17px;
  background: rgba(5, 10, 18, 0.78);
}

.mine-cell {
  display: grid;
  min-width: 0;
  padding: 0;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(154, 188, 226, 0.1);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(31, 52, 78, 0.96), rgba(15, 27, 45, 0.96));
  color: var(--ink);
  font-size: clamp(10px, 3.4vw, 16px);
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.mine-cell.is-open {
  border-color: transparent;
  background: rgba(255,255,255,.025);
}

.mine-cell.is-flagged {
  color: var(--amber);
}

.mine-cell.is-mine {
  background: rgba(255, 107, 122, 0.22);
  color: var(--red);
}

.mine-cell[data-count="1"] { color: #64c7ff; }
.mine-cell[data-count="2"] { color: #67efb6; }
.mine-cell[data-count="3"] { color: #ff8b98; }
.mine-cell[data-count="4"] { color: #b99cff; }
.mine-cell[data-count="5"],
.mine-cell[data-count="6"],
.mine-cell[data-count="7"],
.mine-cell[data-count="8"] { color: #ffc870; }

.mine-footer {
  min-height: 48px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

@media (min-width: 700px) {
  .portal {
    padding-right: 32px;
    padding-left: 32px;
  }

  .game-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  .game-card {
    min-height: 330px;
  }

  .card-art {
    min-height: 180px;
  }

  .card-copy {
    padding: 18px 19px 8px;
  }

  .card-copy strong {
    font-size: 24px;
  }

  .card-meta {
    padding-right: 19px;
    padding-left: 19px;
  }

  .game-header {
    padding-right: 24px;
    padding-left: 24px;
  }

  .reactor-layout {
    padding-right: 30%;
    padding-left: 30%;
  }

  .code-layout,
  .mine-layout,
  .circuit-layout {
    width: min(100%, 630px);
    margin: 0 auto;
  }
}

@media (max-width: 360px) {
  .portal {
    padding-right: 12px;
    padding-left: 12px;
  }

  .cache-status {
    padding-right: 8px;
    padding-left: 8px;
    font-size: 9px;
  }

  .hero h1 {
    font-size: 38px;
  }

  .hero-stats {
    gap: 11px;
  }

  .game-grid {
    gap: 8px;
  }

  .game-card {
    min-height: 240px;
    border-radius: 20px;
  }

  .card-copy {
    padding-right: 12px;
    padding-left: 12px;
  }

  .card-meta {
    padding-right: 12px;
    padding-left: 12px;
  }

  .code-row {
    grid-template-columns: 20px minmax(0, 1fr) 45px;
    gap: 4px;
  }

  .code-slots {
    gap: 4px;
  }
}

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