/* =====================================================================
   Quiz Citations — feuille de style (vanilla, responsive mobile-first)
   ===================================================================== */

:root {
    --bg:        #0f1226;
    --bg-card:   #1b1f3b;
    --bg-card-2: #232848;
    --accent:    #ffcf4d;
    --accent-2:  #6c7bff;
    --text:      #f4f5ff;
    --muted:     #9aa0c7;
    --danger:    #ff6b6b;
    --success:   #4ddb8a;
    --radius:    14px;
    --shadow:    0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(1200px 600px at 50% -10%, #2a2f5c 0%, var(--bg) 60%);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px 16px 48px;
}

/* ------- Écrans (une seule visible à la fois) ------- */
.screen { display: none; animation: fade .25s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------- En-têtes ------- */
.brand { text-align: center; margin: 24px 0 8px; }
.brand h1 { font-size: 1.9rem; margin: 0; }
.tagline { color: var(--muted); margin: 6px 0 0; }

/* ------- Cartes ------- */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: var(--radius);
    padding: 18px;
    margin: 16px 0;
    box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 1.2rem; }
.card h3 { margin: 18px 0 8px; font-size: 1rem; color: var(--muted); }

/* ------- Formulaires ------- */
label {
    display: block;
    margin: 10px 0;
    font-size: .9rem;
    color: var(--muted);
}
input, textarea {
    width: 100%;
    margin-top: 6px;
    padding: 13px 14px;
    background: var(--bg-card-2);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(108,123,255,.25);
}
textarea { resize: vertical; }

/* ------- Boutons ------- */
button {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    padding: 13px 16px;
    width: 100%;
    transition: transform .08s ease, filter .15s ease;
    font-family: inherit;
}
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: #22232f; margin-top: 8px; }
button.primary:hover { filter: brightness(1.05); }
button.ghost { background: transparent; border: 1px solid rgba(255,255,255,.2); color: var(--text); }
button.ghost.danger { border-color: rgba(255,107,107,.6); color: var(--danger); margin-top: 12px; }
button.small { width: auto; padding: 8px 12px; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ------- Divers texte ------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big   { font-size: 1.25rem; }
.center { text-align: center; }
.error {
    background: rgba(255,107,107,.12);
    border: 1px solid rgba(255,107,107,.4);
    color: #ffd0d0;
    padding: 10px 12px;
    border-radius: 10px;
    margin-top: 12px;
}

/* ------- Room / code ------- */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
}
.room-code {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: .35em;
    color: var(--accent);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.pill {
    display: inline-block;
    background: var(--accent-2);
    color: #fff;
    border-radius: 999px;
    padding: 1px 10px;
    font-size: .8rem;
    vertical-align: middle;
}

/* ------- Listes de joueurs ------- */
.player-list { list-style: none; margin: 0; padding: 0; }
.player-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.player-list li:last-child { border-bottom: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.badge-host { font-size: .7rem; background: rgba(255,207,77,.2); color: var(--accent); padding: 1px 7px; border-radius: 6px; }
.badge-turn { font-size: .7rem; background: rgba(108,123,255,.25); color: #c3caff; padding: 1px 7px; border-radius: 6px; }

/* ------- Scoreboard (en jeu) ------- */
.scoreboard {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 10px;
    -webkit-overflow-scrolling: touch;
}
.score-chip {
    flex: none;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    padding: 8px 12px;
    min-width: 84px;
    text-align: center;
}
.score-chip.turn { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(108,123,255,.3); }
.score-chip .name { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90px; }
.score-chip .pts  { font-size: 1.4rem; font-weight: 800; color: var(--accent); }
.score-chip.offline { opacity: .45; }

/* ------- Bandeau de tour ------- */
.turn-banner {
    text-align: center;
    padding: 10px;
    margin: 6px 0 12px;
    border-radius: 10px;
    background: var(--bg-card-2);
    font-weight: 600;
}

/* ------- Citation ------- */
.quote-box {
    background: linear-gradient(135deg, #2a2f5c, #1b1f3b);
    border-left: 4px solid var(--accent);
    padding: 18px;
    border-radius: 10px;
    font-size: 1.25rem;
    font-style: italic;
    line-height: 1.4;
}

/* ------- Chrono ------- */
.timer {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin: 12px 0;
    color: var(--accent);
}
.timer.low { color: var(--danger); animation: pulse .8s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ------- Formulaire de proposition ------- */
.guess-form { display: flex; gap: 8px; margin-top: 14px; }
.guess-form input { margin-top: 0; }
.guess-form button { width: auto; white-space: nowrap; }

/* ------- Listes de propositions ------- */
.guess-list { list-style: none; margin: 8px 0 0; padding: 0; }
.guess-list li {
    background: var(--bg-card-2);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px;
    padding: 11px 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.guess-list .g-text { flex: 1; word-break: break-word; }
.guess-list .g-meta { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.guess-list .g-author { font-weight: 700; color: #c3caff; }

/* Propositions cliquables (arbitrage) */
.guess-list.arbitrate li { cursor: pointer; transition: border-color .15s, background .15s; }
.guess-list.arbitrate li:hover { border-color: var(--success); background: rgba(77,219,138,.08); }

.badge-first {
    font-size: .68rem;
    background: var(--accent);
    color: #22232f;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    flex: none;
}

/* ------- Bandeau résultat de manche ------- */
.result-banner {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent-2);
    box-shadow: var(--shadow);
    border-radius: 12px;
    padding: 14px 20px;
    max-width: 90%;
    text-align: center;
    z-index: 20;
    animation: fade .25s ease;
}
.result-banner.win { border-color: var(--success); }

/* ------- Classement ------- */
.ranking { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranking li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: var(--bg-card-2);
    border-radius: 10px;
}
.ranking li .r-name { display: flex; align-items: center; gap: 10px; }
.ranking li .r-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent-2); color: #fff; font-weight: 800; font-size: .85rem;
}
.ranking li:first-child .r-rank { background: var(--accent); color: #22232f; }
.ranking li .r-score { font-weight: 800; color: var(--accent); }

/* ------- Écran de reconnexion (après F5) ------- */
.reconnect { text-align: center; padding: 80px 20px; }
.spinner {
    width: 42px; height: 42px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255,255,255,.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------- Responsive ------- */
@media (max-width: 420px) {
    .room-code { font-size: 1.8rem; }
    .quote-box { font-size: 1.1rem; }
    .guess-form { flex-direction: column; }
    .guess-form button { width: 100%; }
}
