    :root {
      --bg: #0e141b;
      --panel: #16212c;
      --line: #2a3a4c;
      --text: #e4edf7;
      --muted: #9fb0c2;
      --blue: #6fb6ff;
      --red: #ff6f68;
      --green: #6fd17c;
      --violet: #b98cff;
    }

    * { box-sizing: border-box; }

    html, body {
      margin: 0;
      width: 100%;
      height: 100%;
      background: radial-gradient(circle at 20% 0%, #1a2633, var(--bg) 44%);
      color: var(--text);
      font-family: "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
    }

    .app {
      display: grid;
      grid-template-rows: 64px 1fr;
      width: 100%;
      height: 100%;
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: nowrap;
      padding: 10px 14px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: linear-gradient(180deg, rgba(19, 30, 42, 0.96), rgba(16, 24, 34, 0.96));
      backdrop-filter: blur(8px);
    }

    .right-pane {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 0;
      justify-content: flex-end;
      flex: 1;
    }

    .group {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .label {
      font-size: 0.82rem;
      color: var(--muted);
      letter-spacing: 0.02em;
    }

    input[type="number"], button {
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #1b2a3a;
      color: var(--text);
      padding: 8px 10px;
      font-weight: 600;
    }

    input[type="number"] { width: 140px; }
    input[type="range"] { accent-color: #66b4ff; }

    button {
      cursor: pointer;
      background: linear-gradient(180deg, #2a3f55, #213347);
    }

    button.primary { background: linear-gradient(180deg, #2f8f52, #246e3f); }
    button.warn { background: linear-gradient(180deg, #94503a, #733f2f); }

    .map-wrap {
      position: relative;
      overflow: hidden;
    }

    canvas {
      display: block;
      width: 100%;
      height: 100%;
      background: #0c1218;
    }

    .hud {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      font-size: 0.84rem;
      color: var(--muted);
    }

    .chip {
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 999px;
      padding: 4px 9px;
      background: rgba(255, 255, 255, 0.04);
      color: var(--text);
      white-space: nowrap;
    }

    .modal {
      position: fixed;
      inset: 0;
      background: rgba(5, 10, 16, 0.72);
      backdrop-filter: blur(5px);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      z-index: 10;
    }

    .modal.show { display: flex; }

    .modal-panel {
      width: min(980px, 96vw);
      max-height: 88vh;
      overflow: auto;
      background: linear-gradient(180deg, #172330, #111a24);
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-radius: 14px;
      padding: 14px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    }

    .options-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px;
      margin-top: 10px;
    }

    .faction-box {
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.04);
      padding: 10px;
    }

    .faction-title {
      font-size: 0.9rem;
      font-weight: 800;
      margin-bottom: 8px;
    }

    .opt-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
      margin-bottom: 6px;
      font-size: 0.78rem;
      color: var(--muted);
    }

    .opt-row input[type="range"] {
      grid-column: 1 / span 2;
    }

    @media (max-width: 980px) {
      .options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    .hover-card {
      position: absolute;
      left: 12px;
      bottom: 12px;
      min-width: 260px;
      max-width: 320px;
      background: rgba(17, 26, 35, 0.9);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 12px;
      padding: 10px 12px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
      display: none;
    }

    .hover-card .title {
      font-size: 0.95rem;
      font-weight: 800;
      margin-bottom: 6px;
    }

    .hover-card .line {
      font-size: 0.82rem;
      color: var(--muted);
      margin-bottom: 3px;
    }

    .stats-overlay {
      position: absolute;
      top: 12px;
      right: 12px;
      width: min(520px, 52vw);
      max-height: 52vh;
      overflow: auto;
      background: rgba(15, 24, 33, 0.9);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      padding: 10px;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
      display: none;
      z-index: 6;
    }

    .stats-overlay.show {
      display: block;
    }

    .win-banner {
      position: absolute;
      top: 12px;
      left: 50%;
      transform: translateX(-50%);
      background: rgba(15, 24, 33, 0.9);
      border: 1px solid rgba(255, 255, 255, 0.18);
      border-radius: 12px;
      padding: 8px 12px;
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
      display: none;
      z-index: 5;
      font-size: 0.9rem;
      font-weight: 700;
    }
