:root {
      color-scheme: dark;
      --bg: #0b0d12;
      --surface: #11141c;
      --surface-2: #0e1016;
      --mint: #b8f36b;
      --blue: #9e8cff;
      --text: #eef0f5;
      --muted: #9a9eac;
      --dim: #777d8c;
      --border: rgba(255, 255, 255, .105);
      --danger: #ff8f9a;
    }

    * { box-sizing: border-box; }
    html { min-width: 320px; min-height: 100%; background: var(--bg); }
    body {
      min-height: 100vh;
      min-height: 100svh;
      margin: 0;
      overflow-x: hidden;
      background:
        radial-gradient(ellipse at 85% 9%, rgba(158, 140, 255, .10), transparent 33rem),
        radial-gradient(ellipse at 9% 82%, rgba(184, 243, 107, .055), transparent 28rem),
        var(--bg);
      color: var(--text);
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      -webkit-font-smoothing: antialiased;
      overscroll-behavior-y: contain;
    }
    body::before {
      position: fixed;
      z-index: 0;
      inset: 0;
      pointer-events: none;
      content: "";
      background-image: radial-gradient(rgba(238, 240, 245, .12) .65px, transparent .65px);
      background-size: 24px 24px;
      opacity: .2;
    }
    button, a { font: inherit; }
    button { -webkit-tap-highlight-color: transparent; }
    a { color: inherit; text-decoration: none; }
    button:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }

    .page {
      position: relative;
      z-index: 1;
      width: min(100% - 36px, 650px);
      margin: 0 auto;
      padding: 0 0 max(28px, env(safe-area-inset-bottom));
    }
    .topbar {
      min-height: 72px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      border-bottom: 1px solid var(--border);
    }
    .brand { display: inline-flex; align-items: center; gap: 10px; }
    .brand-mark { font-size: 24px; font-weight: 800; letter-spacing: -.09em; }
    .brand-mark span { color: var(--mint); }
    .brand-name { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .18em; }
    .top-actions { display: flex; align-items: center; gap: 10px; }
    .back-link, .language-button {
      min-height: 40px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 12px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: rgba(16, 23, 34, .72);
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      transition: border-color .2s, color .2s, background .2s;
    }
    .back-link:hover, .language-button:hover { border-color: rgba(184, 243, 107, .45); color: var(--mint); }
    .language-button { min-width: 48px; color: var(--text); cursor: pointer; letter-spacing: .06em; }

    .intro { padding: 31px 0 19px; }
    .eyebrow {
      display: flex;
      align-items: center;
      gap: 9px;
      margin: 0 0 12px;
      color: var(--muted);
      font-size: 9px;
      font-weight: 750;
      letter-spacing: .18em;
      line-height: 1.5;
    }
    .status-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px rgba(184, 243, 107, .6); }
    h1 { margin: 0; font-size: clamp(34px, 7vw, 48px); font-weight: 650; letter-spacing: -.065em; line-height: 1.04; }
    h1 span { color: var(--mint); }
    .subtitle { margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.75; }

    .game-card {
      padding: clamp(13px, 3.2vw, 21px);
      border: 1px solid var(--border);
      border-radius: 11px;
      background: linear-gradient(145deg, rgba(16, 23, 34, .96), rgba(10, 16, 25, .96));
      box-shadow: 0 25px 90px rgba(0, 0, 0, .2);
    }
    .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
    .stat {
      min-width: 0;
      padding: 11px 12px 10px;
      border: 1px solid rgba(174, 184, 200, .1);
      border-radius: 6px;
      background: rgba(8, 11, 18, .48);
    }
    .stat-label { display: block; overflow: hidden; color: var(--dim); font-size: 8px; font-weight: 750; letter-spacing: .13em; text-overflow: ellipsis; white-space: nowrap; }
    .stat-value { display: block; margin-top: 3px; color: var(--text); font-size: 21px; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -.04em; line-height: 1.15; }
    .stat:first-child .stat-value { color: var(--mint); }

    .board-frame {
      position: relative;
      width: 100%;
      overflow: hidden;
      border: 1px solid rgba(184, 243, 107, .2);
      border-radius: 7px;
      background: #0b0d12;
      box-shadow: inset 0 0 45px rgba(184, 243, 107, .025), 0 0 32px rgba(184, 243, 107, .035);
    }
    canvas {
      display: block;
      width: 100%;
      aspect-ratio: 1 / 1;
      touch-action: none;
      user-select: none;
      -webkit-user-select: none;
    }
    .veil {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      padding: 24px;
      background: rgba(5, 9, 15, .68);
      text-align: center;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }
    .veil.is-hidden { display: none; }
    .veil-inner { width: min(100%, 320px); }
    .veil-symbol { margin-bottom: 12px; color: var(--mint); font-size: 26px; text-shadow: 0 0 22px rgba(184, 243, 107, .4); }
    .veil h2 { margin: 0; font-size: clamp(20px, 4.5vw, 27px); font-weight: 650; letter-spacing: -.04em; }
    .veil p { margin: 9px 0 0; color: var(--muted); font-size: 11px; line-height: 1.75; }

    .game-actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 9px; margin-top: 13px; }
    .action-button {
      min-height: 46px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 0 12px;
      border: 1px solid var(--border);
      border-radius: 6px;
      background: rgba(8, 11, 18, .5);
      color: var(--text);
      font-size: 11px;
      font-weight: 750;
      cursor: pointer;
      transition: transform .15s, border-color .15s, background .15s, opacity .15s;
      touch-action: manipulation;
    }
    .action-button:active, .direction-button:active { transform: scale(.97); }
    .action-button.primary { border-color: var(--mint); background: var(--mint); color: #07120f; }
    .action-button.primary:hover { background: #8af5ce; }
    .action-button:not(.primary):hover { border-color: rgba(184, 243, 107, .45); }
    .action-button:disabled { opacity: .38; cursor: not-allowed; }

    .under-board { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; }
    .help { margin: 0; color: var(--dim); font-size: 9px; line-height: 1.65; }
    .help strong { color: var(--muted); font-weight: 650; }
    .mobile-hint { display: none; }
    .control-pad {
      display: grid;
      grid-template-columns: repeat(3, 54px);
      grid-template-rows: repeat(2, 48px);
      gap: 5px;
      flex: 0 0 auto;
      touch-action: manipulation;
    }
    .direction-button {
      display: grid;
      place-items: center;
      min-width: 0;
      min-height: 0;
      padding: 0;
      border: 1px solid rgba(174, 184, 200, .19);
      border-radius: 7px;
      background: linear-gradient(145deg, rgba(27, 39, 54, .95), rgba(13, 20, 31, .95));
      color: var(--mint);
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      touch-action: manipulation;
    }
    .direction-button:hover { border-color: rgba(184, 243, 107, .5); }
    .direction-button.up { grid-column: 2; grid-row: 1; }
    .direction-button.left { grid-column: 1; grid-row: 2; }
    .direction-button.down { grid-column: 2; grid-row: 2; }
    .direction-button.right { grid-column: 3; grid-row: 2; }

    .footnote {
      display: flex;
      align-items: flex-start;
      gap: 9px;
      margin: 15px 2px 0;
      color: var(--dim);
      font-size: 9px;
      line-height: 1.65;
    }
    .footnote-mark { color: var(--mint); }
    .footer {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      margin-top: 19px;
      padding-top: 15px;
      border-top: 1px solid var(--border);
      color: #647287;
      font-size: 8px;
      letter-spacing: .08em;
    }

    @media (max-width: 520px) {
      .page { width: min(100% - 28px, 440px); }
      .topbar { min-height: 64px; }
      .brand-mark { font-size: 22px; }
      .brand-name { font-size: 9px; }
      .back-link, .language-button { min-height: 38px; padding-inline: 10px; font-size: 10px; }
      .intro { padding-top: 26px; }
      .game-card { padding: 11px; border-radius: 9px; }
      .stats { gap: 6px; margin-bottom: 10px; }
      .stat { padding: 9px 8px; }
      .stat-label { font-size: 7px; letter-spacing: .1em; }
      .stat-value { font-size: 19px; }
      .game-actions { gap: 6px; margin-top: 10px; }
      .action-button { min-height: 47px; padding-inline: 5px; font-size: 10px; }
      .under-board { align-items: center; flex-direction: column-reverse; gap: 13px; margin-top: 14px; }
      .control-pad { grid-template-columns: repeat(3, 66px); grid-template-rows: repeat(2, 56px); gap: 6px; }
      .direction-button { min-height: 54px; font-size: 23px; }
      .help { width: 100%; text-align: center; }
      .desktop-hint { display: none; }
      .mobile-hint { display: inline; }
    }
    @media (max-width: 360px) {
      .page { width: calc(100% - 20px); }
      .brand { gap: 7px; }
      .brand-name { letter-spacing: .12em; }
      .back-link { gap: 5px; padding-inline: 8px; }
      .control-pad { grid-template-columns: repeat(3, 60px); grid-template-rows: repeat(2, 53px); }
      .direction-button { min-height: 51px; }
    }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
    }
