:root {
      --bg: #040814;
      --panel: rgba(18, 26, 48, 0.92);
      --stroke: rgba(100, 170, 255, 0.45);
      --accent: #6cb6ff;
      --gold: #ffd76a;
      --mint: #5dffb4;
      --text: rgba(248, 252, 255, 0.95);
      --muted: rgba(180, 200, 230, 0.55);
      --glow: rgba(86, 167, 255, 0.35);
    }
    * { box-sizing: border-box; }
    html, body {
      margin: 0;
      min-height: 100%;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      background:
        radial-gradient(1200px 700px at 50% -20%, rgba(86, 140, 255, 0.18), transparent 55%),
        var(--bg);
      color: var(--text);
      font-family: "Segoe UI", system-ui, sans-serif;
    }
    body {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 10px 10px calc(10px + env(safe-area-inset-bottom, 0));
      gap: 6px;
    }
    /* Wenn der Hangar offen ist, soll die Seite nicht "wegscrollen". */
    body.phase-shop {
      overflow: hidden;
      height: 100dvh;
    }
    header {
      width: min(1920px, 100%);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .brand {
      display: flex;
      align-items: baseline;
      gap: 12px;
      flex-wrap: wrap;
    }
    h1 {
      margin: 0;
      font-size: clamp(0.9rem, 2.5vw, 1.05rem);
      letter-spacing: 0.18em;
      text-transform: uppercase;
      font-weight: 800;
      background: linear-gradient(90deg, #9ad0ff, #56a7ff);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }
    .upgrade-hud {
      font-size: clamp(0.75rem, 2.2vw, 0.88rem);
      color: var(--gold);
      font-weight: 700;
      letter-spacing: 0.04em;
    }
    .upgrade-hud strong { color: #fff; font-variant-numeric: tabular-nums; }
    .btn-skip {
      font: inherit;
      cursor: pointer;
      border-radius: 999px;
      border: 1px solid rgba(255, 215, 106, 0.5);
      background: rgba(255, 215, 106, 0.12);
      color: var(--gold);
      padding: 6px 14px;
      font-size: 0.72rem;
      font-weight: 700;
    }
    .btn-skip:disabled { opacity: 0.35; cursor: default; }
    .hud {
      display: flex;
      flex-wrap: wrap;
      gap: 6px 12px;
      font-size: clamp(0.68rem, 1.8vw, 0.8rem);
      color: var(--muted);
      align-items: center;
      justify-content: flex-end;
      flex: 1;
    }
    .hud strong { color: var(--accent); }
    .hud .gold { color: var(--gold); }
    .hud .tag {
      padding: 3px 9px;
      border-radius: 999px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      background: rgba(0, 0, 0, 0.35);
      font-size: 0.65rem;
    }
    .wave-pill {
      padding: 4px 10px;
      border-radius: 999px;
      background: rgba(86, 167, 255, 0.15);
      border: 1px solid rgba(86, 167, 255, 0.35);
      font-weight: 800;
      color: var(--accent);
      font-size: 0.72rem;
    }
    .gameRow {
      width: min(1920px, 100%);
      display: flex;
      flex-direction: column;
      position: relative;
      border-radius: 18px;
      overflow: hidden;
      border: 1px solid var(--stroke);
      box-shadow: 0 28px 100px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
      background: #000;
    }
    .canvasWrap {
      position: relative;
      width: 100%;
      aspect-ratio: 16 / 9;
      background: radial-gradient(ellipse at 30% 20%, rgba(30, 50, 100, 0.4), #000);
    }
    .topGameBar {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 6;
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: flex-end;
      pointer-events: auto;
    }
    .hdrBtn {
      font: inherit;
      cursor: pointer;
      border-radius: 10px;
      border: 1px solid rgba(100, 170, 255, 0.45);
      background: rgba(4, 8, 20, 0.75);
      color: var(--text);
      padding: 6px 12px;
      font-size: 0.65rem;
      font-weight: 800;
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }
    .hdrBtn:hover { border-color: rgba(154, 208, 255, 0.75); }
    .pauseOverlay .card h2 { margin: 0 0 10px; font-size: 0.95rem; letter-spacing: 0.2em; color: var(--gold); }
    .voiceBubble {
      position: absolute;
      left: 50%;
      bottom: 11%;
      transform: translateX(-50%);
      max-width: min(760px, 92%);
      padding: 10px 18px;
      border-radius: 14px;
      border: 1px solid rgba(100, 170, 255, 0.4);
      background: rgba(6, 12, 28, 0.88);
      color: rgba(230, 240, 255, 0.95);
      font-size: clamp(0.72rem, 2vw, 0.88rem);
      font-weight: 700;
      line-height: 1.35;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
      z-index: 9;
      pointer-events: none;
      transition: opacity 0.25s ease, bottom 0.35s ease;
    }
    /* Wärmeleiste (Strahl) sichtbar: Tower-Text höher, damit nichts überlappt */
    .canvasWrap.canvasWrap--strahlHud .voiceBubble {
      bottom: clamp(26%, 22vh, 38%);
    }
    .voiceBubble[hidden] { display: none !important; }
    .voiceBubble .who {
      display: block;
      font-size: 0.58rem;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: var(--gold);
      margin-bottom: 4px;
      opacity: 0.85;
    }
    .comboStage {
      position: absolute;
      left: 50%;
      top: 10px;
      transform: translateX(-50%);
      z-index: 8;
      width: min(92%, 720px);
      pointer-events: none;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 2px;
      filter: drop-shadow(0 0 22px rgba(255, 215, 106, 0.35));
    }
    .comboStage[hidden] {
      display: none !important;
    }
    .comboStage .comboLabel {
      font-size: clamp(0.55rem, 1.6vw, 0.72rem);
      font-weight: 900;
      letter-spacing: 0.55em;
      color: rgba(255, 230, 180, 0.92);
      text-shadow: 0 0 18px rgba(255, 200, 120, 0.9);
    }
    .comboStage .comboBigNum {
      font-size: clamp(2.1rem, 9vw, 4.8rem);
      font-weight: 900;
      line-height: 0.95;
      background: linear-gradient(185deg, #fff9e6, #ffd76a 40%, #ff9d3d 78%, #ff6a4d);
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      text-shadow: none;
      filter: drop-shadow(0 0 28px rgba(255, 180, 80, 0.85));
      transform-origin: 50% 60%;
      will-change: transform;
    }
    .comboStage .comboBar {
      width: min(88%, 420px);
      height: 7px;
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid rgba(255, 215, 106, 0.35);
      overflow: hidden;
      margin-top: 4px;
    }
    .comboStage .comboBar > span {
      display: block;
      height: 100%;
      width: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #56a7ff, #ffd76a, #ff6a4d);
      transform-origin: 0 50%;
      transition: width 0.08s linear;
      box-shadow: 0 0 14px rgba(255, 200, 120, 0.65);
    }
    .comboStage--hot .comboBigNum {
      animation: comboGlowPulse 0.42s ease-in-out infinite;
    }
    .comboStage--mega {
      animation: comboStageShake 0.11s linear infinite;
    }
    .comboStage--mega .comboBigNum {
      animation: comboGlowPulse 0.3s ease-in-out infinite;
    }
    .comboStage--insane {
      animation: comboStageShake 0.07s linear infinite;
    }
    .comboStage--insane .comboBigNum {
      animation: comboGlowPulse 0.22s ease-in-out infinite;
    }
    @keyframes comboGlowPulse {
      0%,
      100% {
        filter: drop-shadow(0 0 18px rgba(255, 200, 100, 0.75)) brightness(1);
        transform: scale(1);
      }
      50% {
        filter: drop-shadow(0 0 42px rgba(255, 230, 160, 1)) brightness(1.12);
        transform: scale(1.04);
      }
    }
    @keyframes comboStageShake {
      0% {
        transform: translateX(-50%) translateY(0) rotate(0deg);
      }
      25% {
        transform: translateX(calc(-50% + 2px)) translateY(-1px) rotate(-0.4deg);
      }
      50% {
        transform: translateX(calc(-50% - 2px)) translateY(1px) rotate(0.35deg);
      }
      75% {
        transform: translateX(calc(-50% + 1px)) translateY(1px) rotate(-0.2deg);
      }
      100% {
        transform: translateX(-50%) translateY(0) rotate(0deg);
      }
    }
    .modHint { margin-top: 4px !important; }
    canvas {
      display: block;
      width: 100%;
      height: 100%;
      touch-action: none;
    }
    .overlay {
      position: absolute;
      inset: 0;
      display: block;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      padding: 16px 12px 28px;
      background: rgba(4, 8, 20, 0.88);
      backdrop-filter: blur(12px);
      text-align: center;
    }
    .overlay .card {
      margin-left: auto;
      margin-right: auto;
    }
    .overlay[hidden] { display: none !important; }
    .card {
      max-width: 460px;
      max-height: min(92vh, 880px);
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      padding: 22px 22px;
      border-radius: 20px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      background: var(--panel);
      box-shadow: 0 0 40px var(--glow);
    }
    .card p, .card ul {
      margin: 0 0 10px;
      color: var(--muted);
      font-size: 0.87rem;
      line-height: 1.55;
      text-align: left;
    }
    .card ul { padding-left: 1.15rem; }
    .btn-primary {
      font: inherit;
      cursor: pointer;
      border-radius: 14px;
      border: none;
      background: linear-gradient(135deg, #56a7ff, #3d7ec9);
      color: #061018;
      padding: 14px 28px;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      font-size: 0.72rem;
      box-shadow: 0 8px 28px rgba(86, 167, 255, 0.35);
    }
    .btn-secondary {
      margin-top: 10px;
      font: inherit;
      cursor: pointer;
      border-radius: 12px;
      border: 1px solid rgba(255, 255, 255, 0.2);
      background: transparent;
      color: var(--text);
      padding: 10px 20px;
      font-size: 0.75rem;
    }
    .shop {
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      padding: 0 18px;
      border-top: 1px solid transparent;
      background:
        radial-gradient(900px 200px at 50% 0%, rgba(255, 215, 106, 0.12), transparent 55%),
        linear-gradient(185deg, rgba(14, 20, 42, 0.99), rgba(4, 6, 16, 0.995));
      transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, padding 0.4s ease, border-color 0.35s;
    }
    body.phase-shop .shop {
      /* Shop als Overlay über dem Spiel (kein Scrollen nach unten nötig). */
      position: absolute;
      inset: 0;
      z-index: 10;

      max-height: none;
      height: 100%;
      overflow-y: auto;
      overflow-x: hidden;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      opacity: 1;

      /* Extra bottom padding, damit man trotz mittigem "Weiter" bis zum Ende scrollen kann */
      padding: 20px 18px 180px;
      border-top-color: rgba(255, 215, 106, 0.55);
      box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 18px 70px rgba(0, 0, 0, 0.75);
    }
    .shopHead {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-start;
      justify-content: space-between;
      gap: 14px;
      margin-bottom: 18px;
      padding-bottom: 16px;
      border-bottom: 1px solid rgba(100, 170, 255, 0.2);
    }
    .shopHead h2 {
      margin: 0 0 6px;
      font-size: clamp(0.82rem, 2.2vw, 1rem);
      letter-spacing: 0.26em;
      text-transform: uppercase;
      color: var(--gold);
      text-shadow: 0 0 32px rgba(255, 215, 106, 0.35);
    }
    .shopSub {
      margin: 0;
      max-width: min(520px, 100%);
      font-size: 0.74rem;
      color: var(--muted);
      line-height: 1.5;
    }
    .shopCreditsPill {
      flex-shrink: 0;
      padding: 10px 18px 10px 16px;
      border-radius: 999px;
      border: 1px solid rgba(93, 255, 180, 0.45);
      background: linear-gradient(135deg, rgba(20, 60, 48, 0.9), rgba(8, 22, 32, 0.95));
      box-shadow: 0 0 24px rgba(93, 255, 180, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
      font-weight: 900;
      font-size: clamp(0.95rem, 3vw, 1.15rem);
      color: var(--mint);
      letter-spacing: 0.04em;
    }
    .shopCreditsPill small {
      font-size: 0.62em;
      opacity: 0.75;
      margin-left: 2px;
    }
    .shopGrid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
      gap: 12px 14px;
    }
    .shopLayout {
      display: grid;
      grid-template-columns: 1fr;
      gap: 14px;
    }
    @media (min-width: 980px) {
      .shopLayout { grid-template-columns: 1.35fr 0.65fr; align-items: start; }
    }
    .shopControls {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
      margin: 6px 0 14px;
      padding-bottom: 12px;
      border-bottom: 1px solid rgba(100, 170, 255, 0.18);
    }
    .shopChip {
      font: inherit;
      cursor: pointer;
      border-radius: 999px;
      border: 1px solid rgba(100, 170, 255, 0.35);
      background: rgba(30, 45, 80, 0.42);
      color: var(--text);
      padding: 8px 14px;
      font-size: 0.68rem;
      font-weight: 900;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
    }
    .shopChip:hover { transform: translateY(-1px); border-color: rgba(154, 208, 255, 0.7); }
    .shopChip[aria-pressed="true"] {
      background: linear-gradient(135deg, rgba(86, 167, 255, 0.38), rgba(93, 255, 180, 0.18));
      border-color: rgba(180, 255, 220, 0.65);
      box-shadow: 0 10px 26px rgba(86, 167, 255, 0.12);
    }
    .shopSectionTitle {
      grid-column: 1 / -1;
      margin: 8px 0 0;
      font-size: 0.65rem;
      font-weight: 900;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: rgba(200, 220, 255, 0.8);
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .shopSectionTitle::after {
      content: "";
      height: 1px;
      flex: 1;
      background: linear-gradient(90deg, rgba(154, 208, 255, 0.35), transparent);
      opacity: 0.85;
    }
    .shopCard--selected {
      border-color: rgba(255, 215, 106, 0.6);
      box-shadow:
        0 18px 46px rgba(255, 215, 106, 0.12),
        0 10px 28px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
      transform: translateY(-2px);
    }
    .shopCard-priceRow {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 10px;
      margin-top: auto;
      padding-top: 8px;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .shopCard-price {
      margin-top: 0;
      padding-top: 0;
      border-top: none;
    }
    .shopCard-state {
      font-size: 0.62rem;
      font-weight: 900;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      opacity: 0.9;
      color: rgba(200, 220, 255, 0.75);
    }
    .shopCard-state--buy { color: rgba(93, 255, 180, 0.95); }
    .shopCard-state--poor { color: rgba(255, 160, 90, 0.95); }
    .shopCard-state--max { color: rgba(200, 200, 220, 0.8); }

    /* Shop simplifiziert: kein Detail-Panel, Kauf direkt per Klick auf Karte */
    .shopDetail { display: none !important; }
    .shopDetailTag {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      font-size: 0.58rem;
      font-weight: 900;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      padding: 4px 10px;
      border-radius: 999px;
      border: 1px solid rgba(154, 208, 255, 0.3);
      background: rgba(0, 0, 0, 0.28);
      color: rgba(200, 220, 255, 0.9);
      margin-bottom: 10px;
    }
    .shopDetailTitle {
      margin: 0 0 10px;
      font-size: 1rem;
      font-weight: 1000;
      letter-spacing: 0.02em;
      color: #f4f8ff;
    }
    .shopDetailText {
      margin: 0 0 12px;
      font-size: 0.72rem;
      line-height: 1.55;
      color: rgba(180, 200, 230, 0.9);
    }
    .shopDetailMeta {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 0 0 14px;
      color: rgba(200, 220, 255, 0.8);
      font-size: 0.68rem;
      font-weight: 800;
    }
    .shopDetailMeta span {
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(0, 0, 0, 0.22);
      padding: 6px 10px;
      border-radius: 999px;
    }
    .shopBuyBtn {
      width: 100%;
      font: inherit;
      cursor: pointer;
      padding: 14px 16px;
      border-radius: 16px;
      border: 2px solid rgba(93, 255, 180, 0.55);
      background: linear-gradient(165deg, rgba(50, 120, 95, 0.95), rgba(18, 48, 42, 0.98));
      color: #e8fff4;
      font-weight: 900;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      box-shadow: 0 0 40px rgba(93, 255, 180, 0.18), 0 14px 40px rgba(0, 0, 0, 0.45);
      transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
    }
    .shopBuyBtn:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(180, 255, 220, 0.85); }
    .shopBuyBtn:active:not(:disabled) { transform: translateY(1px) scale(0.99); }
    .shopBuyBtn:disabled { opacity: 0.42; cursor: not-allowed; filter: grayscale(0.3); }
    .shopCard {
      position: relative;
      width: 100%;
      margin: 0;
      padding: 0;
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 16px;
      cursor: pointer;
      text-align: left;
      font: inherit;
      color: var(--text);
      background: linear-gradient(155deg, rgba(38, 52, 92, 0.96), rgba(12, 16, 36, 0.98));
      box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.07);
      transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
      overflow: hidden;
      min-height: 118px;
    }
    .shopCard::before {
      content: "";
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 4px;
      border-radius: 16px 0 0 16px;
      background: linear-gradient(180deg, rgba(154, 208, 255, 0.85), rgba(86, 167, 255, 0.35));
    }
    .shopCard--rare::before {
      background: linear-gradient(180deg, #c9a8ff, #7b5cff);
    }
    .shopCard--epic::before {
      background: linear-gradient(180deg, #ffe8a8, #ff9d4d);
    }
    .shopCard-inner {
      padding: 12px 14px 12px 16px;
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-height: 118px;
    }
    .shopCard-tag {
      align-self: flex-start;
      font-size: 0.52rem;
      font-weight: 900;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      padding: 3px 8px;
      border-radius: 6px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid rgba(154, 208, 255, 0.35);
      color: rgba(200, 220, 255, 0.9);
    }
    .shopCard--rare .shopCard-tag {
      border-color: rgba(180, 140, 255, 0.55);
      color: #e8d8ff;
    }
    .shopCard--epic .shopCard-tag {
      border-color: rgba(255, 200, 120, 0.65);
      color: #ffe8c8;
    }
    .shopCard-title {
      font-size: clamp(0.68rem, 1.7vw, 0.8rem);
      font-weight: 900;
      letter-spacing: 0.04em;
      line-height: 1.25;
      color: #f4f8ff;
    }
    .shopCard-detail {
      flex: 1;
      font-size: 0.62rem;
      font-weight: 600;
      line-height: 1.4;
      color: rgba(180, 200, 230, 0.88);
    }
    .shopCard-price {
      margin-top: auto;
      padding-top: 8px;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      font-size: 0.78rem;
      font-weight: 900;
      color: var(--gold);
      letter-spacing: 0.06em;
    }
    .shopCard:hover:not(:disabled) {
      transform: translateY(-3px);
      box-shadow:
        0 16px 40px rgba(86, 167, 255, 0.2),
        0 10px 28px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    .shopCard:disabled {
      opacity: 0.4;
      cursor: not-allowed;
      transform: none;
      filter: grayscale(0.35);
    }
    .shopCard:disabled .shopCard-price { color: rgba(255, 215, 106, 0.45); }
    .shopContinueBar {
      display: flex;
      justify-content: center;
      align-items: center;
      margin-top: 0;
      padding-top: 0;
      border-top: none;
    }
    .shopContinueBar[hidden] {
      display: none !important;
    }
    body.phase-shop .shopContinueBar {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      z-index: 6;
      width: min(92%, 640px);
      pointer-events: none;
    }
    body.phase-shop .shopContinueBar > * {
      pointer-events: auto;
    }
    .btn-shop-continue {
      font: inherit;
      cursor: pointer;
      min-width: min(92%, 520px);
      padding: 18px 32px;
      border-radius: 18px;
      border: 2px solid rgba(93, 255, 180, 0.55);
      background: linear-gradient(165deg, rgba(50, 120, 95, 0.95), rgba(18, 48, 42, 0.98));
      color: #e8fff4;
      font-weight: 900;
      font-size: clamp(1rem, 3.2vw, 1.35rem);
      letter-spacing: 0.28em;
      text-transform: uppercase;
      box-shadow:
        0 0 40px rgba(93, 255, 180, 0.22),
        0 14px 40px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
      transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    }
    .btn-shop-continue:hover {
      transform: scale(1.02);
      border-color: rgba(180, 255, 220, 0.85);
      box-shadow:
        0 0 52px rgba(93, 255, 180, 0.35),
        0 18px 48px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.16);
    }
    .btn-shop-continue:active {
      transform: scale(0.98);
    }
    .touch {
      display: none;
      width: min(1920px, 100%);
      grid-template-columns: repeat(4, 1fr);
      gap: 8px;
    }
    @media (max-width: 900px) {
      .touch { display: grid; }
    }
    .touch button {
      padding: 14px;
      font-size: 0.62rem;
      min-height: 50px;
      border-radius: 12px;
      border: 1px solid rgba(154, 208, 255, 0.35);
      background: rgba(30, 45, 80, 0.9);
      color: var(--text);
      font-weight: 800;
    }
    footer { font-size: 0.76rem; color: var(--muted); }
    footer a { color: rgba(154, 208, 255, 0.95); }
    kbd {
      padding: 2px 6px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(0, 0, 0, 0.35);
      font-size: 0.72em;
    }
    .toastHost {
      position: absolute;
      top: 8%;
      left: 50%;
      transform: translateX(-50%);
      pointer-events: none;
      z-index: 4;
    }
    .toast {
      font: 800 clamp(0.8rem, 2.2vw, 1.05rem) system-ui, sans-serif;
      color: #fff;
      text-shadow: 0 0 24px rgba(86, 167, 255, 0.9);
      opacity: 0;
      transition: opacity 0.35s ease;
    }
    .toast.show { opacity: 1; }
    .soundRow {
      width: min(1920px, 100%);
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 8px;
      font-size: 0.72rem;
      color: var(--muted);
    }
    .soundRow label { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
    .difficultyRow {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: center;
      gap: 8px;
      margin: 14px 0 6px;
    }
    .difficultyRow span {
      font-size: 0.68rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
      width: 100%;
      text-align: center;
    }
    .difficultyRow .chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: center;
    }
    .diffChip {
      font: inherit;
      cursor: pointer;
      border-radius: 999px;
      border: 1px solid rgba(100, 170, 255, 0.35);
      background: rgba(30, 45, 80, 0.55);
      color: var(--text);
      padding: 8px 16px;
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.06em;
      transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    }
    .diffChip:hover { border-color: rgba(154, 208, 255, 0.55); }
    .diffChip[aria-pressed="true"] {
      border-color: rgba(93, 255, 180, 0.65);
      background: rgba(40, 90, 70, 0.55);
      box-shadow: 0 0 18px rgba(93, 255, 180, 0.2);
      color: var(--mint);
    }
    .diffHint {
      font-size: 0.72rem;
      color: var(--muted);
      text-align: center;
      margin: 0 0 8px;
      line-height: 1.45;
    }
    #diffHud {
      font-size: 0.65rem;
      padding: 2px 8px;
      border-radius: 6px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(0, 0, 0, 0.35);
      color: var(--mint);
      font-weight: 700;
    }
    .shipPreviewBox {
      width: 100%;
      max-width: 420px;
      margin: 10px auto 4px;
      border-radius: 16px;
      border: 1px solid rgba(100, 170, 255, 0.35);
      background: radial-gradient(ellipse at 30% 40%, rgba(40, 70, 140, 0.45), rgba(4, 8, 18, 0.95));
      box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 8px 32px rgba(0, 0, 0, 0.35);
      overflow: hidden;
    }
    .shipPreviewBox canvas {
      display: block;
      width: 100%;
      height: auto;
    }
    @keyframes heatBarPulse {
      0%, 100% { filter: brightness(1); box-shadow: 0 0 28px rgba(255, 140, 80, 0.75); }
      50% { filter: brightness(1.12); box-shadow: 0 0 42px rgba(255, 90, 50, 0.95); }
    }
    @keyframes heatBarCritical {
      0%, 100% { filter: brightness(1.05); box-shadow: 0 0 34px rgba(255, 60, 40, 0.9); }
      50% { filter: brightness(1.2); box-shadow: 0 0 52px rgba(255, 40, 30, 1); }
    }
    .heatDock[hidden] {
      display: none !important;
    }
    .heatDock {
      position: absolute;
      left: 50%;
      bottom: clamp(10px, 2.2vh, 24px);
      transform: translateX(-50%);
      width: min(920px, 95%);
      z-index: 7;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 10px 14px 12px;
      border-radius: 18px;
      background: linear-gradient(180deg, rgba(8, 14, 32, 0.94), rgba(4, 8, 20, 0.9));
      border: 2px solid rgba(120, 190, 255, 0.5);
      box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.07) inset,
        0 14px 48px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(255, 120, 70, 0.18);
    }
    .heatDock__top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-width: 0;
    }
    .heatDock__title {
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: clamp(0.72rem, 2.2vw, 0.98rem);
      font-weight: 900;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: rgba(255, 210, 170, 0.98);
      text-shadow: 0 0 22px rgba(255, 150, 90, 0.65);
    }
    .heatDock__pct {
      flex: 0 0 auto;
      font-size: clamp(1rem, 3.4vw, 1.45rem);
      font-weight: 900;
      font-variant-numeric: tabular-nums;
      color: #fff;
      min-width: 3.1em;
      text-align: right;
      text-shadow: 0 0 20px rgba(255, 190, 120, 0.75);
    }
    .heatDock__track {
      height: clamp(26px, 5.5vw, 42px);
      border-radius: 999px;
      background: rgba(0, 0, 0, 0.65);
      border: 2px solid rgba(255, 255, 255, 0.22);
      overflow: hidden;
      box-shadow: inset 0 3px 14px rgba(0, 0, 0, 0.7);
    }
    .heatDock__fill {
      height: 100%;
      width: 0%;
      border-radius: inherit;
      background: linear-gradient(90deg, #5af0ff 0%, #5dffb4 12%, #ffe566 40%, #ff9944 68%, #ff5530 88%, #ff3018 100%);
      box-shadow: 0 0 26px rgba(255, 150, 80, 0.7);
      transition: width 0.06s linear;
    }
    .heatDock--warn .heatDock__track {
      border-color: rgba(255, 200, 120, 0.55);
    }
    .heatDock--hot .heatDock__fill {
      animation: heatBarPulse 0.5s ease-in-out infinite;
    }
    .heatDock--critical .heatDock__track {
      border-color: rgba(255, 100, 70, 0.9);
    }
    .heatDock--critical .heatDock__fill {
      animation: heatBarCritical 0.32s ease-in-out infinite;
    }
    .heatDock--locked {
      border-color: rgba(255, 70, 50, 0.95);
      box-shadow:
        0 0 0 1px rgba(255, 100, 80, 0.25) inset,
        0 0 48px rgba(255, 40, 30, 0.45),
        0 14px 48px rgba(0, 0, 0, 0.55);
    }
    .heatDock--locked .heatDock__title {
      color: #ff8870;
      text-shadow: 0 0 28px rgba(255, 60, 40, 0.9);
    }
    .heatDock--locked .heatDock__pct {
      color: #ffc8be;
    }
