:root {
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --taille: clamp(13px, 1.2vw + 6px, 17px);
  --interligne: 1.65;
}
html[data-theme="ambre"] {
  --fond: #000000; --texte: #ecebe6; --doux: #8a877f; --tres-doux: #4a4843;
  --accent: #ffb000; --ok: #4ee38a; --err: #ff5348; --bleu: #6cb6ff;
  --barre: #0c0c0b; --bord: #22211e; --puce: #121211;
}
html[data-theme="phosphore"] {
  --fond: #000000; --texte: #c8ffd8; --doux: #5f9f74; --tres-doux: #2b4a35;
  --accent: #39ff88; --ok: #39ff88; --err: #ff6b5e; --bleu: #7fffd4;
  --barre: #020803; --bord: #10291a; --puce: #06140b;
}
html[data-theme="papier"] {
  --fond: #fafaf7; --texte: #000000; --doux: #6b6860; --tres-doux: #b9b6ae;
  --accent: #b45400; --ok: #0b7a3e; --err: #c8221a; --bleu: #1d4ed8;
  --barre: #f0efea; --bord: #dedcd5; --puce: #efeee9;
}
html[data-theme="phosphore"] body { text-shadow: 0 0 6px rgba(57, 255, 136, .35); }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); }
body {
  min-height: 100svh;
  color: var(--texte);
  font-family: var(--mono);
  font-size: var(--taille);
  line-height: var(--interligne);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
::selection { background: var(--accent); color: var(--fond); }

.cadre {
  max-width: 940px;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 52px) clamp(16px, 4vw, 48px) 180px;
}
.barre {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: clamp(18px, 3vw, 32px);
  border-bottom: 1px solid var(--bord);
  font-size: 12px;
  color: var(--doux);
}
.barre .pts { display: flex; gap: 7px; }
.barre .pts i { width: 11px; height: 11px; border-radius: 50%; background: var(--bord); display: block; }
.barre .pts i:first-child { background: var(--err); }
.barre .dims { margin-left: auto; color: var(--tres-doux); }

#sortie { white-space: pre-wrap; overflow-wrap: anywhere; }
.l { min-height: calc(var(--interligne) * 1em); }
.invite { color: var(--doux); }
.invite b { color: var(--accent); font-weight: 400; }
.doux { color: var(--doux); }
.tres-doux { color: var(--tres-doux); }
.accent { color: var(--accent); }
.ok { color: var(--ok); }
.err { color: var(--err); }
.gras { font-weight: 700; }
.pre { white-space: pre; overflow-x: auto; }
a { color: var(--texte); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* Commandes cliquables, partout dans la sortie */
.c {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  white-space: pre;
  text-shadow: inherit;
  text-decoration: underline dotted;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}
.c:hover, .c:focus-visible { outline: 0; text-decoration-style: solid; background: color-mix(in srgb, var(--accent) 14%, transparent); }

.curseur {
  display: inline-block;
  width: .62em;
  height: 1.15em;
  vertical-align: -.2em;
  background: var(--accent);
  animation: clignote 1.05s steps(1) infinite;
}
@keyframes clignote { 50% { opacity: 0; } }

/* Bannière en blocs */
.banniere { margin: 1em 0 1.2em; line-height: 0; }
.banniere svg { display: block; width: min(100%, 600px); height: auto; }
svg.blocs { fill: var(--accent); shape-rendering: crispEdges; }
.banniere rect { transform-box: fill-box; transform-origin: center; animation: pixel .24s cubic-bezier(.2, .8, .2, 1.5) both; }
@keyframes pixel { from { opacity: 0; transform: scale(.1); } }

/* Enregistrements DNS */
.rr { display: grid; grid-template-columns: auto auto 9ch 1fr; column-gap: 2ch; }
.rr .dom { color: var(--doux); }
.rr .cl { color: var(--tres-doux); }
.rr .ty { color: var(--accent); }

/* Aide */
.aide-l { display: grid; grid-template-columns: 15ch 1fr; column-gap: 1ch; padding-left: 2ch; }
.aide-l .c { justify-self: start; }

/* Manuel */
.man { max-width: 74ch; }
.man-tete, .man-pied { display: flex; justify-content: space-between; gap: 1ch; }
.man-pied { margin-top: .9em; }
.man h4 { margin: .9em 0 0; font-size: inherit; font-weight: 700; }
.man p { margin: 0; padding-left: 4ch; }
.man dl { margin: 0; padding-left: 4ch; display: grid; grid-template-columns: 14ch 1fr; column-gap: 1ch; }
.man dt { color: var(--accent); }
.man dd { margin: 0; }

/* Fiche technique */
.infos { display: flex; gap: 3ch; align-items: flex-start; margin: .3em 0; }
.infos .logo svg { display: block; width: clamp(104px, 15vw, 164px); height: auto; margin-top: .35em; }
.nuancier { display: flex; margin-top: .7em; }
.nuancier i { display: block; width: 2.4ch; height: 1.15em; }
.nuancier i:nth-child(1) { background: var(--err); }
.nuancier i:nth-child(2) { background: var(--accent); }
.nuancier i:nth-child(3) { background: var(--ok); }
.nuancier i:nth-child(4) { background: var(--bleu); }
.nuancier i:nth-child(5) { background: var(--texte); }
.nuancier i:nth-child(6) { background: var(--doux); }
.nuancier i:nth-child(7) { background: var(--tres-doux); }
.nuancier i:nth-child(8) { background: var(--bord); }

/* Aperçu du message */
.apercu { margin: .2em 0; padding: .45em 0 .45em 2ch; border-left: 2px solid var(--accent); }
.apercu div { display: grid; grid-template-columns: 7ch 1fr; }
.apercu p { margin: .5em 0 0; }

/* Le réveil */
.reveil { font-size: 1.12em; min-height: 3em; padding-top: 18vh; }
.suggestions .c[data-cmd="rouge"] { color: #ff5a4e; border-color: #8f241d; }
.suggestions .c[data-cmd="bleue"] { color: #6c9bff; border-color: #22408f; }

/* Le train */
.train { overflow: hidden; }
.train pre { display: inline-block; margin: 0; font: inherit; line-height: 1.25; color: var(--accent); animation: rouler 4.6s linear forwards; }
@keyframes rouler { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }

/* Saisie */
.saisie { display: flex; align-items: baseline; gap: 1ch; }
.saisie[hidden] { display: none; }
.saisie label { color: var(--doux); white-space: nowrap; }
.saisie label b { color: var(--accent); font-weight: 400; }
.saisie input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--texte);
  font: inherit;
  text-shadow: inherit;
  caret-color: var(--accent);
  caret-shape: block;
}

/* Bas de l'écran : suggestions et barre d'état */
.bas {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .4s ease, transform .4s ease;
}
body.pret .bas { opacity: 1; transform: none; pointer-events: auto; }
.suggestions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 26px 16px 12px;
  background: linear-gradient(180deg, transparent 0%, var(--fond) 48%);
}
.suggestions .c {
  font-size: 13px;
  color: var(--texte);
  background: var(--puce);
  border: 1px solid var(--bord);
  border-radius: 999px;
  padding: 7px 14px;
  text-decoration: none;
  flex: none;
}
.suggestions .c:hover, .suggestions .c:focus-visible { color: var(--accent); border-color: var(--accent); background: var(--puce); }
.statut {
  display: flex;
  align-items: center;
  gap: 2ch;
  padding: 5px 16px calc(5px + env(safe-area-inset-bottom));
  background: var(--barre);
  border-top: 1px solid var(--bord);
  font-size: 12px;
  color: var(--doux);
  white-space: nowrap;
}
.statut .onglet { color: var(--fond); background: var(--accent); padding: 0 1ch; text-shadow: none; }
.statut .onglet b { margin-right: 1ch; }
.statut .clavier { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; }
.statut .droite { display: flex; gap: 2ch; }
.pastille { display: inline-block; width: 7px; height: 7px; margin-right: .8ch; border-radius: 50%; background: var(--ok); vertical-align: 1px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 640px) {
  .rr { grid-template-columns: 8ch 1fr; column-gap: 1.5ch; }
  .rr .dom, .rr .cl { display: none; }
  .barre .dims { display: none; }
  .aide-l { grid-template-columns: 13ch 1fr; padding-left: 0; }
  .man-tete span:nth-child(2), .man-pied span:nth-child(2) { display: none; }
  .man p, .man dl { padding-left: 2ch; }
  .man dl { grid-template-columns: 1fr; }
  .man dd { padding-left: 2ch; margin-bottom: .3em; }
  .infos { flex-direction: column; gap: .8em; }
  .statut { display: none; }
  .suggestions {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .suggestions::-webkit-scrollbar { display: none; }
}
@media (pointer: coarse) { .statut .clavier { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
