@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,800&family=Josefin+Sans:wght@400;600;700&family=Nunito:wght@400;700;800&display=swap');

:root {
  --ink: #0e0f1a;
  --panel: #191b2c;
  --line: #2b2e47;
  --text: #f4f2fb;
  --muted: #bcbed6;  /* texte secondaire : contraste ≥ 9:1 (WCAG AAA) */
  --a: #ff7a1a;      /* joueur 1 : orange */
  --b: #90a4ff;      /* joueur 2 : bleu (assez clair pour un texte lisible sur fond sombre) */
  --danger: #ff97ab;
  --clock-start: #3ddc84;   /* chrono : début (vert) */
  --clock-half: #ffb020;    /* chrono : 50 % écoulés (orange) */
  --on-accent: #0e0f1a;     /* texte posé sur un aplat de couleur (--a, --b, --owner, --danger) : sombre, toujours ≥ 7:1 */
  --radius: 14px;
  --font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: var(--font);
}

/* Thème « Rosey » (choisi par theme.js) : crépuscule mauve, halo crème, poteaux de bois, police ronde.
   Les panneaux restent sombres et opaques pour garder le texte lisible sur le décor. */
:root[data-theme="rosey"] {
  --ink: #3b2143;
  --panel: rgba(43, 22, 50, .86);
  --line: rgba(255, 228, 214, .28);
  --text: #fff8f2;
  --muted: #f0cfd9;
  --a: #ffa060;      /* orange du bandeau */
  --b: #7cc2ff;      /* bleu ciel */
  --danger: #ff97ab;
  --radius: 20px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-title: 'Josefin Sans', var(--font);
}
:root[data-theme="rosey"] body {
  background: var(--ink) url('/platform/themes/rosey-decor.svg') center / cover no-repeat fixed;
}
:root[data-theme="rosey"] :is(h1, h2) { font-family: var(--font-title); }

/* Thème « Boutique » : vitrine de jeux vidéo, bleu marine profond, barre presque noire, accents bleu clair,
   boutons verts, coins à peine arrondis, police sobre (Arial). */
:root[data-theme="boutique"] {
  --ink: #1b2838;
  --panel: #16202d;
  --line: #2a475e;
  --text: #c7d5e0;
  --muted: #8f98a0;
  --a: #a4d007;      /* vert des boutons */
  --b: #66c0f4;      /* bleu clair des liens */
  --danger: #ff97ab;
  --radius: 3px;
  --font: Arial, Helvetica, system-ui, sans-serif;
  --font-title: var(--font);
}
:root[data-theme="boutique"] body {
  background: radial-gradient(ellipse 120% 60vh at 50% 0, #2a475e 0%, rgba(42, 71, 94, 0) 100%) var(--ink) fixed;
}
:root[data-theme="boutique"] .site-head { background: #171a21; border-bottom: 0; box-shadow: 0 0 12px rgba(0, 0, 0, .6); }
:root[data-theme="boutique"] .site-head .logo { color: #fff; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
:root[data-theme="boutique"] .site-head nav a { color: #dcdedf; font-weight: 400; text-transform: uppercase; letter-spacing: .06em; }
:root[data-theme="boutique"] .site-head nav a:hover, :root[data-theme="boutique"] .site-head nav a:focus-visible {
  color: #fff; text-decoration: none; box-shadow: inset 0 -3px #1a9fff; }
:root[data-theme="boutique"] .btn.primary { background: linear-gradient(to right, #75b022 5%, #588a1b 95%); color: #fff;
  border-color: transparent; border-radius: 2px; }
:root[data-theme="boutique"] .btn.primary small { color: #d2efa9; }
:root[data-theme="boutique"] .site-head .theme-pick select { font-weight: 400; color: #fff; background: #316282;
  border: 1px solid #000; border-radius: var(--radius); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

/* Barre de menu du site, fixée en haut de toutes les pages ; le contenu commence dessous (body décalé de --head-h,
   les calques plein écran aussi). Une seule ligne : sur un écran étroit, les liens défilent horizontalement. */
:root { --head-h: clamp(52px, 7vh, 68px); }
body { padding-top: var(--head-h); }
html { scroll-padding-top: var(--head-h); }   /* ancres (#jeux) : pas sous la barre */
.site-head { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; flex-wrap: nowrap; align-items: center;
  justify-content: space-between; gap: 12px clamp(14px, 3vw, 28px); height: var(--head-h); margin: 0;
  padding: env(safe-area-inset-top) clamp(16px, 4vw, 48px) 0; background: var(--ink); border-bottom: 1px solid var(--line); }
.site-head .logo { display: inline-flex; flex: none; align-items: center; gap: .35em; color: var(--text); text-decoration: none;
  font-family: var(--font-title); font-weight: 600; font-size: clamp(1.2rem, 2.2vw, 2rem); letter-spacing: .02em; }
.site-head .logo svg { width: 1.3em; height: 1.3em; }
.site-head nav { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px clamp(14px, 3vw, 40px); min-width: 0;
  overflow-x: auto; scrollbar-width: none; }
.site-head nav::-webkit-scrollbar { display: none; }
.site-head nav a { flex: none; color: var(--text); text-decoration: none; font-weight: 800; font-size: clamp(.95rem, 1.2vw, 1.1rem); }
.site-head nav a:hover, .site-head nav a:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 6px; }
.site-head .theme-pick { display: inline-flex; flex: none; align-items: center; gap: .5em; color: var(--muted); font-size: .95rem; }
.site-head .theme-pick select { font: inherit; font-weight: 700; color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: 999px; padding: .3em .8em; }
@media (max-width: 560px) { .site-head .theme-pick .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.hidden { display: none !important; }

.owner-a { --owner: var(--a); }
.owner-b { --owner: var(--b); }
.dot { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: var(--owner, var(--muted)); margin-right: .4em; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Chrono (écran et téléphones) : vert, orange à 50 % du temps écoulé, rouge à 80 % (voir clockLevel). */
.clock[data-level="start"] { color: var(--clock-start); }
.clock[data-level="half"] { color: var(--clock-half); }
.clock[data-level="late"] { color: var(--danger); }
/* Cadran du chrono : un cercle qui se remplit dans le sens des aiguilles d'une montre (--elapsed, voir paintClock). */
@property --elapsed { syntax: '<number>'; inherits: true; initial-value: 0; }
.clock::before { content: ''; display: inline-block; width: 1.1em; height: 1.1em; margin-right: .45em; vertical-align: -.2em; box-sizing: border-box;
  border-radius: 50%; border: .13em solid currentColor;
  background: conic-gradient(currentColor calc(var(--elapsed, 0) * 1turn), transparent 0);
  transition: --elapsed .5s linear; }
