/* ==========================================================================
   Blindtest : socle commun « arcade néon »
   Tokens, fond en quatre couches, keyframes, composants partagés.
   Chargé avant le CSS de chaque surface (play, show, animator, admin, home).
   ========================================================================== */

:root {
    /* Fonds */
    --bt-bg: #05060b;
    --bt-surface: #0a0c14;
    --bt-glass: rgba(255, 255, 255, 0.045);
    --bt-glass-weak: rgba(255, 255, 255, 0.025);
    --bt-border: rgba(255, 255, 255, 0.1);
    --bt-border-weak: rgba(255, 255, 255, 0.07);

    /* Textes */
    --bt-text: #f2f5ff;
    --bt-text-strong: #ffffff;
    --bt-text-2: #c4cbde;
    --bt-text-3: #7e88a3;
    --bt-text-3-alt: #8a93ad;
    --bt-text-muted: #5c6482;

    /* Accents */
    --bt-cyan: #00e5ff;
    --bt-cyan-light: #7df3ff;
    --bt-cyan-dark: #00a6ff;
    --bt-on-cyan: #04121a;
    --bt-violet: #7c4dff;
    --bt-magenta: #ff2d95;

    /* États */
    --bt-success: #39ff88;
    --bt-on-success: #04120a;
    --bt-success-pale: #b6f5d2;
    --bt-error: #ff4d5e;
    --bt-error-text: #ff7a87;
    --bt-error-text-2: #ff9aa4;
    --bt-gold: #ffc93c;
    --bt-on-gold: #1a1200;
    --bt-gold-muted: #e6c77a;
    --bt-bronze: #e0975a;

    /* Typographies */
    --bt-font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    --bt-font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
    --bt-font-mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;

    /* Rayons */
    --bt-r-sm: 8px;
    --bt-r-md: 10px;
    --bt-r-lg: 12px;
    --bt-r-xl: 14px;
    --bt-r-hero: 20px;
    --bt-r-modal: 16px;

    /* Ombres */
    --bt-shadow-cyan: 0 16px 40px rgba(0, 229, 255, 0.3);
    --bt-shadow-cyan-hover: 0 20px 48px rgba(0, 229, 255, 0.42);
    --bt-shadow-modal: 0 40px 100px rgba(0, 0, 0, 0.7);

    /* Courbes */
    --bt-ease-in: cubic-bezier(0.22, 1.2, 0.36, 1);
    --bt-ease-pop: cubic-bezier(0.22, 1.4, 0.36, 1);
    --bt-ease-tap: cubic-bezier(0.2, 0.8, 0.3, 1);

    /* Fond : réglages surchargés par surface */
    --bt-grid-size: 36px;
    --bt-grid-opacity: rgba(0, 229, 255, 0.055);
    --bt-scanline-step: 3px;
    --bt-halo: radial-gradient(circle at 30% 30%, rgba(0, 229, 255, 0.28), transparent 62%),
        radial-gradient(circle at 78% 20%, rgba(255, 45, 149, 0.22), transparent 60%);
    --bt-halo-height: 70%;
    --bt-halo-blur: 12px;
}

/* --------------------------------------------------------------------------
   Réinitialisation minimale
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bt-bg);
    color: var(--bt-text);
    font-family: var(--bt-font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

a {
    color: var(--bt-cyan);
    text-decoration: none;
}

/* Sur tactile, un survol reste collé (retour arrière sur iOS) : réservé aux
   pointeurs qui survolent vraiment. */
@media (hover: hover) {
    a:hover {
        color: var(--bt-cyan-light);
    }
}

/* --------------------------------------------------------------------------
   Fond en quatre couches : halos, grille, scanlines, balayage.
   Rendu par pseudo-éléments de <html> et <body> : aucune balise décorative
   n'est nécessaire dans les vues, et rien n'intercepte les clics.
   Le contenu applicatif doit se placer sur z-index >= 1.
   -------------------------------------------------------------------------- */

html::before,
html::after,
body::before,
body::after {
    content: "";
    position: fixed;
    pointer-events: none;
}

/* 1. Halos
   Le masque fond le bas de la couche : sans lui, le dégradé s'arrêtait net
   sur le bord inférieur et traçait une ligne horizontale à mi-écran, visible
   sur toutes les surfaces. */
html::before {
    inset: -25% -40% auto -40%;
    height: var(--bt-halo-height);
    z-index: 0;
    background: var(--bt-halo);
    filter: blur(var(--bt-halo-blur));
    -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 98%);
    mask-image: linear-gradient(to bottom, #000 45%, transparent 98%);
    animation: btDrift 16s ease-in-out infinite;
}

/* 2. Grille */
body::before {
    inset: 0;
    z-index: 3;
    background-image: linear-gradient(var(--bt-grid-opacity) 1px, transparent 1px),
        linear-gradient(90deg, var(--bt-grid-opacity) 1px, transparent 1px);
    background-size: var(--bt-grid-size) var(--bt-grid-size);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 62%);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 62%);
}

/* 3. Scanlines */
body::after {
    inset: 0;
    z-index: 4;
    background: repeating-linear-gradient(
        to bottom,
        rgba(160, 230, 255, 0.035) 0,
        rgba(160, 230, 255, 0.035) 1px,
        transparent 1px,
        transparent var(--bt-scanline-step)
    );
}

/* 4. Balayage */
html::after {
    left: 0;
    right: 0;
    top: 0;
    height: 70px;
    z-index: 4;
    background: linear-gradient(to bottom, transparent, rgba(0, 229, 255, 0.07), transparent);
    animation: btScan 7s linear infinite;
}

/* --------------------------------------------------------------------------
   Keyframes
   -------------------------------------------------------------------------- */

@keyframes btIn {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.97);
    }
    60% {
        opacity: 1;
        transform: translateY(-3px) scale(1.008);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes btPop {
    0% {
        opacity: 0;
        transform: scale(0.4) rotate(-12deg);
    }
    55% {
        opacity: 1;
        transform: scale(1.14) rotate(3deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes btSweep {
    0% {
        transform: translateX(-130%) skewX(-18deg);
    }
    55%,
    100% {
        transform: translateX(260%) skewX(-18deg);
    }
}

@keyframes btBarShine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

@keyframes btUrgent {
    0%,
    100% {
        transform: scale(1);
        text-shadow: 0 0 18px rgba(255, 45, 149, 0.5);
    }
    50% {
        transform: scale(1.09);
        text-shadow: 0 0 30px rgba(255, 45, 149, 0.85);
    }
}

@keyframes btFlicker {
    0%,
    100% {
        opacity: 1;
    }
    93% {
        opacity: 1;
    }
    95% {
        opacity: 0.72;
    }
    97% {
        opacity: 1;
    }
}

@keyframes btPulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 0.9;
    }
    50% {
        transform: scale(1.06);
        opacity: 1;
    }
}

@keyframes btRing {
    0% {
        transform: scale(0.85);
        opacity: 0.55;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes btNote {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(-8deg);
    }
    25% {
        opacity: 0.9;
    }
    100% {
        opacity: 0;
        transform: translateY(-90px) rotate(10deg);
    }
}

@keyframes btScan {
    0% {
        transform: translateY(-100%);
    }
    100% {
        transform: translateY(900%);
    }
}

@keyframes btDrift {
    0%,
    100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-24px, -18px);
    }
}

@keyframes btCrown {
    0%,
    100% {
        transform: translateY(0) rotate(-4deg);
    }
    50% {
        transform: translateY(-12px) rotate(4deg);
    }
}

@keyframes btGlow {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.35);
    }
    50% {
        box-shadow: 0 0 34px 4px rgba(0, 229, 255, 0.28);
    }
}

@keyframes btRise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes btSlideDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   Composants partagés
   -------------------------------------------------------------------------- */

/* Micro-label en capitales monospace */
.bt-label {
    font-family: var(--bt-font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--bt-text-3);
}

/* Bouton primaire cyan */
.bt-btn-primary {
    display: block;
    width: 100%;
    padding: 22px;
    border: none;
    border-radius: var(--bt-r-lg);
    background: linear-gradient(135deg, var(--bt-cyan), var(--bt-cyan-dark));
    color: var(--bt-on-cyan);
    font-family: var(--bt-font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: var(--bt-shadow-cyan);
    transition: transform 0.18s var(--bt-ease-tap), box-shadow 0.18s ease;
}

/* Survol réservé aux pointeurs qui survolent : sur tactile, il restait
   appliqué après le tap. Le toucher a son propre retour, à l'appui. */
@media (hover: hover) {
    .bt-btn-primary:hover:not(:disabled) {
        transform: translateY(-2px);
        box-shadow: var(--bt-shadow-cyan-hover);
    }
}

.bt-btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.bt-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Bouton discret (quitter, fermer, secondaire) */
.bt-btn-ghost {
    padding: 10px 16px;
    border-radius: var(--bt-r-sm);
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: var(--bt-text-2);
    font-family: var(--bt-font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

@media (hover: hover) {
    .bt-btn-ghost:hover {
        background: rgba(255, 255, 255, 0.1);
    }
}

.bt-btn-ghost:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Champ de saisie */
.bt-input {
    width: 100%;
    padding: 18px 20px;
    border-radius: var(--bt-r-md);
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: var(--bt-text);
    font-family: var(--bt-font-body);
    font-size: 19px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.bt-input::placeholder {
    color: var(--bt-text-muted);
    font-weight: 500;
}

/* Point d'état pulsé */
.bt-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--bt-success);
    animation: btPulse 1.6s ease-in-out infinite;
    flex: none;
}

/* Reflet balayant : à poser dans un conteneur position:relative;overflow:hidden */
.bt-shine {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.14), transparent);
    animation: btSweep 3.2s ease-in-out 1s infinite;
}

/* --------------------------------------------------------------------------
   Focus clavier : l'app supprimait l'outline sans le remplacer.
   -------------------------------------------------------------------------- */

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.35);
    border-radius: var(--bt-r-sm);
}

.bt-input:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    border-color: rgba(0, 229, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.35);
}

/* --------------------------------------------------------------------------
   Mouvement réduit : on neutralise les boucles décoratives et on raccourcit
   les entrées à un simple fondu.
   -------------------------------------------------------------------------- */

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

    body::after {
        display: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --------------------------------------------------------------------------
   Modale commune.
   Vivait dans play.css : la refonte de /admin en a eu besoin pour remplacer
   ses dialogues natifs, et deux copies auraient divergé à la première
   correction.
   -------------------------------------------------------------------------- */

.bt-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(2, 3, 8, 0.8);
    backdrop-filter: blur(6px);
}

.bt-modal[hidden] {
    display: none;
}

.bt-modal-box {
    width: 100%;
    max-width: 360px;
    padding: 26px 22px;
    border-radius: var(--bt-r-modal);
    background: var(--bt-surface);
    border: 1px solid var(--bt-border);
    box-shadow: var(--bt-shadow-modal);
    text-align: center;
    animation: btIn 0.4s var(--bt-ease-in) both;
}

.bt-modal-title {
    margin: 0 0 10px;
    font-family: var(--bt-font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--bt-gold);
}

.bt-modal-text {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--bt-text-2);
    text-wrap: pretty;
}

.bt-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bt-modal-actions .bt-btn-primary {
    padding: 16px;
    font-size: 15px;
}

.bt-modal-actions .bt-btn-ghost {
    width: 100%;
    padding: 15px;
}

