    :root {
      color-scheme: dark;
      --bg: #181724;
      --bg-alt: #241b38;
      --panel: rgba(35, 28, 55, 0.84);
      --panel-2: rgba(44, 44, 68, 0.92);
      --border: rgba(119, 168, 255, 0.24);
      --border-strong: rgba(119, 168, 255, 0.42);
      --text: #ece7ff;
      --muted: #beb5de;
      --accent: #77a8ff;
      --accent-2: #a335ee;
      --accent-3: #f7d47f;
      --danger: #ff7a96;
      --success: #7ef3ce;
      --shadow: rgba(0, 0, 0, 0.34);
      --shadow-strong: rgba(0, 0, 0, 0.54);
    }

    * {
      box-sizing: border-box;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      min-height: 100vh;
      background:
        radial-gradient(circle at top right, rgba(128, 0, 255, 0.22), transparent 24%),
        radial-gradient(circle at top left, rgba(0, 112, 221, 0.18), transparent 20%),
        radial-gradient(circle at bottom center, rgba(247, 212, 127, 0.08), transparent 20%),
        linear-gradient(180deg, var(--bg-alt), var(--bg));
      color: var(--text);
      font-family: "Inter", sans-serif;
    }

    ::selection {
      background: #002a50;
      color: var(--accent-3);
    }

    a {
      color: var(--accent);
      text-decoration: none;
    }

    a:hover {
      color: var(--accent-3);
    }

    button {
      font: inherit;
    }

    .shell {
      width: min(1600px, calc(100vw - 24px));
      max-width: 1600px;
      margin: 0 auto;
      padding: 40px 18px 72px;
    }

    .back-link {
      display: inline-block;
      margin-bottom: 18px;
      color: var(--accent-3);
      font: 700 0.92rem/1 "Fira Code", monospace;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .hero {
      display: grid;
      gap: 10px;
      margin-bottom: 24px;
    }

    .eyebrow {
      color: var(--accent-3);
      font: 700 0.9rem/1 "Fira Code", monospace;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    h1 {
      margin: 0;
      font-size: clamp(2.5rem, 6vw, 4.4rem);
      line-height: 0.95;
    }

    .lead {
      max-width: 900px;
      margin: 0;
      color: var(--muted);
      font-size: 1.03rem;
      line-height: 1.7;
    }

    .layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
      gap: 18px;
      align-items: start;
    }

    .game-card,
    .sidebar-card {
      border: 1px solid var(--border);
      border-radius: 24px;
      background: linear-gradient(180deg, rgba(35, 28, 55, 0.96), rgba(44, 44, 68, 0.98));
      box-shadow: 0 20px 42px var(--shadow);
    }

    .game-card {
      overflow: hidden;
    }

    .game-toolbar {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      gap: 14px;
      padding: 18px;
      border-bottom: 1px solid rgba(119, 168, 255, 0.14);
      background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent),
        rgba(24, 22, 35, 0.46);
    }

    .toolbar-cluster {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .hud-pill {
      min-width: 92px;
      padding: 10px 12px;
      border-radius: 16px;
      border: 1px solid rgba(119, 168, 255, 0.18);
      background: rgba(17, 16, 30, 0.5);
    }

    .hud-pill span {
      display: block;
      color: var(--muted);
      font: 700 0.74rem/1.1 "Fira Code", monospace;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      margin-bottom: 6px;
    }

    .hud-pill strong {
      display: block;
      color: var(--text);
      font-size: 1rem;
      font-weight: 800;
    }

    .toolbar-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .button {
      border: 1px solid rgba(119, 168, 255, 0.22);
      border-radius: 999px;
      background: rgba(17, 16, 30, 0.7);
      color: var(--text);
      padding: 12px 16px;
      font-weight: 700;
      cursor: pointer;
      transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
    }

    .button:hover,
    .button:focus-visible {
      transform: translateY(-1px);
      border-color: var(--border-strong);
      background: rgba(35, 28, 55, 0.92);
      outline: none;
    }

    .button.primary {
      color: #141222;
      background: linear-gradient(135deg, var(--accent-3), #ffe5a3);
      border-color: rgba(247, 212, 127, 0.38);
      box-shadow: 0 10px 28px rgba(247, 212, 127, 0.24);
    }

    .button.primary:hover,
    .button.primary:focus-visible {
      background: linear-gradient(135deg, #ffe29a, #fff0c0);
    }

    .button.level-ready {
      color: #141222;
      background: linear-gradient(135deg, var(--accent-3), #ffe5a3);
      border-color: rgba(247, 212, 127, 0.38);
      box-shadow: 0 10px 28px rgba(247, 212, 127, 0.24);
    }

    .button.level-ready:hover,
    .button.level-ready:focus-visible {
      background: linear-gradient(135deg, #ffe29a, #fff0c0);
    }

    .button.danger {
      color: #ffd2d8;
      background: linear-gradient(135deg, rgba(112, 22, 34, 0.74), rgba(58, 18, 28, 0.9));
      border-color: rgba(255, 122, 150, 0.34);
      box-shadow: 0 10px 24px rgba(255, 80, 112, 0.12);
    }

    .button.danger:hover,
    .button.danger:focus-visible {
      border-color: rgba(255, 122, 150, 0.58);
      background: linear-gradient(135deg, rgba(142, 30, 46, 0.82), rgba(72, 20, 32, 0.96));
    }

    .button.alt {
      background: linear-gradient(135deg, rgba(119, 168, 255, 0.16), rgba(163, 53, 238, 0.2));
    }

    .button.toggle-active {
      color: #141222;
      background: linear-gradient(135deg, #7ef3ce, #d7fff1);
      border-color: rgba(126, 243, 206, 0.42);
      box-shadow: 0 10px 24px rgba(126, 243, 206, 0.18);
    }

    .button.small {
      padding: 8px 11px;
      border-radius: 12px;
      font-size: 0.76rem;
      letter-spacing: 0.03em;
    }

    .button[disabled] {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
    }

    .debug-toolbar {
      display: grid;
      grid-template-columns: minmax(150px, 220px) auto;
      gap: 8px;
      align-items: center;
    }

    .debug-toolbar .control-select {
      padding: 11px 12px;
      border-radius: 999px;
      font-size: 0.88rem;
    }

    .toolbar-debug-note {
      grid-column: 1 / -1;
      max-width: 300px;
      margin: -2px 0 0;
      font-size: 0.74rem;
      line-height: 1.25;
    }

    .control-select {
      width: 100%;
      border: 1px solid rgba(119, 168, 255, 0.22);
      border-radius: 14px;
      background: rgba(17, 16, 30, 0.72);
      color: var(--text);
      padding: 12px 14px;
      font: inherit;
    }

    .control-select:focus-visible {
      outline: none;
      border-color: var(--border-strong);
      box-shadow: 0 0 0 2px rgba(119, 168, 255, 0.16);
    }

    .debug-note {
      margin: 12px 0 0;
      color: var(--muted);
      font-size: 0.92rem;
      line-height: 1.5;
    }

    .debug-note.toolbar-debug-note {
      margin: -2px 0 0;
      font-size: 0.74rem;
      line-height: 1.25;
    }

    .canvas-shell {
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 16px;
      background:
        radial-gradient(circle at top, rgba(119, 168, 255, 0.08), transparent 30%),
        rgba(9, 10, 20, 0.72);
    }

    canvas {
      display: block;
      width: min(100%, 1240px);
      height: min(72vh, 860px);
      min-height: 420px;
      border-radius: 24px;
      border: 1px solid rgba(119, 168, 255, 0.18);
      background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.035), transparent 58%),
        linear-gradient(180deg, rgba(10, 11, 22, 0.98), rgba(5, 7, 14, 0.98));
      box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 30px 64px rgba(0, 0, 0, 0.34);
      touch-action: none;
    }

    canvas:fullscreen {
      width: 100vw;
      height: 100vh;
      min-height: 100vh;
      border-radius: 0;
      border: none;
      box-shadow: none;
      background: #05070d;
    }

    .canvas-shell:fullscreen {
      width: 100vw;
      height: 100vh;
      padding: 0;
      background: #000;
    }

    .canvas-shell:fullscreen canvas {
      width: 100vw;
      height: 100vh;
      min-height: 100vh;
      border-radius: 0;
      border: none;
      box-shadow: none;
    }

    .mobile-control-layer {
      display: none;
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }

    .mobile-stick,
    .mobile-quick-button,
    .mobile-exit-fullscreen {
      pointer-events: auto;
      touch-action: none;
      -webkit-user-select: none;
      user-select: none;
    }

    .mobile-stick {
      position: absolute;
      bottom: max(18px, env(safe-area-inset-bottom));
      width: 112px;
      height: 112px;
      border: 1px solid rgba(119, 168, 255, 0.26);
      border-radius: 50%;
      background:
        radial-gradient(circle, rgba(119, 168, 255, 0.12), rgba(17, 16, 30, 0.34) 62%, rgba(17, 16, 30, 0.16));
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 12px 28px rgba(0, 0, 0, 0.28);
      --knob-x: 0px;
      --knob-y: 0px;
    }

    .mobile-stick::before {
      content: "";
      position: absolute;
      inset: 34px;
      border-radius: 50%;
      border: 1px solid rgba(236, 231, 255, 0.18);
    }

    .mobile-stick::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: rgba(236, 231, 255, 0.76);
      box-shadow: 0 0 18px rgba(119, 168, 255, 0.24);
      transform: translate(calc(-50% + var(--knob-x)), calc(-50% + var(--knob-y)));
    }

    .mobile-move-stick {
      left: max(18px, env(safe-area-inset-left));
    }

    .mobile-aim-stick {
      right: max(18px, env(safe-area-inset-right));
    }

    .mobile-quick-button,
    .mobile-exit-fullscreen {
      position: absolute;
      border: 1px solid rgba(119, 168, 255, 0.26);
      border-radius: 999px;
      background: rgba(17, 16, 30, 0.64);
      color: var(--text);
      min-width: 62px;
      min-height: 44px;
      padding: 9px 13px;
      font-size: 0.78rem;
      font-weight: 800;
      box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
    }

    .mobile-dash-button {
      right: max(26px, calc(env(safe-area-inset-right) + 8px));
      bottom: calc(max(18px, env(safe-area-inset-bottom)) + 122px);
    }

    .mobile-level-button {
      left: 50%;
      bottom: max(20px, env(safe-area-inset-bottom));
      transform: translateX(-50%);
    }

    .mobile-level-button[hidden] {
      display: none;
    }

    .canvas-shell.draft-open .mobile-stick,
    .canvas-shell.draft-open .mobile-quick-button {
      display: none;
    }

    .mobile-exit-fullscreen {
      display: none;
      top: max(12px, env(safe-area-inset-top));
      right: max(12px, env(safe-area-inset-right));
      z-index: 6;
    }

    .overlay,
    .draft-panel {
      position: absolute;
      inset: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 24px;
      border-radius: 24px;
      background: rgba(8, 10, 18, 0.58);
      transition: opacity 160ms ease, visibility 160ms ease;
      z-index: 4;
      overflow: hidden;
    }

    .canvas-shell:fullscreen .mobile-control-layer {
      z-index: 6;
    }

    .overlay.hidden,
    .draft-panel.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    .overlay-card,
    .draft-card {
      width: min(780px, 100%);
      max-height: 100%;
      padding: 28px;
      border-radius: 24px;
      border: 1px solid rgba(119, 168, 255, 0.18);
      background: linear-gradient(180deg, rgba(19, 20, 33, 0.95), rgba(31, 24, 45, 0.94));
      box-shadow: 0 24px 60px var(--shadow-strong);
      text-align: center;
    }

    .draft-card {
      display: flex;
      flex-direction: column;
      min-height: 0;
      overflow: hidden;
    }

    .overlay-kicker {
      margin: 0 0 10px;
      color: var(--accent-3);
      font: 700 0.82rem/1 "Fira Code", monospace;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .overlay-card h2,
    .draft-card h2 {
      margin: 0 0 10px;
      font-size: clamp(1.9rem, 5vw, 2.6rem);
    }

    .overlay-copy {
      margin: 0 0 18px;
      color: var(--muted);
      line-height: 1.7;
    }

    .draft-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 12px;
      margin-top: 18px;
      text-align: left;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      padding-right: 4px;
    }

    .draft-actions {
      display: flex;
      gap: 8px;
      flex: 0 0 auto;
      justify-content: flex-end;
      margin-top: 14px;
    }

    .draft-option {
      padding: 16px;
      border-radius: 18px;
      border: 1px solid rgba(119, 168, 255, 0.18);
      background: rgba(17, 16, 30, 0.74);
      color: var(--text);
      cursor: pointer;
      transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
    }

    .draft-option:hover,
    .draft-option:focus-visible {
      transform: translateY(-2px);
      border-color: var(--border-strong);
      background: rgba(35, 28, 55, 0.94);
      outline: none;
    }

    .draft-type {
      display: inline-block;
      margin-bottom: 10px;
      color: var(--accent-3);
      font: 700 0.72rem/1 "Fira Code", monospace;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .draft-option strong {
      display: block;
      margin-bottom: 8px;
      font-size: 1rem;
    }

    .draft-option span {
      display: block;
      color: var(--muted);
      font-size: 0.94rem;
      line-height: 1.55;
    }

    .sidebar {
      display: grid;
      gap: 18px;
    }

    .sidebar-card {
      padding: 20px;
    }

    .sidebar-card h2 {
      margin: 0 0 10px;
      font-size: 1.08rem;
    }

    .loadout-card {
      display: block;
    }

    .loadout-summary {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin: 0;
      color: var(--text);
      font-size: 1.08rem;
      font-weight: 800;
      cursor: pointer;
      list-style: none;
    }

    .loadout-summary::-webkit-details-marker {
      display: none;
    }

    .loadout-summary::after {
      content: "Show";
      color: var(--accent-3);
      font: 700 0.72rem/1 "Fira Code", monospace;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    .loadout-card[open] .loadout-summary {
      margin-bottom: 10px;
    }

    .loadout-card[open] .loadout-summary::after {
      content: "Hide";
    }

    .sidebar-card p {
      margin: 0;
      color: var(--muted);
      line-height: 1.6;
    }

    .sidebar-card ul {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
      line-height: 1.6;
    }

    .stat-grid {
      display: grid;
      gap: 10px;
    }

    .stat-row {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 12px;
      padding-bottom: 10px;
      border-bottom: 1px solid rgba(119, 168, 255, 0.1);
    }

    .stat-row:last-child {
      padding-bottom: 0;
      border-bottom: 0;
    }

    .stat-row span {
      color: var(--muted);
      font-size: 0.92rem;
    }

    .stat-row strong {
      color: var(--text);
      font-weight: 800;
      text-align: right;
    }

    .loadout-group + .loadout-group {
      margin-top: 16px;
    }

    .loadout-group h3 {
      margin: 0 0 10px;
      color: var(--accent-3);
      font: 700 0.78rem/1 "Fira Code", monospace;
      letter-spacing: 0.06em;
      text-transform: uppercase;
    }

    .loadout-list {
      display: grid;
      gap: 8px;
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .loadout-list li {
      padding: 10px 12px;
      border-radius: 14px;
      background: rgba(17, 16, 30, 0.46);
      color: var(--muted);
      font-size: 0.93rem;
      line-height: 1.5;
    }

    .loadout-entry {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .remove-loadout {
      flex: 0 0 auto;
      width: 26px;
      height: 26px;
      border: 1px solid rgba(255, 122, 122, 0.26);
      border-radius: 50%;
      background: rgba(255, 92, 92, 0.1);
      color: #ffd2d8;
      cursor: pointer;
      font: 800 0.8rem/1 "Inter", sans-serif;
    }

    .remove-loadout:hover,
    .remove-loadout:focus-visible {
      border-color: rgba(255, 122, 122, 0.48);
      background: rgba(255, 92, 92, 0.2);
      outline: none;
    }

    .controls-strip {
      grid-column: 1 / -1;
      padding: 16px 18px;
      border: 1px solid var(--border);
      border-radius: 24px;
      background: linear-gradient(180deg, rgba(35, 28, 55, 0.9), rgba(44, 44, 68, 0.94));
      box-shadow: 0 20px 42px var(--shadow);
    }

    .controls-strip h2 {
      margin: 0 0 12px;
      font-size: 1.08rem;
    }

    .controls-list {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .controls-list li,
    .control-touch-note {
      padding: 8px 10px;
      border-radius: 12px;
      background: rgba(17, 16, 30, 0.46);
      color: var(--muted);
      font-size: 0.9rem;
      line-height: 1.35;
    }

    .control-touch-note {
      margin: 10px 0 0;
      color: var(--accent-3);
    }

    @media (max-width: 1100px) {
      .layout {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 720px) {
      .shell {
        width: 100vw;
        padding: 8px 6px 28px;
      }

      .back-link {
        margin-bottom: 8px;
        font-size: 0.72rem;
      }

      .hero {
        gap: 5px;
        margin-bottom: 10px;
      }

      .eyebrow {
        font-size: 0.68rem;
      }

      h1 {
        font-size: 1.95rem;
      }

      .lead {
        display: none;
      }

      .layout,
      .sidebar {
        gap: 8px;
      }

      .game-card,
      .sidebar-card {
        border-radius: 14px;
      }

      .game-toolbar {
        padding: 7px;
        gap: 7px;
      }

      .toolbar-cluster {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 5px;
      }

      .hud-pill {
        min-width: 0;
        padding: 6px 5px;
        border-radius: 9px;
      }

      .hud-pill span {
        margin-bottom: 3px;
        font-size: 0.52rem;
        letter-spacing: 0.02em;
      }

      .hud-pill strong {
        font-size: 0.72rem;
      }

      .toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
      }

      .debug-toolbar {
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 5px;
      }

      .debug-toolbar .control-select {
        min-width: 0;
        padding: 7px 8px;
        border-radius: 10px;
        font-size: 0.72rem;
      }

      .toolbar-debug-note {
        display: none;
      }

      .button,
      .button.small {
        min-height: 34px;
        padding: 7px 8px;
        border-radius: 10px;
        font-size: 0.72rem;
      }

      .canvas-shell {
        padding: 0;
      }

      canvas {
        width: 100%;
        height: 62vh;
        min-height: 360px;
        border-radius: 12px;
      }

      .overlay,
      .draft-panel {
        inset: 6px;
        padding: 6px;
        align-items: stretch;
      }

      .overlay-card,
      .draft-card {
        width: 100%;
        max-height: 100%;
        padding: 12px;
        border-radius: 14px;
      }

      .draft-card {
        text-align: left;
      }

      .overlay-kicker {
        margin-bottom: 6px;
        font-size: 0.62rem;
      }

      .overlay-card h2,
      .draft-card h2 {
        margin-bottom: 6px;
        font-size: clamp(1.15rem, 6vw, 1.45rem);
      }

      .overlay-copy {
        margin-bottom: 8px;
        font-size: 0.78rem;
        line-height: 1.35;
      }

      .draft-grid {
        grid-template-columns: 1fr;
        gap: 7px;
        margin-top: 8px;
      }

      .draft-option {
        padding: 9px;
        border-radius: 10px;
      }

      .draft-type {
        margin-bottom: 5px;
        font-size: 0.58rem;
      }

      .draft-option strong {
        margin-bottom: 4px;
        font-size: 0.84rem;
      }

      .draft-option span {
        font-size: 0.74rem;
        line-height: 1.32;
      }

      .draft-actions {
        justify-content: stretch;
        gap: 6px;
        margin-top: 8px;
      }

      .draft-actions .button {
        flex: 1 1 0;
        min-width: 0;
      }

      .sidebar-card {
        padding: 12px;
      }

      .controls-strip {
        padding: 12px;
        border-radius: 14px;
      }

      .controls-list {
        gap: 6px;
      }

      .controls-list li,
      .control-touch-note {
        width: 100%;
        padding: 7px 8px;
        border-radius: 10px;
        font-size: 0.78rem;
      }
    }

    @media (pointer: coarse), (max-width: 720px) {
      .canvas-shell.mobile-controls-active .mobile-control-layer,
      .canvas-shell:fullscreen .mobile-control-layer {
        display: block;
      }

      .canvas-shell:fullscreen:not(.mobile-controls-active) .mobile-stick,
      .canvas-shell:fullscreen:not(.mobile-controls-active) .mobile-quick-button {
        display: none;
      }

      .canvas-shell:fullscreen .mobile-exit-fullscreen {
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
    }

    @media (max-width: 430px) {
      .overlay,
      .draft-panel {
        inset: 4px;
        padding: 4px;
      }

      .draft-card {
        padding: 9px;
      }

      .draft-card h2 {
        font-size: 1.08rem;
      }

      .overlay-copy {
        font-size: 0.72rem;
      }

      .draft-grid {
        gap: 5px;
      }

      .draft-option {
        padding: 7px;
      }

      .draft-option span {
        font-size: 0.7rem;
      }

      .draft-actions {
        gap: 5px;
      }

      .draft-actions .button {
        padding-inline: 6px;
        font-size: 0.68rem;
      }

      .mobile-stick {
        width: 96px;
        height: 96px;
      }

      .mobile-stick::before {
        inset: 29px;
      }

      .mobile-stick::after {
        width: 36px;
        height: 36px;
      }

      .mobile-dash-button {
        bottom: calc(max(18px, env(safe-area-inset-bottom)) + 104px);
      }
    }
