/* ===== ÉCHOS DE MÉMOIRE — DA BACKROOMS // VHS // LIMINAL ===== */
@import url('https://fonts.googleapis.com/css2?family=VT323&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
    color-scheme: dark;
    /* Murs jaunis, néons fatigués */
    --wall-dark: #100E07;
    --wall: #1B180C;
    --wall-line: rgba(216, 194, 90, 0.07);
    --panel: rgba(12, 10, 5, 0.78);
    --panel-solid: #0F0D07;
    --line: rgba(233, 226, 196, 0.26);
    --line-strong: rgba(233, 226, 196, 0.55);

    --paper: #ECE5C8;       /* texte principal, blanc cassé VHS */
    --paper-dim: #BDB38C;
    --paper-muted: #8F8766;
    --mono-yellow: #D8C25A; /* jaune moquette / papier peint */
    --fluo: #F4EBB8;

    /* Équipes = les deux franges de l'aberration chromatique VHS */
    --team-a: #5CE1FF;
    --team-b: #FF4D6A;
    --ok: #9CFF8A;
    --half: var(--mono-yellow);
    --ko: #FF4D6A;

    --font-osd: 'VT323', ui-monospace, monospace;
    --font-body: 'IBM Plex Mono', ui-monospace, monospace;
    accent-color: var(--mono-yellow);
    scrollbar-color: #5A5233 #100E07;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: var(--font-osd);
    color: var(--paper);
    background-color: var(--wall);
    /* papier peint mono-jaune : rayures + losanges discrets */
    background-image:
        radial-gradient(ellipse 70% 45% at 50% -5%, rgba(244, 235, 184, 0.16), transparent 70%),
        radial-gradient(circle at 50% 50%, rgba(216, 194, 90, 0.08) 1.5px, transparent 2px),
        repeating-linear-gradient(90deg, var(--wall-line) 0 2px, transparent 2px 34px),
        linear-gradient(180deg, #221E0F 0%, var(--wall) 45%, var(--wall-dark) 100%);
    background-size: 100% 100%, 34px 34px, 100% 100%, 100% 100%;
    inline-size: 100%;
    min-block-size: 100dvh;
    overflow-x: clip;
    line-height: 1.25;
    letter-spacing: 0.02em;
}

/* --- Couches VHS : vignette, scanlines, grain, bande de tracking --- */
body::before {
    content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 40;
    background:
        radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.75) 100%),
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
.vhs-noise {
    position: fixed; inset: -50%; pointer-events: none; z-index: 41; opacity: 0.09;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation: grain 0.5s steps(4) infinite;
}
.vhs-tracking {
    position: fixed; inset-inline: 0; block-size: 9vh; pointer-events: none; z-index: 42;
    background: linear-gradient(180deg, transparent, rgba(236, 229, 200, 0.06) 40%, rgba(236, 229, 200, 0.12) 50%, rgba(236, 229, 200, 0.06) 60%, transparent);
    mix-blend-mode: screen;
    animation: tracking 9s linear infinite;
}
@keyframes grain {
    0% { transform: translate(0, 0); } 25% { transform: translate(-5%, 3%); }
    50% { transform: translate(4%, -4%); } 75% { transform: translate(-3%, -2%); } 100% { transform: translate(2%, 4%); }
}
@keyframes tracking { 0% { inset-block-start: -12vh; } 100% { inset-block-start: 110vh; } }

/* Néon qui grésille */
@keyframes flicker {
    0%, 100% { opacity: 1; } 92% { opacity: 1; } 93% { opacity: 0.82; } 94% { opacity: 1; } 96% { opacity: 0.9; } 97% { opacity: 1; }
}

/* Aberration chromatique de base sur les textes d'affichage */
.chroma { text-shadow: -2px 0 rgba(255, 77, 106, 0.55), 2px 0 rgba(92, 225, 255, 0.55); }

/* Texte glitché : deux copies décalées via data-text */
.glitch { position: relative; }
.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute; inset: 0;
    pointer-events: none; opacity: 0;
    white-space: pre-line;
}
.glitch::before { color: var(--team-b); transform: translateX(-3px); mix-blend-mode: screen; }
.glitch::after { color: var(--team-a); transform: translateX(3px); mix-blend-mode: screen; }
.glitch.auto::before { animation: slice-a 7s infinite steps(1); }
.glitch.auto::after { animation: slice-b 7s infinite steps(1); }
@keyframes slice-a {
    0%, 89%, 100% { opacity: 0; clip-path: inset(0 0 100% 0); }
    90% { opacity: 0.9; clip-path: inset(12% 0 70% 0); transform: translateX(-8px); }
    92% { opacity: 0.9; clip-path: inset(55% 0 25% 0); transform: translateX(6px); }
    94% { opacity: 0.9; clip-path: inset(80% 0 5% 0); transform: translateX(-4px); }
}
@keyframes slice-b {
    0%, 89%, 100% { opacity: 0; clip-path: inset(0 0 100% 0); }
    91% { opacity: 0.9; clip-path: inset(30% 0 50% 0); transform: translateX(7px); }
    93% { opacity: 0.9; clip-path: inset(65% 0 12% 0); transform: translateX(-6px); }
}

/* Rafale de glitch déclenchée par JS (changement de phase / question) */
body.glitching .glitch::before { opacity: 0.95; animation: burst-a 0.45s steps(1) 1; }
body.glitching .glitch::after { opacity: 0.95; animation: burst-b 0.45s steps(1) 1; }
body.glitching .tv, body.glitching .player { animation: shake 0.45s steps(2) 1; }
body.glitching .vhs-tracking { animation-duration: 0.6s; }
@keyframes burst-a {
    0% { clip-path: inset(5% 0 75% 0); transform: translateX(-14px); }
    25% { clip-path: inset(40% 0 40% 0); transform: translateX(10px); }
    50% { clip-path: inset(70% 0 10% 0); transform: translateX(-6px); }
    75% { clip-path: inset(20% 0 60% 0); transform: translateX(12px); }
    100% { clip-path: inset(0 0 100% 0); opacity: 0; }
}
@keyframes burst-b {
    0% { clip-path: inset(60% 0 20% 0); transform: translateX(12px); }
    33% { clip-path: inset(10% 0 80% 0); transform: translateX(-10px); }
    66% { clip-path: inset(45% 0 35% 0); transform: translateX(8px); }
    100% { clip-path: inset(0 0 100% 0); opacity: 0; }
}
@keyframes shake {
    0% { transform: translate(0, 0); filter: none; }
    20% { transform: translate(-6px, 1px) skewX(-1deg); filter: saturate(1.6) hue-rotate(-12deg); }
    40% { transform: translate(5px, -1px); filter: contrast(1.3); }
    60% { transform: translate(-3px, 0) skewX(1deg); filter: saturate(0.4); }
    80% { transform: translate(2px, 1px); filter: none; }
    100% { transform: translate(0, 0); }
}

.mono { font-family: var(--font-osd); font-variant-numeric: tabular-nums; }
.visually-hidden {
    position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
}
:where(button, input, textarea, a):focus-visible { outline: 3px solid var(--mono-yellow); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; font-weight: 400; }
p { text-wrap: pretty; }

/* Badges OSD */
.badge {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-family: var(--font-osd); font-size: 1.25rem; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--paper-dim);
}
.badge .dot { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--paper-muted); }
.badge[data-state="online"] .dot { background: var(--ko); animation: blink 1.2s steps(1) infinite; }
.badge[data-state="offline"] .dot { background: var(--paper-muted); }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* --- OSD magnétoscope (coins de l'écran) --- */
.vhs-osd { position: fixed; inset: 0; pointer-events: none; z-index: 43; font-family: var(--font-osd); color: var(--paper); text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8), -1px 0 rgba(255, 77, 106, 0.5), 1px 0 rgba(92, 225, 255, 0.5); text-transform: uppercase; }
.vhs-osd > * { position: absolute; font-size: clamp(1.2rem, 2.2vw, 2rem); letter-spacing: 0.06em; }
.osd-play { inset-block-start: clamp(0.6rem, 2vh, 1.4rem); inset-inline-start: clamp(0.8rem, 2vw, 1.8rem); }
.osd-sp { inset-block-start: clamp(0.6rem, 2vh, 1.4rem); inset-inline-end: clamp(0.8rem, 2vw, 1.8rem); }
.osd-time { inset-block-end: clamp(0.6rem, 2vh, 1.4rem); inset-inline-start: clamp(0.8rem, 2vw, 1.8rem); }
.osd-date { inset-block-end: clamp(0.6rem, 2vh, 1.4rem); inset-inline-end: clamp(0.8rem, 2vw, 1.8rem); }

/* =====================================================================
   ÉCRAN PRINCIPAL (TV / TABLETTE)
   ===================================================================== */
.tv {
    block-size: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: clamp(0.6rem, 2vh, 1.4rem);
    padding: clamp(3rem, 8vh, 4.75rem) clamp(1.2rem, 4vw, 4rem) clamp(3rem, 8vh, 4.75rem);
    animation: flicker 6s infinite;
}

.tv-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tv-brand { display: flex; flex-direction: column; gap: 0.1rem; }
.tv-brand h1 { font-size: clamp(1.8rem, 3.4vw, 3rem); letter-spacing: 0.14em; text-transform: uppercase; line-height: 1; }
.tv-brand .sub { color: var(--paper-muted); font-size: clamp(1rem, 1.5vw, 1.35rem); letter-spacing: 0.18em; text-transform: uppercase; }

.progress-pips { display: flex; gap: 0.35rem; align-items: center; }
.pip {
    inline-size: clamp(1.9rem, 3vw, 2.7rem); block-size: clamp(1.9rem, 3vw, 2.7rem);
    display: grid; place-items: center;
    font-size: clamp(1.2rem, 1.8vw, 1.6rem);
    border: 1px solid var(--line); color: var(--paper-muted); background: var(--panel);
}
.pip.done { color: var(--paper-dim); border-color: var(--line-strong); text-decoration: line-through; text-decoration-color: rgba(236, 229, 200, 0.4); }
.pip.current { color: var(--wall-dark); background: var(--paper); border-color: var(--paper); box-shadow: -2px 0 var(--team-b), 2px 0 var(--team-a); }

.tv-stage {
    position: relative;
    min-block-size: 0;
    display: grid; place-items: center; text-align: center;
    background: var(--panel);
    border: 1px solid var(--line);
    outline: 1px solid rgba(0, 0, 0, 0.6); outline-offset: 3px;
    padding: clamp(0.8rem, 3vh, 2.5rem) clamp(1rem, 4vw, 4rem);
    overflow: hidden;
}
.view { display: none; inline-size: 100%; max-inline-size: 1500px; flex-direction: column; align-items: center; gap: clamp(0.5rem, 2.2vh, 1.6rem); }
body[data-phase="idle"] .view-idle,
body[data-phase="intro"] .view-intro,
body[data-phase="question"] .view-question,
body[data-phase="recap"] .view-question,
body[data-phase="done"] .view-done,
body[data-phase="results"] .view-results,
body[data-phase="global"] .view-global { display: flex; }

.eyebrow { letter-spacing: 0.32em; text-transform: uppercase; color: var(--mono-yellow); font-size: clamp(1.2rem, 2.1vw, 1.9rem); }
.huge-title { font-size: clamp(2.6rem, min(9vw, 13vh), 8.5rem); letter-spacing: 0.08em; text-transform: uppercase; line-height: 0.92; color: var(--fluo); }
.lead { color: var(--paper-dim); font-size: clamp(1.2rem, min(2.2vw, 3.6vh), 2rem); max-inline-size: 52ch; }

.join-box { display: flex; align-items: center; gap: clamp(1rem, 3vw, 2.5rem); margin-block-start: 0.6rem; text-align: start; }
.join-qr { background: var(--paper); padding: 8px; line-height: 0; filter: sepia(0.35) contrast(1.05); box-shadow: -3px 0 rgba(255, 77, 106, 0.6), 3px 0 rgba(92, 225, 255, 0.6); }
.join-qr img, .join-qr canvas { inline-size: clamp(90px, 15vh, 180px) !important; block-size: auto !important; }
.join-url { color: var(--paper-dim); font-size: clamp(1.2rem, 1.8vw, 1.6rem); overflow-wrap: anywhere; }

.intro-text { font-size: clamp(1.5rem, 3.2vw, 2.7rem); max-inline-size: 44ch; color: var(--paper); line-height: 1.15; }

/* Question */
.q-meta { display: flex; gap: 0.9rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.q-type { font-size: clamp(1.1rem, 1.7vw, 1.5rem); letter-spacing: 0.14em; text-transform: uppercase; padding: 0.05rem 0.55rem; border: 1px solid var(--line-strong); color: var(--paper-dim); }
.q-text { font-size: clamp(1.9rem, min(4.6vw, 7.2vh), 4.6rem); line-height: 1.02; max-inline-size: 30ch; color: var(--fluo); }

.options-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(0.5rem, 1.4vw, 1.1rem); inline-size: 100%; max-inline-size: 1200px; }
.option-card {
    display: flex; align-items: center; gap: 1rem; text-align: start;
    padding: clamp(0.35rem, 1.2vh, 0.9rem) clamp(0.8rem, 2vw, 1.4rem);
    background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line-strong);
    font-size: clamp(1.5rem, min(3.2vw, 5vh), 3rem);
}
.option-card .letter {
    flex-shrink: 0; display: grid; place-items: center;
    inline-size: 1.4em; block-size: 1.4em;
    background: var(--paper); color: var(--wall-dark);
    box-shadow: -2px 0 var(--team-b), 2px 0 var(--team-a);
}
.libre-hint { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 1.3rem; border: 1px dashed var(--line-strong); color: var(--paper-dim); font-size: clamp(1.4rem, 2.6vw, 2.3rem); text-transform: uppercase; letter-spacing: 0.06em; }
.libre-hint .mono { color: var(--mono-yellow); }

/* Lecture audio */
.listen { display: none; align-items: center; gap: 0.75rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mono-yellow); font-size: clamp(1.3rem, 2vw, 1.8rem); }
body[data-listening="true"] .listen { display: inline-flex; }
.wave { display: inline-flex; gap: 4px; align-items: center; block-size: 1.2em; }
.wave i { display: block; inline-size: 5px; block-size: 30%; background: currentColor; animation: wave 0.9s steps(4) infinite; }
.wave i:nth-child(2) { animation-delay: 0.15s; } .wave i:nth-child(3) { animation-delay: 0.3s; }
.wave i:nth-child(4) { animation-delay: 0.45s; } .wave i:nth-child(5) { animation-delay: 0.6s; }
@keyframes wave { 0%, 100% { block-size: 25%; } 50% { block-size: 100%; } }

/* Bas d'écran : équipes + chrono */
.tv-bottom { display: grid; grid-template-columns: 1fr auto 1fr; gap: clamp(0.6rem, 2vw, 1.4rem); align-items: stretch; }
.team-panel {
    --team: var(--team-a);
    display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
    padding: clamp(0.5rem, 1.6vh, 1rem) clamp(0.8rem, 2vw, 1.3rem);
    background: var(--panel); border: 1px solid var(--line); border-inline-start: 4px solid var(--team);
    min-inline-size: 0;
}
.team-panel[data-team="B"] { --team: var(--team-b); border-inline-start-width: 1px; border-inline-end: 4px solid var(--team); text-align: end; }
.team-name { font-size: clamp(1.6rem, 2.8vw, 2.5rem); letter-spacing: 0.08em; text-transform: uppercase; color: var(--team); overflow-wrap: anywhere; line-height: 1; }
.team-status { font-size: clamp(1.15rem, 1.7vw, 1.5rem); letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper-muted); }
.team-panel[data-answered="true"] { border-color: var(--team); background: color-mix(in oklab, var(--team) 9%, var(--panel-solid)); }
.team-panel[data-answered="true"] .team-status { color: var(--paper); }
.team-answer { display: none; font-size: clamp(1.5rem, 2.6vw, 2.3rem); color: var(--paper); overflow-wrap: anywhere; line-height: 1.05; }
body[data-phase="recap"] .team-answer { display: block; }

.timer {
    --p: 1;
    position: relative; display: grid; place-items: center; align-content: center;
    min-inline-size: clamp(7rem, 13vw, 11rem);
    padding: 0.2rem 1rem 0.8rem;
    background: var(--panel); border: 1px solid var(--line-strong);
    font-size: clamp(3rem, 6.5vw, 5.6rem); line-height: 1;
    font-variant-numeric: tabular-nums; color: var(--fluo);
    text-shadow: -2px 0 rgba(255, 77, 106, 0.6), 2px 0 rgba(92, 225, 255, 0.6);
}
.timer::after {
    content: ""; position: absolute; inset-inline-start: 0; inset-block-end: 0;
    block-size: 6px; inline-size: calc(var(--p) * 100%);
    background: var(--timer-color, var(--paper));
}
.timer[data-tone="warn"] { --timer-color: var(--mono-yellow); color: var(--mono-yellow); }
.timer[data-tone="alert"] { --timer-color: var(--ko); color: var(--ko); animation: blink 0.5s steps(1) infinite; }
.timer[data-tone="idle"] { color: var(--paper-muted); text-shadow: none; }
.timer small { font-size: 0.3em; letter-spacing: 0.2em; color: var(--paper-muted); text-shadow: none; }
body:not([data-phase="question"]):not([data-phase="recap"]) .timer { visibility: hidden; }
body[data-phase="results"] .tv-bottom,
body[data-phase="global"] .tv-bottom,
body[data-phase="idle"] .tv-bottom { display: none; }

/* Résultats */
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1rem, 3vw, 3rem); inline-size: 100%; max-inline-size: 1200px; }
.result-card { --team: var(--team-a); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--team); border-block-start-width: 4px; padding: clamp(1rem, 3vh, 2rem); display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.result-card[data-team="B"] { --team: var(--team-b); }
.result-card .team-name { color: var(--team); }
.result-percent { font-size: clamp(5rem, 15vw, 12rem); line-height: 0.85; font-variant-numeric: tabular-nums; color: var(--fluo); text-shadow: -4px 0 rgba(255, 77, 106, 0.6), 4px 0 rgba(92, 225, 255, 0.6); }
.result-detail { color: var(--paper-dim); letter-spacing: 0.1em; text-transform: uppercase; font-size: clamp(1.2rem, 1.8vw, 1.6rem); }
.result-ticks { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: center; }
.tick { inline-size: 1.9em; block-size: 1.9em; display: grid; place-items: center; font-size: clamp(1.2rem, 1.8vw, 1.6rem); border: 1px solid var(--line); }
.tick[data-v="1"] { border-color: var(--ok); color: var(--ok); }
.tick[data-v="0.5"] { border-color: var(--half); color: var(--half); }
.tick[data-v="0"] { border-color: var(--ko); color: var(--ko); }

/* Résultat global */
.global-doors { display: flex; gap: 0.3rem; flex-wrap: wrap; justify-content: center; }
.gdoor { display: flex; flex-direction: column; align-items: center; min-inline-size: 2.6em; padding: 0.15rem 0.35rem; border: 1px solid var(--line); font-size: clamp(1.1rem, 1.6vw, 1.45rem); line-height: 1; }
.gdoor small { font-size: 0.75em; color: var(--paper-muted); letter-spacing: 0.06em; }
.gdoor b { font-weight: 400; margin-block-start: 0.15rem; }
.gdoor[data-kind="door"][data-v="100"] { border-color: var(--ok); color: var(--ok); }
.gdoor[data-kind="door"][data-v="0"] { border-color: var(--ko); color: var(--ko); }
.gdoor[data-kind="quiz"] { border-color: var(--mono-yellow); color: var(--mono-yellow); }
.gdoor[data-kind="none"] { opacity: 0.45; }
.exit-verdict { font-size: clamp(1.5rem, 2.6vw, 2.3rem); letter-spacing: 0.14em; text-transform: uppercase; padding: 0.1rem 0.8rem; border: 1px solid currentColor; opacity: 0; }
.exit-verdict:empty { display: none; }
.exit-verdict[data-ok="true"] { color: var(--ok); }
.exit-verdict[data-ok="false"] { color: var(--ko); }
.exit-verdict.show { opacity: 1; animation: blink 0.25s steps(1) 4; }

/* Calque de démarrage (débloque l'audio) : écran bleu magnétoscope */
.boot {
    position: fixed; inset: 0; z-index: 60;
    display: grid; place-items: center; text-align: center;
    background: #0A1A9C;
    border: 0; inline-size: 100%; color: #F2F2F2; cursor: pointer;
    font-family: var(--font-osd);
}
.boot[hidden] { display: none; }
.boot .boot-inner { display: flex; flex-direction: column; gap: 1rem; align-items: center; padding: 2rem; }
.boot strong { font-size: clamp(2.4rem, 6vw, 5rem); font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; }
.boot span { font-size: clamp(1.3rem, 2.4vw, 2rem); letter-spacing: 0.1em; text-transform: uppercase; }
.boot .blink { animation: blink 1s steps(1) infinite; }

@media (max-aspect-ratio: 1/1) {
    .tv-bottom { grid-template-columns: 1fr 1fr; }
    .timer { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
    .options-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   TERMINAL JOUEUR (TÉLÉPHONE)
   ===================================================================== */
.player {
    --team: var(--mono-yellow);
    max-inline-size: 560px; margin-inline: auto;
    min-block-size: 100dvh;
    display: flex; flex-direction: column; gap: 0.9rem;
    padding: max(2.6rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(2.6rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px));
    animation: flicker 7s infinite;
}
.player[data-team="A"] { --team: var(--team-a); }
.player[data-team="B"] { --team: var(--team-b); }
.player ~ .vhs-osd > * { font-size: 1.35rem; }

.p-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 0.75rem; padding-block-end: 0.6rem; border-block-end: 1px dashed var(--line); }
.p-brand { font-size: 1.6rem; letter-spacing: 0.1em; text-transform: uppercase; line-height: 1; }
.p-brand small { display: block; color: var(--team); font-size: 1.2rem; letter-spacing: 0.14em; margin-block-start: 0.2rem; }

.p-card {
    background: var(--panel); border: 1px solid var(--line); border-inline-start: 3px solid var(--team);
    padding: 1rem; display: flex; flex-direction: column; gap: 0.85rem;
}
.p-screen { display: none; flex-direction: column; gap: 0.9rem; flex: 1; }
.p-screen.active { display: flex; }

.p-title { font-size: 1.35rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper-dim); }
.p-big { font-family: var(--font-body); font-size: 1.25rem; font-weight: 600; line-height: 1.3; color: var(--paper); }
.p-muted { color: var(--paper-muted); font-size: 1.2rem; letter-spacing: 0.06em; text-transform: uppercase; }

.btn {
    --btn-accent: var(--team);
    font-family: var(--font-osd); font-size: 1.5rem; letter-spacing: 0.06em; text-transform: uppercase;
    min-block-size: 56px; padding: 0.5rem 1rem;
    border: 1px solid var(--line-strong); border-radius: 0;
    background: rgba(0, 0, 0, 0.4); color: var(--paper);
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    cursor: pointer; user-select: none; text-align: start;
}
.btn:active { transform: translateX(2px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--paper); color: var(--wall-dark); border-color: var(--paper); box-shadow: -3px 0 var(--team-b), 3px 0 var(--team-a); }
.btn-primary:disabled { background: transparent; color: var(--paper-muted); box-shadow: none; border-color: var(--line); }

.team-pick { display: grid; gap: 0.8rem; }
.team-pick .btn { min-block-size: 84px; font-size: 2rem; border-inline-start-width: 6px; }
.team-pick .btn[data-team="A"] { border-inline-start-color: var(--team-a); color: var(--team-a); }
.team-pick .btn[data-team="B"] { border-inline-start-color: var(--team-b); color: var(--team-b); }

.p-timer-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.p-timer { font-variant-numeric: tabular-nums; font-size: 2.6rem; line-height: 1; color: var(--team); }
.p-timer[data-tone="alert"] { color: var(--ko); animation: blink 0.5s steps(1) infinite; }
.p-bar { block-size: 6px; background: rgba(236, 229, 200, 0.12); overflow: hidden; }
.p-bar > div { block-size: 100%; inline-size: 100%; background: var(--team); transform-origin: left; }

.p-options { display: grid; gap: 0.6rem; }
.p-option { justify-content: flex-start; font-size: 1.9rem; min-block-size: 64px; text-transform: none; }
.p-option .letter { display: grid; place-items: center; inline-size: 2.4rem; block-size: 2.4rem; flex-shrink: 0; background: var(--paper); color: var(--wall-dark); }
.p-option[aria-pressed="true"] { border-color: var(--team); background: color-mix(in oklab, var(--team) 20%, var(--panel-solid)); box-shadow: inset 4px 0 var(--team); }
.p-option[aria-pressed="true"] .letter { background: var(--team); }

.p-field { display: flex; flex-direction: column; gap: 0.45rem; }
.p-field label { font-size: 1.25rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper-dim); }
.p-field textarea {
    font-family: var(--font-body); font-size: 1.1rem; color: var(--paper);
    background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line-strong); border-radius: 0;
    padding: 0.8rem; min-block-size: 8rem; resize: vertical; caret-color: var(--team);
}
.p-field textarea:focus { border-color: var(--team); outline: none; }
.p-count { align-self: flex-end; font-size: 1.1rem; color: var(--paper-muted); }

.sent-box { border: 1px solid var(--team); border-inline-start-width: 3px; background: color-mix(in oklab, var(--team) 8%, var(--panel-solid)); }
.sent-box .p-title { color: var(--team); }
.sent-box .p-big { overflow-wrap: anywhere; }

.p-footer { margin-block-start: auto; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.link-btn { background: none; border: 0; color: var(--paper-muted); font-family: var(--font-osd); font-size: 1.2rem; letter-spacing: 0.08em; text-transform: uppercase; text-decoration: underline; cursor: pointer; min-block-size: 44px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .vhs-tracking { display: none; }
}
@media (prefers-contrast: more) {
    :root { --line: rgba(236, 229, 200, 0.6); --line-strong: rgba(236, 229, 200, 0.85); --paper-dim: #FFFFFF; --paper-muted: #DDD6B8; }
    .vhs-noise, .vhs-tracking { display: none; }
}
