/* ============================================
   Quiz Platform — Modern Stylesheet
   ============================================ */

/* ---------- Design Tokens ---------- */
:root {
    --bg-grad-start: #6a11cb;
    --bg-grad-end: #2575fc;
    --bg-glass: rgba(255, 255, 255, 0.12);
    --bg-glass-strong: rgba(255, 255, 255, 0.2);
    --border-glass: rgba(255, 255, 255, 0.25);
    --color-text: #ffffff;
    --color-text-muted: rgba(255, 255, 255, 0.7);
    --color-text-dark: #1a1a2e;
    --color-primary: #6c5ce7;
    --color-primary-dark: #5849c2;
    --color-success: #00b894;
    --color-danger: #e74c3c;
    --color-gold: #ffd700;
    --color-warning: #fdcb6e;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 999px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(108, 92, 231, 0.4);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Outfit', system-ui, -apple-system, sans-serif;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-grad-start), var(--bg-grad-end));
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Animated background ---------- */
.bg-decor {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 50% 90%, rgba(255, 215, 0, 0.05) 0%, transparent 30%);
}

.bg-decor::before,
.bg-decor::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.bg-decor::before {
    background: #e84393;
    top: -100px;
    left: -100px;
}

.bg-decor::after {
    background: #00cec9;
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(50px, -30px);
    }
}

/* ---------- Layout ---------- */
.quiz-container {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.card.glass {
    animation: cardIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* ---------- Typography ---------- */
h1 {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 0.75rem;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.gold-text {
    color: var(--color-gold);
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

/* ---------- Animations ---------- */
.fade-in {
    animation: fadeIn 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    60% {
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 0.35rem 0.9rem;
    background: var(--bg-glass-strong);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-glass);
}

.badge.gold {
    background: linear-gradient(135deg, var(--color-gold), #ffb700);
    color: var(--color-text-dark);
    font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn-primary {
    display: block;
    width: 100%;
    max-width: 320px;
    margin: 1.5rem auto 0;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-main);
    color: white;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    box-shadow: var(--shadow-glow);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 50px rgba(108, 92, 231, 0.6);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* ---------- Start Screen ---------- */
.start-screen h1 {
    margin-bottom: 1.5rem;
}

.info-box {
    background: var(--bg-glass-strong);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1rem;
    text-align: left;
}

.info-box ul {
    list-style: none;
}

.info-box li {
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
}

.info-box li:last-child {
    border-bottom: none;
}

.deadline {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 1rem;
}

/* ---------- Question ---------- */
.header-info {
    margin-bottom: 1.5rem;
}

.header-info h2 {
    text-align: center;
    margin-bottom: 1rem;
}

.stats {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success), #55efc4);
    border-radius: var(--radius-pill);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-box {
    position: relative;
}

.question-box h3 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

/* Timer */
.timer-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-danger), var(--color-warning));
    border-radius: var(--radius-pill);
}

/* Options */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 500px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
}

.option-btn {
    padding: 1.2rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-main);
    color: var(--color-text);
    background: var(--bg-glass-strong);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    backdrop-filter: blur(10px);
}

.option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.3);
    border-color: var(--color-gold);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.option-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ---------- Result Overlay ---------- */
.result-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.result-overlay.correct {
    background: radial-gradient(circle, rgba(0, 184, 148, 0.85), rgba(0, 184, 148, 0.7));
}

.result-overlay.wrong {
    background: radial-gradient(circle, rgba(231, 76, 60, 0.85), rgba(231, 76, 60, 0.7));
}

.result-overlay h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.broken-egg {
    text-align: center;
}

.result-info-box {
    margin-top: 1rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.winnings-box {
    margin-top: 1rem;
    text-align: center;
}

.winnings-amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-gold);
}

.winnings-total {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.timeout-text {
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

/* ---------- Finished Screen ---------- */
.finished-screen h1 {
    font-size: 2.5rem;
}

.finished-screen h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.result-card {
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-gold), #ff9f43);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text-dark);
    box-shadow: var(--shadow-glow);
}

.score-circle span {
    font-size: 3rem;
}

/* Prize / Leaderboard */
.prize-card,
.leaderboard-card {
    background: var(--bg-glass-strong);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.prize-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--color-gold);
    margin: 0.5rem 0;
}

.jackpot {
    font-size: 1.1rem;
    color: var(--color-warning);
    margin-top: 0.5rem;
}

.winner-banner {
    background: var(--bg-glass-strong);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.winner-banner.gold {
    border: 2px solid var(--color-gold);
}

.winner-prize {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-gold);
    margin-top: 0.5rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.6rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table tr.highlight {
    background: rgba(255, 215, 0, 0.15);
    font-weight: 700;
}

.score-cell {
    text-align: right;
}

.score-detail {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Tracker dots */
.tracker-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.tracker-container {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.tracker-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid transparent;
}

.tracker-dot.correct {
    background: var(--color-success);
}

.tracker-dot.wrong {
    background: var(--color-danger);
}

.tracker-dot.unanswered {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- Error Box ---------- */
.error-box {
    text-align: center;
    padding: 2rem;
}

.error-box h2 {
    color: var(--color-warning);
}

/* ---------- Loader ---------- */
.loader-wrap {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.loader {
    width: 40px;
    height: 40px;
    margin: 1rem auto;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--color-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---------- Toast ---------- */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.8rem 1.2rem;
    background: var(--bg-glass-strong);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    animation: slideInRight 0.3s ease;
    max-width: 320px;
}

.toast.error {
    border-left: 4px solid var(--color-danger);
}

.toast.removing {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(120%);
    }

    to {
        transform: none;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(120%);
        opacity: 0;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
    .card {
        padding: 1.5rem;
    }

    h1 {
        font-size: 1.7rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    .finished-screen h1 {
        font-size: 1.9rem;
    }

    .score-circle {
        width: 90px;
        height: 90px;
        font-size: 1.5rem;
    }

    .score-circle span {
        font-size: 2.2rem;
    }

    .prize-amount {
        font-size: 2rem;
    }

    .result-overlay h1 {
        font-size: 2.2rem;
    }
}