/* Thai: Noto Sans Thai (SIL OFL, self-hosted, thai subset). Downloaded only when the page contains Thai characters. */
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/noto-sans-thai-thai-400-normal.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "Noto Sans Thai"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("vendor/fonts/noto-sans-thai-thai-700-normal.woff2") format("woff2");
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }

/* page language not applied yet (js/boot.js → js/i18n.js): the French of the HTML stays hidden instead of flashing */
html.i18n-pending :is([data-i18n], [data-i18n-rich]) { visibility: hidden; }
html.i18n-pending [data-i18n-placeholder]::placeholder { color: transparent; }

/* ---------------------------------------------------------------- tokens (charte du site, docs/design/agencement-menus.md §3.1) */
:root {
  --bg: #0f1216;
  --surface-1: #161a20;   /* panneaux, menus, dialogues */
  --surface-2: #1d2229;   /* contrôles au repos, survol des boutons fins */
  --surface-3: #262d36;   /* survol, segment actif */
  --overlay: rgba(22, 26, 32, .96);
  --line: #2b323c;
  --line-strong: #4a5462;
  --text: #d9dee5;
  --text-strong: #f3f5f8;
  --muted: #9aa4b2;
  --text-faint: #6b7583;
  --accent: #f0a53a;      /* ambre : uniquement l'état actif (et la tête de lecture) */
  --accent-ink: #15110a;
  --accent-bg: #1c1912;
  --accent-soft: rgba(240, 165, 58, .14);
  --focus: #8cc2ff;
  --team0: #e5484d;
  --team1: #3e8ef7;
  --blu: #5c9dff;
  --red: #ff6b70;
  --branch: #c77dff;
  --ok: #46d17a;
  --danger: #ff6a5c;
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, .5);
  --ch: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  /* hauteurs de la barre du haut et de la timeline ; --tlx = voies / arbre des branches dépliés (timeline.js) */
  --tb-h: 40px;
  --tl-h: 48px;
  --lanes: 0;
  --tlx: 0px;
  --ptop: calc(var(--tb-h) + var(--tl-h) + var(--tlx) + 8px);
  --isz: 1;
  /* mobile foundations (docs/specs/17-mobile.md). CSS vars cannot be used in media queries, so breakpoints are
     literals everywhere: phone < 600px (max-width: 599px), narrow < 900px (max-width: 899px), tablet landscape
     901-1184px, touch = (pointer: coarse). */
  --touch: 44px;          /* min touch target under (pointer: coarse) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", sans-serif; overflow: hidden; }
#view { position: fixed; inset: 0; }
#view canvas { display: block; }
[hidden] { display: none !important; }
html[data-uimode="design"] .only-pres, html[data-uimode="pres"] .only-design { display: none !important; }

/* ---------------------------------------------------------------- base controls */
select, button, input, textarea, .btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 2px; padding: 3px 6px; font: inherit; }
input[type=text], input[type=number], input:not([type]), textarea, select { background: var(--bg); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input[type=color] { padding: 0; width: 34px; height: 22px; }
input[type=checkbox], input[type=radio], input[type=range] { padding: 0; accent-color: var(--accent); }
button, .btn { cursor: pointer; }
button:hover, .btn:hover { border-color: var(--line-strong); background: var(--surface-3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(1.08); background: var(--accent); }
button.danger, .menu .danger { color: var(--danger); }
button:disabled, .noperm { opacity: .4; cursor: not-allowed; }
.num { width: 64px; }
.unit { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 5px 0; }
.row select { flex: 1; max-width: 180px; }
.row input[type=range] { flex: 1; max-width: 130px; }
.check { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.check select { margin-left: auto; }
.check.sub1, .row.sub1 { margin-left: 20px; padding-left: 8px; border-left: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 11.5px; margin: 4px 0; }
.hint { margin-left: 22px; }
details { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }
summary { cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 4px 0; user-select: none; }
summary:hover, details[open] > summary { color: var(--text); }
details.sub { border: 0; margin: 0 0 0 20px; padding: 0; }
details.sub > summary { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.seg { display: flex; margin: 6px 0; border: 1px solid var(--line); }
.seg button { flex: 1; border: 0; border-radius: 0; padding: 4px 2px; font-size: 12px; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; }
.seg button:hover { color: var(--text); background: var(--surface-2); }
.seg button.on { background: var(--surface-3); color: var(--text-strong); border-bottom-color: var(--accent); }
.seg.small button { padding: 2px 6px; font-size: 11px; }
.btns { display: flex; gap: 4px; margin-top: 6px; }
.btns > * { flex: 1; text-align: center; font-size: 12px; padding: 3px 2px; }
.c-fire { color: #ff4b4b; } .c-defend { color: #3ec1ff; } .c-spot { color: #ffd23f; }

/* ---------------------------------------------------------------- faceted button (thin line + cut corners): outer frame + inner face */
.cb { --cut: 6px; position: relative; display: inline-flex; padding: 1px; border: 0; border-radius: 0; background: var(--line); clip-path: var(--ch);
  color: var(--muted); cursor: pointer; flex: none; text-decoration: none; }
.cb > span { --cut: 6px; display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; padding: 0 8px;
  background: var(--bg); clip-path: var(--ch); white-space: nowrap; }
.cb svg { width: 20px; height: 20px; flex: none; }
.cb i[data-ui-icon] { font-style: normal; line-height: 1; display: grid; place-items: center; }
.cb:hover { background: var(--line-strong); color: var(--text); }
.cb:hover > span { background: var(--surface-2); }
.cb.on, .cb[aria-pressed="true"] { background: var(--accent); color: var(--accent); }
.cb.on > span, .cb[aria-pressed="true"] > span { background: var(--accent-bg); }
.cb:focus-visible { outline: none; background: var(--focus); color: var(--text); }
.cb:disabled, .cb.noperm { opacity: .35; }
.cb:disabled:hover { background: var(--line); color: var(--muted); }
.cb:disabled:hover > span { background: var(--bg); }
.cb.sq { width: 30px; height: 30px; }
.cb.sq > span { padding: 0; }
.cb.sq svg { width: 18px; height: 18px; }
.cb.rail { width: 38px; height: 38px; }
.cb.rail > span { padding: 0; font-size: 16px; }
.cb.flat { background: transparent; }
.cb.flat > span { background: transparent; }
.cb.flat:hover { background: var(--line); }
.cb.flat:hover > span { background: var(--surface-2); }
.cb.flat.on { background: var(--accent); }
.cb.danger:hover { background: var(--danger); color: var(--danger); }
.cb .fly-mark { position: absolute; right: 4px; bottom: 4px; width: 0; height: 0; border-left: 4px solid transparent; border-bottom: 4px solid currentColor; pointer-events: none; }

/* ---------------------------------------------------------------- faceted floating panels */
.fr { --cut: 10px; position: fixed; padding: 1px; background: var(--line); clip-path: var(--ch); z-index: 10; }
.fr > .in { --cut: 10px; background: var(--overlay); clip-path: var(--ch); height: 100%; max-height: inherit; overflow: hidden; display: flex; flex-direction: column; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 6px 12px; min-height: 38px;
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); flex: none; }
.sec-h .act { display: flex; gap: 2px; align-items: center; }
.scroll { overflow: auto; flex: 1; min-height: 0; }
.fr .body { padding: 0 12px 12px; }
.fr .body > details:first-of-type { margin-top: 8px; }
.hr { display: block; height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------------------------------------------------------------- custom tooltip (js/ui.js) */
#tip { position: fixed; z-index: 90; max-width: 300px; padding: 7px 10px; background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 12px; line-height: 1.35; pointer-events: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; box-shadow: var(--shadow-pop); }
#tip b { color: var(--text-strong); font-weight: 600; }
#tip kbd { font: 600 11px ui-monospace, monospace; color: var(--accent); border: 1px solid var(--line-strong); padding: 0 5px; align-self: start; white-space: nowrap; }
#tip span { grid-column: 1 / -1; color: var(--muted); }

/* ---------------------------------------------------------------- popovers and menus */
.pop { z-index: 60; box-shadow: var(--shadow-pop); }
.fly > .in { flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 6px; width: max-content; max-width: 180px; }
.menu { min-width: 230px; }
.menu > .in { padding: 4px; }
.menu button, .menu .btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 10px; border: 0; background: transparent;
  color: var(--text); text-align: left; font-size: 13px; border-radius: 0; }
.menu button:hover, .menu .btn:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu .menu-h { display: block; padding: 8px 10px 3px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.menu .menu-empty { margin: 0; padding: 8px 10px; }
#hiddenMenu { max-height: 70vh; overflow: auto; }
.menu i[data-ui-icon] { width: 16px; height: 16px; color: var(--muted); display: grid; place-items: center; font-style: normal; }
.menu i[data-ui-icon] svg { width: 16px; height: 16px; }
.menu .danger, .menu .danger i { color: var(--danger); }
.menu .hr { margin: 4px 6px; }

/* ---------------------------------------------------------------- top bar: logo, plan tabs, room, mode */
#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--tb-h); display: flex; align-items: stretch; z-index: 12;
  background: var(--surface-1); border-bottom: 1px solid var(--line); }
.tb-brand { display: grid; place-items: center; padding: 0 12px; border-right: 1px solid var(--line); flex: none; }
.tb-brand img { width: 24px; height: 24px; display: block; }
.tb-brand:hover img, .tb-brand:focus-visible img { filter: brightness(1.25); }
.tb-spacer { flex: 1; min-width: 8px; }
.ptabs { display: flex; align-items: stretch; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ptabs::-webkit-scrollbar { display: none; }
.ptab { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 100%; max-width: 260px; flex: none;
  border: 0; border-right: 1px solid var(--line); border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ptab:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); border-bottom-color: transparent; }
.ptab .n { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ptab .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ptab .lbl small { color: var(--muted); }
.ptab.on { background: var(--surface-2); color: var(--text-strong); border-bottom-color: var(--accent); }
.ptab.done:not(.on) { opacity: .65; }
.ptab.dragging { opacity: .45; }
.ptab.drop-before { box-shadow: inset 3px 0 0 var(--accent); }
.ptab.drop-after { box-shadow: inset -3px 0 0 var(--accent); }
.ptab .ok { color: var(--ok); display: grid; place-items: center; font-style: normal; }
.ptab .ok svg { width: 14px; height: 14px; }
.ptab .more { display: grid; place-items: center; width: 22px; height: 22px; margin-right: -6px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.ptab .more:hover { background: var(--surface-3); color: var(--text); }
.ptab .more svg { width: 16px; height: 16px; }
.ptab.ghost { font-style: italic; border-bottom: 2px dashed var(--line-strong); }
.ptab.ghost.on { border-bottom-color: var(--accent); }
.ptab-add { width: 40px; justify-content: center; padding: 0; }
.ptab-add i, .ptab i[data-ui-icon] { font-style: normal; display: grid; place-items: center; }
.ptab-add svg { width: 16px; height: 16px; }
.modeseg { display: flex; align-items: stretch; border-left: 1px solid var(--line); flex: none; }
.modeseg button { display: flex; align-items: center; gap: 6px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  color: var(--muted); padding: 0 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.modeseg button i { font-style: normal; display: grid; }
.modeseg button svg { width: 16px; height: 16px; }
.modeseg button:hover { background: var(--surface-2); color: var(--text); }
.modeseg button.on { color: var(--text-strong); background: var(--surface-2); border-bottom-color: var(--accent); }

/* room (js/net.js renderPresence) */
#presence { display: flex; align-items: center; gap: 8px; padding: 0 10px; border-left: 1px solid var(--line); flex: none; min-width: 0; }
#presence button { font: inherit; color: inherit; }
.rb-room { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; max-width: 220px; border: 1px solid var(--line); background: transparent;
  font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-room .dot, .tl-dot { width: 6px; height: 6px; background: var(--accent); transform: rotate(45deg); flex: none; display: inline-block; }
.rb-room b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
button.rb-room:hover, .rb-users:hover { border-color: var(--line-strong); background: var(--surface-2); }
.rb-demo { color: var(--accent); }
.rb-ro { border: 1px solid var(--accent); color: var(--accent); padding: 1px 8px; font-size: 11px; white-space: nowrap; }
.rb-users { display: flex; align-items: center; gap: 3px; height: 28px; background: transparent; border: 1px solid transparent; padding: 0 4px; }
.rb-pill, .av { width: 22px; height: 22px; display: grid; place-items: center; font-weight: 700; font-size: 10px; color: var(--bg); background: var(--c);
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); flex: none; }
.rb-pill.away, .av.away { opacity: .45; }
.rb-count { color: var(--muted); font-size: 11px; margin-left: 3px; white-space: nowrap; }
.rb-menu { position: fixed; z-index: 60; width: 320px; max-height: 70vh; overflow: auto; background: var(--surface-1);
  border: 1px solid var(--line); padding: 4px; box-shadow: var(--shadow-pop); }
.rb-head { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; padding: 8px 8px 4px; }
.rb-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: 0; background: none; text-align: left; border-radius: 0; min-height: 30px; }
.rb-pick:hover:not(:disabled) { background: var(--surface-2); }
.rb-pick.cur { opacity: 1; cursor: default; color: var(--accent); }
.rb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-sub { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rb-pad { padding: 4px 8px 8px; }
.rb-dot { width: 9px; height: 9px; background: var(--c); flex: none; transform: rotate(45deg); }
.rb-manage { display: block; border-top: 1px solid var(--line); margin-top: 4px; padding: 7px 8px 4px; color: var(--accent); }
.rb-me { display: flex; align-items: center; gap: 8px; padding: 4px 8px; }
.rb-role { color: var(--c); font-size: 11px; border: 1px solid var(--c); padding: 0 6px; }
.rb-share { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px 8px; font-size: 12px; border-bottom: 1px solid var(--line); }
.rb-toggle { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.rb-toggle input { margin: 0; }
.rb-presenter { color: var(--accent); font-weight: 600; }

/* ---------------------------------------------------------------- timeline (docked under the top bar) */
#timeline { position: fixed; top: var(--tb-h); left: 0; right: 0; height: calc(var(--tl-h) + var(--tlx)); display: flex; align-items: flex-start; gap: 6px;
  padding: 9px 10px 0; background: var(--surface-1); border-bottom: 1px solid var(--line); z-index: 11; }
#timeline > select, #timeline > input, .tl-group select { height: 30px; }
#timeline .time { width: 58px; text-align: center; font-variant-numeric: tabular-nums; }
.tl-sep { width: 1px; height: 24px; margin: 3px 2px 0; background: var(--line); flex: none; }
.tl-group { display: flex; gap: 6px; align-items: center; }
#tlNewVis { max-width: 110px; }
.clock { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; background: transparent; border: 1px solid var(--line); color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock i { font-style: normal; display: grid; } .clock svg { width: 16px; height: 16px; }
.clock b { color: var(--text-strong); font-weight: 600; }
.clock.running { border-color: var(--accent); color: var(--accent); }
#tlTrack { position: relative; flex: 1; min-width: 80px; height: calc(30px + var(--lanes) * 9px); cursor: pointer; background: var(--bg); border: 1px solid var(--line); }
#tlTicks span { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: 9.5px; color: var(--muted); padding: 1px 3px; pointer-events: none; }
#tlTicks span.end { color: transparent; }
#tlCursor { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); margin-left: -1px; pointer-events: none; box-shadow: 0 0 4px var(--accent); }
#tlCursor::before { content: ""; position: absolute; top: -2px; left: -5px; border: 6px solid transparent; border-top-color: var(--accent); }
#tlKeys .kf { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--surface-1); transform: rotate(45deg); cursor: ew-resize; border: 1.5px solid var(--text); }
#tlKeys .kf.br { background: var(--branch); }
#tlKeys .win { position: absolute; bottom: 2px; height: 5px; background: rgba(62, 142, 247, .7); pointer-events: none; }
#tlDivs .div { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--branch); cursor: ew-resize; }
#tlDivs .div span { position: absolute; bottom: -2px; left: 2px; background: var(--branch); color: #111; font-size: 10px; font-weight: 700;
  padding: 0 4px; white-space: nowrap; cursor: pointer; }
#tlDivs .div.dead { opacity: .35; }
#tlScore { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .9; }
#tlLanes { position: absolute; left: 0; right: 0; top: 31px; }
#tlLanes .lane { position: absolute; right: 0; height: 7px; border-top: 2px solid rgba(199, 125, 255, .35); cursor: pointer; }
#tlLanes .lane.on { border-top: 3px solid var(--branch); }
#tlLanes .lane b { position: absolute; left: 3px; top: -8px; font-size: 9px; color: var(--branch); background: var(--bg); padding: 0 2px; }
#tlExpand.on { background: var(--branch); color: var(--branch); }
#tlInfo { position: fixed; top: var(--ptop); left: 50%; transform: translateX(-50%); display: flex; gap: 14px; z-index: 11; pointer-events: none; font-size: 12px; }
#tlInfo span:not(:empty) { background: var(--overlay); border: 1px solid var(--line); padding: 2px 10px; }
#tlBranch { color: var(--branch); }
#divPop { position: fixed; top: calc(var(--tb-h) + 44px); z-index: 30; background: var(--surface-1); border: 1px solid var(--branch); padding: 8px 10px; width: 270px; box-shadow: var(--shadow-pop); }
#divPop .dname { width: 170px; font-weight: 600; }
#divPop .opt { display: flex; align-items: center; gap: 6px; margin: 4px 0; }
#divPop .opt .oname { flex: 1; }
#divPop .odel { padding: 0 6px; }
#tlTree { position: fixed; top: 46px; z-index: 12; overflow: visible; }
#tlTree .lane { stroke: rgba(199,125,255,.35); stroke-width: 3; }
#tlTree .lane.on { stroke: var(--branch); stroke-width: 4; }
#tlTree .arrow { fill: none; stroke: rgba(199,125,255,.55); stroke-width: 2; }
#tlTree .arrow.on { stroke: var(--branch); }
#tlTree .node { fill: var(--branch); cursor: pointer; }
#tlTree .tag { cursor: pointer; }
#tlTree .tag rect { fill: #221a2e; stroke: var(--branch); }
#tlTree .tag.on rect { fill: var(--branch); }
#tlTree .tag text { fill: #e6ccff; font-size: 11px; font-weight: 700; }
#tlTree .tag.on text { fill: #111; }
#tlTree .btn circle { fill: #2b2336; stroke: #7d5aa6; cursor: pointer; }
#tlTree .btn text { fill: #e6ccff; font-size: 10px; pointer-events: none; }
/* presentation: the tree only picks the branch shown (no renaming, adding, deleting or merging) */
html[data-uimode="pres"] #tlTree .btn { display: none; }

/* ---------------------------------------------------------------- tool rail (left) */
#rail { left: 8px; top: var(--ptop); bottom: 8px; width: 50px; transition: top .15s; }
#rail > .in { align-items: center; gap: 4px; padding: 6px 0 8px; overflow-y: auto; scrollbar-width: none; }
.rail-hr { display: block; width: 26px; height: 1px; background: var(--line); margin: 2px 0; flex: none; }
.rail-fill { flex: 1; min-height: 8px; }
.rail-off { display: block; width: 28px; height: 1px; background: var(--line); margin: 8px 0 6px; flex: none; }

/* ---------------------------------------------------------------- forces (BLUFOR / OPFOR) */
#forces { left: 66px; top: var(--ptop); width: 300px; max-height: calc(100% - var(--ptop) - 8px); transition: top .15s; }
#forces .full { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
#forces .strip { display: none; }
#forces.collapsed { width: 46px; }
#forces.collapsed .full { display: none; }
#forces.collapsed .strip { display: flex; }
#forces .strip { flex-direction: column; align-items: center; gap: 4px; padding: 6px 0 8px; overflow-y: auto; max-height: calc(100vh - var(--ptop) - 20px); scrollbar-width: none; }
.strip .lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; margin-top: 4px; }
.strip .lbl.ally { color: var(--blu); } .strip .lbl.enemy { color: var(--red); }
.badges { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.badge { width: 30px; height: 22px; padding: 0; border: 0; border-radius: 0; font-size: 11px; font-weight: 700;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.badge.ally { background: rgba(92, 157, 255, .18); color: var(--blu); }
.badge.enemy { background: rgba(255, 107, 112, .16); color: var(--red); }
.badge:hover { background: var(--surface-3); }
.badge.sel { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.roster { font-size: 12px; }
.roster + .roster { border-top: 1px solid var(--line); margin-top: 4px; }
.roster header { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px 6px 4px 12px; }
.roster h3 { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.side-ally h3 { color: var(--blu); } .side-enemy h3 { color: var(--red); }
.roster h3 .count { color: var(--muted); font-weight: 400; }
.roster .act { display: flex; align-items: center; gap: 2px; }
.roster .act select { height: 26px; padding: 0 4px; font-size: 11.5px; max-width: 92px; }
.roster .act .cb.sq { width: 26px; height: 26px; }
.roster .act .cb.sq svg { width: 16px; height: 16px; }
.roster.collapsed .rows, .roster.collapsed .addbox { display: none; }
.roster .addbox { padding: 4px 12px 6px; border-bottom: 1px solid var(--line); }
.roster .rows { padding: 0 0 4px; }
.roster .rempty { padding: 0 12px; margin: 2px 0 6px; }
.rrow { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 24px; align-items: center; gap: 8px; padding: 3px 6px 3px 12px; min-height: 28px; cursor: pointer; }
.rrow:hover { background: var(--surface-2); }
.rrow.sel { background: var(--accent-bg); box-shadow: inset 2px 0 0 var(--accent); }
.rrow .cls { width: 20px; height: 20px; display: grid; place-items: center; font-weight: 700; font-size: 11px;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.side-ally .rrow .cls { background: rgba(92, 157, 255, .18); color: var(--blu); }
.side-enemy .rrow .cls { background: rgba(255, 107, 112, .16); color: var(--red); }
.rrow .nm { overflow: hidden; white-space: nowrap; display: flex; gap: 5px; align-items: center; min-width: 0; }
.rrow .nm > span { display: inline-block; overflow: hidden; text-overflow: ellipsis; }
/* long names scroll back and forth (js/roster.js sets .long and --shift); ellipsis kept when motion is reduced */
@media (prefers-reduced-motion: no-preference) {
  .rrow .nm.long > span:last-child { flex: none; overflow: visible; text-overflow: clip; animation: marquee 5s ease-in-out infinite alternate; }
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(var(--shift)); } }
.rrow .sp { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rrow .loc, .rrow .del { width: 24px; height: 24px; padding: 2px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.rrow .loc:hover, .rrow .del:hover { color: var(--text); background: var(--surface-3); }
.rrow .loc svg, .rrow .del svg { width: 16px; height: 16px; }
.rrow .more { grid-column: 1 / -1; display: none; align-items: center; gap: 6px; padding: 2px 0 4px; }
.rrow.sel .more { display: flex; }
.rrow .lance { width: 46px; padding: 0 2px; height: 24px; }
.rrow .pilot { flex: 1; min-width: 0; padding: 1px 6px; font-size: 11.5px; height: 24px; }
.rrow .pilot.linked { border-color: var(--ok); color: var(--ok); font-weight: 600; }
.rrow .more .del { margin-left: auto; }
.rrow .more .del:hover { color: var(--danger); }
.rrow .grp { font-size: 10px; font-weight: 800; background: #f5d33a; color: #111; padding: 0 3px; flex: none; }
.combo { position: relative; margin: 4px 0; }
.combo input { width: 100%; }
.floatlist { position: fixed !important; z-index: 60; list-style: none; margin: 0; padding: 0; overflow: auto;
  background: var(--surface-1); border: 1px solid var(--line); box-shadow: var(--shadow-pop); }
.floatlist li { padding: 5px 8px; cursor: pointer; display: flex; flex-direction: column; }
.floatlist li small { color: var(--muted); }
.floatlist li:hover, .floatlist li.on { background: var(--surface-3); }
.floatlist li.hint { cursor: default; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.floatlist li.empty { color: var(--muted); cursor: default; }
#teamPop { position: fixed; z-index: 60; background: var(--surface-1); border: 1px solid var(--line); padding: 6px; min-width: 240px; box-shadow: var(--shadow-pop); }
#teamPop .t { display: flex; gap: 4px; align-items: center; padding: 2px 0; }
#teamPop .t span { flex: 1; }

/* ---------------------------------------------------------------- floating panels opened from the rail (Affichage, Détection) */
.float-panel { left: 66px; top: var(--ptop); width: 310px; max-height: calc(100% - var(--ptop) - 8px); z-index: 14; }
.float-panel > .in { max-height: calc(100vh - var(--ptop) - 10px); }
#legend { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; font-size: 11.5px; }
#legend span { display: flex; align-items: center; gap: 5px; }
#mapName { font-weight: 600; text-align: right; }
.vstree details { margin: 0 0 0 12px; border: 0; padding: 0; }
.vstree > details { margin-left: 0; }
.vstree summary { list-style: revert; display: list-item; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 400; color: var(--text); }
.vstree summary .check, .vstree .leaf .check { display: inline-flex; margin: 2px 0; }
.vstree .leaf { margin-left: 26px; display: flex; align-items: center; gap: 6px; }
.vstree input[type=color] { width: 22px; height: 16px; margin-left: 6px; vertical-align: middle; }

/* ---------------------------------------------------------------- right column: inspector, tool options, people */
#rightCol { position: fixed; right: 8px; top: var(--ptop); width: 280px; max-height: calc(100% - var(--ptop) - 44px); display: flex; flex-direction: column; gap: 8px;
  z-index: 10; pointer-events: none; transition: top .15s; }
#rightCol > .fr { position: relative; pointer-events: auto; flex: none; max-height: 100%; }
#rightCol > .fr > .in { max-height: calc(100vh - var(--ptop) - 52px); }
#props .sec-h { text-transform: none; letter-spacing: 0; font-size: 13px; }
#props .ptitle { color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#props .ptitle b { font-weight: 600; }
#props .ptitle .muted { font-size: 11.5px; }
#propsBody { overflow: auto; min-height: 0; }
.p-sum { padding: 0 12px 4px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.p-vis { display: flex; align-items: center; gap: 6px; padding: 2px 12px; }
.p-vis input { width: 54px; text-align: center; font-variant-numeric: tabular-nums; }
.p-vis .cb.sq { width: 26px; height: 26px; font-size: 10px; }
.p-sw { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 12px 4px; align-items: center; }
.p-sw button, .swatches button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 0; background: var(--c);
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px); }
.p-sw button.on, .swatches button.on { outline: 1.5px solid var(--text-strong); outline-offset: 2px; clip-path: none; }
.p-sw input[type=color] { width: 22px; height: 18px; }
.p-acts { display: flex; gap: 4px; padding: 6px 12px 10px; align-items: center; }
.p-acts .grow { flex: 1; }
.p-more { border-top: 1px solid var(--line); padding: 4px 12px 10px; }
#props .vis { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
#props h3 { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 8px 0 4px; font-weight: 600; }
#toolOpts #opts { padding: 0 12px 10px; overflow: auto; }
.opt { display: none; }
.opt.show { display: block; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 2px 0 4px; }
.iconpal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.iconpal button { padding: 3px; color: var(--c, #e5484d); display: grid; place-items: center; }
.iconpal button.on { outline: 1.5px solid var(--accent); }
.iconpal svg { width: 22px; height: 22px; }
.viewer { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto 18px; align-items: center; gap: 9px; padding: 4px 12px; min-height: 30px; }
.viewer .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 6px; white-space: nowrap; }
.viewer .tag.pres { color: var(--accent); border-color: var(--accent); }
.viewer i { color: var(--text-faint); display: grid; font-style: normal; } .viewer i.on { color: var(--ok); }
.viewer svg { width: 16px; height: 16px; }
.viewer button.follow { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; background: none; color: var(--text-faint); }
.viewer button.follow:hover { color: var(--text); background: none; }
.viewer button.follow.on { color: var(--accent); }
#viewers .muted { padding: 0 12px 10px; }
#viewers .in > .scroll { padding-bottom: 6px; }

/* ---------------------------------------------------------------- overlays */
#readout, #status { position: fixed; bottom: 8px; background: var(--overlay); border: 1px solid var(--line);
  padding: 4px 10px; font-variant-numeric: tabular-nums; pointer-events: none; z-index: 10; font-size: 12px; }
#readout { right: 8px; }
#status { left: 50%; transform: translateX(-50%); max-width: calc(100% - 420px); }
#readout:empty, #status:empty { display: none; }
#toast { position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%); background: var(--surface-3); border: 1px solid var(--accent);
  padding: 6px 14px; z-index: 80; white-space: pre-line; }
#gpuWarn { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 85; display: flex; gap: 10px; align-items: flex-start;
  max-width: min(640px, calc(100% - 16px)); padding: 8px 10px 8px 14px; background: var(--surface-3); border: 1px solid var(--danger); box-shadow: var(--shadow-pop); font-size: 12.5px; }
#gpuWarn strong { color: var(--danger); white-space: nowrap; }
#gpuWarn .x { flex: none; padding: 0 6px; border: 0; background: none; font-size: 16px; line-height: 1; color: var(--muted); }
@media (max-width: 600px) {
  #gpuWarn { flex-direction: column; gap: 6px; width: calc(100% - 16px); padding: 10px 40px 10px 12px; }
  #gpuWarn strong { white-space: normal; }
  #gpuWarn .x { position: absolute; top: 0; right: 0; min-width: 44px; min-height: 44px; }
}
#card { position: fixed; z-index: 40; background: var(--surface-1); border: 1px solid var(--line); padding: 8px 10px;
  max-width: 320px; pointer-events: none; box-shadow: var(--shadow-pop); }
#card h4 { margin: 0 0 2px; color: var(--text-strong); }
#card .sub { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
#card table { border-collapse: collapse; font-size: 12px; }
#card th { text-align: left; color: var(--muted); font-weight: 500; padding: 1px 8px 1px 0; vertical-align: top; }
#card .notetext { white-space: pre-wrap; max-width: 280px; }
#boxsel { position: fixed; border: 1px dashed var(--accent); background: rgba(240,165,58,.12); pointer-events: none; z-index: 12; }

/* ---------------------------------------------------------------- dialogs */
dialog { background: var(--surface-1); color: var(--text); border: 1px solid var(--line); border-radius: 0; min-width: 320px; padding: 16px 18px; }
dialog::backdrop { background: rgba(8,10,13,.6); backdrop-filter: blur(2px); }
dialog h3 { margin: 0 0 10px; color: var(--text-strong); font-size: 16px; font-weight: 600; }
dialog input[type=text], dialog textarea { width: 100%; }
#confirmDialog .msg { margin: 0 0 14px; max-width: 440px; white-space: pre-line; color: var(--text-strong); }
dialog .fields { display: grid; gap: 6px; }
dialog .fields label { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.dlg-foot { justify-content: flex-end; margin-top: 14px; }
.dlg-foot > * { flex: none; padding: 5px 14px; }
.dlg-foot .danger { margin-right: auto; background: transparent; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 -2px 6px; overflow-x: auto; }
.tabs button { flex: none; height: 34px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 0; background: transparent;
  color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.on { color: var(--text-strong); border-bottom-color: var(--accent); }
#settingsDialog { width: min(600px, 94vw); }
#settingsDialog .settings { min-height: 220px; }
#settingsDialog fieldset { border: 0; margin: 0; padding: 4px 2px; }
#settingsDialog legend { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; padding: 0 0 6px; }
#settingsDialog .row { justify-content: space-between; }
#settingsDialog h4 { margin: 8px 0 2px; font-size: 12px; color: var(--muted); text-transform: uppercase; }
#settingsDialog .pane-sec { border: 0; margin: 0; }
#planAddDialog { width: min(440px, 94vw); }
#planAddDialog .row select { max-width: 260px; }
#briefDialog { width: min(720px, 92vw); }
#briefDialog textarea { width: 100%; font: 12px/1.45 ui-monospace, "Noto Sans Thai", monospace; }
#briefDialog details { border: 1px solid var(--line); padding: 4px 8px; margin: 6px 0; }
.csvtool a { color: var(--accent); }

/* ---------------------------------------------------------------- loading, login, closed */
#noPlans { position: fixed; top: var(--tb-h); left: 0; right: 0; bottom: 0; z-index: 20; display: grid; place-content: center; justify-items: center;
  gap: 28px; background: var(--bg); color: var(--accent); }
#noPlans[hidden] { display: none; }
#noPlans img { width: min(36vh, 360px); opacity: .9; }
#noPlans .brand-logo { width: min(60vw, 520px); max-width: none; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font-size: 16px; background: rgba(10,12,15,.6); z-index: 50; pointer-events: none; }
#loading .box { display: grid; gap: 10px; justify-items: center; min-width: 280px; padding: 20px 28px; background: var(--surface-1); border: 1px solid var(--line); text-align: center; }
#loading .box p { margin: 0; }
#loading .brand-logo { width: 240px; color: var(--accent); }
/* progression par étapes ; la bande animée (transform, sur le compositeur) continue de bouger pendant les calculs bloquants */
#loading .bar { position: relative; width: 240px; height: 4px; background: var(--surface-3); overflow: hidden; }
#loading .bar span { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .3s ease-out; }
#loading .bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: loadSweep 1.1s linear infinite; }
@keyframes loadSweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
/* logo (nom stylisé) : masque PNG transparent coloré par currentColor */
.brand-logo { display: block; width: 100%; max-width: 230px; aspect-ratio: 939 / 38; background-color: currentColor;
  -webkit-mask: url("img/logo.png") no-repeat center / contain; mask: url("img/logo.png") no-repeat center / contain; }
#loginGate .brand-logo { width: 260px; max-width: 100%; margin: 4px auto; }
#closedGate { position: fixed; inset: 0; z-index: 110; background: rgba(10,12,15,.92); display: grid; place-items: center; }
#closedGate .box { background: var(--surface-1); border: 1px solid var(--line); padding: 20px 28px; max-width: 420px; text-align: center;
  display: flex; flex-direction: column; gap: 10px; align-items: center; }
#closedGate h2 { color: var(--accent); margin: 0; }
#closedGate a { color: var(--muted); font-size: 12px; }
#loginGate { position: fixed; inset: 0; z-index: 100; background: rgba(10,12,15,.92); display: grid; place-items: center; }
#loginGate .box { background: var(--surface-1); border: 1px solid var(--line); padding: 20px 28px; min-width: 300px; text-align: center; }
#loginGate h2 { color: var(--accent); margin: 0 0 8px; }
/* rôles sans droit d'édition : outils de conception, options et inspecteur masqués (les calques restent) */
body[data-role=spectator] #rail .only-design, body[data-role=spectator] #toolOpts, body[data-role=spectator] #props { display: none !important; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1100px) {
  .ptab { max-width: 170px; }
  .modeseg button span { display: none; }
  #rightCol { width: 250px; }
  #forces { width: 270px; }
}
@media (max-width: 800px) {
  #forces:not(.collapsed) { width: calc(100% - 82px); max-height: 45%; }
  #rightCol { width: calc(100% - 82px); max-height: 40%; top: auto; bottom: 40px; }
  .float-panel { width: calc(100% - 82px); }
  #presence .rb-users { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } #loading .bar::after { animation: none; } }

/* ---------------------------------------------------------------- phone: presentation only (js/layout.js isPhone)
   On y suit une présentation ou on gère son salon : pas de conception, pas de forces, pas d'inspecteur. En portrait, le rail devient
   une barre en bas, Affichage et Détection s'ouvrent en tiroir au-dessus. */
html[data-device="phone"] { --tb-h: 44px; --tl-h: 46px; --bar-h: calc(54px + env(safe-area-inset-bottom)); }
@media (orientation: landscape) { html[data-device="phone"] { --tl-h: 42px; } html[data-device="phone"] #timeline { padding-top: 6px; } }
html[data-device="phone"] body { touch-action: manipulation; }
html[data-device="phone"] :is(.modeseg, #planAdd, #forces, #rightCol, #readout, #eveClock, #tlStart, #tlSpeed, #tlDuration, .tl-sep, #tip) { display: none !important; }
/* menu d'un plan : seulement ce qui se lit ou s'emporte */
html[data-device="phone"] #planMenu :is(#planNew, #planDup, #planRen, label:has(#importJson), #eveDone, #eveRemove, #planDel, .hr) { display: none; }
html[data-device="phone"] .tb-brand { padding: 0 10px; }
html[data-device="phone"] .ptab { max-width: 46vw; padding: 0 10px; }
html[data-device="phone"] #presence { padding: 0 6px; }
html[data-device="phone"] .rb-room { max-width: 34vw; height: 32px; }
html[data-device="phone"] .rb-menu { width: auto; left: 8px !important; right: 8px; }
html[data-device="phone"] #timeline { gap: 4px; padding: 8px 6px 0; }
html[data-device="phone"] #timeline .time { width: 50px; }
/* portrait : rail en barre du bas ; en paysage la hauteur manque, il reste à gauche comme sur un ordinateur */
@media (orientation: portrait) {
  html[data-device="phone"] #rail { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: var(--bar-h); clip-path: none; padding: 1px 0 0; }
  html[data-device="phone"] #rail > .in { flex-direction: row; justify-content: safe center; gap: 4px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    clip-path: none; background: var(--surface-1); overflow-x: auto; overflow-y: hidden; }
  html[data-device="phone"] .cb.rail { flex: 0 1 44px; min-width: 34px; width: auto; height: 42px; }
  html[data-device="phone"] :is(.rail-hr, .rail-off) { width: 1px; height: 26px; margin: 0 2px; }
  html[data-device="phone"] .rail-fill { flex: 0 0 0; min-height: 0; }
  html[data-device="phone"] .float-panel { left: 6px; right: 6px; width: auto; top: auto; bottom: calc(var(--bar-h) + 6px); max-height: none; }
  html[data-device="phone"] .float-panel > .in { max-height: calc(100svh - var(--ptop) - var(--bar-h) - 16px); }
  html[data-device="phone"] #status { bottom: calc(var(--bar-h) + 8px); max-width: calc(100% - 16px); }
  html[data-device="phone"] #toast { bottom: calc(var(--bar-h) + 40px); max-width: calc(100% - 16px); }
}
html[data-device="phone"] #card { max-width: calc(100% - 16px); }
html[data-device="phone"] dialog { min-width: 0; width: calc(100vw - 16px); max-width: none; padding: 14px; }
html[data-device="phone"] .row select { max-width: 60%; }

/* ---------------------------------------------------------------- CSS2D: game markers */
.mk { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.mk .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #111; box-shadow: 0 0 0 1px rgba(255,255,255,.5); }
.mk.spawn .dot { width: 8px; height: 8px; border-width: 1px; }
.mk.capture .dot, .mk.tower .dot { border-radius: 2px; transform: rotate(45deg); width: 13px; height: 13px; background: #f5d33a !important; }
.mk.base .dot, .mk.generator .dot { border-radius: 2px; width: 14px; height: 14px; }
.mk.turret .dot { width: 9px; height: 9px; border-radius: 0; }
.mk .lbl { margin-top: 2px; font-size: 12px; font-weight: 800; white-space: nowrap; color: #f5d33a; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 2px #000; }
.gridlbl { font-size: 13px; font-weight: 700; color: #ffd98a; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.nolabels .mk .lbl, .nolabels .gridlbl, .nolabels .pi .lbl { display: none; }

/* CSS2D: plan items */
body.pathing #labels .pi { pointer-events: none; }   /* drawing a move path: clicks go through to the map */
.pi { pointer-events: auto; cursor: pointer; display: flex; flex-direction: column; align-items: center; user-select: none; }
.pi.sel { filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 2px #fff); }
.pi .t { font-weight: 700; white-space: pre; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.pi-textbg .t { text-shadow: none; padding: 2px 8px; border-radius: 12px; border: 1px solid rgba(255,255,255,.4); }
.pi .ic { filter: drop-shadow(0 0 2px #000) drop-shadow(0 0 1px #000); line-height: 0; }
.pi .lbl { font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.pi .mech { min-width: 30px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--c); border: 2px solid #111;
  box-shadow: 0 0 0 1px rgba(255,255,255,.7); display: grid; place-items: center; font-size: 10px; font-weight: 800; color: #111; }
.note-ic { width: 22px; height: 22px; border-radius: 4px; background: #f5d33a; color: #111; display: grid; place-items: center; font-size: 13px; border: 1px solid #111; }
.note-body { display: none; }
.pi-label { background: rgba(0,0,0,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 8px; white-space: nowrap; pointer-events: none; }
.ping { width: var(--s, 18px); height: var(--s, 18px); border-radius: 50%; border: var(--b, 3px) solid var(--c); animation: ping 1s ease-out infinite; }
@keyframes ping { from { transform: scale(.5); opacity: 1; } to { transform: scale(3); opacity: 0; } }
.hidemarkers .mk { display: none; }

/* capture rings */
.capring { position: relative; width: 44px; height: 44px; pointer-events: none; display: grid; place-items: center; }
.capring .ring { position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--c) var(--f), rgba(0,0,0,.35) 0); -webkit-mask: radial-gradient(circle, transparent 13px, #000 14px);
  mask: radial-gradient(circle, transparent 13px, #000 14px); }
.capring.neutral .ring { opacity: .45; }   /* conquest: neutral band, scores for nobody */
.capring .pct { position: absolute; top: 46px; font-size: 11px; font-weight: 800; color: #fff; white-space: nowrap; text-shadow: 0 0 3px #000, 0 0 3px #000; }

.mk.off { opacity: .5; }
.mk.off .dot { background: #b36bff !important; }
.mk.off .lbl { color: #d4a8ff; text-decoration: line-through; }
/* mech symbols: MWO class diamond in the team colour (semi-transparent), role glyph on top */
.pi .msym { position: relative; display: grid; place-items: center; filter: drop-shadow(0 0 2px rgba(0,0,0,.8)); }
.pi .msym .diamond { display: block; }
.pi .msym i { position: absolute; top: -12px; right: -12px; color: #fff; background: rgba(17,17,17,.75); border-radius: 50%; width: 17px; height: 17px;
  display: grid; place-items: center; border: 1px solid var(--c); }
.pi [data-group]::after { content: attr(data-group); position: absolute; left: -12px; top: -9px; font-size: 9px; font-weight: 800;
  background: #f5d33a; color: #111; border-radius: 3px; padding: 0 2px; }
.pi .mech { position: relative; }
.pi-group .gicon { position: relative; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 55%, transparent); border: 2px solid #fff; color: #fff; filter: drop-shadow(0 0 2px #000); }
.pi-group .gicon svg { width: 20px; height: 20px; }
.pi-group .gicon b { position: absolute; right: -8px; bottom: -6px; font-size: 10px; background: #111; color: #fff; border-radius: 8px; padding: 0 4px; border: 1px solid var(--c); }

/* order labels (editable duration) */
.pi.order-lbl { flex-direction: row; align-items: center; gap: 3px; }
.order-lbl { pointer-events: auto; background: rgba(0,0,0,.72); border: 1px solid var(--c); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 8px; padding: 1px 6px; white-space: nowrap; }
.order-lbl .k { color: var(--c); }
.order-lbl input { width: 42px; padding: 0 2px; font-size: 11px; background: #111; }
.order-lbl.sel { outline: 2px solid #fff; }
.order-lbl .warn { color: #ffb020; cursor: help; }
/* general icon size (markers, mechs, labels) */
.pi-mech > *, .pi-group > * { zoom: var(--isz); }   /* mech icons only */
.pi-mech.undetected > * { opacity: .45; transform: scale(.72); transition: opacity .2s, transform .2s; }

/* facing pointer around the mech icon */
.pi-mech { position: relative; }
.pi-mech.has-facing::before { content: ""; position: absolute; left: 50%; top: 12px; width: 0; height: 0; pointer-events: none;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #fff;
  transform-origin: 50% 0; transform: translate(-50%, 0) rotate(var(--fy)) translate(0, -24px);
  filter: drop-shadow(0 0 2px #000); }
.ewwrap { pointer-events: none; }
.ewlbl { display: inline-block; font: 600 9px/1 system-ui, "Noto Sans Thai", sans-serif; letter-spacing: .12em; text-transform: uppercase; color: var(--c);
  text-shadow: 0 0 2px #000, 0 0 2px #000; pointer-events: none; white-space: nowrap; transform: rotate(var(--rot, 0deg)); }

/* ---------------------------------------------------------------- guided tour (js/tutorial.js) */
/* the overlay lets clicks through: the user tries each feature while its step is shown */
#tuto { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
#tuto .tuto-spot { position: fixed; border: 2px solid var(--accent); border-radius: 8px; box-shadow: 0 0 0 9999px rgba(0,0,0,.55);
  transition: left .2s, top .2s, width .2s, height .2s; }
#tuto.centered .tuto-spot { left: 50% !important; top: 50% !important; width: 0 !important; height: 0 !important; border: 0; }
#tuto .tuto-card { position: fixed; width: min(340px, calc(100vw - 20px)); max-height: calc(100vh - 20px); overflow: auto; pointer-events: auto;
  background: var(--surface-1); border: 1px solid var(--accent); padding: 12px 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#tuto h3 { margin: 2px 0 6px; color: var(--accent); font-size: 15px; }
#tuto .tuto-step { font-size: 11px; }
#tuto .tuto-body p { margin: 0 0 6px; }
#tuto .btns { align-items: center; margin-top: 10px; }
#tuto .btns > * { flex: none; }
#tuto .tuto-skip { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 3px 0; }
#tuto .tuto-nav { display: flex; gap: 6px; margin-left: auto; }
#tuto .tuto-nav button { padding: 4px 12px; }
@media (prefers-reduced-motion: reduce) { #tuto .tuto-spot { transition: none; } }

/* Donate link of the tool pages (web/js/donate.js): discreet, next to the language menu / at the end of the top bar */
.donate-link { display: inline-flex; align-items: center; align-self: center; gap: 4px; height: 28px; padding: 0 8px; margin: 0 4px;
  border-radius: 2px; color: var(--muted); font-size: 12px; text-decoration: none; white-space: nowrap; }
.donate-link:hover, .donate-link:focus-visible { background: var(--surface-3); color: var(--text-strong); }
@media (max-width: 900px) { .donate-link span { display: none; } }

/* ---------------------------------------------------------------- mobile foundations (docs/specs/17-mobile.md) */
/* inputs >= 16px: iOS zooms the page on focus otherwise */
@media (max-width: 899px), (pointer: coarse) {
  input:not([type=checkbox], [type=radio], [type=range], [type=color]), select, textarea { font-size: 16px; }
}
@media (pointer: coarse) {
  .ui-sheet__close { min-width: var(--touch); min-height: var(--touch); }
}
/* long-press tooltip (js/touch-tip.js) */
.touch-tip { position: fixed; z-index: 90; max-width: min(280px, calc(100vw - 16px)); padding: 6px 10px; pointer-events: none;
  background: var(--surface-1); color: var(--text); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop);
  font-size: 13px; line-height: 1.4; }
/* bottom sheet (js/ui-sheet.js) */
.ui-sheet { position: fixed; inset: 0; z-index: 80; }
.ui-sheet__backdrop { position: absolute; inset: 0; background: rgba(8, 10, 13, .6); opacity: 0; transition: opacity .18s ease; }
.ui-sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh;
  max-width: 640px; margin: 0 auto; background: var(--surface-1); border: 1px solid var(--line); border-bottom: 0; box-shadow: var(--shadow-pop);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px)); transform: translateY(100%); transition: transform .2s ease; outline: 0; }
.ui-sheet.is-open .ui-sheet__backdrop { opacity: 1; }
.ui-sheet.is-open .ui-sheet__panel { transform: none; }
.ui-sheet__handle { flex: none; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--line-strong); }
.ui-sheet__head { flex: none; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-3) var(--sp-1) var(--sp-4); }
.ui-sheet__title { flex: 1; min-width: 0; margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 600; }
.ui-sheet__close { flex: none; min-width: 36px; min-height: 36px; padding: 0; font-size: 22px; line-height: 1; background: none; border-color: transparent; }
.ui-sheet__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-2) var(--sp-4); }
html.ui-sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .ui-sheet__backdrop, .ui-sheet__panel { transition: none; } }
