/* KamiGo — le Go résolu, sur les petits gobans
   Copyright (c) 2026 Tristan Cazenave. Tous droits réservés — voir LICENSE.

   Le goban prend la largeur, et rien d'autre ne compte. Sur ces tailles une
   intersection fait au moins soixante pixels sur un téléphone : le doigt vise
   un point, sans aucune ruse de proximité. */

:root {
  --fond: #f4f1e8; --surface: #fffdf7; --ligne: #d8d0bc;
  --texte: #2b2620; --texte-doux: #7a7161;
  --accent: #4b3b86; --accent-clair: #e6e1f2;
  --bois-a: #e6cd93; --bois-b: #d8b878; --trait-goban: #6b5426;
  /* Les pierres ont un reflet : une couleur claire au point d'éclairage, une
     sombre au bord. Les deux valeurs pleines servent encore au territoire et
     aux pastilles, qui n'ont pas de relief. */
  --pierre-n: #17151a; --pierre-n1: #5a626c; --pierre-n2: #0b0e12;
  --pierre-b: #fdfbf4; --pierre-b1: #ffffff; --pierre-b2: #d8cfba;
  --cher: #a53a24; --bon: #2f6d43;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #17161a; --surface: #221f27; --ligne: #38333f;
    --texte: #ece7f2; --texte-doux: #a29ab0; --accent: #9d8ee0; --accent-clair: #2e2740;
    --cher: #e08c78; --bon: #7fc79a;
    /* Sous un thème sombre la pierre blanche éblouit : on la ternit un peu,
       comme le fait Geta. */
    --pierre-n1: #3e454e; --pierre-n2: #05070a;
    --pierre-b1: #f7f2e5; --pierre-b2: #cbc1a9;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
.ecran { display: flex; flex-direction: column; min-height: 100%; }
/* Le goban ne gagne rien à s'étaler : l'écran de jeu tient dans la même
   colonne que la boîte de choix, et se centre comme elle. */
#ecran-jeu { max-width: 560px; width: 100%; margin: 0 auto; }
/* `display:flex` écrase la règle du navigateur pour [hidden]. */
.ecran[hidden] { display: none; }
.pousse { flex: 1; }

.btn { appearance: none; background: var(--surface); border: 1px solid var(--ligne);
  color: var(--texte); border-radius: 10px; padding: 10px 14px; cursor: pointer;
  min-height: 44px; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-primaire { background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 650; }
.btn-mini { padding: 6px 10px; min-height: 36px; font-size: 13px; }
.seg { display: inline-flex; border: 1px solid var(--ligne); border-radius: 999px;
  overflow: hidden; }
.seg button { appearance: none; background: transparent; border: 0;
  color: var(--texte-doux); font-size: 12px; letter-spacing: .08em;
  padding: 6px 10px; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.boite { background: var(--surface); border: 1px solid var(--ligne);
  border-radius: 16px; margin: 16px auto; max-width: 34rem; width: calc(100% - 24px); }
.boite-tete { padding: 16px 18px 0; }
.boite-tete h1 { margin: 8px 0 0; font-size: 30px; letter-spacing: -.01em; }
.sous-titre { margin: 8px 0 0; color: var(--texte-doux); font-size: 14px; }
.sous-titre .rappel { opacity: .85; font-size: 13px; }
.boite-corps { padding: 12px 18px 16px; }
.boite-pied { display: flex; gap: 8px; padding: 0 18px 18px; }
.champ { margin-top: 12px; }
.champ label { font-weight: 600; }

.choix { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choix button { appearance: none; background: var(--surface); color: var(--texte);
  border: 1px solid var(--ligne); border-radius: 10px; padding: 8px 14px;
  min-height: 44px; cursor: pointer; font-variant-numeric: tabular-nums; }
.note { margin: 8px 0 0; font-size: 13px; color: var(--texte-doux); }
.note:empty { display: none; }
.choix button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 650; }

#barre { display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--ligne); }
.trait { font-weight: 650; font-size: 14px; display: inline-flex; align-items: center; gap: 7px; }
.trait::before { content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--trait-goban); flex: none; }
.trait.tour-noir::before { background: var(--pierre-n); }
.trait.tour-blanc::before { background: var(--pierre-b); }
.prises { font-size: 12px; color: var(--texte-doux); font-variant-numeric: tabular-nums; }

#zone-goban { padding: 10px; display: flex; justify-content: center; }
#goban { width: 100%; max-width: 520px; height: auto; touch-action: manipulation;
  cursor: pointer; }

.bois { fill: url(#bois); }
.ligne { stroke: var(--trait-goban); stroke-width: 3; opacity: .8; }
.hoshi { fill: var(--trait-goban); }
.ombre { fill: #00000038; }
.pierre { stroke-width: .8; }
.pierre.noire { fill: url(#pierre-n); stroke: #00000080; }
.pierre.blanche { fill: url(#pierre-b); stroke: #5a462859; }
.pierre.morte { opacity: .3; }
.fantome { opacity: .38; pointer-events: none; stroke: none; }
.fantome.noire { fill: url(#pierre-n); }
.fantome.blanche { fill: url(#pierre-b); }
.marque { fill: none; stroke-width: 4; }
.marque.sur-noire { stroke: #fdfbf4; }
.marque.sur-blanche { stroke: #17151a; }
.refus { fill: none; stroke: var(--cher); stroke-width: 6; }
.terr { opacity: .75; }
.terr-n { fill: var(--pierre-n); }
.terr-b { fill: var(--pierre-b); stroke: #6d6455; stroke-width: 1.5; }

.valeur { margin: 2px 14px 0; font-size: 15px; font-weight: 650; color: var(--accent);
  min-height: 1.5em; }
.verdict { margin: 2px 14px 0; font-size: 14px; min-height: 1.5em; color: var(--texte-doux); }
.verdict.cher { color: var(--cher); font-weight: 650; }
.verdict.bon { color: var(--bon); }
.dit { margin: 2px 14px 0; color: var(--texte-doux); font-size: 14px; min-height: 1.5em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }

.modale { position: fixed; inset: 0; background: #0b0e0a99; display: flex;
  align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modale[hidden] { display: none; }
.modale-boite { background: var(--surface); border-radius: 14px; max-width: 34rem;
  width: 100%; max-height: 88vh; display: flex; flex-direction: column; }
.modale-tete { display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--ligne); }
.modale-tete h2 { margin: 0; font-size: 18px; flex: 1; }
.modale-corps { padding: 14px 16px; overflow: auto; }
.modale-corps h3 { font-size: 14px; color: var(--accent); margin: 14px 0 6px; }
.modale-corps p { font-size: 14px; }
