/* Kernel Kingdoms : feuille commune aux pages du site (pas au jeu : /web/ a la sienne).
   v2.33 (refonte, DESIGN.md §5) : l'identité du terminal (JetBrains Mono, l'or du jeu, les cadres ╭─ titre ─╮, ◆ devant
   les titres de section), des jetons, une barre et un pied communs (dessinés par compte.js) et quatre gabarits :
   A accueil, B appli (marché, profil), C formulaire (connexion, clés), D texte (pages légales). */

/* Police hébergée ici (plus de CDN) et découpée : latin, flèches, cadres, symboles du jeu ; graisses 400 et 500 */
@font-face { font-family: "KK Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("/polices/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "KK Mono"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("/polices/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  /* Surfaces */
  --fond: #0c0d0f; --bloc: #121317; --releve: #1a1c21;
  /* Traits : séparateurs, cadres décoratifs, bordures de commandes (3:1 au moins), règle des titres */
  --trait: #26292f; --cadre: #3b3f47; --champ: #666b75; --regle: #4b505a;
  /* Texte */
  --texte: #e6e3da; --doux: #a3a095; --pale: #8b887f;
  /* L'or : action principale, sélection, rang, ◆, chiffres du jeu ; puis le sens */
  --or: #ffc43c; --or-sombre: #a8790f; --argent: #c8c8d2; --royale: #b48cff; --vert: #7ad687; --rouge: #f07868;
  --courbe: cubic-bezier(.22, 1, .36, 1);
  --commande: 40px; /* hauteur des boutons, champs et puces (44 sous 960 px) */
  --l: 1.6em;       /* une ligne de texte, pour les pages de texte */
}
@media (max-width: 960px) { :root { --commande: 44px; } }

* { box-sizing: border-box; }
html { background: var(--fond); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.6 "KK Mono", ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  font-variant-ligatures: none; /* JetBrains Mono : pas de ligatures (-> != …) dans un texte */
  overflow-wrap: break-word;
}
@media (max-width: 600px) { body { font-size: 14px; } }

/* ---------- texte ---------- */
a { color: var(--texte); text-decoration: underline; text-decoration-color: var(--or); text-underline-offset: 3px;
  transition: color 150ms var(--courbe); }
a:hover { color: var(--or); }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
p { margin: 0 0 var(--l); }
b, strong, dt, kbd { font-weight: 500; }
code, kbd { font: inherit; }
kbd { color: var(--texte); }
i { font-style: normal; font-weight: 500; } /* pas d'italique dans la police chargée : les titres d'œuvres en 500 */
.doux { color: var(--doux); }
.pale { color: var(--pale); }
.vert { color: var(--vert); }
.erreur { color: var(--rouge); }
.k { color: var(--or); } /* les chiffres du jeu dans un texte (marquer() de l'accueil) */
.c-or { color: var(--or); } .c-argent { color: var(--argent); } .c-royale { color: var(--royale); }
.nombre { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Lien d'évitement : visible au focus seulement */
.sauter { position: absolute; left: 16px; top: -64px; z-index: 30; background: var(--or); color: var(--fond); padding: 8px 16px;
  border-radius: 8px; text-decoration: none; font-weight: 500; }
.sauter:focus { top: 8px; }

/* Titre de page : 32/500, sans trait ; une phrase douce dessous */
h1 { font-size: 32px; line-height: 1.15; font-weight: 500; color: var(--texte); margin: 0 0 8px; }
@media (max-width: 600px) { h1 { font-size: 26px; } }
/* Titre de section, comme dans le jeu : ◆ le nom, puis un trait ━ jusqu'au bord (le propriétaire aime les séparateurs marqués) */
h2 { font-size: 18px; line-height: 1.4; font-weight: 500; color: var(--texte); display: flex; align-items: baseline; gap: 1ch;
  white-space: nowrap; overflow: hidden; margin: 48px 0 16px; }
h2::before { content: "◆"; color: var(--or); font-size: .75em; }
h2::after { content: "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━";
  color: var(--regle); font-weight: 400; flex: 1; overflow: hidden; }
@media (max-width: 600px) { h2 { white-space: normal; } h2::after { min-width: 4ch; white-space: nowrap; } }
h3 { font-size: 1em; font-weight: 500; margin: 24px 0 8px; }
h3::before { content: "» "; color: var(--pale); }
.chapeau, .intro { color: var(--doux); max-width: 64ch; }

ul { list-style: none; margin: 0 0 var(--l); padding: 0; }
li { padding-left: 2ch; text-indent: -2ch; margin: 0 0 8px; }
li::before { content: "- "; color: var(--pale); }
dl { margin: 0 0 var(--l); }
dd { margin: 0 0 12px 4ch; }
dd > p:last-child { margin-bottom: 0; }
@media (max-width: 600px) { dd { margin-left: 2ch; } }

/* ---------- conteneurs ---------- */
.large { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .large { padding: 0 16px; } }

/* ---------- barre du haut (compte.js) : une ligne de 56 px ---------- */
.barre { position: relative; z-index: 20; background: var(--fond); border-bottom: 1px solid var(--trait); }
.barre-dedans { display: flex; align-items: center; gap: 24px; height: 56px; }
.marque { color: var(--texte); text-decoration: none; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.marque .glyphe { color: var(--or); }
.marque:hover { color: var(--texte); }
.sections { display: flex; align-items: center; gap: 20px; margin-right: auto; }
.sections a { color: var(--doux); text-decoration: none; padding: 16px 0 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.sections a:hover { color: var(--texte); }
.sections a[aria-current] { color: var(--texte); border-bottom-color: var(--or); }
.outils { display: flex; align-items: center; gap: 16px; }
.compte { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.compte a { color: var(--texte); text-decoration: none; }
.compte a:hover { color: var(--or); }
.compte button { font: inherit; background: none; border: 0; padding: 0; color: var(--pale); cursor: pointer; }
.compte button:hover { color: var(--texte); }
/* Langues : la langue choisie comme l'onglet actif du jeu (fond or) */
.langues { display: flex; gap: 2px; }
.langues a { display: inline-flex; align-items: center; justify-content: center; min-width: 3ch; padding: 0 4px; border-radius: 4px;
  text-decoration: none; color: var(--doux); }
.langues a:hover { color: var(--texte); }
.langues a[aria-current] { background: var(--or); color: var(--fond); font-weight: 500; }
.barre .jouer { height: 32px; padding: 0 14px; }
.menu-bouton { display: none; font: inherit; color: var(--texte); background: none; border: 0; cursor: pointer;
  min-width: 44px; height: 44px; padding: 0 4px; white-space: nowrap; }
.menu-bouton::before { content: "["; color: var(--pale); } .menu-bouton::after { content: "]"; color: var(--pale); }
.menu-bouton[aria-expanded=true] { color: var(--or); }
.panneau { position: absolute; top: 56px; left: 0; right: 0; background: var(--bloc); border-bottom: 1px solid var(--trait);
  padding: 8px 0 16px; animation: ouvrir 180ms var(--courbe); }
.panneau nav a, .panneau .compte a, .panneau .compte button { display: flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--texte); }
.panneau nav a[aria-current] { color: var(--or); }
.panneau nav { border-bottom: 1px solid var(--trait); padding-bottom: 8px; margin-bottom: 8px; }
.panneau .compte { display: flex; gap: 24px; }
.panneau .langues { gap: 4px; margin-top: 8px; }
.panneau .langues a { min-width: 44px; height: 44px; }
@keyframes ouvrir { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 960px) {
  .barre .sections, .barre .outils { display: none; }
  .barre .jouer { margin-left: auto; height: 44px; }
  .menu-bouton { display: inline-flex; align-items: center; justify-content: center; }
  .barre-dedans { gap: 12px; }
}
/* Très petits écrans (320 px) : la couronne seule, le nom revient au-dessus */
@media (max-width: 359px) { .marque .nom-marque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* ---------- pied (compte.js), identique partout ---------- */
.pied { margin-top: 64px; }
.pied-dedans { border-top: 1px solid var(--trait); padding-top: 24px; padding-bottom: 32px; color: var(--doux); font-size: 13px; }
.pied nav { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0 0 12px; }
.pied nav a { color: var(--doux); text-decoration: none; }
.pied nav a:hover { color: var(--texte); }
.pied nav a[aria-current] { color: var(--texte); }
.manuel { display: flex; justify-content: space-between; gap: 2ch; color: var(--pale); margin: 0; }
@media (max-width: 960px) { .pied nav a { display: inline-flex; align-items: center; min-height: 44px; } .pied nav { gap: 0 20px; } }

/* ---------- cadres du jeu : ╭─ titre ───╮ (toujours position: relative, pour l'encoche) ---------- */
.cadre { position: relative; border: 1px solid var(--cadre); border-radius: 12px; padding: 20px; margin: 0 0 24px; }
@media (max-width: 600px) { .cadre { padding: 16px; } }
.cadre > .titre { position: absolute; top: 0; left: 16px; transform: translateY(-50%); background: var(--fond);
  padding: 0 8px; color: var(--doux); font-size: 13px; line-height: 1; white-space: nowrap; max-width: calc(100% - 32px);
  overflow: hidden; text-overflow: ellipsis; }

/* ---------- chiffres : libellé, valeur, ligne secondaire ---------- */
.chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px 16px; margin: 0; }
@media (max-width: 600px) { .chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
.chiffres dt { color: var(--pale); font-weight: 400; font-size: 13px; }
.chiffres dd { margin: 4px 0 0; font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.3; }
.chiffres dd small { display: block; font-size: 13px; font-weight: 400; color: var(--pale); }
.chiffres .or { color: var(--or); }

/* ---------- commande à copier (ssh, codes) ---------- */
.cmd { display: flex; align-items: center; background: var(--bloc); border-radius: 8px; padding: 0; }
.cmd pre { flex: 1; min-width: 0; margin: 0; padding: 10px 16px; overflow-x: auto; line-height: inherit; font: inherit; }
.cmd.ssh code::before { content: "$ "; color: var(--pale); user-select: none; -webkit-user-select: none; }
.copier { font: inherit; background: none; border: 0; color: var(--doux); cursor: pointer; min-height: 44px; padding: 0 16px; white-space: nowrap; }
.copier::before { content: "["; color: var(--pale); } .copier::after { content: "]"; color: var(--pale); }
.copier:hover { color: var(--or); }
.copier.fait { color: var(--vert); }
/* Curseur bloc après la commande, comme dans un terminal (fixe : rien ne clignote) */
.curseur { display: inline-block; width: 1ch; height: 1.2em; margin-left: .2ch; vertical-align: -.2em; background: var(--doux); }
@media (max-width: 420px) { .cmd { font-size: 13px; } .cmd pre, .copier { padding-left: 10px; padding-right: 10px; } }

/* ---------- tableaux ---------- */
.defile { overflow-x: auto; margin: 0 0 var(--l); }
table { border-collapse: collapse; }
th, td { text-align: left; vertical-align: middle; padding: 0 24px 0 0; }
th:last-child, td:last-child { padding-right: 0; }
th { font-weight: 400; font-size: 13px; color: var(--doux); padding-bottom: 8px; }
.lignes { width: 100%; }
.lignes tbody tr { border-top: 1px solid var(--trait); }
.lignes td { height: 36px; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 600px) { .opt { display: none; } th, td { padding-right: 16px; } }

/* ---------- puces (filtres, périodes) : rayon 4, comme les onglets du jeu ---------- */
.puces { display: flex; flex-wrap: wrap; gap: 6px; }
.puce { font: inherit; font-size: 13px; color: var(--doux); background: var(--bloc); border: 1px solid var(--champ); border-radius: 4px;
  height: 32px; padding: 0 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: color 150ms var(--courbe), background-color 150ms var(--courbe); }
@media (max-width: 960px) { .puce { height: 40px; } }
.puce:hover { color: var(--texte); }
.puce[aria-pressed=true] { color: var(--fond); background: var(--or); border-color: var(--or); }
.puce small { font-size: inherit; opacity: .75; }

/* ---------- boutons ---------- */
button { font: inherit; cursor: pointer; }
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--commande); padding: 0 16px;
  color: var(--fond); background: var(--or); border: 1px solid var(--or); border-radius: 8px; font-weight: 500; text-decoration: none;
  white-space: nowrap; transition: background-color 150ms var(--courbe), color 150ms var(--courbe); }
.bouton:hover { background: var(--texte); border-color: var(--texte); color: var(--fond); }
.bouton:disabled { opacity: .6; cursor: wait; }
.bouton.secondaire { color: var(--texte); background: none; border-color: var(--champ); font-weight: 400; }
.bouton.secondaire:hover { color: var(--or); border-color: var(--or); background: none; }

/* ---------- formulaires ---------- */
label { color: var(--doux); font-size: 13px; }
input, select, textarea { font: inherit; color: var(--texte); background: var(--bloc); border: 1px solid var(--champ); border-radius: 8px; }
input, select { height: var(--commande); padding: 0 12px; max-width: 100%; }
textarea { padding: 8px 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--or); outline: 2px solid var(--or); outline-offset: 0; }
input[type=checkbox] { width: 20px; height: 20px; padding: 0; margin: 0; accent-color: var(--or); }
/* iOS zoome sur un champ de moins de 16 px */
@media (max-width: 600px) { input, select, textarea { font-size: 16px; } }

/* ---------- états ---------- */
.vide { color: var(--pale); margin: 0; }
.chargement { color: var(--pale); }
.reessayer { font: inherit; background: none; border: 0; padding: 0; color: var(--texte); text-decoration: underline; text-decoration-color: var(--or); cursor: pointer; }

/* ---------- gabarit B : en-tête d'une page d'appli (marché, profil) ---------- */
.tete { padding-top: 48px; padding-bottom: 32px; }
.tete > p { color: var(--doux); max-width: 64ch; margin: 0; }
@media (max-width: 600px) { .tete { padding-top: 32px; padding-bottom: 24px; } }

/* ---------- gabarit C : formulaire centré de 440 px ---------- */
.formulaire { max-width: 440px; margin: 48px auto 0; }
.formulaire h1 { font-size: 24px; }
.formulaire label { display: block; margin: 0 0 4px; }
.formulaire input:not([type=checkbox]) { width: 100%; margin: 0 0 16px; }
.formulaire .bouton { width: 100%; }

/* ---------- gabarit D : texte légal, colonne de 72ch, sommaire collant à partir de 1100 px ---------- */
.texte-legal { display: grid; grid-template-columns: minmax(0, 72ch); justify-content: center; gap: 48px; padding-top: 48px; }
.texte-legal h2 { margin-top: 40px; }
.texte-legal .maj { color: var(--pale); margin: 0 0 32px; }
.sommaire { display: none; }
@media (min-width: 1100px) {
  .texte-legal { grid-template-columns: 220px minmax(0, 72ch); }
  .sommaire { display: block; position: sticky; top: 24px; align-self: start; font-size: 13px; padding-top: 8px; }
  .sommaire p { color: var(--pale); margin: 0 0 8px; }
  .sommaire a { display: block; color: var(--doux); text-decoration: none; padding: 4px 0; }
  .sommaire a:hover { color: var(--texte); }
}
.a-completer { color: var(--rouge); }

/* Ascension : le compteur de royaumes sous la commande ssh */
.ascension { color: var(--pale); font-variant-numeric: tabular-nums; }

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