:root {
  --bg: #0d0f12; --panel: #16191f; --line: #2a2f3a;
  --txt: #c8cdd6; --dim: #6b7280; --acc: #c9a45c; --danger: #b34a4a;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--txt);
  font-family: 'Segoe UI', system-ui, sans-serif; overflow: hidden; }

.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 28px;
  width: min(440px, 94vw); max-height: 94vh; overflow-y: auto; }
h1 { font-size: 42px; letter-spacing: 10px; color: var(--acc); text-align: center; font-weight: 300; }
h2 { color: var(--acc); font-weight: 400; margin-bottom: 12px; }
h3 { color: var(--acc); font-weight: 400; font-size: 14px; margin: 8px 0 4px; }
.tag { color: var(--dim); text-align: center; font-style: italic; margin: 8px 0 18px; font-size: 13px; }
input { background: #0a0c0f; border: 1px solid var(--line); color: var(--txt);
  padding: 10px; width: 100%; margin: 6px 0; font-size: 15px; }
button { background: #20242c; border: 1px solid var(--line); color: var(--txt);
  padding: 10px 14px; cursor: pointer; font-size: 14px; margin: 4px 2px; }
button:hover { border-color: var(--acc); color: var(--acc); }
button.big { width: 100%; padding: 14px; background: var(--acc); color: #0d0f12;
  font-weight: 700; letter-spacing: 2px; border: none; }
button.big.waiting { background: #3a3f4a; color: var(--dim); }
button.danger { border-color: var(--danger); color: var(--danger); width: 100%; }
.row { display: flex; gap: 6px; align-items: center; }
.row input { width: 90px; text-transform: uppercase; }
.msg { color: var(--dim); font-size: 12px; margin-top: 10px; min-height: 16px; }
.code { color: var(--acc); font-size: 22px; letter-spacing: 6px; font-weight: 700; }

#faction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0; }
.fcard { border: 1px solid var(--line); padding: 8px; cursor: pointer; font-size: 12px; }
.fcard.sel { border-color: var(--acc); background: #1d1a12; }
.fcard b { display: block; font-size: 13px; }
.fcard small { color: var(--dim); }

#lobby-players { list-style: none; margin: 14px 0; }
#lobby-players li { padding: 8px; border-bottom: 1px solid var(--line); }

/* --- Jeu --- */
#screen-game { flex-direction: column; align-items: stretch; justify-content: flex-start; }
#topbar { height: 44px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px; padding: 0 14px; font-size: 13px; flex-shrink: 0; }
#hud-timer { color: var(--acc); font-weight: 700; min-width: 48px; }
#hud-bastion { color: var(--danger); }
#map { flex: 1; touch-action: none; background: #08090b; width: 100%; }
#sidebar { position: absolute; right: 0; top: 44px; bottom: 0; width: 270px;
  background: var(--panel); border-left: 1px solid var(--line); padding: 10px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
#players-list div { font-size: 12px; padding: 3px 0; }
#players-list .dead { text-decoration: line-through; color: var(--dim); }
#players-list .rdy::after { content: ' ✓'; color: #5bd6a3; }
#players-list .dc::after { content: ' ⚠'; color: var(--danger); }
#sel-info { font-size: 12px; border: 1px solid var(--line); padding: 8px; min-height: 56px; }
#actions button { font-size: 12px; padding: 6px 8px; }
#market { border: 1px solid var(--line); padding: 8px; }
#market-prices { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
#market button { flex: 1; font-size: 11px; padding: 6px 4px; }
#orders-list { font-size: 11px; color: var(--dim); max-height: 90px; overflow-y: auto; }
#orders-list div { padding: 2px 0; border-bottom: 1px dotted var(--line); }
#orders-list span { color: var(--danger); cursor: pointer; float: right; }
#log { font-size: 11px; color: var(--dim); max-height: 140px; overflow-y: auto;
  border-top: 1px solid var(--line); padding-top: 6px; }

#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.8); display: flex;
  align-items: center; justify-content: center; z-index: 50; }
#overlay-box { background: var(--panel); border: 1px solid var(--acc); padding: 30px;
  text-align: center; max-width: 90vw; }
#overlay-box h2 { font-size: 28px; }

@media (max-width: 720px) {
  #sidebar { width: 100%; top: auto; height: 46vh; border-left: none; border-top: 1px solid var(--line); }
  #map { height: calc(54vh - 44px); flex: none; }
}
