:root {
  --bg-0: #070b14;
  --bg-1: #0d1424;
  --bg-2: #131c30;
  --line: #1e2b45;
  --glass: rgba(20, 30, 52, 0.55);
  --glass-brd: rgba(120, 160, 230, 0.14);
  --txt: #e6edff;
  --txt-dim: #8da0c4;
  --p1: #38bdf8;   /* joueur 1 — cyan */
  --p2: #fbbf24;   /* joueur 2 — ambre */
  --energy: #facc15;
  --danger: #fb7185;
  --ok: #4ade80;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(56,189,248,0.07), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(251,191,36,0.06), transparent 60%),
    var(--bg-0);
  color: var(--txt);
  font-family: var(--sans);
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px clamp(8px, 2vw, 18px);
  gap: 10px;
}

/* ── HUD ────────────────────────────────────────────────────────────── */
#hud {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  font-size: 22px; color: var(--p1);
  text-shadow: 0 0 16px rgba(56,189,248,0.7);
}
.title {
  font-family: var(--mono);
  font-weight: 700; letter-spacing: 2px; font-size: 15px;
}
.title-accent { color: var(--p1); margin-left: 6px; }

.stats { display: flex; gap: 8px; margin-left: 4px; }
.pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(8,12,22,0.6);
  border: 1px solid var(--line);
  font-family: var(--mono); font-weight: 600;
}
.pill-ico { font-size: 15px; }
.pill.energy { color: var(--energy); border-color: rgba(250,204,21,0.3); }
.pill.energy.flash { animation: pulse 0.3s ease; }
.pill-label, .pill-sub { font-size: 10px; color: var(--txt-dim); letter-spacing: 1px; }
.pill-sub { margin-left: -2px; }

.players { display: flex; gap: 8px; margin-left: auto; }
.phud {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(8,12,22,0.6);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 600;
}
.phud .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.phud.off { opacity: 0.4; }

/* ── Barre des défenseurs ───────────────────────────────────────────── */
#seedbar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 8px;
  background: var(--glass);
  border: 1px solid var(--glass-brd);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}
.seed {
  position: relative;
  width: 84px; min-height: 76px;
  padding: 8px 6px 6px;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform 0.08s ease, border-color 0.15s ease;
  user-select: none;
}
.seed:hover { transform: translateY(-2px); }
.seed.selected { border-color: var(--sel, var(--p1)); box-shadow: 0 0 0 1px var(--sel, var(--p1)), 0 6px 20px rgba(0,0,0,0.4); }
.seed .icon { font-size: 26px; line-height: 1.1; }
.seed .name { font-size: 11px; color: var(--txt); text-align: center; }
.seed .cost { font-family: var(--mono); font-size: 11px; color: var(--energy); font-weight: 700; }
.seed.locked { opacity: 0.45; cursor: not-allowed; }
.seed .cd {
  position: absolute; inset: 0; border-radius: 11px;
  background: rgba(5,8,16,0.72);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 17px; font-weight: 700; color: #cdd9f5;
}
.seed .cd.hidden { display: none; }

/* ── Scène / canvas ─────────────────────────────────────────────────── */
#stage {
  position: relative;
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
}
#lawn {
  width: 100%;
  max-width: 900px;
  max-height: 100%;
  aspect-ratio: 900 / 500;
  border-radius: 16px;
  border: 1px solid var(--glass-brd);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.02);
  cursor: crosshair;
  touch-action: none;
}

/* ── Bannière de vague ──────────────────────────────────────────────── */
.banner {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  padding: 9px 18px; border-radius: 999px;
  background: rgba(10,14,24,0.82);
  border: 1px solid var(--glass-brd);
  font-family: var(--mono); font-weight: 600; font-size: 14px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  animation: bannerIn 0.3s ease;
}
.banner.big { color: var(--danger); border-color: rgba(251,113,133,0.4); }
.banner.hidden { display: none; }

/* ── Overlays ───────────────────────────────────────────────────────── */
.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,8,16,0.74);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  z-index: 10;
}
.overlay.hidden { display: none; }
.panel {
  width: min(440px, 90%);
  padding: 28px;
  background: linear-gradient(180deg, rgba(22,32,54,0.92), rgba(13,20,36,0.92));
  border: 1px solid var(--glass-brd);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  text-align: center;
}
.panel h1 {
  font-family: var(--mono); font-size: 26px; letter-spacing: 1px;
  margin-bottom: 8px;
}
.tagline { color: var(--txt-dim); font-size: 14px; margin-bottom: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; margin-bottom: 16px; }
.field span { font-size: 12px; color: var(--txt-dim); letter-spacing: 0.5px; }
.field input {
  padding: 11px 14px; border-radius: 10px;
  background: rgba(8,12,22,0.8); border: 1px solid var(--line);
  color: var(--txt); font-size: 15px; font-family: var(--mono);
  outline: none;
}
.field input:focus { border-color: var(--p1); box-shadow: 0 0 0 3px rgba(56,189,248,0.15); }

.lobby-players { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.lobby-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  background: rgba(8,12,22,0.6); border: 1px solid var(--line);
  font-size: 13px;
}
.lobby-row .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.lobby-row .state { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.lobby-row .state.ready { color: var(--ok); }
.lobby-row .state.wait { color: var(--txt-dim); }

.btn {
  width: 100%; padding: 13px; border: none; border-radius: 11px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: var(--sans); transition: filter 0.12s ease, transform 0.08s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--p1), #0ea5e9);
  color: #03121e; box-shadow: 0 8px 24px rgba(56,189,248,0.35);
}
.btn.primary.go { background: linear-gradient(180deg, var(--ok), #22c55e); color: #04130a; box-shadow: 0 8px 24px rgba(74,222,128,0.3); }
.btn:hover { filter: brightness(1.06); }
.hint { font-size: 12px; color: var(--txt-dim); margin-top: 14px; line-height: 1.5; }

/* ── Statut connexion ───────────────────────────────────────────────── */
.conn {
  position: absolute; bottom: 10px; right: 12px; z-index: 11;
  font-family: var(--mono); font-size: 11px; color: var(--txt-dim);
  padding: 5px 10px; border-radius: 8px;
  background: rgba(8,12,22,0.7); border: 1px solid var(--line);
}
.conn.ok { color: var(--ok); }
.conn.ko { color: var(--danger); }
.conn.hidden { display: none; }

/* ── Pied de page ───────────────────────────────────────────────────── */
#tips {
  text-align: center; font-size: 12px; color: var(--txt-dim);
  padding: 2px;
}
#tips b { color: var(--txt); }

/* ── Animations ─────────────────────────────────────────────────────── */
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes bannerIn { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

@media (max-width: 640px) {
  .title { font-size: 12px; letter-spacing: 1px; }
  .players { width: 100%; margin: 6px 0 0; order: 3; }
  #hud { flex-wrap: wrap; }
  .seed { width: 70px; }
  #tips { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; }
}
