/**
 * QuizLive Frontend CSS - Tema Glassmorphism Oscuro / Wine
 * Inspirado en diseño de cata de vinos premium
 */

/* ========================================
   GOOGLE FONTS (fallback si no carga via PHP)
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Lato:wght@300;400;700&display=swap');

/* ========================================
   CSS VARIABLES
   ======================================== */
:root {
    /* Colores principales */
    --ql-bg-deep: #0f172a;
    --ql-bg-purple: #1e1b4b;
    --ql-wine-dark: rgba(114, 47, 55, 0.4);
    --ql-wine-warm: rgba(88, 28, 12, 0.4);

    /* Glass */
    --ql-glass-bg: rgba(255, 255, 255, 0.05);
    --ql-glass-border: rgba(255, 255, 255, 0.1);
    --ql-glass-blur: 16px;
    --ql-glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* Colores de texto */
    --ql-text-white: #ffffff;
    --ql-text-light: rgba(255, 255, 255, 0.9);
    --ql-text-muted: rgba(255, 255, 255, 0.6);
    --ql-text-dark: #1e293b;

    /* Acentos */
    --ql-rose-300: #fda4af;
    --ql-rose-400: #fb7185;
    --ql-rose-500: #f43f5e;
    --ql-rose-600: #e11d48;
    --ql-rose-700: #be123c;
    --ql-rose-800: #9f1239;
    --ql-amber-200: #fde68a;
    --ql-amber-300: #fcd34d;
    --ql-amber-400: #fbbf24;
    --ql-amber-600: #d97706;
    --ql-green-400: #4ade80;
    --ql-green-500: #22c55e;
    --ql-red-400: #f87171;
    --ql-red-500: #ef4444;
    --ql-yellow-500: #eab308;

    /* Respuestas - colores de borde inferior */
    --ql-answer-red: #b91c1c;
    --ql-answer-blue: #1d4ed8;
    --ql-answer-yellow: #ca8a04;
    --ql-answer-green: #15803d;

    /* Respuestas - fondos de shape icon */
    --ql-shape-red: #ef4444;
    --ql-shape-blue: #3b82f6;
    --ql-shape-yellow: #eab308;
    --ql-shape-green: #22c55e;

    /* Radios */
    --ql-radius-sm: 8px;
    --ql-radius: 12px;
    --ql-radius-lg: 16px;
    --ql-radius-xl: 20px;
    --ql-radius-2xl: 24px;
    --ql-radius-3xl: 32px;

    /* Transiciones */
    --ql-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ql-transition-slow: all 0.3s ease;
}

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

body.ql-page-bg,
.ql-page-bg {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(to bottom right, var(--ql-bg-deep), var(--ql-bg-purple)) !important;
    background-color: var(--ql-bg-deep) !important;
    background-image:
        radial-gradient(circle at 10% 20%, var(--ql-wine-dark) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, var(--ql-wine-warm) 0%, transparent 20%),
        linear-gradient(to bottom right, var(--ql-bg-deep), var(--ql-bg-purple)) !important;
    background-attachment: fixed;
    color: var(--ql-text-white) !important;
    min-height: 100vh;
    overflow-x: hidden;
}

.ql-page-bg h1,
.ql-page-bg h2,
.ql-page-bg h3,
.ql-page-bg .serif {
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

/* ========================================
   GLASSMORPHISM CARD
   ======================================== */
.glass-card,
.quizlive-card {
    background-color: #1e1e3a;
    background: var(--ql-glass-bg);
    backdrop-filter: blur(var(--ql-glass-blur));
    -webkit-backdrop-filter: blur(var(--ql-glass-blur));
    border: 1px solid var(--ql-glass-border);
    box-shadow: var(--ql-glass-shadow);
    border-radius: var(--ql-radius-2xl);
    padding: 32px;
    color: var(--ql-text-white) !important;
}

/* Solid dark fallback when inside a light WP theme */
.ql-page-bg .glass-card,
.ql-page-bg .quizlive-card {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(var(--ql-glass-blur));
    -webkit-backdrop-filter: blur(var(--ql-glass-blur));
}

.quizlive-card h1,
.quizlive-card h2,
.quizlive-card h3,
.quizlive-card h4,
.quizlive-card p,
.quizlive-card span,
.quizlive-card label,
.glass-card h1,
.glass-card h2,
.glass-card h3,
.glass-card h4,
.glass-card p,
.glass-card span,
.glass-card label,
.ql-page-bg h1,
.ql-page-bg h2,
.ql-page-bg h3,
.ql-page-bg h4,
.ql-page-bg p,
.ql-page-bg span,
.ql-page-bg label {
    color: var(--ql-text-white) !important;
    text-shadow: none;
}

.quizlive-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.875rem;
    font-weight: 700;
    margin: 0 0 16px 0;
}

.quizlive-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 12px 0;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
.quizlive-container {
    max-width: 900px;
    width: 100%;
    margin: 24px auto;
    padding: 20px;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.quizlive-page-wrapper {
    padding: 24px;
    min-height: 100vh;
}

/* ========================================
   BUTTONS
   ======================================== */
.quizlive-button {
    background: linear-gradient(to right, var(--ql-rose-600), var(--ql-rose-800));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--ql-radius-xl);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ql-transition-slow);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3);
}

.quizlive-button:hover {
    background: linear-gradient(to right, var(--ql-rose-500), var(--ql-rose-700));
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
    transform: translateY(-2px) scale(1.02);
    color: white;
    text-decoration: none;
}

.quizlive-button:active {
    transform: translateY(0) scale(0.98);
}

.quizlive-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.quizlive-button:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3);
}

/* ========================================
   INPUTS
   ======================================== */
.quizlive-input {
    width: 100%;
    padding: 14px 20px;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    border-radius: var(--ql-radius-xl);
    font-size: 1.1rem;
    margin-bottom: 16px;
    transition: var(--ql-transition);
    background-color: rgba(15, 23, 42, 0.6) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
    text-align: center;
    font-family: 'Lato', sans-serif;
}

.ql-page-bg .quizlive-input {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.quizlive-input:focus {
    outline: none;
    border-color: var(--ql-rose-500) !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
    background: rgba(255, 255, 255, 0.12) !important;
}

.quizlive-input::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1;
}

/* ========================================
   GAME SCREEN HEADER (Pregunta X/Y + Score)
   ======================================== */
.ql-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 4px;
}

.ql-question-counter {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.ql-score-display {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ql-amber-400);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ========================================
   QUESTION CARD
   ======================================== */
.quizlive-question-container {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.quizlive-question {
    position: relative;
}

.ql-question-card {
    background: var(--ql-glass-bg);
    backdrop-filter: blur(var(--ql-glass-blur));
    -webkit-backdrop-filter: blur(var(--ql-glass-blur));
    border: 1px solid var(--ql-glass-border);
    box-shadow: var(--ql-glass-shadow);
    border-radius: var(--ql-radius-xl);
    padding: 32px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ql-question-card h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 12px 0 8px 0;
    color: var(--ql-text-white);
}

/* ========================================
   TIMER - PROGRESS BAR
   ======================================== */
.ql-timer-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px 3px 0 0;
    overflow: hidden;
}

.ql-timer-fill {
    height: 100%;
    width: 100%;
    transition: width 1s linear;
    border-radius: 3px;
}

.ql-timer-fill.ql-timer-green {
    background: var(--ql-green-500);
}

.ql-timer-fill.ql-timer-yellow {
    background: var(--ql-yellow-500);
}

.ql-timer-fill.ql-timer-red {
    background: var(--ql-red-500);
}

.ql-timer-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--ql-rose-300);
    animation: ql-pulse 2s ease-in-out infinite;
}

.ql-timer-text .ql-timer-icon {
    width: 20px;
    height: 20px;
}

.ql-timer-text .ql-timer-number {
    font-family: 'Lato', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Old timer class - keep for backward compat */
.quizlive-timer {
    font-size: 3rem;
    font-weight: 700;
    text-align: center;
    margin: 24px 0;
    color: var(--ql-amber-400);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ========================================
   ANSWERS GRID
   ======================================== */
.quizlive-answers {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.quizlive-answer {
    position: relative;
    overflow: hidden;
    padding: 24px 20px;
    border-radius: var(--ql-radius-xl);
    text-align: left;
    transition: var(--ql-transition-slow);
    cursor: pointer;
    background: #ffffff;
    color: var(--ql-text-dark) !important;
    border: none;
    border-bottom: 6px solid transparent;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Lato', sans-serif;
    display: flex;
    align-items: center;
    gap: 14px;
}

.quizlive-answer:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

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

/* Answer colors by index */
.quizlive-answer.ql-answer-0 {
    border-bottom-color: var(--ql-answer-red);
}

.quizlive-answer.ql-answer-1 {
    border-bottom-color: var(--ql-answer-blue);
}

.quizlive-answer.ql-answer-2 {
    border-bottom-color: var(--ql-answer-yellow);
}

.quizlive-answer.ql-answer-3 {
    border-bottom-color: var(--ql-answer-green);
}

/* Shape icons */
.ql-shape-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.ql-shape-icon.ql-shape-red { background: var(--ql-shape-red); }
.ql-shape-icon.ql-shape-blue { background: var(--ql-shape-blue); }
.ql-shape-icon.ql-shape-yellow { background: var(--ql-shape-yellow); }
.ql-shape-icon.ql-shape-green { background: var(--ql-shape-green); }

/* Background tint on answers */
.quizlive-answer .ql-answer-tint {
    position: absolute;
    inset: 0;
    opacity: 0.07;
    pointer-events: none;
}

.ql-answer-tint.ql-tint-red { background: var(--ql-shape-red); }
.ql-answer-tint.ql-tint-blue { background: var(--ql-shape-blue); }
.ql-answer-tint.ql-tint-yellow { background: var(--ql-shape-yellow); }
.ql-answer-tint.ql-tint-green { background: var(--ql-shape-green); }

.quizlive-answer .answer-text {
    color: var(--ql-text-dark);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    position: relative;
    z-index: 1;
}

.quizlive-answer .answer-check {
    position: relative;
    z-index: 1;
}

/* Answer states */
.quizlive-answer.selected {
    border-color: var(--ql-amber-400);
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.quizlive-answer.selected .answer-text {
    color: var(--ql-text-dark) !important;
}

.quizlive-answer:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* Correct/Incorrect answer states */
.quizlive-answer.correct-answer {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0) !important;
    border-color: var(--ql-green-500) !important;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3) !important;
    opacity: 1 !important;
    animation: ql-correctPulse 0.5s ease-out;
}

.quizlive-answer.correct-answer .answer-text {
    color: #166534 !important;
}

.quizlive-answer.incorrect-answer {
    background: linear-gradient(135deg, #fef2f2, #fecaca) !important;
    border-color: var(--ql-red-500) !important;
    opacity: 0.8 !important;
}

.quizlive-answer.incorrect-answer .answer-text {
    color: #991b1b !important;
}

/* Lock answers */
.quizlive-question-container.answers-locked .quizlive-answer {
    pointer-events: none !important;
    cursor: not-allowed !important;
    opacity: 0.55 !important;
}

.quizlive-question-container.answers-locked .quizlive-answer.correct-answer {
    opacity: 1 !important;
    cursor: default !important;
}

/* ========================================
   ANSWER SCREEN / FEEDBACK OVERLAY
   ======================================== */
.quizlive-answer-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px;
    animation: ql-popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.ql-feedback-card {
    background: var(--ql-glass-bg);
    backdrop-filter: blur(var(--ql-glass-blur));
    -webkit-backdrop-filter: blur(var(--ql-glass-blur));
    border: 2px solid var(--ql-green-500);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: var(--ql-radius-3xl);
    padding: 40px;
    text-align: center;
    max-width: 600px;
    width: 100%;
    animation: ql-popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.ql-feedback-card.ql-feedback-incorrect {
    border-color: var(--ql-red-500);
}

.ql-feedback-icon {
    margin-bottom: 20px;
}

.ql-feedback-icon svg {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.ql-feedback-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.ql-feedback-title.ql-correct {
    color: var(--ql-green-400);
}

.ql-feedback-title.ql-incorrect {
    color: var(--ql-red-400);
}

.ql-feedback-answer-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--ql-radius-xl);
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.ql-feedback-answer-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    margin-bottom: 8px;
}

.ql-feedback-answer-text {
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
}

.ql-feedback-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 12px 0;
}

.ql-feedback-user-result {
    padding: 12px;
    border-radius: var(--ql-radius);
    margin-top: 12px;
}

.ql-feedback-user-result.ql-user-correct {
    background: rgba(34, 197, 94, 0.15);
    border-left: 4px solid var(--ql-green-500);
}

.ql-feedback-user-result.ql-user-incorrect {
    background: rgba(239, 68, 68, 0.15);
    border-left: 4px solid var(--ql-red-500);
}

.ql-feedback-user-result .ql-user-result-text {
    font-size: 1rem;
    font-weight: 700;
}

.ql-feedback-user-result .ql-user-answer-text {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 4px;
}

.ql-feedback-waiting {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    animation: ql-pulse 2s ease-in-out infinite;
}

/* ========================================
   CORRECT ANSWER MESSAGE (inline version)
   ======================================== */
.correct-answer-message {
    margin-top: 20px;
    padding: 20px;
    background: rgba(34, 197, 94, 0.12);
    border: 2px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--ql-radius-xl);
    color: var(--ql-green-400) !important;
    font-weight: 700;
    text-align: center;
    font-size: 1.1rem;
    animation: ql-slideInUp 0.3s ease-out;
}

/* ========================================
   RESULTS SCREEN
   ======================================== */
.quizlive-results-screen .quizlive-card {
    text-align: center;
    max-width: 550px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.ql-results-icon {
    margin-bottom: 20px;
    color: var(--ql-amber-400);
}

.ql-results-subtitle {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.7) !important;
    margin-bottom: 8px;
}

.ql-results-player-name {
    font-family: 'Playfair Display', serif;
    font-size: 2.25rem;
    font-weight: 700;
    color: white !important;
    margin-bottom: 24px;
}

.ql-results-score-box {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--ql-radius-xl);
    padding: 24px;
    margin-bottom: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ql-results-score-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.5) !important;
    margin-bottom: 4px;
}

.ql-results-score-number {
    font-size: 4rem;
    font-weight: 900;
    font-family: 'Lato', sans-serif;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(to bottom, var(--ql-amber-300), var(--ql-amber-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.ql-results-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--ql-rose-300) !important;
    margin-top: 8px;
    font-style: italic;
}

.ql-results-back-btn {
    width: 100%;
    background: white;
    color: var(--ql-rose-800) !important;
    font-weight: 700;
    padding: 16px 32px;
    border-radius: var(--ql-radius-xl);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--ql-transition-slow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ql-results-back-btn:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    color: var(--ql-rose-800);
    text-decoration: none;
}

/* ========================================
   RANKING (Final & Intermediate)
   ======================================== */
.quizlive-ranking {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 0;
    margin: 20px 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.ranking-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--ql-glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--ql-glass-border);
    border-radius: var(--ql-radius);
    padding: 14px 24px;
    font-size: 1rem;
    min-width: 320px;
    max-width: 90vw;
    width: 100%;
    color: var(--ql-text-white) !important;
    transition: var(--ql-transition);
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.ranking-item .position {
    font-size: 1.2rem;
    color: var(--ql-text-white) !important;
    min-width: 48px;
    text-align: center;
    font-weight: 700;
}

.ranking-item .player-name {
    font-weight: 500;
    color: var(--ql-text-white) !important;
    font-size: 1rem;
    min-width: 120px;
    text-align: center;
    flex: 1;
}

.ranking-item .final-score {
    color: var(--ql-amber-400) !important;
    font-size: 1.125rem;
    font-weight: 700;
}

.ranking-item .final-time {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.8em;
}

/* Top 3 highlight */
.ranking-item.position-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(251, 191, 36, 0.06));
    border-color: rgba(255, 215, 0, 0.3);
}

.ranking-item.position-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.1), rgba(160, 160, 160, 0.05));
    border-color: rgba(192, 192, 192, 0.25);
}

.ranking-item.position-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.1), rgba(184, 134, 11, 0.05));
    border-color: rgba(205, 127, 50, 0.25);
}

/* Intermediate ranking */
.quizlive-intermediate-ranking {
    max-width: 800px;
    width: 100%;
    margin: 24px auto;
    padding: 0 20px;
}

.quizlive-intermediate-ranking .quizlive-card {
    text-align: center;
}

.quizlive-ranking-list {
    margin: 24px 0;
    text-align: left;
}

.quizlive-ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ql-glass-bg);
    border: 1px solid var(--ql-glass-border);
    border-radius: var(--ql-radius);
    padding: 14px 20px;
    margin: 10px 0;
    transition: var(--ql-transition);
}

.quizlive-ranking-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.quizlive-ranking-item .ranking-position {
    color: var(--ql-text-white) !important;
    font-weight: 700;
    font-size: 1.15rem;
    min-width: 64px;
    text-align: center;
}

.quizlive-ranking-item .player-name {
    color: var(--ql-text-white) !important;
    font-weight: 500;
    font-size: 1rem;
    flex-grow: 1;
    margin: 0 24px;
    text-align: center;
}

.quizlive-ranking-item .player-score {
    color: var(--ql-amber-400) !important;
    font-weight: 700;
    font-size: 1.1rem;
    min-width: 64px;
    text-align: right;
}

.quizlive-ranking-actions {
    margin-top: 24px;
}

.quizlive-continue-btn {
    background: linear-gradient(to right, var(--ql-rose-600), var(--ql-rose-800));
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--ql-radius-xl);
    font-weight: 700;
    cursor: pointer;
    transition: var(--ql-transition-slow);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.quizlive-continue-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.4);
}

.quizlive-waiting-message {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.9375rem;
    padding: 16px;
    animation: ql-pulse 2s ease-in-out infinite;
}

/* ========================================
   PLAYER LIST
   ======================================== */
.quizlive-player-list {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--ql-radius-lg);
    padding: 20px;
    margin: 24px 0;
    border: 1px solid var(--ql-glass-border);
}

.quizlive-players-title {
    color: var(--ql-text-white) !important;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 14px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--ql-radius);
    border: 1px solid var(--ql-glass-border);
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--ql-radius-sm);
    margin: 6px 0;
    transition: var(--ql-transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--ql-text-white);
}

.player-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.player-item.player-header {
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.player-name {
    font-weight: 500;
    color: var(--ql-text-white) !important;
}

.player-score {
    font-weight: 700;
    color: var(--ql-amber-400) !important;
}

.player-time {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5) !important;
}

/* ========================================
   ADMIN PANEL (during live game)
   ======================================== */
.quizlive-admin-answers-panel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ql-glass-border);
    border-radius: var(--ql-radius);
    margin: 18px 0 8px 0;
    padding: 16px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    font-size: 0.875rem;
}

.quizlive-admin-answers-panel h3 {
    margin-top: 0;
    color: var(--ql-text-white) !important;
    font-weight: 600;
    font-size: 1rem;
}

div#admin-answers-table {
    color: var(--ql-text-white) !important;
}

div#admin-answers-table h3,
div#admin-answers-table h1,
div#admin-answers-table h2,
div#admin-answers-table h4,
div#admin-answers-table p,
div#admin-answers-table span,
div#admin-answers-table label,
div#admin-answers-table strong,
div#admin-answers-table li {
    color: var(--ql-text-white) !important;
}

.quizlive-admin-answered-panel h3,
.quizlive-admin-answered-panel p,
.quizlive-admin-answered-panel span,
.quizlive-admin-answered-panel strong,
.quizlive-admin-answered-panel li {
    color: var(--ql-text-white) !important;
}

.quizlive-admin-answers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.quizlive-admin-answers-table th,
.quizlive-admin-answers-table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    text-align: left;
    color: var(--ql-text-white);
    font-size: 0.8rem;
}

.quizlive-admin-answers-table th {
    background: rgba(255, 255, 255, 0.08);
    color: var(--ql-text-white);
    font-weight: 600;
}

.quizlive-admin-answers-table td.correct {
    color: var(--ql-green-400);
    font-weight: 600;
}

.quizlive-admin-answers-table td.incorrect {
    color: var(--ql-red-400);
    font-weight: 600;
}

.quizlive-admin-countdown {
    text-align: center;
    margin: 12px 0;
    font-weight: 700;
    color: var(--ql-amber-400);
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: var(--ql-radius);
    border: 1px solid var(--ql-glass-border);
}

.host-controls,
.host-game-controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--ql-radius);
    padding: 16px;
    margin: 16px 0;
    border: 1px solid var(--ql-glass-border);
}

/* ========================================
   BOTTLE IMAGE DISPLAY
   ======================================== */
.quizlive-bottle-fixed {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.quizlive-bottle-fixed .quizlive-bottle-image {
    max-width: 140px;
    max-height: 200px;
    border-radius: var(--ql-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 3px solid var(--ql-amber-400);
    margin-bottom: 10px;
}

.quizlive-bottle-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    margin-bottom: 16px;
}

.quizlive-bottle-row .quizlive-bottle-image {
    max-width: 60px;
    max-height: 90px;
    border-radius: var(--ql-radius-sm);
    border: 2px solid var(--ql-amber-400);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.quizlive-bottle-row .quizlive-game-title {
    color: var(--ql-amber-400) !important;
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
}

.quizlive-game-title {
    color: var(--ql-text-white);
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 12px 0;
}

.quizlive-bottle-display {
    margin: 24px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--ql-radius);
    border: 1px solid var(--ql-glass-border);
}

.quizlive-bottle-image {
    max-width: 120px;
    max-height: 160px;
    border-radius: var(--ql-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--ql-amber-400);
}

/* ========================================
   ROOMS LISTING
   ======================================== */
.quizlive-rooms-container {
    background: var(--ql-glass-bg);
    backdrop-filter: blur(var(--ql-glass-blur));
    -webkit-backdrop-filter: blur(var(--ql-glass-blur));
    border: 1px solid var(--ql-glass-border);
    box-shadow: var(--ql-glass-shadow);
    border-radius: var(--ql-radius-2xl);
    padding: 40px;
    text-align: center;
    max-width: 1200px;
    width: 100%;
    margin: 20px auto;
    position: relative;
    overflow: hidden;
}

.quizlive-rooms-title {
    font-family: 'Playfair Display', serif;
    color: var(--ql-text-white);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.quizlive-rooms-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.quizlive-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.quizlive-room-card {
    background: var(--ql-glass-bg);
    border-radius: var(--ql-radius-lg);
    padding: 20px;
    border: 1px solid var(--ql-glass-border);
    transition: var(--ql-transition-slow);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.quizlive-room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.quizlive-room-card.quizlive-room-active {
    border: 2px solid rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.06);
}

.quizlive-room-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.quizlive-status-active {
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
    animation: ql-pulse-active 2s ease-in-out infinite;
}

.quizlive-room-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.quizlive-room-info h3 {
    color: var(--ql-text-white) !important;
    font-family: 'Playfair Display', serif;
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
}

.quizlive-room-info p {
    color: rgba(255, 255, 255, 0.7) !important;
    margin: 5px 0;
    font-size: 0.9em;
}

.quizlive-room-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.quizlive-players-count {
    color: var(--ql-amber-400);
    font-weight: 600;
}

.quizlive-join-btn {
    background: linear-gradient(to right, var(--ql-rose-600), var(--ql-rose-800));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--ql-transition-slow);
    text-decoration: none;
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.quizlive-join-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.4);
    color: white;
    text-decoration: none;
}

.quizlive-refresh-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--ql-text-white);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 10px 24px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    margin: 16px 0;
    transition: var(--ql-transition-slow);
}

.quizlive-refresh-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.03);
}

.quizlive-no-rooms {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1em;
    padding: 40px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--ql-radius-lg);
    border: 1px solid var(--ql-glass-border);
}

/* ========================================
   SHORTCODE: ACTIVE GAMES GRID
   ======================================== */
.quizlive-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.quizlive-game-card {
    background: var(--ql-glass-bg);
    border-radius: var(--ql-radius-lg);
    padding: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--ql-glass-border);
    transition: var(--ql-transition-slow);
    position: relative;
}

.quizlive-game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.quizlive-game-card.quizlive-game-active {
    border: 2px solid rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.06);
}

.quizlive-game-status-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.quizlive-game-info h3 {
    margin: 0 0 10px 0;
    color: var(--ql-text-white) !important;
    font-family: 'Playfair Display', serif;
    font-size: 1.2em;
}

.quizlive-game-info p {
    margin: 0 0 10px 0;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.95em;
    line-height: 1.4;
}

.quizlive-button-small {
    padding: 8px 18px;
    font-size: 0.85rem;
}

/* ========================================
   GAME SCREEN
   ======================================== */
.quizlive-game-screen {
    background: transparent !important;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.quizlive-game-screen .quizlive-card {
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
}

/* ========================================
   WAITING SCREEN
   ======================================== */
.quizlive-waiting-screen .quizlive-card {
    text-align: center;
}

/* QR Code section */
#qr-code {
    background: white !important;
    border-radius: var(--ql-radius);
    display: inline-block;
    padding: 16px;
}

/* ========================================
   DEBUG INFO
   ======================================== */
.debug-info {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--ql-radius);
    padding: 16px;
    margin-top: 20px;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ========================================
   ANSWERED QUESTION STATE
   ======================================== */
.quizlive-question.answered {
    border: 2px solid var(--ql-amber-400) !important;
    background: rgba(251, 191, 36, 0.06) !important;
    border-radius: var(--ql-radius-xl);
    opacity: 0.85;
}

/* ========================================
   MESSAGES
   ======================================== */
.quizlive-message {
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--ql-radius);
    padding: 14px;
    margin: 14px 0;
    font-weight: 500;
    color: var(--ql-text-white);
    border: 1px solid var(--ql-glass-border);
}

/* ========================================
   RESULT (inline)
   ======================================== */
.quizlive-result {
    margin: 20px 0;
    padding: 14px;
    border-radius: var(--ql-radius);
    font-weight: 500;
    font-size: 1rem;
}

.incorrect-answer {
    background: rgba(239, 68, 68, 0.12) !important;
    color: var(--ql-red-400) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}

/* ========================================
   LOADING STATE
   ======================================== */
.loading,
.quizlive-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 20px;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top: 2px solid var(--ql-rose-400);
    border-radius: 50%;
    animation: ql-spin 0.8s linear infinite;
}

/* ========================================
   STATES / SCREENS
   ======================================== */
.quizlive-waiting-screen,
.quizlive-game-screen,
.quizlive-results-screen {
    transition: var(--ql-transition);
}

/* ========================================
   WINE ICON SVG (inline in template)
   ======================================== */
.ql-wine-icon svg {
    color: var(--ql-rose-400);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes ql-float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

@keyframes ql-popIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

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

@keyframes ql-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes ql-pulse-active {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes ql-correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

@keyframes ql-slideInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ql-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-float {
    animation: ql-float 6s ease-in-out infinite;
}

.pop-in {
    animation: ql-popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .quizlive-container {
        max-width: 95%;
        padding: 16px;
    }

    .quizlive-rooms-container {
        padding: 28px;
    }
}

@media (max-width: 768px) {
    .quizlive-container {
        padding: 12px;
        margin: 12px auto;
    }

    .quizlive-card {
        padding: 24px;
    }

    .quizlive-rooms-container {
        padding: 20px;
        margin: 10px;
        border-radius: var(--ql-radius-lg);
    }

    .quizlive-rooms-title {
        font-size: 1.85rem;
    }

    .quizlive-rooms-grid,
    .quizlive-games-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .quizlive-answers {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .quizlive-answer {
        padding: 18px 16px;
    }

    .ql-question-card h3 {
        font-size: 1.35rem;
    }

    .quizlive-button {
        padding: 12px 20px;
        font-size: 0.9rem;
        width: 100%;
        margin: 4px 0;
    }

    .ql-game-header {
        flex-direction: row;
        gap: 8px;
    }

    .ranking-item {
        min-width: auto;
        padding: 12px 16px;
        gap: 10px;
    }

    .quizlive-room-header {
        flex-direction: column;
        text-align: center;
    }

    .quizlive-room-stats {
        flex-direction: column;
        gap: 10px;
    }

    .ql-feedback-card {
        padding: 28px 20px;
    }

    .ql-feedback-title {
        font-size: 2rem;
    }

    .ql-results-score-number {
        font-size: 3rem;
    }

    .ql-results-player-name {
        font-size: 1.75rem;
    }

    .quizlive-intermediate-ranking {
        padding: 0 12px;
        margin: 16px auto;
    }

    .quizlive-ranking-item {
        flex-direction: column;
        text-align: center;
        gap: 6px;
    }

    .quizlive-ranking-item .player-name {
        margin: 0;
    }
}

@media (max-width: 480px) {
    .ql-page-bg,
    body.ql-page-bg {
        padding: 8px;
    }

    .quizlive-container {
        padding: 8px;
        margin: 8px auto;
    }

    .quizlive-card {
        padding: 18px;
    }

    .quizlive-rooms-container {
        padding: 16px;
        margin: 8px;
    }

    .quizlive-rooms-title {
        font-size: 1.5rem;
    }

    .quizlive-answer {
        padding: 14px 12px;
        gap: 10px;
    }

    .ql-shape-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        font-size: 1rem;
    }

    .ql-feedback-card {
        padding: 24px 16px;
    }

    .ql-feedback-title {
        font-size: 1.6rem;
    }

    .ql-results-score-number {
        font-size: 2.5rem;
    }
}
