/* ORA — charte inspirée des écrans du Projet OMEGA : bleu nuit, cadres blancs à coins coupés, police à chasse fixe. */
:root {
  --fond: #07111f;
  --panneau: #12406a;
  --panneau-fonce: #0c2a47;
  --trait: #e9f2ff;
  --texte: #f3f8ff;
  --texte-doux: #a9c1dc;
  --accent: #5fd4ff;
  --vert: #36d27e;
  --rouge: #ff5c63;
  --ambre: #ffb84d;
  --coin: 12px;
  --police: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font-family: var(--police); font-size: 16px; line-height: 1.45; }
body { min-height: 100dvh; background: radial-gradient(ellipse at 50% -20%, #173d63 0%, var(--fond) 60%) fixed; }
#app { max-width: 720px; margin: 0 auto; padding: 12px 16px 96px; }
.page-ecran #app, .page-gm #app { max-width: 1280px; }

h2 { font-size: 1.05rem; margin: 0 0 10px; letter-spacing: .04em; text-transform: uppercase; }
h3 { font-size: .95rem; margin: 14px 0 6px; color: var(--accent); }
p { margin: 6px 0; }
a { color: var(--accent); }

/* Cadre à coins coupés : un calque blanc (le trait) et un calque bleu (le fond), découpés à l'identique. */
.cadre { margin: 12px 0; padding: 2px; background: var(--trait); display: flex; flex-direction: column;
  clip-path: polygon(var(--coin) 0, calc(100% - var(--coin)) 0, 100% var(--coin), 100% calc(100% - var(--coin)), calc(100% - var(--coin)) 100%, var(--coin) 100%, 0 calc(100% - var(--coin)), 0 var(--coin)); }
.cadre-in { flex: 1; background: var(--panneau); padding: 14px 16px;
  clip-path: polygon(calc(var(--coin) - 1px) 0, calc(100% - var(--coin) + 1px) 0, 100% calc(var(--coin) - 1px), 100% calc(100% - var(--coin) + 1px), calc(100% - var(--coin) + 1px) 100%, calc(var(--coin) - 1px) 100%, 0 calc(100% - var(--coin) + 1px), 0 calc(var(--coin) - 1px)); }

.logo { font-weight: 800; letter-spacing: .3em; color: var(--accent); font-size: 1.4rem; }
.logo.grand { font-size: clamp(3rem, 14vw, 6rem); text-align: center; text-shadow: 0 0 24px rgba(95, 212, 255, .45); }
.sous-titre { text-align: center; color: var(--texte-doux); letter-spacing: .08em; }
.mention { color: var(--texte-doux); font-size: .82rem; }
.fort { font-weight: 700; }
.bonus { color: var(--ambre); }
.regle { border-left: 3px solid var(--ambre); padding-left: 10px; }
.meta { color: var(--texte-doux); font-size: .85rem; }

label { display: block; margin: 10px 0 4px; color: var(--texte-doux); font-size: .85rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--texte); background: var(--panneau-fonce);
  border: 1px solid var(--trait); border-radius: 0; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"], input[type="radio"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); margin: 0; flex: none; }

button, .bouton { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; margin: 6px 6px 0 0;
  font: inherit; font-weight: 700; color: var(--panneau-fonce); background: var(--trait); border: 0; cursor: pointer; text-decoration: none;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
button.principal, .bouton.principal { background: var(--accent); width: 100%; margin-top: 14px; }
button.secondaire, .bouton.secondaire { background: transparent; color: var(--texte); box-shadow: inset 0 0 0 2px var(--trait); clip-path: none; }
button.danger { background: var(--rouge); color: #fff; width: 100%; }
button.petit { min-height: 36px; padding: 6px 12px; font-size: .85rem; }
button:disabled { opacity: .45; cursor: not-allowed; }

.ligne { display: flex; gap: 8px; align-items: stretch; margin-top: 8px; }
.ligne > input, .ligne > select { flex: 1; }
.ligne > button { margin: 0; white-space: nowrap; }
.ligne.wrap { flex-wrap: wrap; }
.choix { display: grid; gap: 6px; }
.option { display: flex; gap: 10px; align-items: center; margin: 0; padding: 10px 12px; color: var(--texte); background: var(--panneau-fonce); cursor: pointer; }
.liste { margin: 0; padding-left: 18px; }
.liste li { margin: 4px 0; }
.liste.colonnes { columns: 2; }
.liste.petit { font-size: .78rem; max-height: 340px; overflow: auto; }
.traitre { color: var(--rouge); }

.entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 2px solid var(--trait); }
.entete .agent { font-weight: 800; font-size: 1.1rem; }
.entete small { display: block; font-weight: 400; color: var(--texte-doux); font-size: .78rem; }
.chrono { font-variant-numeric: tabular-nums; color: var(--accent); text-align: right; }
.bandeau { background: var(--ambre); color: #1a1200; text-align: center; padding: 6px; margin-top: 8px; font-weight: 700; }

.onglets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 6px 0; }
.onglets button { margin: 0; background: var(--panneau-fonce); color: var(--texte); clip-path: none; box-shadow: inset 0 -3px 0 transparent; }
.onglets button.actif { background: var(--panneau); box-shadow: inset 0 -3px 0 var(--accent); }

.missions { padding-left: 22px; }
.missions li { margin: 10px 0; }
.missions li span:first-child { display: block; }
.missions li.fait span:first-child { color: var(--texte-doux); text-decoration: line-through; }
.etat { font-size: .8rem; color: var(--texte-doux); }
.etat.ok { color: var(--vert); font-weight: 700; }

.relations li { list-style: none; margin: 8px 0; }
.relations { padding: 0; }
.rel-confiance strong { color: var(--vert); }
.rel-mefiance strong { color: var(--rouge); }
.rel-prudence strong { color: var(--ambre); }

.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 8px; }
.case { margin: 0; width: 100%; clip-path: none; color: #fff; }
.case.vert { background: #1f8a52; }
.case.rouge { background: #b8323a; }
.case.bleu { background: #1d6fb1; }
.statut { color: var(--accent); }
.resultat { padding: 10px; margin: 8px 0; border: 2px solid; }
.resultat.rouge { border-color: var(--rouge); }
.resultat.vert { border-color: var(--vert); }
.empreinte { width: 96px; height: 120px; margin: 8px auto; border-radius: 48px 48px 40px 40px;
  background: repeating-radial-gradient(ellipse at 50% 60%, transparent 0 5px, rgba(95, 212, 255, .7) 5px 7px); }
.transmission { border-top: 1px dashed var(--texte-doux); padding-top: 6px; }

.fil { max-height: 52dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.fil p { margin: 0; padding: 8px 12px; max-width: 88%; }
.fil .ora { background: var(--panneau-fonce); border-left: 3px solid var(--accent); align-self: flex-start; }
.fil .moi { background: #1d5f96; align-self: flex-end; }
.micro { min-width: 52px; font-size: 1.2rem; }

.toasts { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); width: min(680px, calc(100% - 24px)); display: grid; gap: 8px; z-index: 50; }
.toast { padding: 12px 14px; background: var(--panneau-fonce); border: 2px solid var(--trait); box-shadow: 0 8px 24px rgba(0, 0, 0, .5); transition: opacity .4s; }
.toast.sortie { opacity: 0; }
.toast-erreur { border-color: var(--rouge); }
.toast-secret, .toast-mission { border-color: var(--ambre); }
.toast-ora { border-color: var(--accent); }
.reseau { position: fixed; top: 0; left: 0; right: 0; background: var(--rouge); color: #fff; text-align: center; padding: 4px; z-index: 60; font-size: .85rem; }

.accueil { max-width: 520px; margin: 4vh auto 0; }

/* Écran commun */
.entete-ecran { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; border-bottom: 2px solid var(--trait); padding-bottom: 8px; }
.entete-ecran .phase { font-size: 1.4rem; text-transform: uppercase; letter-spacing: .12em; }
.chrono.geant { font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 800; }
.annonce { font-size: clamp(1.2rem, 2.6vw, 2.1rem); line-height: 1.35; }
.lobby-grille > .cadre { margin: 0; }
.lobby-grille { margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.qr { width: min(320px, 100%); display: block; margin: 0 auto; background: #fff; padding: 8px; }
.code { text-align: center; font-size: 3rem; font-weight: 800; letter-spacing: .4em; margin: 8px 0 0; }
.oeil { width: 140px; height: 140px; margin: 18px auto; border-radius: 50%; border: 3px solid var(--accent);
  display: grid; place-items: center; box-shadow: 0 0 40px rgba(95, 212, 255, .35), inset 0 0 30px rgba(95, 212, 255, .25); animation: respire 4s ease-in-out infinite; }
.pupille { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 24px var(--accent); }
@keyframes respire { 50% { transform: scale(1.05); box-shadow: 0 0 60px rgba(95, 212, 255, .55), inset 0 0 30px rgba(95, 212, 255, .35); } }

/* Défaillances d'ORA : plus la contamination monte, plus l'interface se dérègle. */
body[data-defaillance="1"] .oeil { animation: respire 4s ease-in-out infinite, tressaute 7s steps(1) infinite; }
body[data-defaillance="2"] .oeil, body[data-defaillance="3"] .oeil { border-color: var(--rouge); animation: tressaute 2.2s steps(1) infinite; }
body[data-defaillance="2"] .pupille, body[data-defaillance="3"] .pupille { background: var(--rouge); box-shadow: 0 0 24px var(--rouge); }
body[data-defaillance="3"] .annonce { animation: brouille 1.6s steps(2) infinite; }
@keyframes tressaute { 0%, 92% { transform: none; } 94% { transform: translateX(-6px) skewX(8deg); } 96% { transform: translateX(5px); opacity: .6; } }
@keyframes brouille { 50% { text-shadow: 2px 0 var(--rouge), -2px 0 var(--accent); } }

.tableau { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tableau th, .tableau td { text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(233, 242, 255, .2); }
.tableau td.rouge { color: var(--rouge); font-weight: 700; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (max-width: 520px) { .liste.colonnes { columns: 1; } .entete-ecran { grid-template-columns: 1fr; } }

/* V3 : archives vidéo diffusées par ORA (repli texte si le fichier n'existe pas encore) */
.archive-video { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, 0.82); }
.archive-cadre { width: min(900px, 100%); max-height: 100%; overflow: auto; padding: 16px; border: 1px solid currentColor; border-radius: 8px; background: #05080a; color: #d8f3ec; font-family: ui-monospace, Menlo, Consolas, monospace; }
.archive-titre { margin: 0 0 12px; letter-spacing: 0.08em; font-size: 0.85rem; opacity: 0.85; }
.archive-cadre video { width: 100%; max-height: 60vh; background: #000; filter: contrast(1.1) saturate(0.6); }
.sous-titre-video { margin: 12px 0; line-height: 1.5; }
/* v1.8.2 (D021 A1) : textes affichés par le jeu par-dessus une vidéo neutre ; tailles en largeur d'image (vidéo de 1280 px). */
.archive-image { position: relative; width: min(100%, calc(60vh * 16 / 9)); aspect-ratio: 16 / 9; margin: 0 auto; container-type: inline-size; }
.archive-image video { display: block; width: 100%; height: 100%; max-height: none; }
.archive-incrust { position: absolute; inset: 0; pointer-events: none; overflow: hidden; font-family: Menlo, ui-monospace, Consolas, monospace; }
.archive-carton { position: absolute; left: 0; right: 0; margin: 0; transform: translateY(-50%); text-align: center; font-size: 2.34cqw; color: rgb(235, 235, 225); opacity: 0; white-space: nowrap; }
.archive-nom { position: absolute; transform: translate(-50%, calc(-100% + 0.47cqw)); padding: 0.47cqw 0.63cqw; font-size: 1.72cqw; line-height: 1; color: rgb(250, 245, 200); background: rgba(0, 0, 0, 0.55); opacity: 0; white-space: nowrap; }
.sous-titre-video.seul { font-size: 1.15rem; }

/* V3.1 : vainqueur affiché, journal des annonces */
.bandeau-victoire { margin: 0 0 12px; padding: 12px 16px; border-radius: 8px; font-size: 1.3rem; font-weight: 700; text-align: center; }
.bandeau-victoire.vert { background: rgba(80, 200, 120, 0.18); border: 1px solid rgba(80, 200, 120, 0.6); }
.bandeau-victoire.rouge { background: rgba(255, 92, 99, 0.18); border: 1px solid var(--rouge); }
.fil .annonce-journal { opacity: 0.8; font-style: italic; border-left: 3px solid var(--accent); padding-left: 8px; }

/* V3.2 : ARO, double maléfique d'ORA — logo ORA retourné en miroir, bulles aux couleurs inversées. */
.logo.miroir { transform: scaleX(-1); display: inline-block; color: #ff4d6d; text-shadow: 0 0 18px rgba(255, 77, 109, .5); }
body.aro .fil .ora { border-left-color: #ff4d6d; background: #2a0f18; }
.fil .ecouter { margin-left: 8px; padding: 0 6px; font-size: .9rem; background: transparent; border: 1px solid var(--accent); min-height: 0; }
.option.lecture { margin-top: 8px; font-size: .85rem; }
