/* ========================================
   🎯 TRIVIA - CULTURE POPULAIRE
   Design System Integration — Zikof
======================================== */

.main-header { display: none !important; } /* Replaced by game-header */

/* ========================================
   FLOATING BACK PILL (Zikof pattern)
======================================== */
.floating-back {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10000;
    background: #241f33;
    color: #fbf2dd;
    padding: 7px 11px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    border: 2px solid #fbf2dd;
    box-shadow: 4px 4px 0 #000;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s, transform 0.2s;
}
.floating-back:hover {
    background: #2b2bff;
    color: #fff;
    transform: translateX(-2px);
}

/* ========================================
   INTRO / MODE BADGE
======================================== */
.game-intro {
    text-align: center;
    padding: 10px 12px 4px;
}
.game-intro-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.25rem;
    margin: 0;
    color: #2b2bff;
    font-weight: 800;
}
.game-intro-sub {
    font-size: 0.8rem;
    color: #b9b3c9;
    margin: 4px 0 8px;
}
.game-mode-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #ffd23f;
    border: 2px solid #000;
    box-shadow: 3px 3px 0 #000;
    color: #1a1a1a;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   RELATED GAMES (replaces inline styles)
======================================== */
.related-games {
    display: block;
    width: 100%;
    max-width: 1200px;
    margin: 3rem auto 0 !important;
    padding: 2rem 1.25rem;
    background: #241f33;
    border-radius: 1rem;
    border: 2px solid #fbf2dd;
    box-shadow: 4px 4px 0 #000;
    box-sizing: border-box;
}
.related-games-title {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.4rem;
    margin: 0 0 1.5rem;
    text-align: center;
    color: #fbf2dd;
}
.related-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}
.related-game-card {
    padding: 1.25rem;
    background: #2d2740;
    border: 2px solid #fbf2dd;
    border-radius: 0.75rem;
    box-shadow: 4px 4px 0 #000;
    transition: transform 0.2s, border-color 0.2s;
}
.related-game-card:hover {
    transform: translateY(-2px);
    border-color: #ffd23f;
}
.related-game-card h3 {
    font-size: 1.1rem;
    margin: 0 0 0.5rem;
    font-family: 'Bricolage Grotesque', sans-serif;
}
.related-game-card h3 a {
    color: #ffd23f;
    text-decoration: none;
}
.related-game-card h3 a:hover { text-decoration: underline; }
.related-game-card p {
    color: #b9b3c9;
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0;
}

/* ========================================
   HEADER UNIFORME
======================================== */

.main-header {
    background-color: var(--bg-secondary);
    color: var(--text-white);
    padding: var(--spacing-md) var(--spacing-xl);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-white);
    text-decoration: none;
}

.logo:hover {
    opacity: 0.8;
}

.nav-links {
    display: flex;
    gap: var(--space-md);
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    color: var(--text-white);
    text-decoration: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    font-weight: 500;
}

.nav-links a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#user-status {
    color: var(--text-white);
    font-size: var(--font-size-sm);
    padding: var(--space-sm) var(--space-md);
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
}

.btn-theme-toggle {
    background-color: transparent;
    color: var(--text-white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-icon {
    background-color: transparent;
    color: var(--text-white);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: var(--space-sm);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xl);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   1. LAYOUT PRINCIPAL
======================================== */

.game-container {
    min-height: 100vh;
    padding: var(--space-xl) 0;
    background: #17151f;
}

.game-main-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    margin-top: var(--space-xl);
}

/* ========================================
   2. STATS BAR (Responsive)
======================================== */

.game-stats-bar {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: var(--space-lg);
}

.game-stats-bar::-webkit-scrollbar {
    display: none;
}

.stat-card {
    min-width: 75px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: #241f33;
    border: 2px solid #fbf2dd;
    border-radius: var(--radius-lg);
    box-shadow: 4px 4px 0 #000;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: #2b2bff;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #2b2bff;
}

.stat-label {
    font-size: 0.75rem;
    color: #b9b3c9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.streak-value {
    color: #ff5da2;
}

/* Timer Circle */
.timer-circle {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#progress-ring-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

#progress-ring {
    fill: none;
    stroke: url(#progressGradient);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 226.19;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.5s linear;
}

.timer-value {
    position: relative;
    z-index: 1;
    font-size: 1.5rem;
    font-weight: 800;
    color: #fbf2dd;
}

/* ========================================
   3. QUESTION SECTION
======================================== */

.question-section {
    margin-bottom: var(--space-lg);
}

.question-container {
    background: #241f33;
    border: 2px solid #fbf2dd;
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    box-shadow: 4px 4px 0 #000;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.35s ease;
}

.question-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: transparent;
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.category-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: #2b2bff;
    color: #fff;
    border: 2px solid #000;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-md);
    position: relative;
    z-index: 1;
    box-shadow: 3px 3px 0 #000;
}

.question-text {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fbf2dd;
    margin: var(--space-lg) 0;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.difficulty-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    position: relative;
    z-index: 1;
}

.difficulty-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.difficulty-stars {
    display: flex;
    gap: var(--space-xs);
}

.difficulty-stars::before {
    content: '★';
    color: #ffd700;
}

.difficulty-stars[data-level="2"]::before {
    content: '★★';
}

.difficulty-stars[data-level="3"]::before {
    content: '★★★';
}

/* ========================================
   4. ANSWERS SECTION
======================================== */

.answers-section {
    margin-bottom: var(--space-lg);
}

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

.answer-btn {
    width: 100%;
    padding: var(--space-lg);
    background: #2d2740;
    border: 2px solid #fbf2dd;
    border-radius: var(--radius-lg);
    color: #fbf2dd;
    font-size: 1.125rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 4px 4px 0 #000;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: transparent;
    transition: left 0.5s ease;
}

.answer-btn:hover::before {
    left: 100%;
}

.answer-btn:hover {
    transform: translateY(-2px);
    border-color: #2b2bff;
    background: #2b2bff;
    color: #fff;
}

.answer-btn:active {
    transform: scale(0.98);
}

.answer-btn.correct {
    background: #16c08a;
    color: #1a1a1a;
    border-color: #000;
    animation: correctPulse 0.5s ease;
}

.answer-btn.incorrect {
    background: #ff5da2;
    color: #1a1a1a;
    border-color: #000;
    animation: shake 0.5s ease;
}

.answer-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.answer-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    text-align: center;
    background: #ffd23f;
    color: #1a1a1a;
    border: 2px solid #000;
    border-radius: 50%;
    margin-right: var(--space-sm);
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    box-shadow: 2px 2px 0 #000;
}

/* ========================================
   5. PROGRESS BAR
======================================== */

.progress-section {
    margin-top: var(--space-xl);
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #2d2740;
    border: 2px solid #fbf2dd;
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: #2b2bff;
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    animation: shimmer 2s infinite;
}

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

.progress-text {
    text-align: center;
    margin-top: var(--space-sm);
    color: #b9b3c9;
    font-size: 0.875rem;
}

#correct-count {
    color: #16c08a;
    font-weight: 700;
}

/* ========================================
   6. MODALS
======================================== */

.end-game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.end-stat {
    text-align: center;
    padding: var(--space-lg);
    background: #2d2740;
    border-radius: var(--radius-lg);
    border: 2px solid #fbf2dd;
    box-shadow: 4px 4px 0 #000;
}

.end-stat-label {
    display: block;
    font-size: 0.875rem;
    color: #b9b3c9;
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.end-stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: #2b2bff;
}

.performance-chart {
    margin: var(--space-xl) 0;
    padding: var(--space-lg);
    background: #2d2740;
    border: 2px solid #fbf2dd;
    border-radius: var(--radius-lg);
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-md);
}

/* Help Modal - Styles spécifiques */
.help-content {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: calc(85vh - 250px);
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.help-item {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    padding: var(--space-md);
    background: #2d2740;
    border-radius: var(--radius-md);
    border: 2px solid #fbf2dd;
}

.help-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.help-item h3 {
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: #fbf2dd;
    margin-bottom: var(--space-xs);
}

.help-item p {
    font-size: var(--font-size-sm);
    color: #b9b3c9;
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 768px) {
    .help-content {
        max-height: calc(90vh - 180px);
        gap: var(--space-xs);
        padding-right: var(--space-xs);
    }

    .help-item {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }

    .help-icon {
        font-size: 1.25rem;
    }

    .help-item h3 {
        font-size: var(--font-size-base);
        margin-bottom: 4px;
    }

    .help-item p {
        font-size: var(--font-size-xs);
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .help-content {
        max-height: calc(95vh - 150px);
        gap: 6px;
        padding-right: 4px;
    }

    .help-item {
        padding: 8px 10px;
        gap: 8px;
        flex-direction: row;
    }

    .help-icon {
        font-size: 1.1rem;
    }

    .help-item h3 {
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    .help-item p {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* ========================================
   7. RESPONSIVE
======================================== */

@media (min-width: 480px) {
    .stat-card {
        min-width: 85px;
    }

    .answers-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 768px) {
    .stat-card {
        min-width: 100px;
    }

    .question-text {
        font-size: 2rem;
    }

    .answers-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .timer-circle {
        width: 70px;
        height: 70px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 900px;
    }

    .question-container {
        padding: var(--space-2xl);
    }
}

/* ========================================
   8. ANIMATIONS
======================================== */

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

.answer-btn {
    animation: fadeInUp 0.4s ease backwards;
}

.answer-btn:nth-child(1) { animation-delay: 0.1s; }
.answer-btn:nth-child(2) { animation-delay: 0.2s; }
.answer-btn:nth-child(3) { animation-delay: 0.3s; }
.answer-btn:nth-child(4) { animation-delay: 0.4s; }

/* ========================================
   9. ACCESSIBILITY
======================================== */

.answer-btn:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   10. DARK MODE ADJUSTMENTS
======================================== */

[data-theme="light"] .question-container {
    background: #fbf2dd;
    border-color: #000;
}
/* Garde-fou contraste : fond crème ⇒ texte sombre (sinon texte crème invisible) */
[data-theme="light"] .question-text {
    color: #1a1a1a;
}

[data-theme="light"] .stat-card,
[data-theme="light"] .answer-btn {
    background: #fbf2dd;
    border-color: #000;
    color: #1a1a1a;
}

/* Score & streak animations (moved from JS injection) */
@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes streakPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ========================================
   11. ANSWER FLASH FEEDBACK
======================================== */

.answer-correct {
    animation: correctFlash 0.5s ease;
    background: #16c08a !important;
    color: #1a1a1a !important;
}

.answer-wrong {
    animation: wrongFlash 0.5s ease;
    background: #ff5da2 !important;
    color: #1a1a1a !important;
}

@keyframes correctFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes wrongFlash {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

/* ========================================
   CATEGORY FILTERS
======================================== */

.category-filters { display:flex; gap:8px; justify-content:center; flex-wrap:wrap; margin-bottom:20px; }
.cat-btn { padding:8px 16px; border-radius:999px; border:2px solid #fbf2dd; background:#241f33; color:#b9b3c9; font-size:0.85rem; font-weight:600; cursor:pointer; transition:all 0.2s; font-family: inherit; }
.cat-btn:hover { background:#2d2740; color:#fbf2dd; }
.cat-btn.active { background:#2b2bff; color:#fff; border-color:#000; box-shadow: 3px 3px 0 #000; }

/* ========================================
   MOBILE COMPACT
======================================== */
@media (max-width: 600px) {
    .game-container { padding: 8px 0; }
    .container { padding: 0 10px; }
    .game-stats-bar { gap: 4px; }
    .stat-card { min-width: 65px; padding: 6px; }
    .stat-value { font-size: 1.2rem; }
    .stat-label { font-size: 0.7rem; }
    .question-text { font-size: 1.1rem; }
    .question-container { padding: 16px; }
    .answers-grid { gap: 8px; }
    .category-filters { gap: 4px; margin-bottom: 12px; }
    .cat-btn { padding: 6px 12px; font-size: 0.8rem; min-height: 36px; }
    .answer-btn { min-height: 44px; padding: 12px 14px; font-size: 0.9rem; }
    button, .btn { min-height: 44px; }
    .related-games { padding: 1.25rem 0.75rem; margin-top: 2rem; }
    .related-games-grid { grid-template-columns: 1fr; gap: 0.75rem; }
}

@media (max-width: 380px) {
    .container { padding: 0 8px; }
    .game-intro-title { font-size: 1.05rem; }
    .game-stats-bar { gap: 3px; }
    .stat-card { min-width: 56px; padding: 5px 4px; }
    .stat-value { font-size: 1rem; }
    .stat-label { font-size: 0.62rem; letter-spacing: 0; }
    .timer-circle { width: 48px; height: 48px; }
    .timer-value { font-size: 1.1rem; }
    .question-container { padding: 12px; }
    .question-text { font-size: 1rem; }
    .answer-btn { padding: 10px 12px; font-size: 0.85rem; }
    .answer-letter { width: 26px; height: 26px; font-size: 0.78rem; }
    .cat-btn { padding: 5px 10px; font-size: 0.72rem; }
    .floating-back { font-size: 0.72rem; padding: 6px 9px; }
}

/* ---- Panneau « Classement du jour » (fin de partie) ---- */
.trivia-lb {
  margin: 18px 0 6px;
  background: var(--bg-card, #241f33);
  border: 2px solid var(--glass-border, #fbf2dd);
  border-radius: 14px;
  box-shadow: 4px 4px 0 #000;
  padding: 14px 16px;
  text-align: left;
}
.trivia-lb-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1rem; font-weight: 800; margin: 0 0 10px;
  color: var(--text-primary, #fbf2dd);
}
.trivia-lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.trivia-lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 9px;
  background: rgba(251, 242, 221, 0.05);
  font-size: 0.9rem; color: var(--text-primary, #fbf2dd);
}
.trivia-lb-row.me { background: #2b2bff; color: #fff; font-weight: 800; box-shadow: 2px 2px 0 #000; }
.trivia-lb-row .lb-rank { flex: 0 0 32px; text-align: center; font-weight: 800; }
.trivia-lb-row .lb-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trivia-lb-row .lb-score { flex: 0 0 auto; font-weight: 800; color: var(--gold, #ffd23f); }
.trivia-lb-row.me .lb-score { color: #fff; }
.trivia-lb-sep { text-align: center; color: var(--text-tertiary, #8e889e); letter-spacing: 3px; line-height: 1; }
.trivia-lb-note { margin: 10px 0 0; font-size: 0.8rem; color: var(--text-secondary, #b9b3c9); text-align: center; }
.trivia-lb-note a { color: #5a5aff; font-weight: 700; text-decoration: underline; }
.trivia-lb-empty, .trivia-lb-loading { padding: 10px; text-align: center; color: var(--text-secondary, #b9b3c9); font-size: 0.85rem; }
