/**
 * Pocket-Sommelier — Quiz Styles
 * Full Dark/Light Mode Support via CSS Custom Properties from themes.css
 */

/* ==================== Quiz Menu ==================== */
.quiz-menu {
    padding: 1.25rem 1rem;
}

.quiz-champion-banner {
    background: linear-gradient(135deg, #722F37 0%, #8c2942 40%, #4B0D18 100%);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}

.quiz-champion-trophy {
    font-size: 2rem;
    flex-shrink: 0;
}

.quiz-champion-info {
    flex: 1;
    min-width: 0;
}

.quiz-champion-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 2px;
}

.quiz-champion-name {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quiz-champion-meta {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2px;
}

.quiz-champion-streak {
    background: var(--gold);
    color: white;
    font-size: 1.25rem;
    font-weight: 800;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==================== Level Cards ==================== */
.quiz-levels {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.quiz-level-card {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 1rem;
    padding: 0;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-level-card:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 20px rgba(197, 160, 89, 0.12);
    transform: translateY(-1px);
}

.quiz-level-card:active {
    transform: scale(0.99);
}

.quiz-level-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    flex-shrink: 0;
}

.quiz-level-body {
    flex: 1;
    padding: 0.75rem 1rem;
}

.quiz-level-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Playfair Display', Georgia, serif;
}

.quiz-level-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.quiz-level-arrow {
    color: var(--text-tertiary);
    margin-right: 1rem;
    flex-shrink: 0;
}

/* ==================== Ranking Button ==================== */
.quiz-ranking-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--gold);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gold);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.quiz-ranking-btn:hover {
    background: rgba(197, 160, 89, 0.08);
    box-shadow: 0 4px 15px rgba(197, 160, 89, 0.2);
}

/* ==================== Play Screen ==================== */
.quiz-play {
    padding: 1rem;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
}

.quiz-play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.quiz-back-btn {
    background: none;
    border: none;
    color: var(--gold);
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.quiz-streak-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.quiz-streak-fire {
    font-size: 1.3rem;
}

/* ==================== Question Card ==================== */
.quiz-question-card {
    background: var(--bg-secondary);
    border-radius: 1.25rem;
    padding: 1.5rem 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
    animation: quizCardIn 0.35s ease;
}

@keyframes quizCardIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

.quiz-question-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 1.5rem;
    font-family: 'Playfair Display', Georgia, serif;
}

/* ==================== Answer Buttons ==================== */
.quiz-answers {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.quiz-answer-btn {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    line-height: 1.4;
}

.quiz-answer-btn:hover:not(.disabled) {
    border-color: var(--gold);
    background: rgba(197, 160, 89, 0.06);
}

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

.quiz-answer-btn.disabled {
    pointer-events: none;
}

.quiz-answer-btn.correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.quiz-answer-btn.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.quiz-answer-btn.reveal-correct {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
}

/* ==================== Feedback Area ==================== */
.quiz-feedback {
    margin-top: auto;
    padding-top: 1rem;
}

.quiz-feedback-badge {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.quiz-feedback-badge.correct {
    color: #22c55e;
}

.quiz-feedback-badge.wrong {
    color: #ef4444;
}

.quiz-explanation {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--gold);
    border-radius: 0 0.5rem 0.5rem 0;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.quiz-explanation-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 4px;
}

.quiz-next-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--gold) 0%, #92702D 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quiz-next-btn:hover {
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}

/* ==================== Game Over Screen ==================== */
.quiz-gameover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    min-height: 65vh;
}

.quiz-gameover-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.quiz-gameover-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.quiz-gameover-streak {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.quiz-gameover-best {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.quiz-gameover-btns {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
}

/* ==================== New Record / Nickname Screen ==================== */
.quiz-newrecord {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    min-height: 65vh;
}

.quiz-newrecord-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.5rem;
}

.quiz-newrecord-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 320px;
}

.quiz-nickname-input {
    width: 100%;
    max-width: 280px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    text-align: center;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.quiz-nickname-input:focus {
    outline: none;
    border-color: var(--gold);
}

.quiz-nickname-input::placeholder {
    color: var(--text-tertiary);
}

.quiz-nickname-hint {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 1.25rem;
    max-width: 300px;
}

.quiz-nickname-btns {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 280px;
}

/* ==================== Ranking Sub-Screen ==================== */
.quiz-ranking-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    padding: 3px;
    margin-bottom: 1rem;
}

.quiz-ranking-tab {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    color: var(--text-secondary);
    border: none;
}

.quiz-ranking-tab.active {
    background: var(--bg-secondary);
    color: var(--gold);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.quiz-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.quiz-ranking-row {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.5rem;
    border-bottom: 1px solid var(--border-color-light);
    gap: 0.25rem;
}

.quiz-ranking-row:last-child {
    border-bottom: none;
}

.quiz-ranking-header-row {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.quiz-ranking-pos {
    width: 28px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* nth-child(2) = first data row because header is nth-child(1) */
.quiz-ranking-row:nth-child(2) .quiz-ranking-pos { color: #FFD700; }
.quiz-ranking-row:nth-child(3) .quiz-ranking-pos { color: #C0C0C0; }
.quiz-ranking-row:nth-child(4) .quiz-ranking-pos { color: #CD7F32; }

.quiz-ranking-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quiz-ranking-region {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
}

.quiz-ranking-date {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    margin: 0 0.25rem;
}

.quiz-ranking-score {
    font-weight: 700;
    color: var(--gold);
    font-size: 0.85rem;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
}

.quiz-ranking-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* ==================== Confetti ==================== */
.quiz-confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 200;
}
