/* Composants réutilisables, façon menus de jeu : lignes nettes, capitales condensées,
   et la sélection qui s'inverse (fond clair, texte sombre) comme dans les menus de GTA. */

/* ——— Menu latéral : bannière, sous-titres, lignes ——— */
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.side-banner { position: relative; display: block; height: 112px; flex: none; overflow: hidden; border-bottom: 2px solid #000; background: #1a0630; }
.side-banner .scene { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform 0.6s var(--ease); }
.side-banner:hover .scene { transform: scale(1.04); }
.side-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10, 4, 18, 0.1), rgba(10, 4, 18, 0.55)); }
.side-brand { position: absolute; z-index: 1; left: 14px; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.side-brand .stars { font-size: 13px; }
.side-brand .wordmark { font-size: 44px; line-height: 0.9; }
[data-theme="west"] .side-banner .scene, [data-theme="west"] .footer-art .scene { filter: sepia(0.75) saturate(1.25) hue-rotate(-12deg) brightness(0.92); }
.side-sub {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none;
  padding: 7px 14px; background: color-mix(in srgb, var(--bg) 70%, #000);
  color: var(--text-2); font: 600 12.5px/1.2 var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}
[data-theme="light"] .side-sub { background: var(--ink); color: var(--surface); }
.nav-group { display: flex; flex-direction: column; }
.nav-title { padding: 0 10px 6px; color: var(--text-3); font: 600 12px var(--font-ui); letter-spacing: 0.12em; text-transform: uppercase; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 7px 14px; min-height: 36px;
  background: var(--row); border-bottom: 1px solid var(--line);
  color: var(--text-2); font: 600 15.5px/1.1 var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.nav-link:hover { background: var(--row-hover); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--sel-bg); color: var(--sel-text); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.nav-link .count { margin-left: auto; font: 600 12px var(--font-ui); color: inherit; opacity: 0.7; font-variant-numeric: tabular-nums; }
.nav-link .dot-live { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); animation: pulse 2s infinite; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 14px 12px 14px; }
.countdown-mini {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--g-gta6) 45%, var(--line)); border-left: 4px solid var(--g-gta6);
  background: linear-gradient(120deg, color-mix(in srgb, var(--g-gta6) 18%, var(--surface)), var(--surface) 70%);
}
.countdown-mini b { font: 400 30px/1 var(--font-gta); letter-spacing: 0.02em; color: var(--g-gta6); text-shadow: 2px 2px 0 #000; }
.countdown-mini .tiny { color: var(--text-2); }
.tab-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 2px; border-radius: var(--radius); color: var(--text-3); font: 600 12px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }
.tab-link[aria-current="page"] { color: var(--sel-text); background: var(--sel-bg); }

/* ——— Barre du haut ——— */
.top-logo { flex: none; }
.search-trigger {
  flex: 1; max-width: 560px; height: 40px; min-width: 0;
  display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg) 55%, transparent);
  color: var(--text-3); text-align: left; font-size: 14px;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease);
}
.search-trigger:hover { border-color: var(--focus); background: var(--surface); color: var(--text-2); }
.search-trigger span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.search-trigger .kbd { flex: none; }
/* Les touches : des touches blanches comme les aides à l'écran des jeux. */
.kbd {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; min-width: 22px; height: 21px; padding: 0 6px;
  border-radius: 3px; background: #f4f1ea; color: #14100a; border: 1px solid #000; box-shadow: 0 2px 0 #000;
  font: 700 12px/1 var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px;
}

/* ——— Boutons ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  font: 700 15px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text);
  transition: transform 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease), border-color 0.12s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:hover { background: var(--sel-bg); color: var(--sel-text); border-color: var(--sel-bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-2); }
.btn.primary { border: 2px solid #000; color: #14060c; background: var(--brand); box-shadow: 3px 3px 0 #000, 0 10px 26px color-mix(in srgb, var(--brand-1) 28%, transparent); }
.btn.primary:hover { color: #14060c; background: var(--brand); border-color: #000; filter: brightness(1.08) saturate(1.1); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #000, 0 12px 30px color-mix(in srgb, var(--brand-1) 40%, transparent); }
.btn.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
[data-theme="west"] .btn.primary { color: #1a0d05; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--sel-bg); color: var(--sel-text); }
.btn.ok { border-color: color-mix(in srgb, var(--ok) 55%, transparent); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.btn.ok:hover { background: var(--ok); color: #06150c; border-color: var(--ok); }
.btn.bad { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); background: color-mix(in srgb, var(--bad) 9%, var(--surface)); }
.btn.bad:hover { background: var(--bad); color: #1a0505; border-color: var(--bad); }
.btn.on { border-color: var(--gold); color: var(--text); background: color-mix(in srgb, var(--gold) 16%, var(--surface)); }
.btn.on .i { color: var(--gold); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn.lg { height: 52px; padding: 0 22px; font-size: 18px; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }

/* ——— Cartes ——— */
.card {
  position: relative; display: block;
  padding: 18px; border-radius: var(--radius-l);
  border: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #fff 2%), var(--surface));
  box-shadow: var(--shadow);
}
a.card, button.card { transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease); text-align: left; width: 100%; }
a.card:hover, button.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); transform: translateY(-2px); box-shadow: inset 4px 0 0 var(--accent), var(--shadow); }
.card.flat { box-shadow: none; }
.card.tight { padding: 14px; }
.card.glow::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 80%, transparent), transparent 40%, transparent 70%, color-mix(in srgb, var(--brand-2) 60%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.card-title { font-weight: 700; font-size: 15.5px; letter-spacing: -0.01em; line-height: 1.3; }
.card-sub { margin-top: 6px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 12px; margin-bottom: 14px; }
.section-head > div:first-child { min-width: 0; flex: 1 1 220px; }
.section-head p { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; }
.eyebrow { color: var(--text-3); font: 600 13px/1.2 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; }
/* Ambiance Jour : contours d'encre et ombres franches, comme une case de bande dessinée. */
[data-theme="light"] .card, [data-theme="light"] .stat, [data-theme="light"] .score-card, [data-theme="light"] .answer-card,
[data-theme="light"] .game-hero, [data-theme="light"] .copilot, [data-theme="light"] .lab-hero, [data-theme="light"] .progress-box {
  border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
}
[data-theme="light"] a.card:hover { box-shadow: inset 4px 0 0 var(--accent), 6px 6px 0 var(--ink); }

/* ——— Badges, puces, étiquettes de jeu ——— */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 23px; padding: 0 8px; border-radius: var(--radius-s);
  font: 700 12.5px/1 var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--tone, var(--text-3)) 45%, transparent);
  background: color-mix(in srgb, var(--tone, var(--text-3)) 14%, transparent);
  color: var(--tone, var(--text-2));
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge .score { font-variant-numeric: tabular-nums; opacity: 0.85; font-weight: 700; }
.badge.solid { color: #0b0610; background: var(--tone, #fff); border-color: #000; }
/* Badge à phrase longue : il passe à la ligne au lieu de déborder sur téléphone. */
.badge.long { height: auto; min-height: 23px; padding: 5px 10px; white-space: normal; line-height: 1.3; text-transform: none; letter-spacing: 0.02em; font-size: 13.5px; }
.badge.long > .i { flex: none; }
.tone-ok { --tone: var(--ok); } .tone-warn { --tone: var(--warn); } .tone-hot { --tone: var(--hot); }
.tone-bad { --tone: var(--bad); } .tone-info { --tone: var(--info); } .tone-violet { --tone: var(--violet); } .tone-mute { --tone: var(--text-3); }
.game-tag {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 7px; border-radius: var(--radius-s);
  font: 700 12.5px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gc); background: color-mix(in srgb, var(--gc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--gc) 40%, transparent);
}
.game-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gc); flex: none; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--radius-s);
  border: 1px solid var(--line-2); background: var(--row); color: var(--text-2);
  font: 600 15px/1 var(--font-ui); letter-spacing: 0.03em; transition: all 0.12s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--focus); background: var(--row-hover); }
.chip[aria-pressed="true"] { color: var(--sel-text); border-color: transparent; background: var(--gc, var(--sel-bg)); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.75; }
.chip .n { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-s); background: var(--surface-2); color: var(--text-2); font-size: 12px; border: 1px solid var(--line); }

/* ——— Champs ——— */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font: 600 13.5px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--bg) 50%, var(--surface)); color: var(--text);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* ——— Onglets segmentés : la barre d'onglets d'un menu de jeu ——— */
.segmented { display: inline-flex; gap: 2px; padding: 0; background: transparent; flex-wrap: wrap; border-bottom: 2px solid var(--line-2); }
.segmented button { height: 36px; padding: 0 14px; border-radius: 0; background: var(--row); color: var(--text-2); font: 700 14.5px/1 var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; transition: all 0.12s var(--ease); }
.segmented button:hover { color: var(--text); background: var(--row-hover); }
.segmented button[aria-selected="true"] { background: var(--sel-bg); color: var(--sel-text); }

/* ——— Jauges en segments, comme les statistiques d'un personnage ——— */
.meter {
  position: relative; height: 9px; background: color-mix(in srgb, var(--text) 13%, transparent); overflow: hidden;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%);
  mask: repeating-linear-gradient(90deg, #000 0 calc(10% - 2px), transparent calc(10% - 2px) 10%);
}
.meter > i { position: absolute; inset: 0 auto 0 0; background: var(--tone, var(--accent)); }
.stat {
  position: relative; padding: 16px 16px 14px; border-radius: var(--radius-l); border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone, var(--accent)) 7%, var(--surface)), var(--surface) 70%);
  border-top: 3px solid var(--tone, var(--line-2));
}
.stat .k { color: var(--text-3); font: 600 13px/1.2 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; }
.stat .v { margin-top: 6px; font: 400 38px/1 var(--font-gta); letter-spacing: 0.02em; color: var(--tone, var(--text)); text-shadow: 2px 2px 0 #000; font-variant-numeric: tabular-nums; }
.stat .s { margin-top: 8px; color: var(--text-2); font-size: 12.5px; }

/* ——— Tableaux ——— */
.table-wrap { overflow-x: auto; border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { position: sticky; top: 0; padding: 10px 14px; text-align: left; font: 700 13px/1.2 var(--font-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); border-bottom: 2px solid var(--line-2); white-space: nowrap; }
.table th button { color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; gap: 4px; align-items: center; }
.table th button[aria-sort] { color: var(--text); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s var(--ease); }
.table tbody tr:nth-child(even) { background: var(--row); }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover, .table tbody tr:hover { background: var(--row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ——— Listes de résultats ——— */
.result {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start;
  padding: 13px 16px; border-radius: var(--radius); border: 1px solid transparent; border-bottom-color: var(--line);
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), box-shadow 0.12s var(--ease);
}
.result:hover, .result.active { background: var(--row-hover); box-shadow: inset 4px 0 0 var(--gc, var(--accent)); }
.result .ico { width: 38px; height: 38px; border-radius: var(--radius); display: grid; place-items: center; color: var(--gc); background: color-mix(in srgb, var(--gc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--gc) 35%, transparent); }
.result .t { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.result .d { margin-top: 3px; color: var(--text-2); font-size: 13.5px; }
.result .m { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
mark { background: color-mix(in srgb, var(--focus) 34%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ——— États vides, chargement ——— */
.empty { padding: 42px 20px; text-align: center; color: var(--text-2); border: 2px dashed var(--line-2); border-radius: var(--radius-l); background: var(--row); }
.empty h3 { color: var(--text); margin-bottom: 8px; font: 400 26px/1.1 var(--font-head); letter-spacing: 0.01em; }
/* Le petit cercle de chargement en bas des écrans de jeu. */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--text) 18%, transparent); border-top-color: var(--brand-1); border-right-color: var(--brand-2); animation: spin 0.8s linear infinite; flex: none; }

/* ——— Accordéon ——— */
details.disclosure { border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
details.disclosure > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; align-items: center; gap: 10px; font: 700 15.5px var(--font-ui); letter-spacing: 0.05em; text-transform: uppercase; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after { content: "+"; margin-left: auto; color: var(--text-3); font-size: 18px; }
details.disclosure[open] > summary::after { content: "−"; }
details.disclosure > .body { padding: 0 16px 16px; }

/* ——— Palette de commandes : un menu d'interaction de jeu ——— */
.overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: start center; padding: 12vh 16px 16px; background: rgba(4, 2, 8, 0.7); backdrop-filter: blur(6px) saturate(120%); animation: fade-up 0.18s var(--ease); }
[data-theme="light"] .overlay { background: rgba(27, 18, 9, 0.35); }
.palette { width: min(680px, 100%); max-height: 72vh; display: flex; flex-direction: column; border-radius: var(--radius-l); border: 1px solid var(--line-2); background: var(--panel); backdrop-filter: blur(20px); box-shadow: var(--shadow-pop); overflow: hidden; }
.palette::before { content: ""; display: block; height: 5px; flex: none; background: var(--brand); }
[data-theme="light"] .palette { border: 2px solid var(--ink); }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 60px; border-bottom: 2px solid var(--line-2); }
.palette-input input { flex: 1; height: 100%; border: 0; background: transparent; outline: none; font-size: 17px; min-width: 0; }
.palette-list { overflow-y: auto; padding: 6px 0; }
.palette-sec { padding: 8px 16px; margin-top: 4px; background: color-mix(in srgb, var(--bg) 60%, #000); color: var(--text-2); font: 600 12.5px/1.2 var(--font-ui); letter-spacing: 0.14em; text-transform: uppercase; }
[data-theme="light"] .palette-sec { background: var(--ink); color: var(--surface); }
.palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; text-align: left; color: var(--text); border-bottom: 1px solid var(--line); }
.palette-item:hover { background: var(--row-hover); }
.palette-item .sub { color: var(--text-3); font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.palette-item[aria-selected="true"] { background: var(--sel-bg); color: var(--sel-text); }
.palette-item[aria-selected="true"] .sub { color: inherit; opacity: 0.7; }
.palette-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; padding: 10px 16px; border-top: 2px solid var(--line-2); color: var(--text-2); font: 600 13px var(--font-ui); letter-spacing: 0.06em; text-transform: uppercase; }

/* ——— Notifications : comme les messages qui arrivent sur le téléphone du jeu ——— */
.toasts { position: fixed; z-index: 90; left: calc(var(--side-w) + 18px); bottom: 18px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 420px;
  padding: 10px 16px 10px 10px; border-radius: var(--radius); background: rgba(10, 7, 16, 0.94); color: #f7f2ff;
  border: 1px solid rgba(255, 255, 255, 0.14); border-left: 4px solid var(--brand-1); box-shadow: var(--shadow-pop);
  font-size: 14px; animation: toast-in 0.28s var(--ease);
}
.toast > .i { flex: none; width: 30px; height: 30px; padding: 6px; border-radius: var(--radius); background: var(--brand); color: #14060c; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@media (max-width: 920px) { .toasts { left: 12px; right: 12px; bottom: 86px; } .toast { max-width: none; } }
