/* ======================================================================
   DIPLOMATIE — feuille de style
   ====================================================================== */
:root {
  --navy: #0e1a2b;
  --navy-2: #15243a;
  --navy-3: #1d3150;
  --line: rgba(201, 164, 92, .28);
  --brass: #c9a45c;
  --brass-2: #e3c88b;
  --paper: #f3ead6;
  --paper-2: #e8dcbf;
  --ink: #2b2218;
  --txt: #e9e3d4;
  --muted: #9aa6b8;
  --ok: #4caf7a;
  --bad: #e05a4f;
  --warn: #e2a23b;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  font-family: var(--sans); color: var(--txt); font-size: 14px;
  background: radial-gradient(1200px 700px at 20% -10%, #24406a 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 110%, #3a2b14 0%, transparent 55%), var(--navy);
  overflow: hidden;
}
button { font-family: inherit; }
.hidden { display: none !important; }
h1, h2, h3, .serif { font-family: var(--serif); font-weight: normal; letter-spacing: .02em; }
a { color: var(--brass-2); }
kbd { font-family: var(--sans); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,.05); }

/* ---------------------------------------------------------------- Boutons */
.btn {
  appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--txt);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; transition: .15s; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: rgba(201,164,92,.14); border-color: var(--brass); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #d8b66d, #b58f43); color: #1c1407; border-color: #e7cf95; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 12px 20px; font-size: 15px; }
.btn.small { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { border-color: rgba(224,90,79,.5); color: #ffb3ab; }
.btn.ok { border-color: rgba(76,175,122,.6); color: #b9f0cf; }
.btn.active { background: rgba(201,164,92,.22); border-color: var(--brass); color: var(--brass-2); }
.iconbtn { width: 34px; height: 34px; justify-content: center; padding: 0; }

input, select, textarea {
  font-family: inherit; font-size: 14px; color: var(--txt); background: rgba(0,0,0,.25);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201,164,92,.15); }
select option { background: var(--navy-2); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Accueil */
.home { height: 100%; overflow: auto; display: flex; flex-direction: column; align-items: center; padding: 40px 20px 60px; }
.home-hero { text-align: center; margin: 10px 0 34px; }
.home-hero .crest { width: 86px; height: 86px; margin: 0 auto 14px; }
.home-hero h1 { font-size: 64px; margin: 0; color: var(--brass-2); letter-spacing: .14em; text-shadow: 0 2px 0 #000; }
.home-hero p { margin: 6px 0 0; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 18px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; width: min(1100px, 100%); }
.hcard {
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; cursor: pointer; transition: .2s; position: relative; overflow: hidden;
}
.hcard:hover { transform: translateY(-3px); border-color: var(--brass); box-shadow: var(--shadow); }
.hcard h3 { margin: 10px 0 6px; font-size: 21px; color: var(--brass-2); }
.hcard p { margin: 0; color: var(--muted); line-height: 1.45; }
.hcard .ic { font-size: 28px; }
.home-foot { margin-top: 30px; color: var(--muted); font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- Écrans de configuration */
.panel-page { height: 100%; overflow: auto; padding: 30px 20px 60px; display: flex; justify-content: center; }
.panel { width: min(1100px, 100%); }
.panel h2 { font-size: 34px; color: var(--brass-2); margin: 0 0 4px; }
.panel .sub { color: var(--muted); margin: 0 0 22px; }
.section { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 18px; }
.section h3 { margin: 0 0 12px; font-size: 19px; color: var(--brass-2); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.seat { border-radius: 12px; padding: 12px; background: rgba(0,0,0,.2); border: 1px solid var(--line); border-left: 6px solid var(--pc); }
.seat .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.seat .name { font-family: var(--serif); font-size: 18px; }
.seat .seg { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.seat .seg button { flex: 1; }
.seat .opts { display: flex; gap: 6px; }
.seat .opts select { flex: 1; padding: 5px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--pc); box-shadow: 0 0 0 2px rgba(255,255,255,.18); display: inline-block; flex: none; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.actions-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.room-code { font-family: var(--serif); font-size: 40px; letter-spacing: .3em; color: var(--brass-2); }
.share { font-size: 13px; color: var(--muted); }
.share code { color: var(--txt); background: rgba(0,0,0,.3); padding: 2px 6px; border-radius: 5px; }

/* ---------------------------------------------------------------- Écran de jeu */
.game { display: grid; grid-template-rows: 56px 1fr; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14,26,43,.95), rgba(14,26,43,.75)); backdrop-filter: blur(6px); z-index: 5;
}
.brand { font-family: var(--serif); color: var(--brass-2); font-size: 20px; letter-spacing: .18em; cursor: pointer; }
.phase { display: flex; flex-direction: column; line-height: 1.15; }
.phase .t { font-family: var(--serif); font-size: 18px; }
.phase .s { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.spacer { flex: 1; }
.timer { display: flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); background: rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.timer .clock { font-size: 18px; font-weight: 600; }
.timer.low { border-color: var(--bad); color: #ffc2bb; animation: pulse 1s infinite; }
.timer .stage { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .08em; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(224,90,79,.25); } }
.me-badge { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 99px; background: var(--pc); color: var(--pink, #fff); font-weight: 600; cursor: default; }
.me-badge .flag { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; font-size: 12px; }
.main { display: grid; grid-template-columns: 1fr 400px; min-height: 0; }
.mapwrap { position: relative; overflow: hidden; min-height: 0; }
.mapframe { position: absolute; inset: 12px; border-radius: 12px; overflow: hidden; border: 1px solid rgba(201,164,92,.45); box-shadow: inset 0 0 40px rgba(0,0,0,.45), var(--shadow); background: radial-gradient(circle at 50% 45%, #22466d, #0f2238); }
.mapframe svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.mapctl { position: absolute; right: 24px; top: 24px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.mapctl .btn { background: rgba(14,26,43,.85); }
.maplegend { position: absolute; left: 24px; bottom: 22px; z-index: 3; display: flex; gap: 6px; flex-wrap: wrap; max-width: 70%; }
.maplegend .chip { background: rgba(14,26,43,.82); }
.history-banner { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); z-index: 4; background: rgba(14,26,43,.92); border: 1px solid var(--brass); border-radius: 99px; padding: 6px 8px 6px 16px; display: flex; gap: 10px; align-items: center; }
.palette {
  position: absolute; z-index: 6; display: flex; gap: 4px; padding: 5px; border-radius: 10px; background: rgba(14,26,43,.95);
  border: 1px solid var(--brass); box-shadow: var(--shadow); left: 50%; bottom: 62px; transform: translateX(-50%); max-width: calc(100% - 40px); flex-wrap: wrap; justify-content: center;
}
.palette .plbl { font-family: var(--serif); padding: 4px 8px 4px 6px; color: var(--brass-2); white-space: nowrap; align-self: center; }
.palette .hint { font-size: 11px; color: var(--muted); align-self: center; padding: 0 6px; max-width: 220px; }

/* ---------------------------------------------------------------- Barre latérale */
.side { border-left: 1px solid var(--line); display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: rgba(10,18,30,.55); }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab { flex: 1; padding: 12px 6px; text-align: center; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; position: relative; user-select: none; }
.tab:hover { color: var(--txt); }
.tab.on { color: var(--brass-2); border-bottom-color: var(--brass); }
.tab .badge { position: absolute; top: 6px; right: 10%; background: var(--bad); color: #fff; font-size: 10px; border-radius: 99px; padding: 1px 6px; }
.tabbody { overflow: auto; min-height: 0; padding: 12px; }
.sidefoot { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; align-items: center; }
.sidefoot .btn.primary { flex: 1; justify-content: center; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; font-style: italic; }

/* Ordres */
.olist { display: flex; flex-direction: column; gap: 6px; }
.orow { display: grid; grid-template-columns: 30px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 8px; background: rgba(255,255,255,.035); border: 1px solid transparent; cursor: pointer; }
.orow:hover { border-color: var(--line); }
.orow.sel { border-color: var(--brass); background: rgba(201,164,92,.1); }
.orow .ut { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--pc); color: #fff; font-weight: 700; font-size: 12px; }
.orow .txt { font-family: var(--serif); font-size: 15px; }
.orow .txt .none { color: var(--warn); font-family: var(--sans); font-size: 12.5px; font-style: italic; }
.orow .from { color: var(--muted); font-size: 11.5px; }
.orow .x { opacity: .5; }
.orow .x:hover { opacity: 1; }
.cmd { margin-top: 12px; display: flex; gap: 6px; }
.cmd input { flex: 1; font-family: var(--serif); }
.help { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 12px; padding: 10px; border: 1px dashed var(--line); border-radius: 8px; }
.adjust-box { padding: 12px; border-radius: 10px; background: rgba(201,164,92,.08); border: 1px solid var(--line); margin-bottom: 10px; }
.adjust-box b { color: var(--brass-2); }
.status-line { font-size: 12px; color: var(--muted); }

/* Diplomatie */
.dip { display: grid; grid-template-columns: 1fr; gap: 10px; }
.convlist { display: flex; flex-direction: column; gap: 4px; }
.conv { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; background: rgba(255,255,255,.03); }
.conv:hover { background: rgba(255,255,255,.07); }
.conv .nm { flex: 1; }
.conv .nm small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.conv .unread { background: var(--bad); color: #fff; font-size: 11px; border-radius: 99px; padding: 1px 7px; }
.thread-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.thread-head .ttl { font-family: var(--serif); font-size: 18px; flex: 1; }
.agreements { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.agree { font-size: 11.5px; padding: 3px 8px; border-radius: 99px; background: rgba(76,175,122,.15); border: 1px solid rgba(76,175,122,.5); color: #c6f1d6; }
.agree.broken { background: rgba(224,90,79,.12); border-color: rgba(224,90,79,.5); color: #ffc0b8; text-decoration: line-through; }
.thread { display: flex; flex-direction: column; gap: 8px; padding: 6px 2px 10px; }
.msg { max-width: 86%; padding: 8px 11px; border-radius: 12px; line-height: 1.4; position: relative; }
.msg.in { align-self: flex-start; background: rgba(255,255,255,.07); border-top-left-radius: 3px; border-left: 3px solid var(--pc); }
.msg.out { align-self: flex-end; background: rgba(201,164,92,.18); border-top-right-radius: 3px; }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-style: italic; font-size: 12px; text-align: center; }
.proposal { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.proposal .pt { font-family: var(--serif); color: var(--brass-2); font-size: 14.5px; }
.proposal .pa { display: flex; gap: 6px; margin-top: 6px; }
.proposal .st { font-size: 12px; margin-top: 4px; }
.st.yes { color: var(--ok); } .st.no { color: var(--bad); }
.composer { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; }
.composer textarea { resize: none; height: 64px; }
.composer .bar { display: flex; gap: 6px; flex-wrap: wrap; }
.locked { padding: 10px; border-radius: 8px; background: rgba(224,90,79,.1); border: 1px solid rgba(224,90,79,.35); color: #ffc9c2; font-size: 12.5px; }
.picking { padding: 8px 10px; border-radius: 8px; background: rgba(201,164,92,.12); border: 1px solid var(--brass); font-size: 12.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Puissances */
.ptable { width: 100%; border-collapse: collapse; }
.ptable td, .ptable th { padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; font-size: 13px; }
.ptable th { color: var(--muted); font-weight: normal; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.bar-sc { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; width: 90px; }
.bar-sc > i { display: block; height: 100%; background: var(--pc); }
.ready { color: var(--ok); } .waiting { color: var(--warn); }

/* Journal */
.log-entry { padding: 10px; border-radius: 10px; background: rgba(255,255,255,.03); margin-bottom: 10px; border: 1px solid transparent; }
.log-entry:hover { border-color: var(--line); }
.log-entry h4 { margin: 0 0 6px; font-family: var(--serif); font-weight: normal; font-size: 16px; color: var(--brass-2); display: flex; justify-content: space-between; align-items: center; }
.log-entry .ln { font-family: var(--serif); font-size: 13.5px; padding: 1px 0; display: flex; gap: 6px; align-items: baseline; }
.log-entry .ln.fail { color: #d9a39d; }
.log-entry .ln .why { font-family: var(--sans); font-size: 11px; color: var(--muted); }
.news { font-family: var(--serif); font-style: italic; color: var(--paper-2); padding: 3px 0; }

/* ---------------------------------------------------------------- Modales, toasts, info-bulles */
.modal-bg { position: fixed; inset: 0; background: rgba(4,8,14,.66); display: grid; place-items: center; z-index: 58; backdrop-filter: blur(3px); }
.modal { width: min(560px, 92vw); max-height: 86vh; overflow: auto; background: var(--navy-2); border: 1px solid var(--brass); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 10px; color: var(--brass-2); font-size: 24px; }
.modal .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.modal.wide { width: min(860px, 94vw); }
.curtain { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #1d3150, #070d16); cursor: pointer; text-align: center; }
.curtain h2 { font-size: 46px; margin: 10px 0; }
.tooltip { position: fixed; z-index: 70; pointer-events: none; background: rgba(14,26,43,.95); border: 1px solid var(--brass); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 260px; }
.tooltip b { font-family: var(--serif); font-size: 14px; color: var(--brass-2); font-weight: normal; }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: rgba(14,26,43,.96); border: 1px solid var(--brass); border-radius: 10px; padding: 10px 16px; box-shadow: var(--shadow); animation: tin .25s ease-out; max-width: 520px; }
.toast.bad { border-color: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }
.result-card { margin-bottom: 10px; }
.result-card .ln { font-family: var(--serif); }

.rules { line-height: 1.6; color: var(--txt); }
.rules h4 { color: var(--brass-2); font-family: var(--serif); font-weight: normal; font-size: 18px; margin: 18px 0 6px; }
.rules p { margin: 6px 0; }

.winner { text-align: center; padding: 10px; }
.winner .big { font-family: var(--serif); font-size: 36px; color: var(--brass-2); }

/* ---------------------------------------------------------------- Carte (SVG) */
.prov-land { stroke: #5b4630; stroke-width: .55; stroke-linejoin: round; transition: fill .6s; }
.prov-sea { stroke: rgba(225,240,255,.35); stroke-width: .5; transition: fill .3s; }
.prov-hit { cursor: pointer; }
.prov-hit:hover .prov-land, .prov-hit:hover .prov-sea { filter: brightness(1.08); }
.hl-move .prov-land, .hl-move .prov-sea { stroke: #ffd76a; stroke-width: 2.2; filter: brightness(1.13) saturate(1.2); }
.hl-move { animation: glow 1.4s ease-in-out infinite; }
.hl-convoy .prov-land { stroke: #9fe3ff; stroke-width: 1.8; stroke-dasharray: 3 2; filter: brightness(1.06); }
.hl-target .prov-land, .hl-target .prov-sea { stroke: #fff; stroke-width: 2.2; filter: brightness(1.1); }
.hl-sel .prov-land, .hl-sel .prov-sea { stroke: #fff; stroke-width: 2; }
.hl-pick .prov-land, .hl-pick .prov-sea { stroke: #ffe6a3; stroke-width: 1.4; }
@keyframes glow { 50% { opacity: .82; } }
.lbl { font-family: var(--serif); font-size: 6.4px; fill: #3b2d1d; pointer-events: none; paint-order: stroke; stroke: rgba(255,250,235,.7); stroke-width: 1.4px; }
.lbl.sea { fill: rgba(235,245,255,.82); stroke: none; font-style: italic; font-size: 6px; }
.unit { transition: transform .9s cubic-bezier(.4,.1,.2,1); cursor: pointer; }
.unit.mine:hover .ubody { filter: brightness(1.15); }
.unit.sel .ring { stroke: #fff; stroke-width: 1.6; opacity: 1; }
.unit .ring { fill: none; stroke: #ffe6a3; stroke-width: 1.2; opacity: 0; }
.unit.todo .ring { opacity: .9; stroke-dasharray: 2 1.5; animation: spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.unit.dislodged { opacity: .92; }
.order-line { fill: none; stroke-linecap: round; pointer-events: none; }
.order-fail { opacity: .55; }

/* ---------------------------------------------------------------- Aide aux règles */
.qm { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--brass); color: var(--brass-2); background: rgba(201,164,92,.1); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; margin-left: 6px; vertical-align: middle; line-height: 1; flex: none; }
.qm:hover { background: var(--brass); color: #1c1407; }
.helpbtn { width: 34px; height: 34px; border-radius: 50%; justify-content: center; padding: 0; font-size: 17px; font-weight: 700; font-family: var(--serif); border-color: var(--brass); color: var(--brass-2); }
.helpdrawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); z-index: 55; background: var(--navy-2); border-left: 1px solid var(--brass); box-shadow: -20px 0 50px rgba(0,0,0,.5); display: grid; grid-template-rows: auto 1fr; animation: slin .22s ease-out; }
@keyframes slin { from { transform: translateX(40px); opacity: 0; } }
.helphead { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.helphead h3 { margin: 0; color: var(--brass-2); font-size: 22px; flex: none; }
.helphead input { flex: 1; }
.helpbody { display: grid; grid-template-columns: 210px 1fr; min-height: 0; }
.helpnav { overflow: auto; border-right: 1px solid var(--line); padding: 8px; }
.helpnav a { display: block; padding: 7px 9px; border-radius: 7px; color: var(--txt); text-decoration: none; font-size: 13px; }
.helpnav a:hover { background: rgba(255,255,255,.05); }
.helpnav a.on { background: rgba(201,164,92,.16); color: var(--brass-2); }
.helpnav .n { display: inline-block; width: 30px; color: var(--muted); font-family: var(--serif); }
.helpcontent { overflow: auto; padding: 6px 22px 40px; line-height: 1.6; }
.helpcontent h4 { font-family: var(--serif); font-weight: normal; color: var(--brass-2); font-size: 24px; margin: 14px 0 8px; }
.helpcontent h5 { font-family: var(--serif); font-weight: normal; color: var(--paper-2); font-size: 17px; margin: 16px 0 4px; }
.helpcontent p { margin: 6px 0; }
.helpcontent ul { margin: 6px 0; padding-left: 20px; }
.helpcontent .exlink { margin: 4px 4px 4px 0; }
.helpcontent mark { background: rgba(227,200,139,.35); color: inherit; border-radius: 3px; padding: 0 2px; }
.helpcontent .flash { animation: flash 1.8s ease-out; border-radius: 6px; }
@keyframes flash { 0%, 40% { background: rgba(227,200,139,.3); } 100% { background: transparent; } }
.rtable { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.rtable td { padding: 4px 10px 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.rtable td:first-child { color: var(--brass-2); white-space: nowrap; }
.exlist .exitem { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; }
.exlist .exitem:hover { background: rgba(255,255,255,.05); }
.exlist .exnum { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--brass); color: var(--brass-2); font-family: var(--serif); flex: none; }
.searchres { padding: 10px; border-radius: 8px; background: rgba(255,255,255,.03); margin-bottom: 8px; cursor: pointer; }
.searchres:hover { background: rgba(255,255,255,.07); }
.exview { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.exmap { height: min(62vh, 560px); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: radial-gradient(circle at 50% 45%, #22466d, #0f2238); }
.exmap svg { width: 100%; height: 100%; display: block; }
.exside .ord { font-family: var(--serif); font-size: 14.5px; padding: 2px 0; }
.exside .ord.ko { color: #e8a69f; }
.exside .comment { margin-top: 10px; padding: 10px; border-radius: 8px; background: rgba(201,164,92,.08); border: 1px solid var(--line); line-height: 1.5; }
@media (max-width: 900px) { .exview { grid-template-columns: 1fr; } .helpbody { grid-template-columns: 1fr; } .helpnav { display: none; } }

/* ---------------------------------------------------------------- Téléphone et petite tablette */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
@media (max-width: 820px) {
  body { font-size: 15px; }
  .home { padding: 24px 14px 50px; }
  .home-hero h1 { font-size: 40px; letter-spacing: .1em; }
  .home-hero p { font-size: 15px; }
  .home-hero .crest { width: 64px; height: 64px; }
  .panel h2 { font-size: 26px; }
  .panel-page { padding: 18px 12px 50px; }
  .section { padding: 14px; }
  .seats { grid-template-columns: 1fr; }
  .room-code { font-size: 30px; }

  .game { grid-template-rows: 50px 1fr; height: 100dvh; }
  .topbar { gap: 8px; padding: 0 8px; padding-top: env(safe-area-inset-top); }
  .brand { font-size: 0; letter-spacing: 0; }
  .brand::before { content: '♜'; font-size: 22px; }
  .phase .t { font-size: 15px; }
  .phase .s { font-size: 10px; }
  .timer { padding: 3px 8px; gap: 4px; }
  .timer .stage { display: none; }
  .timer .clock { font-size: 15px; }
  .topbar .chip { display: none; }
  .me-badge { padding: 3px 8px 3px 4px; font-size: 0; gap: 0; }
  .me-badge .flag { font-size: 12px; }
  .topbar [data-act="pause"] { padding: 4px 7px; font-size: 0; }
  .topbar [data-act="pause"]::before { content: '⏯'; font-size: 15px; }
  .helpbtn { width: 32px; height: 32px; }

  .main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .mapframe { inset: 4px; border-radius: 8px; }
  .mapctl { right: 10px; top: 10px; }
  .mapctl .btn { width: 40px; height: 40px; }
  .maplegend { left: 8px; bottom: 8px; max-width: calc(100% - 16px); gap: 4px; }
  .maplegend .chip { font-size: 10.5px; padding: 2px 6px; }
  .palette { bottom: 44px; max-width: calc(100% - 12px); padding: 6px; }
  .palette .btn.small { padding: 8px 11px; font-size: 13.5px; }
  .history-banner { top: 8px; padding: 4px 6px 4px 10px; gap: 6px; font-size: 13px; }

  .side { border-left: none; border-top: 1px solid var(--brass); height: 46dvh; transition: height .2s; box-shadow: 0 -10px 30px rgba(0,0,0,.4); padding-bottom: env(safe-area-inset-bottom); }
  .side.folded { height: auto; }
  .side.folded .tabbody { display: none; }
  .tab { padding: 11px 4px; font-size: 13.5px; }
  .tabbody { padding: 10px; }
  .sidefoot { padding: 8px 10px; }
  .sidefoot .btn.big { padding: 11px; }
  .orow { padding: 9px 8px; }
  .composer textarea { height: 54px; font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  .help { display: none; }

  .helpdrawer { width: 100vw; }
  .helphead h3 { font-size: 18px; }
  .helpcontent { padding: 6px 14px 40px; }
  .exmap { height: 46dvh; }
  .modal { padding: 16px; }
  .modal.wide { width: 96vw; }
  #toasts { bottom: 50%; width: 92vw; }
  .tooltip { display: none !important; }
}
@media (max-width: 820px) and (orientation: landscape) {
  .main { grid-template-columns: 1fr 340px; grid-template-rows: 1fr; }
  .side { height: auto; border-top: none; border-left: 1px solid var(--brass); }
  .side.folded .tabbody { display: block; }
}
@media (max-width: 820px) {
  .phase .s { white-space: nowrap; }
  .phase .s .qm { width: 16px; height: 16px; font-size: 10px; margin-left: 4px; }
  .maplegend { display: none; }
  .palette { left: 6px; right: 6px; transform: none; bottom: 10px; max-width: none; }
  .palette .hint { max-width: none; }
}
