:root {
  --ink: #f3e9d2;
  --ink-dim: #c9b994;
  --parchment: #2b2218;
  --panel: rgba(28, 22, 16, 0.88);
  --border: #8a6b3c;
  --gold: #e0b45a;
  --blue: #3d7be0;
  --red: #d24a3a;
  --good: #6cc56b;
  --bad: #e05a4a;
  --font: Georgia, 'Times New Roman', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #111; color: var(--ink); font-family: var(--font); }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui .screen { position: absolute; inset: 0; pointer-events: none; }
#ui .screen > * { pointer-events: auto; }
#ui .screen.hud > * { pointer-events: none; }
#ui .screen.hud .interactive { pointer-events: auto; }

.menu { display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(40,30,20,.55), rgba(10,8,6,.92)); }
.title-card { text-align: center; padding: 48px 64px; background: var(--panel); border: 2px solid var(--border); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.title-card h1 { margin: 0; font-size: 52px; letter-spacing: 2px; color: var(--gold); text-shadow: 0 2px 0 #000; }
.subtitle { margin: 6px 0 28px; color: var(--ink-dim); font-style: italic; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.hint { margin-top: 22px; font-size: 12px; color: var(--ink-dim); }

.btn { font-family: var(--font); font-size: 17px; padding: 10px 22px; color: var(--ink); background: #3a2d1f; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover { background: #4d3b27; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: #6b4a1f; border-color: var(--gold); }
.btn.primary:hover { background: #835b26; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.corner-hint { position: absolute; left: 14px; bottom: 12px; font-size: 13px; color: var(--ink-dim); text-shadow: 0 1px 2px #000; }

#toasts { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 20; }
.toast { padding: 8px 18px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; font-size: 16px; transition: opacity .6s; }
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
.toast.blue { border-color: var(--blue); color: #bcd3ff; }
.toast.red { border-color: var(--red); color: #ffc2b8; }
.toast.out { opacity: 0; }

#fps { position: fixed; right: 8px; top: 6px; font: 12px monospace; color: #9f9; text-shadow: 0 1px 1px #000; z-index: 30; }

/* --- HUD de bataille --- */
.hud-bars { position: absolute; left: 20px; bottom: 22px; width: 320px; display: flex; flex-direction: column; gap: 6px; }
.bar { position: relative; height: 16px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); border-radius: 3px; overflow: hidden; }
.bar .fill { height: 100%; width: 100%; transition: width .12s linear; }
.bar.hp { height: 20px; }
.bar.hp .fill { background: linear-gradient(#d9534f, #a8302c); }
.bar.stam .fill { background: linear-gradient(#e8c25a, #b8902e); }
.bar .label { position: absolute; inset: 0; text-align: center; font-size: 13px; line-height: 20px; text-shadow: 0 1px 2px #000; }
.hud-help { position: absolute; right: 16px; bottom: 14px; font-size: 12px; color: var(--ink-dim); text-shadow: 0 1px 2px #000; max-width: 460px; text-align: right; }
.hud-center { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font-size: 34px; color: var(--gold); text-shadow: 0 2px 6px #000; }
.hud-lock { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); padding: 12px 22px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.hud-stats { position: absolute; left: 20px; bottom: 76px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; text-shadow: 0 1px 2px #000; }
.hud-stats .blue, .blue { color: #8fb4ff; }
.hud-stats .red, .red { color: #ff9d8f; }

/* --- Zone stratégique et commandant --- */
.hud-zone { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); min-width: 360px; padding: 8px 14px; background: rgba(20,16,12,.72); border: 1px solid var(--border); border-radius: 4px; text-align: center; text-shadow: 0 1px 2px #000; }
.zone-name { font-size: 18px; }
.zone-name .obj { color: var(--gold); font-size: 14px; }
.zone-def { margin-top: 4px; font-size: 13px; color: var(--ink-dim); display: flex; align-items: center; justify-content: center; gap: 4px; }
.zone-def span { margin-right: 6px; }
.pip { display: inline-block; width: 14px; height: 14px; transform: rotate(45deg); border: 1px solid rgba(255,255,255,.4); background: rgba(0,0,0,.4); margin: 0 2px; }
.pip.on.blue { background: var(--blue); }
.pip.on.red { background: var(--red); }
.boss { margin-top: 8px; }
.boss-name { font-size: 15px; color: var(--gold); margin-bottom: 3px; }
.bar.boss-hp { height: 14px; }
.bar.boss-hp .fill { background: linear-gradient(#e05a4a, #902a20); }
.bar.boss-posture { height: 8px; margin-top: 3px; }
.bar.boss-posture .fill { background: linear-gradient(#e8e8f0, #a8a8b8); }
.bar.boss-posture.broken .fill { background: linear-gradient(#ffd25a, #d89a20); }
