/* ============================================================
   quiz.css - "Who Is This?" Game Styles
   Builds on the design tokens defined in styles.css
   (loaded after styles.css; relies on its :root variables).
   ============================================================ */

.quiz-page { overflow-y: auto; }

/* ---- Scoreboard ---- */

.quiz-scoreboard {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 14px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.quiz-tagline {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-align: center;
}

.quiz-scoreboard-stats {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.quiz-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 110px;
    padding: 8px 18px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.quiz-stat-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
}

.quiz-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.1;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.quiz-stat-sub { font-size: 13px; font-weight: 500; color: var(--color-text-secondary); }

/* Streak heat: the chip warms up as the streak grows (set via data-heat in quiz.js) */
.quiz-stat-streak { transition: border-color 0.4s, box-shadow 0.4s, background 0.4s; }
.quiz-stat-streak[data-heat="1"] { border-color: var(--color-accent); }
.quiz-stat-streak[data-heat="2"] { border-color: var(--color-accent); background: #fff8f0; box-shadow: 0 0 0 1px var(--color-accent), var(--shadow-sm); }
.quiz-stat-streak[data-heat="3"] { border-color: var(--color-accent); background: #fff3e4; box-shadow: 0 0 12px rgba(245, 124, 0, 0.45); }
.quiz-stat-streak[data-heat="2"] .quiz-stat-value,
.quiz-stat-streak[data-heat="3"] .quiz-stat-value { color: var(--color-accent); }

.quiz-flame { font-size: 14px; }
.quiz-stat-streak[data-heat="3"] .quiz-flame { animation: quiz-flicker 0.9s ease-in-out infinite alternate; }
@keyframes quiz-flicker {
    from { transform: scale(1) rotate(-3deg); }
    to   { transform: scale(1.25) rotate(4deg); }
}

/* ---- Stage ---- */

.quiz-stage {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px 48px;
    overflow-y: auto;
    background: radial-gradient(circle at 1px 1px, var(--color-border) 0.5px, transparent 0.5px);
    background-size: 24px 24px;
}

.quiz-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 80px;
    padding: 36px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    max-width: 420px;
    text-align: center;
}

.quiz-error-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: #fdecea;
    color: #c62828;
    font-size: 22px;
    font-weight: 700;
}

.quiz-error-text { color: var(--color-text-secondary); line-height: 1.5; font-size: 13px; }

/* ---- Question Card ---- */

.quiz-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 460px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 0 28px 24px;
    overflow: hidden;
}

/* Mirrors the accent strip on org chart node cards */
.quiz-card-accent {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 6px;
    background: var(--color-primary);
}

.quiz-card-enter { animation: quiz-card-in 0.35s ease-out; }
@keyframes quiz-card-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.quiz-photo-wrap {
    margin-top: 30px;
    padding: 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    box-shadow: var(--shadow-md);
}

.quiz-photo {
    display: block;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-surface);
}

.quiz-reveal {
    margin-top: 16px;
    min-height: 52px;
    text-align: center;
}

.quiz-prompt { font-size: 18px; font-weight: 700; color: var(--color-text); }
.quiz-reveal.is-correct .quiz-prompt { color: #1b7a3d; }
.quiz-reveal.is-wrong .quiz-prompt { color: #c62828; }

.quiz-reveal-detail {
    margin-top: 4px;
    font-size: 12px;
    color: var(--color-text-secondary);
    min-height: 16px;
}

/* ---- Answer Options ---- */

.quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s, transform 0.1s, opacity 0.2s;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--color-primary);
    background: var(--color-surface);
    transform: translateY(-1px);
}

.quiz-option:focus-visible {
    outline: 2px solid var(--color-highlight);
    outline-offset: 2px;
}

.quiz-option-key {
    flex-shrink: 0;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.quiz-option-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quiz-option:disabled { cursor: default; }

.quiz-option.is-correct {
    border-color: #2e9e54;
    background: #e9f7ee;
    color: #1b7a3d;
}
.quiz-option.is-correct .quiz-option-key { background: #2e9e54; border-color: #2e9e54; color: #fff; }

.quiz-option.is-wrong {
    border-color: #d9534f;
    background: #fdecea;
    color: #c62828;
}
.quiz-option.is-wrong .quiz-option-key { background: #d9534f; border-color: #d9534f; color: #fff; }

.quiz-option.is-dimmed { opacity: 0.45; }

/* ---- Footer ---- */

.quiz-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 18px;
    min-height: 34px;
}

.quiz-hint { font-size: 11px; color: var(--color-text-secondary); }
.quiz-next { padding: 8px 22px; font-size: 13px; }

/* ---- Responsive ---- */

@media (max-width: 520px) {
    .quiz-options { grid-template-columns: 1fr; }
    .quiz-photo { width: 160px; height: 160px; }
    .quiz-card { padding: 0 18px 20px; }
    .quiz-stat { min-width: 90px; padding: 6px 12px; }
    .quiz-stat-value { font-size: 18px; }
    .quiz-footer { flex-direction: column; gap: 10px; }
}

/* Header adjustments scoped to the quiz page only */
@media (max-width: 680px) {
    .quiz-page .header { height: auto; min-height: 56px; padding: 8px 12px; flex-wrap: wrap; gap: 8px; }
    .quiz-page .header-brand { font-size: 13px; }
    .quiz-page #userDisplay { display: none; }
    .quiz-page .btn-nav, .quiz-page .btn-header { padding: 5px 10px; font-size: 11px; }
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
    .quiz-card-enter { animation: none; }
    .quiz-stat-streak[data-heat="3"] .quiz-flame { animation: none; }
    .quiz-option:hover:not(:disabled) { transform: none; }
}
