/**
 * Quiz Bar - Styles partagés
 * ==========================
 * CSS commun à toutes les interfaces
 */

/* =============================================================================
   VARIABLES CSS
   ============================================================================= */
:root {
    /* Couleurs de base */
    --bg: #0c0f14;
    --bg2: #11151d;
    --card: rgba(20, 24, 32, 0.72);
    --card-border: rgba(255, 255, 255, 0.06);
    --text: #e6e9ef;
    --muted: #9aa4b2;
    
    /* Accent principal neutre */
    --accent: #38bdf8;
    --accent2: #0ea5e9;
    --accent-glow: 0 0 30px rgba(56, 189, 248, 0.22);
    
    /* Couleurs sémantiques */
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Espacements */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;
    
    /* Rayons de bordure */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* =============================================================================
   RESET & BASE
   ============================================================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    color: var(--text);
    background: 
        radial-gradient(1000px 600px at 20% -10%, #1b2432 0%, transparent 60%),
        radial-gradient(800px 500px at 110% 20%, #1a202c 0%, transparent 60%),
        var(--bg);
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    letter-spacing: 0.1px;
    line-height: 1.5;
}

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.2;
}

h1 {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: clamp(24px, 4vw, 42px);
}

h2 {
    font-size: clamp(20px, 3vw, 28px);
}

h3 {
    font-size: clamp(16px, 2.5vw, 22px);
}

.mini {
    font-size: 12px;
    color: var(--muted);
}

/* =============================================================================
   LAYOUT
   ============================================================================= */
.wrap {
    max-width: 1100px;
    margin: var(--spacing-xl) auto;
    padding: 0 var(--spacing-lg);
}

.row {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
}

.col {
    flex: 1;
    min-width: 200px;
}

.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

@media (max-width: 768px) {
    .two {
        grid-template-columns: 1fr;
    }
}

/* =============================================================================
   CARDS
   ============================================================================= */
.card {
    background: var(--card);
    backdrop-filter: blur(4px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.notice {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    color: #d7dee8;
}

/* =============================================================================
   FORMS
   ============================================================================= */
.input, select, textarea {
    width: 100%;
    background: #0f131a;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    outline: none;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus, select:focus, textarea:focus {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

.input::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: #cbd5e1;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.btn:hover:not(:disabled) {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: var(--accent-glow);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent2));
    border-color: var(--accent2);
    color: #111;
    font-weight: 700;
}

.btn-success {
    background: var(--success);
    border-color: #059669;
    color: #fff;
}

.btn-danger {
    background: var(--error);
    border-color: #dc2626;
    color: #fff;
}

/* =============================================================================
   LISTS
   ============================================================================= */
.list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm) 0 0;
}

.list li {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.list-compact li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Médailles top 3 */
.list-compact li:nth-child(1) span:first-child::before { content: "🥇 "; }
.list-compact li:nth-child(2) span:first-child::before { content: "🥈 "; }
.list-compact li:nth-child(3) span:first-child::before { content: "🥉 "; }
.list-compact li:nth-child(-n+3) span:first-child { font-weight: 700; }

/* =============================================================================
   DELTA INDICATORS (Score changes)
   ============================================================================= */
.delta {
    font-weight: 700;
    margin-left: var(--spacing-sm);
}

.delta.pos {
    color: var(--success);
}

.delta.neg {
    color: var(--error);
}

.delta.zero {
    color: var(--muted);
    opacity: 0.7;
}

/* =============================================================================
   PODIUM
   ============================================================================= */
.podium {
    display: flex;
    gap: var(--spacing-lg);
    align-items: flex-end;
    justify-content: center;
    margin-top: var(--spacing-md);
}

.podium .step {
    width: 160px;
    padding: 14px 12px;
    border-radius: var(--radius-lg) var(--radius-lg) 6px 6px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: center;
    box-shadow: var(--accent-glow);
}

.podium .medal {
    font-size: 28px;
    margin-bottom: var(--spacing-sm);
}

.podium .name {
    font-weight: 700;
    text-wrap: balance;
}

.podium .score {
    color: var(--muted);
    font-size: 12px;
    margin-top: var(--spacing-xs);
}

.podium .r1 {
    height: 200px;
    outline: 2px solid var(--accent);
}

.podium .r2 {
    height: 160px;
}

.podium .r3 {
    height: 140px;
}

/* =============================================================================
   TIMER
   ============================================================================= */
.timer {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.15), rgba(249, 115, 22, 0.10));
    border: 1px solid rgba(249, 115, 22, 0.25);
    color: #ffd7a1;
    font-weight: 700;
    letter-spacing: 0.6px;
    box-shadow: var(--accent-glow);
}

.timer-pill {
    font-size: clamp(18px, 3.2vw, 28px);
    font-weight: 800;
}

/* =============================================================================
   CHOICES (Quiz buttons)
   ============================================================================= */
.choices button {
    width: 100%;
    margin-top: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    border-radius: var(--radius-lg);
    padding: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.05s ease, border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.choices button:hover:not(.disabled) {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: var(--accent-glow);
}

.choices .btn.choice.selected {
    outline: 2px solid var(--accent);
    transform: translateY(-1px);
}

.choices .btn.choice.disabled {
    opacity: 0.55;
    pointer-events: none;
}

.choices .btn.choice.correct {
    outline: 2px solid var(--success);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18) inset;
}

.choices .btn.choice.wrong {
    outline: 2px solid var(--error);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) inset;
}

.choices .btn.choice.fiftyWrong {
    background: var(--error) !important;
    color: #fff !important;
    border-color: #b91c1c !important;
}

/* =============================================================================
   SPECIAL BANNERS
   ============================================================================= */
.banner-buzz {
    border-left: 6px solid var(--accent2);
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.12), rgba(249, 115, 22, 0.04));
}

.banner-special {
    border-left: 6px solid var(--accent);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
}

.banner-steal {
    border-left: 6px solid var(--warning);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.04));
}

/* =============================================================================
   ÉTATS
   ============================================================================= */
.hidden {
    display: none !important;
}

.elim {
    text-decoration: line-through;
    opacity: 0.6;
}

.ok, .answer-ok {
    color: var(--success);
}

.bad, .err, .answer-bad {
    color: var(--error);
}

/* =============================================================================
   MEDIA BOX
   ============================================================================= */
#mediaBox {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset, var(--accent-glow);
    padding: var(--spacing-md);
    background: 
        radial-gradient(600px 280px at 85% -10%, rgba(249, 115, 22, 0.15), transparent 60%),
        radial-gradient(500px 260px at -10% 90%, rgba(245, 158, 11, 0.12), transparent 70%),
        var(--bg2);
}

#mediaBox video,
#mediaBox audio,
#mediaBox img {
    width: 100%;
    border-radius: var(--radius-md);
    outline: 1px solid rgba(255, 255, 255, 0.05);
}

/* =============================================================================
   FX - ÉCLAIRS
   ============================================================================= */
#fxLightning {
    position: fixed;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 20;
}

#fxLightning .bolt {
    position: absolute;
    opacity: 0;
    font-size: 64px;
    animation: bolt 1.1s linear infinite;
    filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.45));
}

#fxLightning .b1 { left: 8%; top: 10%; animation-delay: 0s; }
#fxLightning .b2 { left: 22%; top: 55%; animation-delay: 0.2s; }
#fxLightning .b3 { right: 10%; top: 18%; animation-delay: 0.4s; }
#fxLightning .b4 { right: 20%; bottom: 15%; animation-delay: 0.55s; }
#fxLightning .b5 { left: 45%; top: 30%; animation-delay: 0.75s; }
#fxLightning .b6 { left: 60%; bottom: 20%; animation-delay: 0.9s; }

@keyframes bolt {
    0% { opacity: 0; transform: scale(0.8) rotate(10deg); }
    10% { opacity: 1; }
    40% { opacity: 0.6; }
    100% { opacity: 0; transform: scale(1.1) rotate(-8deg); }
}

/* =============================================================================
   FX - FEUX D'ARTIFICE
   ============================================================================= */
#fxFireworks {
    position: fixed;
    inset: 0;
    pointer-events: none;
    display: none;
    z-index: 50;
}

#fxFireworks .fw {
    position: absolute;
    opacity: 0;
    font-size: 44px;
    animation: fwpop 1.2s ease-out infinite;
}

#fxFireworks .f1 { left: 12%; top: 65%; animation-delay: 0s; }
#fxFireworks .f2 { left: 28%; top: 30%; animation-delay: 0.2s; }
#fxFireworks .f3 { left: 48%; top: 55%; animation-delay: 0.35s; }
#fxFireworks .f4 { right: 22%; top: 22%; animation-delay: 0.5s; }
#fxFireworks .f5 { right: 10%; bottom: 18%; animation-delay: 0.65s; }
#fxFireworks .f6 { left: 60%; bottom: 12%; animation-delay: 0.8s; }

@keyframes fwpop {
    0% { opacity: 0; transform: translateY(10px) scale(0.8) rotate(-8deg); }
    10% { opacity: 1; }
    45% { opacity: 0.9; transform: translateY(-6px) scale(1.15) rotate(8deg); }
    100% { opacity: 0; transform: translateY(-20px) scale(1.25) rotate(-6deg); }
}

/* =============================================================================
   WATERMARK
   ============================================================================= */
.wm {
    position: fixed;
    right: 16px;
    bottom: 14px;
    opacity: 0.45;
    z-index: 1;
}

.wm img {
    width: 110px;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 600px) {
    .wrap {
        padding: 0 var(--spacing-md);
        margin: var(--spacing-lg) auto;
    }
    
    .podium .step {
        width: 100px;
        padding: 10px 8px;
    }
    
    .podium .r1 { height: 160px; }
    .podium .r2 { height: 130px; }
    .podium .r3 { height: 110px; }
}

/* =============================================================================
   Stranger Things theme – background & title glow
   ============================================================================= */
html[data-theme="stranger_things_v1"] body {
  background:
    radial-gradient(900px 520px at 18% -10%, rgba(225, 29, 72, 0.22) 0%, transparent 60%),
    radial-gradient(820px 520px at 110% 18%, rgba(34, 211, 238, 0.14) 0%, transparent 58%),
    radial-gradient(700px 520px at 60% 120%, rgba(255, 255, 255, 0.05) 0%, transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.65)),
    var(--bg);
}

html[data-theme="stranger_things_v1"] h1 {
  text-shadow:
    0 0 18px rgba(225, 29, 72, 0.28),
    0 0 38px rgba(225, 29, 72, 0.18);
  letter-spacing: 0.6px;
}

html[data-theme="stranger_things_v1"] .card {
  box-shadow:
    0 10px 44px rgba(0,0,0,0.55),
    0 0 34px rgba(225, 29, 72, 0.10);
}

/* =============================================================================
   Player wallpaper (Stranger Things)
   ============================================================================= */

html[data-theme="stranger_things_v1"] body.role-player,
html[data-theme="stranger_things_v1"] body.role-screen{
    /* Fallback si le token n'est pas appliqué (debug / cache / theme pas reçu) */
  --player-bg-fallback: url("/static/themes/stranger-things/player-bg.webp");

  background:
    /* overlay + léger (sinon ton image est invisible car très sombre) */
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.55)),
    /* wallpaper */
    var(--player-bg-img, var(--player-bg-fallback)),
    /* ambiance */
    radial-gradient(900px 520px at 18% -10%, rgba(225, 29, 72, 0.22) 0%, transparent 60%),
    radial-gradient(820px 520px at 110% 18%, rgba(34, 211, 238, 0.14) 0%, transparent 58%),
    var(--bg);

  background-size: auto, cover, auto, auto, auto;
  background-position: center, center, 18% -10%, 110% 18%, center;
  background-repeat: no-repeat;
  background-attachment: scroll, fixed, scroll, scroll, scroll;
}

/* Optionnel mais recommandé : cards un peu + transparentes sur Player pour "voir" le wallpaper */
html[data-theme="stranger_things_v1"] body.role-player .card{
  background: rgba(12, 8, 18, 0.62);
  border-color: rgba(255, 60, 90, 0.14);
}

html[data-theme="stranger_things_v1"] body.role-screen .hero-zone{
  background: rgba(11, 7, 16, 0.35);
  backdrop-filter: blur(6px);
}

/* =============================================================================
   Player wallpaper (Pirate)
   ============================================================================= */

html[data-theme="pirate_v1"] body.role-player,
html[data-theme="pirate_v1"] body.role-screen {
  --player-bg-fallback: url("/static/themes/pirate/player-bg.jpg");

  /* Wallpaper + overlays (vignette + ambiance) */
  background:
    radial-gradient(1200px 700px at 50% 20%, rgba(212,175,55,.14) 0%, transparent 55%),
    radial-gradient(900px 700px at 10% 110%, rgba(14,165,233,.10) 0%, transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.68)),
    var(--player-bg-img, var(--player-bg-fallback)),
    var(--bg);

  background-size: auto, auto, auto, cover, auto;
  background-position: 50% 20%, 10% 110%, center, center, center;
  background-repeat: no-repeat;
  background-attachment: scroll, scroll, scroll, fixed, scroll;
}

/* Cartes un peu plus transparentes pour voir le wallpaper */
html[data-theme="pirate_v1"] body.role-player .card {
  background: rgba(8, 10, 12, 0.60);
  border-color: rgba(212, 175, 55, 0.18);
  box-shadow: 0 10px 44px rgba(0,0,0,0.55), 0 0 38px rgba(212,175,55,0.10);
}

/* Hero zone plus "ciné" côté screen */
html[data-theme="pirate_v1"] body.role-screen .hero-zone{
  background: rgba(8,10,12,0.35);
  backdrop-filter: blur(6px);
}

/* Effets plus visibles : grain + vignette animée légère */
html[data-theme="pirate_v1"] body.fx-grain::before{
  opacity: 0.22;           /* + visible */
  mix-blend-mode: overlay; /* rendu plus “texture” */
}

html[data-theme="pirate_v1"] body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0; /* derrière le contenu (body > * est déjà en z-index:1 dans theme-effects.css) */
  background:
    radial-gradient(900px 520px at 50% 40%, transparent 40%, rgba(0,0,0,0.55) 78%),
    radial-gradient(1400px 900px at 20% 30%, rgba(0,0,0,0.25) 0%, transparent 55%);
  opacity: 0.9;
  animation: pirateFog 14s ease-in-out infinite;
}

@keyframes pirateFog{
  0%   { transform: translate3d(-1.5%, 0, 0) scale(1.02); opacity: .85; }
  50%  { transform: translate3d( 1.5%, 0, 0) scale(1.03); opacity: .95; }
  100% { transform: translate3d(-1.5%, 0, 0) scale(1.02); opacity: .85; }
}

