/* Ghost suit la direction artistique de lab.bingo (.agents/skills/labops-art-direction).
   Mise en page : une bande bleue (marque, phrase du jour, compte), les quatre jeux
   en onglets, puis le jeu à gauche et le classement du jour à droite ; tout
   s'empile sur un téléphone. */

@font-face {
  font-family: 'Red Hat Display Variable';
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/red-hat-display-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Red Hat Display Variable';
  font-weight: 300 900;
  font-display: swap;
  src: url('/fonts/red-hat-display-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Red Hat Text Variable';
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/red-hat-text-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Red Hat Text Variable';
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/red-hat-text-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* L'interface : les jetons de Games (web/app/ui.css), à garder en accord. */
:root {
  --ground: #f3f6fc;
  --surface: #ffffff;
  --ink: #111730;
  --ink-soft: #586079;
  --line: #d5dcec;
  --field-line: #8690a3;
  --tint: #e9eefb;
  --sea: #1443d6;
  --sea-hover: #0f36b3;
  --sea-deep: #0a2480;
  --navy: #0b2a94;
  --mint: #8af2bf;
  --link: #1443d6;
  --danger: #b3261e;
  --display: 'Red Hat Display Variable', ui-sans-serif, system-ui, sans-serif;
  --body: 'Red Hat Text Variable', ui-sans-serif, system-ui, sans-serif;
  --veil: rgb(255 255 255 / 0.12);
  --veil-strong: rgb(255 255 255 / 0.2);
  --white-hover: #e6ecfb;
  --sea-fill: linear-gradient(170deg, var(--sea) 30%, var(--sea-deep) 100%);
  --r: 10px;
  --r-panel: 14px;
  --h: 3rem;
  --h-small: 2.25rem;
  --shadow-pop: 0 0 0 1px var(--line), 0 12px 32px rgb(8 28 102 / 0.28);
  color-scheme: light;

  /* Les mini-jeux gardent leur propre palette, lue par app.js pour le canevas.
     Elle n'appartient qu'aux jeux : l'interface ne s'en sert pas, sauf la
     pastille qui relie une ligne du classement à son fantôme. */
  --g-field: #f3f6fb;
  --g-panel: #f7f9fc;
  --g-ink: #141b2d;
  --g-muted: #5a6478;
  --g-line: #cfd7e4;
  --g-accent: #e8452c;   /* toi */
  --g-mine: #b5359a;     /* ton propre fantôme */
  --g-ghost: #4f63e8;    /* les fantômes des autres */
  --g-bot: #2f8f7a;      /* le fantôme maison */
  --g-good: #1f8a4c;
  --g-bad: #c9302c;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #060f2b;
    --surface: #0c1a45;
    --ink: #eaefff;
    --ink-soft: #a3b3df;
    --line: #20327a;
    --field-line: #5368b5;
    --tint: #16296a;
    --sea: #1238b8;
    --sea-hover: #1a47d6;
    --sea-deep: #081c66;
    --link: #9db6ff;
    --danger: #ff9d94;
    color-scheme: dark;

    --g-field: #111627; --g-panel: #161b2c; --g-ink: #e6eaf3; --g-muted: #95a0b8; --g-line: #273049;
    --g-accent: #ff6a4d; --g-mine: #e06bd0; --g-ghost: #8c9bff; --g-bot: #4cc7a9; --g-good: #52d08a; --g-bad: #ff6b66;
  }
}
/* Du papier posé sur le jeu (départ, résultat) reste blanc dans les deux thèmes. */
.light {
  --surface: #ffffff;
  --ink: #111730;
  --ink-soft: #586079;
  --line: #d5dcec;
  --field-line: #8690a3;
  --link: #1443d6;
  --danger: #b3261e;
  color-scheme: light;
  background: var(--surface);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  padding-inline: 16px;
  padding-block: 16px 32px;
}
h1, h2 { font-family: var(--display); letter-spacing: -0.02em; text-wrap: balance; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--link) 60%, transparent); outline-offset: 2px; }
.sea :focus-visible { outline-color: #fff; }
.light :focus-visible { outline-color: color-mix(in srgb, var(--link) 60%, transparent); }
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ---------- la mer : la bande du haut ---------- */
.sea {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: var(--r-panel);
  background: var(--sea-fill);
  color: #fff;
}
/* Semis de carte marine, visible seulement quand on le cherche. */
.sea::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.12;
  background: radial-gradient(#fff 1px, transparent 1.6px) 0 0 / 1.75rem 1.75rem;
  pointer-events: none;
}
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 16px 32px; padding: 18px 22px;
}
.brand { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lockup { display: inline-flex; align-items: center; gap: 0.7rem; margin: 0; font: 800 1.25rem/1 var(--display); color: #fff; }
.lockup-kind { font-weight: 500; opacity: 0.8; }
.logo { width: 2.5rem; height: 2.5rem; flex: none; border-radius: 22%; box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.4); }
.day { margin: 0; color: rgb(255 255 255 / 0.82); font-size: 0.95rem; max-width: 60ch; }

/* ---------- boutons et champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  height: var(--h); padding: 0 1.25rem;
  border: 1px solid transparent; border-radius: var(--r);
  font: 700 1rem/1 var(--body); white-space: nowrap; cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.small { height: var(--h-small); padding: 0 0.9rem; font-size: 0.9rem; }
.btn.primary { background: var(--sea); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--sea-hover); }
.btn.quiet { border-color: var(--field-line); background: none; color: var(--ink); font-weight: 500; }
.btn.quiet:hover:not(:disabled) { background: color-mix(in srgb, var(--link) 8%, transparent); }
.btn.white { background: #fff; color: var(--navy); }
.btn.white:hover:not(:disabled) { background: var(--white-hover); }
.btn.onsea { border-color: var(--veil-strong); background: var(--veil); color: #fff; font-weight: 500; }
.btn.onsea:hover:not(:disabled) { background: var(--veil-strong); }

.who { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 0; max-width: 100%; }
.login { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; max-width: 100%; }
.login .fields { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.login input {
  height: var(--h); width: 11rem; max-width: 100%; min-width: 0; padding: 0 0.9rem;
  border: 1px solid var(--veil-strong); border-radius: var(--r);
  background: #fff; color: #111730; font: 400 1rem var(--body);
}
.login input::placeholder { color: #586079; }
.small { margin: 0; max-width: 30rem; font-size: 0.85rem; color: rgb(255 255 255 / 0.82); text-align: right; }
.small a { color: #fff; font-weight: 700; }
.err { color: #fff; font-weight: 700; }
.signed { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; color: rgb(255 255 255 / 0.82); }
.signed b { color: #fff; }

/* ---------- les jeux en onglets ---------- */
.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tab {
  font: inherit; color: inherit; text-align: left; cursor: pointer; min-width: 0;
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
  border: 0; border-radius: var(--r-panel); background: var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.tab:hover { box-shadow: 0 0 0 1px var(--field-line); }
/* La menthe dit « celui-ci » : le jeu choisi. */
.tab[aria-selected="true"] { box-shadow: 0 0 0 1px var(--sea), 0 0 0 4px var(--mint); }
.tab .n { font: 800 1.2rem/1.2 var(--display); letter-spacing: -0.02em; }
.tab .k { font-size: 0.85rem; color: var(--ink-soft); }
.tab .r { font-size: 0.85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 920px) { .main { grid-template-columns: minmax(0, 1fr); } }

/* ---------- le jeu (son cadre garde la palette du jeu) ---------- */
.stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.box {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-width: 100%;
  border-radius: var(--r-panel); overflow: hidden; background: var(--g-field);
  box-shadow: 0 0 0 1px var(--line);
  touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
}
canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud { position: absolute; top: 10px; left: 12px; right: 12px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; font-variant-numeric: tabular-nums; }
.hud > div { border-radius: var(--r); background: rgb(255 255 255 / 0.92); color: #111730; box-shadow: 0 0 0 1px rgb(17 23 48 / 0.08); }
.hud .now { font: 800 clamp(1rem, 2.6vw, 1.5rem)/1 var(--display); padding: 6px 10px; }
.hud .vs { font-size: clamp(0.75rem, 1.6vw, 0.9rem); padding: 5px 9px; align-self: flex-start; text-align: right; }
.hud .vs b.good { color: #1a7f45; } .hud .vs b.bad { color: #b3261e; }
.hud .vs:empty { display: none; }

.ov { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgb(8 28 102 / 0.25); container-type: size; }
.card {
  max-width: 440px; width: 100%; padding: clamp(14px, 2.6vw, 24px);
  display: flex; flex-direction: column; gap: 8px; text-align: center;
  border-radius: var(--r-panel); box-shadow: var(--shadow-pop);
}
.card h2 { margin: 0; font-weight: 800; font-size: clamp(1.3rem, 3.2vw, 1.9rem); line-height: 1.1; }
.card p { margin: 0; color: var(--ink-soft); font-size: clamp(0.85rem, 1.7vw, 1rem); }
.card .big { font: 800 clamp(1.8rem, 4.6vw, 2.8rem)/1.1 var(--display); font-variant-numeric: tabular-nums; }
.card .tgt { color: var(--ink); font-variant-numeric: tabular-nums; }
.card .tgt.good { color: #1a7f45; } .card .tgt.bad { color: var(--danger); }
.card .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
.card { max-height: 100%; overflow: auto; }
/* Un petit jeu (téléphone) : la carte garde l'essentiel. */
@container (max-height: 300px) {
  .card { padding: 10px 12px; gap: 4px; }
  .card .blurb, .card .foot { display: none; }
  .card .btn { height: var(--h-small); }
}
.count { font: 900 clamp(3rem, 12vw, 7rem)/1 var(--display); color: #fff; text-shadow: 0 2px 16px rgb(8 28 102 / 0.5); }
@media (prefers-reduced-motion: no-preference) {
  .count { animation: beat 0.5s ease-out; }
  @keyframes beat { from { transform: scale(1.25); opacity: 0.4; } }
}

.hint { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--ink-soft); font-size: 0.9rem; }
kbd { font: 700 0.8rem var(--body); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 6px; background: var(--surface); color: var(--ink); }

/* ---------- le classement : un registre, des lignes séparées d'un filet ---------- */
.board {
  padding: 18px; border-radius: var(--r-panel); background: var(--surface); box-shadow: 0 0 0 1px var(--line);
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.board h2 { margin: 0; font-size: 1.25rem; font-weight: 800; }
.board .sub { margin: -4px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.lb { list-style: none; margin: 0; padding: 0; }
.lb li + li { border-top: 1px solid var(--line); }
.lb button {
  width: 100%; font: inherit; color: inherit; cursor: pointer; background: transparent; border: 0; border-radius: 6px;
  display: grid; grid-template-columns: 1.5rem 14px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 6px; text-align: left;
}
.lb button:hover { background: color-mix(in srgb, var(--link) 6%, transparent); }
.lb .pos { color: var(--ink-soft); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.lb .sw { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; }
.lb .on .sw { background: currentColor; }
.lb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .nm small { color: var(--ink-soft); font-size: 0.85rem; }
.lb .sc { font-variant-numeric: tabular-nums; font-weight: 700; }
.lb .off .nm, .lb .off .sc { color: var(--ink-soft); font-weight: 400; }
/* Ta ligne : la menthe dit « celui-ci ». */
.lb .me { box-shadow: inset 4px 0 0 var(--mint); }
.lb .me .nm { font-weight: 700; }
.empty { color: var(--ink-soft); font-size: 0.9rem; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--line); }
.note { color: var(--ink-soft); font-size: 0.85rem; margin: 0; padding-top: 10px; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .top { padding: 16px; }
  .who, .login { align-items: stretch; width: 100%; }
  .login .fields { justify-content: stretch; }
  .login input { flex: 1 1 8rem; }
  .login .btn { flex: 1 1 100%; }
  .small { text-align: left; }
  .signed { justify-content: space-between; }
}
