/* ═══════════════════════════════════════════════
   aygame — Custom Stylesheet
   Theme: Purple (#7c3aed) & Yellow (#f59e0b)
   ═══════════════════════════════════════════════ */

:root {
    --primary:       #7c3aed;
    --primary-dark:  #5b21b6;
    --primary-light: #ede9fe;
    --accent:        #f59e0b;
    --accent-dark:   #d97706;
    --bg:            #f5f3ff;
    --text:          #1e1b4b;
}

/* ── Base ──────────────────────────────────────── */
*, *::before, *::after {
    font-family: 'Kanit', sans-serif !important;
}
body {
    background-color: var(--bg);
    color: var(--text);
}

/* ── Navbar ────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.3);
}
.navbar-brand,
.navbar .nav-link { color: #fff !important; }
.navbar .nav-link:hover { opacity: 0.8; }
.btn-nav-accent {
    background: var(--accent);
    color: #fff !important;
    border-radius: 8px;
    padding: 0.3rem 0.9rem;
    font-weight: 600;
}
.btn-nav-accent:hover { background: var(--accent-dark); }

/* ── Cards ─────────────────────────────────────── */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.08);
    transition: transform 0.18s, box-shadow 0.18s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124, 58, 237, 0.14); }

/* ── Buttons ───────────────────────────────────── */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    font-weight: 600;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}
.btn-accent {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
}
.btn-accent:hover,
.btn-accent:focus {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #fff;
}
.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
}
.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* ── Forms ─────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.2);
}

/* ── Hero (homepage) ───────────────────────────── */
.hero {
    min-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── PIN display (big) ─────────────────────────── */
.pin-display {
    font-size: 3.8rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 0.6rem;
    background: var(--primary-light);
    border-radius: 16px;
    padding: 0.8rem 2rem;
    display: inline-block;
    line-height: 1.2;
}

/* ── PIN input (player) ────────────────────────── */
.pin-input {
    font-size: 2rem;
    text-align: center;
    letter-spacing: 0.5rem;
    font-weight: 700;
    border: 3px solid var(--primary);
    border-radius: 12px;
}
.pin-input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(124, 58, 237, 0.25);
}

/* ── Answer choice buttons ─────────────────────── */
.choice-btn {
    width: 100%;
    padding: 1.1rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    border-radius: 14px;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.15s;
    text-align: left;
    line-height: 1.4;
}
.choice-btn:hover:not(:disabled) { transform: scale(1.025); }
.choice-btn:disabled { cursor: not-allowed; opacity: 0.65; }
.choice-btn.choice-a { background: #ef4444; }
.choice-btn.choice-b { background: #3b82f6; }
.choice-btn.choice-c { background: #10b981; }
.choice-btn.choice-d { background: #f59e0b; }
.choice-btn.selected { outline: 4px solid #fff; box-shadow: 0 0 0 6px rgba(255,255,255,0.4); }
.choice-btn.correct  { background: #10b981 !important; }
.choice-btn.wrong    { background: #6b7280 !important; }

/* ── Timer bar ─────────────────────────────────── */
.timer-bar {
    height: 10px;
    border-radius: 5px;
    background: var(--primary-light);
    overflow: hidden;
}
.timer-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 5px;
    transition: width 1s linear;
}

/* ── Waiting room: player chips ────────────────── */
.player-chip {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    margin: 0.25rem;
    font-weight: 500;
    font-size: 0.9rem;
    animation: popIn 0.25s ease;
}
@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Leaderboard ───────────────────────────────── */
.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    background: #fff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.07);
}
.leaderboard-row.rank-1 { border-left: 5px solid #f59e0b; }
.leaderboard-row.rank-2 { border-left: 5px solid #9ca3af; }
.leaderboard-row.rank-3 { border-left: 5px solid #cd7f32; }
.rank-badge {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center; justify-content: center;
    font-weight: 700;
    margin-right: 1rem;
    flex-shrink: 0;
}

/* ── Score feedback ────────────────────────────── */
.score-correct  { color: #10b981; font-size: 1.4rem; font-weight: 700; }
.score-wrong    { color: #ef4444; font-size: 1.4rem; font-weight: 700; }
.score-timeout  { color: #f59e0b; font-size: 1.4rem; font-weight: 700; }

/* ── Section labels ────────────────────────────── */
.section-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ── Question text (host projection screen) ─────── */
.question-display {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text);
}

/* ── Utility ───────────────────────────────────── */
.min-h-100px { min-height: 100px; }

/* ── Music toggle button (fixed, bottom-right) ── */
.music-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: background 0.2s, transform 0.15s;
}
.music-toggle:hover { background: var(--primary-dark); transform: scale(1.1); }
.music-toggle.playing {
    background: var(--accent);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.5);
    animation: musicPulse 2s ease-in-out infinite;
}
.music-toggle.playing:hover { background: var(--accent-dark); animation: none; }
@keyframes musicPulse {
    0%, 100% { box-shadow: 0 4px 14px rgba(245, 158, 11, 0.50); }
    50%       { box-shadow: 0 4px 24px rgba(245, 158, 11, 0.85); }
}

/* ── Phase transitions ────────────────────────── */
.phase-fade-in {
    animation: phaseFadeIn 0.4s ease-out;
}
@keyframes phaseFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Streak badge ─────────────────────────────── */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
    padding: .3rem .8rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: .95rem;
    animation: streakGlow 1.5s ease-in-out infinite alternate;
}
@keyframes streakGlow {
    from { box-shadow: 0 0 8px rgba(245,158,11,.4); }
    to   { box-shadow: 0 0 16px rgba(239,68,68,.6); }
}

/* ── Podium ───────────────────────────────────── */
.podium-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem auto;
    max-width: 420px;
}
.podium-col {
    text-align: center;
    flex: 1;
    animation: podiumRise 0.8s ease-out forwards;
    opacity: 0;
}
.podium-col:nth-child(1) { animation-delay: 0.4s; }
.podium-col:nth-child(2) { animation-delay: 0.8s; }
.podium-col:nth-child(3) { animation-delay: 0.2s; }
@keyframes podiumRise {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.podium-avatar {
    width: 56px; height: 56px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.2rem; color: #fff;
    margin: 0 auto .4rem;
}
.podium-name {
    font-weight: 700; font-size: .95rem; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 120px; margin: 0 auto;
}
.podium-score { font-weight: 800; font-size: 1.1rem; color: var(--primary); }
.podium-bar {
    border-radius: 12px 12px 0 0; width: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 900; color: rgba(255,255,255,.9);
    margin-top: .5rem;
}
.podium-bar-1 { background: linear-gradient(180deg, #f59e0b, #d97706); height: 140px; }
.podium-bar-2 { background: linear-gradient(180deg, #9ca3af, #6b7280); height: 100px; }
.podium-bar-3 { background: linear-gradient(180deg, #cd7f32, #a0522d); height: 75px; }

/* ── Confetti ─────────────────────────────────── */
.confetti-wrap {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; overflow: hidden; z-index: 1000;
}
.confetti {
    position: absolute; top: -10px;
    width: 10px; height: 10px; opacity: 0.9;
    animation: confettiFall linear forwards;
}
@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
