:root {
  --bg: rgba(0, 26, 50, 0.86);
  --bg-solid: #002545;
  --bg-2: rgba(255, 255, 255, 0.06);
  --bg-3: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.09);
  --ink: #f1f4ff;
  --ink-2: #b9c3de;
  --ink-3: #8f9bbb;
  --gold: #f2c14e;
  --series: #6fd3ff;
  --good: #72d09a;
  --brand: #72d09a;
  --brand-ink: #00203c;
  --warn: #ffb020;
  --bad: #ff6b5e;
  --al: #b23a48;
  --al-soft: rgba(178, 58, 72, 0.22);
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  --blur: blur(14px) saturate(1.2);
  --top: 60px;
  --left-w: 268px;
  --right-w: 368px;
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #001f3b; color: var(--ink); font: 14px/1.45 var(--font); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button.link { background: none; border: 0; padding: 0; color: var(--ink-3); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
button.link:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--serif); margin: 0; font-weight: 700; }
ul { margin: 0; padding-left: 18px; }
li { margin: 4px 0; }
kbd { background: var(--bg-3); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; font: 12px var(--font); }
.hidden { display: none !important; }
.muted { color: var(--ink-2); font-weight: 400; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#scene:active { cursor: grabbing; }

/* ---------- étiquettes 3D ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); white-space: nowrap; pointer-events: auto;
  background: rgba(10, 16, 36, 0.62); border: 1px solid transparent; border-radius: 999px; padding: 2px 9px 2px 7px;
  font-size: 11.5px; display: flex; align-items: center; gap: 6px; cursor: pointer; will-change: transform;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tag:hover, .tag.picked { border-color: var(--gold); }
.tag .dot { width: 7px; height: 7px; border-radius: 50%; background: #666; flex: none; }
.tag .kw { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tag.alert { border-color: var(--bad); background: rgba(90, 18, 14, 0.9); animation: pulse 1s infinite; }
.tag.quiet { opacity: 0.85; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 107, 94, 0.25); } }

/* ---------- bandeau ---------- */
#topbar {
  position: fixed; left: 0; right: 0; top: 0; height: var(--top); display: flex; align-items: center; gap: 14px; padding: 0 14px;
  z-index: 20; pointer-events: none;
}
#topbar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 96px; background: linear-gradient(180deg, rgba(8, 13, 30, 0.85), rgba(8, 13, 30, 0)); pointer-events: none; z-index: -1; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 0; text-shadow: 0 1px 8px rgba(5, 9, 22, 0.95); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; filter: drop-shadow(0 1px 6px rgba(5, 9, 22, 0.8)); }
.brand-title { font-family: var(--serif); font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--brand); letter-spacing: 0.04em; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.hud {
  display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 7px 6px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); min-width: 0;
}
.hud > div { padding: 0 16px; }
.hud > div + div { border-left: 1px solid var(--line); }
.clock { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.clock-date { color: var(--ink-2); }
.clock-time { font-variant-numeric: tabular-nums; font-size: 17px; font-weight: 700; min-width: 58px; }
.chip { font-size: 11.5px; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); align-self: center; display: inline-flex; align-items: center; gap: 6px; }
.tdot { width: 9px; height: 9px; border-radius: 50%; background: #4aa8ff; flex: none; }
.chip[data-tempo="blanc"] .tdot { background: #f4f6fa; }
.chip[data-tempo="rouge"] .tdot { background: var(--bad); }
.chip[data-tempo="rouge"] { color: var(--ink); background: rgba(255, 107, 94, 0.2); }
.goal { width: 230px; }
.goal-line { display: flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; font-size: 12.5px; margin-bottom: 3px; }
#goal-count { font-size: 17px; font-weight: 700; }
.goal-left { margin-left: auto; font-size: 11.5px; color: var(--ink-3); }
.goal .bar { height: 4px; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 12.5px; }
#money { font-size: 17px; font-weight: 700; color: var(--gold); }
#money.neg { color: var(--bad); }
.controls { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 1 1 0; }
.speed { display: flex; flex: none; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.speed button { background: transparent; border: 0; padding: 7px 10px; min-width: 38px; font-weight: 600; font-size: 12.5px; }
.speed button.on { background: var(--brand); color: var(--brand-ink); }
.ico { display: inline-block; width: 10px; height: 12px; vertical-align: -1px; }
.ico-pause { border-left: 3px solid currentColor; border-right: 3px solid currentColor; }
.ico-play { width: 0; height: 0; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.icon-btn {
  background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; font-size: 12.5px; white-space: nowrap;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.icon-btn:hover, .speed button:hover:not(.on) { background: var(--bg-3); }
.icon-btn.round { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.icon-btn.off { color: var(--ink-3); position: relative; }
.icon-btn.off::after { content: ""; position: absolute; left: 7px; right: 7px; top: 50%; border-top: 2px solid var(--bad); transform: rotate(-45deg); }
.icon-btn.gold { border-color: rgba(242, 193, 78, 0.7); color: var(--gold); font-weight: 600; }

/* ---------- barres ---------- */
.bar { position: relative; height: 6px; border-radius: 4px; background: var(--bg-3); overflow: hidden; }
.bar.big { height: 12px; overflow: visible; }
.bar.big .bar-fill { border-radius: 4px; }
.bar-fill { height: 100%; width: 0; background: var(--series); border-radius: 4px; transition: width 0.25s linear; }
.bar-fill.gold { background: var(--gold); }
.bar-fill.warn { background: var(--warn); }
.bar-fill.bad { background: var(--bad); }
.bar-mark { position: absolute; left: 80%; top: -4px; bottom: -4px; width: 2px; background: var(--ink); border-radius: 2px; }

/* ---------- panneau gauche ---------- */
#left.closed, #alienor.closed { display: none; }
#left {
  position: fixed; left: 12px; top: calc(var(--top) + 6px); bottom: 12px; width: var(--left-w); display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto; z-index: 10; scrollbar-width: none;
}
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow);
}
.card .kicker { margin: 0 0 4px; font-size: 10.5px; color: var(--ink-3); }
.meter-main { display: flex; align-items: baseline; gap: 5px; margin-bottom: 9px; }
.meter-kw { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -0.02em; }
.meter-unit { font-size: 15px; font-weight: 600; }
.meter-of { color: var(--ink-3); font-size: 12.5px; margin-left: 2px; }
.meter-note { margin-left: auto; font-size: 11.5px; color: var(--good); white-space: nowrap; }
.meter-note.warn { color: var(--warn); }
.meter-note.bad { color: var(--bad); font-weight: 600; }
.breaker { margin-top: 10px; }
.breaker-line { display: flex; justify-content: space-between; font-size: 11.5px; margin-bottom: 4px; color: var(--ink-2); }
.breaker .btn { margin-top: 8px; width: 100%; }
.chart-wrap { position: relative; margin-top: 10px; }
#chart { width: 100%; height: 64px; display: block; }
.chart-tip { position: absolute; top: 0; pointer-events: none; background: var(--bg-solid); border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px; font-size: 11px; white-space: nowrap; transform: translateX(-50%); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column; font-size: 11px; color: var(--ink-3); padding-left: 10px; }
.facts div:first-child { padding-left: 0; }
.facts div + div { border-left: 1px solid var(--line); }
.facts b { font-size: 14px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.extras { display: flex; flex-direction: column; gap: 3px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.extras:empty { display: none; }
.extras b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

#loads { padding: 8px 10px; }
.row { display: flex; align-items: center; gap: 9px; padding: 6px 4px; border-radius: 9px; }
.row:hover { background: var(--bg-2); }
.row .name { flex: 1; min-width: 0; cursor: pointer; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .name small { display: none; }
.row .kw.warn { color: var(--warn); }
.row .kw { font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; text-align: right; }
.row .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; flex: none; }
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; border: 0; background: var(--bg-3); padding: 0; flex: none; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: #fff; }
.heat-modes { display: flex; margin: 2px 4px 6px 21px; background: var(--bg-2); border-radius: 9px; padding: 2px; }
.heat-modes button { flex: 1; background: transparent; border: 0; border-radius: 7px; padding: 4px 2px; font-size: 11.5px; color: var(--ink-2); }
.heat-modes button.on { background: var(--bg-3); color: var(--gold); font-weight: 600; }

.btn { background: var(--bg-3); border: 1px solid transparent; border-radius: 10px; padding: 7px 13px; font-weight: 600; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover:not(:disabled) { background: #8fe0b2; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #2a0a07; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.wide { width: 100%; }
.btn.big { padding: 12px 22px; font-size: 16px; }

/* ---------- Aliénor ---------- */
#alienor {
  position: fixed; right: 12px; top: calc(var(--top) + 6px); max-height: calc(100% - var(--top) - 18px); width: var(--right-w); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); z-index: 10; overflow: hidden;
}
.al-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px 14px; }
.al-avatar { width: 42px; height: 42px; border-radius: 50%; background: #5a3040 url(img/alienor.jpg) 48% 14% / 280% auto no-repeat; border: 2px solid var(--gold); flex: none; }
.al-avatar.small { width: 26px; height: 26px; border-width: 1px; }
.al-id { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.al-id b { font-family: var(--serif); font-size: 17px; }
.al-id .muted { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-nav { display: flex; gap: 2px; }
.al-nav button { position: relative; width: 32px; height: 32px; border-radius: 9px; background: transparent; border: 0; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; }
.al-nav button:hover { background: var(--bg-2); color: var(--ink); }
.al-nav button.on { background: var(--bg-3); color: var(--brand); }
.al-nav .badge { position: absolute; right: -2px; top: -2px; margin: 0; }
.al-back { display: flex; align-items: center; gap: 10px; padding: 0 14px 8px; }
.al-back b { font-family: var(--serif); font-size: 15px; }
.badge { display: inline-block; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; background: var(--bad); color: #2a0a07; font-size: 10px; font-weight: 700; text-align: center; margin-left: 5px; padding: 0 4px; vertical-align: 1px; }
.tab-body { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; scrollbar-width: thin; }
#tab-actions, #tab-docs, #tab-mail { padding: 4px 12px 12px; gap: 10px; }
.chat { flex: 0 1 auto; min-height: 0; overflow-y: auto; padding: 2px 12px 10px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.msg { max-width: 92%; border-radius: 14px; padding: 8px 12px; animation: rise 0.2s ease-out; font-size: 13.5px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.alienor { align-self: flex-start; background: rgba(255, 255, 255, 0.07); border-top-left-radius: 4px; }
.msg.user { align-self: flex-end; background: transparent; color: var(--ink-3); font-size: 12px; padding: 0 4px; }
.msg p { margin: 0 0 5px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 2px 0 5px; }
.msg .tagline { font-size: 11px; color: var(--gold); letter-spacing: 0.03em; margin-bottom: 4px; display: block; }
.msg .when { display: none; }
.verify { background: none; border: 0; padding: 0; color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; font-size: 11.5px; margin-top: 3px; }
.verify:hover { color: var(--series); }
.asks { padding: 8px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: center; flex: none; }
.asks-main { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%; }
.asks-main button { background: rgba(114, 208, 154, 0.12); border: 0; color: var(--ink); border-radius: 11px; padding: 9px 8px; font-size: 12.5px; font-weight: 600; }
.asks-main button:hover { background: rgba(114, 208, 154, 0.26); }
.asks-more { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.asks-more button { background: var(--bg-2); border: 0; color: var(--ink-2); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.asks-more button:hover { background: var(--bg-3); color: var(--ink); }

.inset { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-top: 8px; }
.inset h4 { margin: 0 0 6px; font: 600 13px var(--font); }
.inset .meta { font-size: 12px; color: var(--ink-2); margin: 2px 0; }
.inset .meta b { color: var(--ink); font-weight: 600; }
.inset .btn { margin-top: 8px; }
.plan-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.plan-row .state { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; min-width: 52px; text-align: center; }
.plan-row .state.on { background: rgba(61, 220, 151, 0.2); color: var(--good); border: 1px solid rgba(61, 220, 151, 0.5); }
.plan-row .state.off { background: var(--bg-3); color: var(--ink-2); border: 1px solid var(--line); }
.plan-row .why { color: var(--ink-3); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--gold); }
.draft { white-space: pre-wrap; font: 12.5px/1.5 var(--serif); background: rgba(255, 255, 255, 0.05); border-left: 3px solid var(--gold); padding: 7px 9px; border-radius: 4px; margin-top: 6px; }
.draft-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.done-note { font-size: 12px; color: var(--good); margin-top: 6px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }

.act { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.act h4 { margin: 0 0 4px; font: 700 14px var(--serif); display: flex; align-items: center; gap: 8px; }
.pill { font: 600 10.5px var(--font); border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); color: var(--ink-2); }
.pill.live { border-color: var(--good); color: var(--good); }
.pill.paused { border-color: var(--warn); color: var(--warn); }
.hist { margin-top: 8px; font-size: 11.5px; color: var(--ink-2); max-height: 110px; overflow-y: auto; }
.hist div { padding: 2px 0; border-top: 1px dashed var(--line); }
.hist time { color: var(--ink-3); margin-right: 6px; }
.intro { font-size: 12.5px; color: var(--ink-2); margin: 0; }

.doc { background: #fbf6ea; color: #1c2333; border-radius: 8px; padding: 16px 16px 12px; font: 13px/1.5 var(--serif); }
.doc h3 { font-size: 19px; }
.doc h4 { font: 700 14px var(--serif); margin: 14px 0 6px; border-bottom: 1px solid #d8cfb8; padding-bottom: 3px; }
.doc .sub { color: #5a6478; font-size: 12px; margin: 2px 0 10px; }
.doc table { border-collapse: collapse; width: 100%; font: 12px var(--font); font-variant-numeric: tabular-nums; }
.doc th, .doc td { border-bottom: 1px solid #e3dbc7; padding: 4px 6px; text-align: left; }
.doc th:not(:first-child), .doc td:not(:first-child) { text-align: right; }
.doc .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }
.doc .kpi { border: 1px solid #d8cfb8; border-radius: 7px; padding: 5px 7px; font: 11px var(--font); color: #5a6478; }
.doc .kpi b { display: block; font-size: 14px; color: #1c2333; }
.doc .note { color: #5a6478; font-size: 11.5px; margin-top: 12px; }
.doc ul { padding-left: 18px; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.versions button.on { background: var(--gold); color: #1b1404; border-color: var(--gold); }

.mail { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.mail.unread { border-color: var(--gold); }
.mail-head { display: flex; flex-direction: column; gap: 1px; padding: 9px 10px; cursor: pointer; width: 100%; text-align: left; background: transparent; border: 0; }
.mail-head .from { font-size: 11.5px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.mail-head .subj { font-weight: 600; }
.mail.unread .subj::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-right: 6px; vertical-align: 1px; }
.mail-body { padding: 0 10px 10px; font: 13px/1.5 var(--serif); }
.mail-body p { margin: 0 0 7px; }
.mail-body .btn-row { font-family: var(--font); margin-top: 8px; }

/* ---------- fiche de sélection ---------- */
.selcard {
  position: fixed; left: calc(var(--left-w) + 24px); right: calc(var(--right-w) + 24px); bottom: 12px; margin: 0 auto; max-width: 520px;
  background: var(--bg); border: 1px solid rgba(242, 193, 78, 0.55); border-radius: var(--radius); padding: 14px 16px; z-index: 12; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow);
}
.selcard h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; padding-right: 60px; }
.selcard .close { position: absolute; right: 10px; top: 10px; }
.selcard p { margin: 6px 0; color: var(--ink-2); font-size: 13px; }
.selcard .stats { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; font-size: 12.5px; }
.selcard .stats span b { font-variant-numeric: tabular-nums; }
.selcard .btn-row { margin-top: 8px; }
.prog { height: 5px; border-radius: 3px; background: var(--bg-3); overflow: hidden; margin-top: 6px; }
.prog div { height: 100%; background: var(--good); width: 0; }
.quote { font: italic 14px/1.5 var(--serif); color: var(--ink); }

/* ---------- messages flottants ---------- */
#toasts { position: fixed; top: calc(var(--top) + 12px); left: calc(var(--left-w) + 24px); right: calc(var(--right-w) + 24px); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; }
.toast { background: var(--bg-solid); border: 1px solid var(--line); border-left: 4px solid var(--series); border-radius: 12px; padding: 8px 14px; max-width: 440px; font-size: 13px; animation: rise 0.2s ease-out; pointer-events: auto; box-shadow: var(--shadow); }
.toast.good { border-left-color: var(--good); }
.toast.warn { border-left-color: var(--warn); }
.toast.bad { border-left-color: var(--bad); }
.toast.post { border-left-color: var(--gold); }
.toast b { display: block; }
button.toast { text-align: left; color: inherit; font: inherit; font-size: 13px; cursor: pointer; position: relative; padding-right: 30px; }
button.toast::after { content: "›"; position: absolute; right: 12px; top: 50%; transform: translateY(-52%); font-size: 20px; color: var(--ink-3); transition: transform 0.15s, color 0.15s; }
button.toast:hover { border-color: var(--line); background: #06305a; }
button.toast:hover::after { color: var(--ink); transform: translate(3px, -52%); }
/* retours visuels */
.money { position: relative; }
.pop { position: absolute; right: 14px; top: 100%; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; animation: pop 1.25s ease-out forwards; }
.pop.plus { color: var(--good); }
.pop.minus { color: var(--bad); }
@keyframes pop { 0% { opacity: 0; transform: translateY(-6px); } 15% { opacity: 1; transform: translateY(2px); } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(16px); } }
.bump { animation: bump 0.32s ease-out; display: inline-block; }
@keyframes bump { 35% { transform: scale(1.28); color: var(--gold); } }
#tip { position: fixed; z-index: 14; pointer-events: none; background: rgba(0, 20, 40, 0.9); color: var(--ink); border-radius: 8px; padding: 3px 9px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow); }
#pause-pill { position: fixed; left: calc(var(--left-w) + 148px); bottom: 15px; z-index: 11; background: var(--gold); color: #1b1404; border: 0; border-radius: 999px; padding: 4px 14px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; box-shadow: var(--shadow); animation: breathe 1.8s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.6; } }
/* avant l'ouverture : l'atelier seul derrière l'écran d'accueil, puis l'interface apparaît */
#topbar, #left, #alienor, .viewbtns, #labels, .fab { transition: opacity 0.7s ease; }
body:not(.started) #topbar, body:not(.started) #left, body:not(.started) #alienor, body:not(.started) .viewbtns, body:not(.started) #labels, body:not(.started) .fab { opacity: 0; pointer-events: none; }
#modal-start { background: rgba(0, 16, 34, 0.42); backdrop-filter: none; -webkit-backdrop-filter: none; }
.modal:not(.hidden) .sheet { animation: sheet 0.3s ease-out; }
@keyframes sheet { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.star.drop { animation: stardrop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes stardrop { from { transform: scale(2.2) rotate(-25deg); opacity: 0; } }
.viewbtns { position: fixed; left: calc(var(--left-w) + 24px); bottom: 14px; display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; z-index: 11; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.viewbtns button { min-width: 36px; height: 32px; background: transparent; border: 0; font-weight: 700; font-size: 12px; padding: 0 10px; }
.viewbtns button:hover { background: var(--bg-3); }
.fab { position: fixed; right: 12px; bottom: 12px; z-index: 15; display: flex; align-items: center; gap: 8px; background: var(--bg-solid); border: 1px solid var(--gold); border-radius: 999px; padding: 8px 14px 8px 8px; font-weight: 600; }
.fab.left { right: auto; left: 12px; padding: 8px 14px; }
.flash { animation: flash 0.5s 3; }
@keyframes flash { 50% { box-shadow: 0 0 0 4px var(--series); background: rgba(111, 211, 255, 0.18); } }

/* ---------- fenêtres ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 9, 22, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); overflow-y: auto; }
.sheet { width: 100%; max-width: 720px; max-height: 100%; overflow-y: auto; background: var(--bg-solid); border: 1px solid var(--line); border-radius: 22px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.sheet.start { max-width: 600px; text-align: center; padding: 38px 36px 28px; }
.sheet.start .lead { color: var(--ink-2); margin-bottom: 22px; }
.sheet.start .kicker { color: var(--brand); }
.trio { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.trio li { margin: 0; background: var(--bg-2); border-radius: 14px; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); line-height: 1.35; }
.trio b { font: 700 19px var(--serif); color: var(--gold); white-space: nowrap; }
.sheet.wide { max-width: 880px; }
.sheet h1 { font-size: 38px; line-height: 1.1; margin-bottom: 10px; }
.sheet h3 { font-size: 15px; color: var(--gold); margin: 12px 0 4px; }
.sheet-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { font-size: 22px; flex: 1; }
.kicker { color: var(--gold); letter-spacing: 0.06em; text-transform: uppercase; font-size: 11.5px; margin: 0 0 6px; }
.lead { font-size: 15.5px; color: var(--ink); margin: 0 0 8px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-bottom: 18px; }
.fine { font-size: 11.5px; color: var(--ink-3); margin: 14px 0 0; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.item { background: var(--bg-2); border: 1px solid transparent; border-radius: 14px; padding: 13px; display: flex; flex-direction: column; gap: 6px; }
.item h4 { margin: 0; font: 700 14.5px var(--serif); display: flex; justify-content: space-between; gap: 8px; }
.item p { margin: 0; font-size: 12.5px; color: var(--ink-2); flex: 1; }
.item .cost { font: 600 12.5px var(--font); color: var(--gold); white-space: nowrap; }
.item.owned { opacity: 0.7; }
/* clins d'œil et carnet */
.clin { margin-top: 8px; padding: 9px 12px; border-left: 3px solid var(--gold); background: rgba(242, 193, 78, 0.08); border-radius: 4px 10px 10px 4px; }
.clin b { font: 700 14.5px var(--serif); color: var(--gold); }
.selcard .clin p { margin: 3px 0 0; color: var(--ink); }
.carnet .item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.carnet .item.found { background: rgba(242, 193, 78, 0.08); }
.carnet .item.found h4 { color: var(--gold); }
.carnet .item.found .btn { align-self: flex-start; margin-top: 2px; }
.carnet .item.todo h4 { color: var(--ink-3); font-size: 22px; }
.carnet .item.todo .hint { font-style: italic; }
#carnet-count, #end-clins { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; margin-left: 2px; }
/* accueil : logo et niveaux */
.start-mark { width: 52px; height: 52px; display: block; margin: 0 auto 14px; }
.levels { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 20px; }
.levels-row { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.levels-row button { background: transparent; border: 0; border-radius: 999px; padding: 6px 16px; font-size: 13px; color: var(--ink-2); }
.levels-row button.on { background: var(--bg-3); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--brand); }
.levels-note { font-size: 12px; color: var(--ink-3); }
/* guide du premier jour */
#coach-ring { position: fixed; border: 2px solid var(--brand); border-radius: 14px; pointer-events: none; z-index: 40; box-shadow: 0 0 0 4px rgba(114, 208, 154, 0.25), 0 0 26px rgba(114, 208, 154, 0.55); animation: ring 1.4s ease-in-out infinite; }
@keyframes ring { 50% { box-shadow: 0 0 0 8px rgba(114, 208, 154, 0.12), 0 0 34px rgba(114, 208, 154, 0.7); } }
.coach { position: fixed; z-index: 41; width: 300px; background: #fff; color: #00203c; border-radius: 16px; padding: 14px 16px 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
.coach p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.45; font-weight: 500; }
.coach-row { display: flex; align-items: center; gap: 10px; }
.coach-row .muted { color: #6b7a8c; font-size: 12px; margin-left: auto; }
.coach button.link { color: #6b7a8c; }
.coach button.link:hover { color: #00203c; }
/* fin de partie */
.end-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 6px 0 12px; }
.score { text-align: right; line-height: 1.15; }
.score b { display: block; font: 700 34px var(--serif); color: var(--gold); font-variant-numeric: tabular-nums; }
.score span { font-size: 12px; color: var(--ink-3); }
.end-top .stars { margin: 0; }
.share-box { width: 100%; margin-top: 12px; background: var(--bg-2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: 13px/1.45 var(--font); resize: none; }
.inline-act { margin-top: 6px; }
.stars { display: flex; gap: 6px; margin: 4px 0 10px; }
.star { width: 34px; height: 34px; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); background: var(--bg-3); }
.star.on { background: var(--gold); }
.criteria { list-style: none; padding: 0; margin: 10px 0 16px; }
.criteria li { display: flex; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.criteria .mark { font-weight: 700; width: 46px; flex: none; font-size: 12px; }
.criteria .ok .mark { color: var(--good); }
.criteria .ko .mark { color: var(--ink-3); }
.criteria .what { font-weight: 600; flex: 1; }
.criteria .detail { color: var(--ink-2); font-size: 12.5px; text-align: right; }
.end-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- petits écrans ---------- */
@media (max-width: 1320px) {
  :root { --left-w: 252px; --right-w: 336px; }
  .brand-sub, .goal-left { display: none; }
  .goal { width: 170px; }
  .hud > div { padding: 0 12px; }
}
@media (max-width: 1120px) {
  .brand { display: none; }
  .controls { flex: none; }
  .hud { margin-right: auto; }
}
@media (max-width: 920px) {
  :root { --top: 100px; }
  #topbar { flex-wrap: wrap; gap: 6px 8px; padding: 6px 8px; align-content: center; }
  #topbar::before { height: var(--top); background: rgba(8, 13, 30, 0.88); }
  .hud { width: 100%; justify-content: space-between; margin: 0; }
  .hud > div { padding: 0 10px; }
  .goal { flex: 1; width: auto; }
  .chip { display: none; }
  .chip.hc { display: inline; }
  .controls { width: 100%; justify-content: space-between; gap: 6px; }
  .speed button { min-width: 34px; padding: 7px 8px; }
  .icon-btn { padding: 7px 10px; }
  #left, #alienor { top: calc(var(--top) + 8px); bottom: 64px; left: 8px; right: 8px; width: auto; z-index: 16; }
  #alienor { max-height: none; }
  .chat { flex: 1 1 auto; }
  .coach { width: min(300px, calc(100% - 20px)); }
  #left.closed, #alienor.closed { display: none; }
  .selcard { left: 8px; right: 8px; bottom: 64px; }
  #toasts { left: 8px; right: 8px; }
  .viewbtns { left: auto; right: 12px; bottom: 70px; }
  #pause-pill { left: 12px; bottom: 70px; }
  .cols, .trio { grid-template-columns: 1fr; }
  .sheet, .sheet.start { padding: 20px 18px; }
  .sheet h1 { font-size: 28px; }
}
@media (max-width: 480px) {
  .controls { gap: 4px; }
  .icon-btn { padding: 7px 8px; font-size: 12px; }
  .icon-btn.round { width: 32px; height: 32px; }
  .speed button { min-width: 30px; padding: 7px 6px; }
  .hud > div { padding: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .msg, .toast, #coach-ring, .pop, .bump, #pause-pill, .modal:not(.hidden) .sheet, .star.drop { animation: none; }
  #topbar, #left, #alienor, .viewbtns, #labels, .fab { transition: none; }
  .tag.alert { animation: none; }
  .bar-fill { transition: none; }
}
