@import url('https://fonts.googleapis.com/css2?family=Judson:wght@400;700&family=Montserrat:wght@300;400;700&display=swap');

:root {
    --bg-color: #0f0505;
    --card-bg: rgba(30, 5, 5, 0.6);
    --cinema-red: #ff000d;
    --gold: #ffcc33;
    --text-white: #ffffff;
    --text-muted: #b0b0b0;
    --accent-blue: #00e5ff;
    --glass-border: rgba(255, 204, 51, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    font-family: 'Montserrat', sans-serif;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    background-image: radial-gradient(circle at center, #4a0404 0%, #1a0202 100%);
    /* text-wrap: balance; Removed as it can cause spacing issues in some browsers */
    letter-spacing: 0.03em;
    /* Improved readability */
}

h1,
h2,
h3,
.serif {
    font-family: 'Judson', serif;
    color: var(--gold);
    letter-spacing: 0.05em;
    /* Fixes title squashing */
}

.container {
    width: 90%;
    max-width: 500px;
    text-align: center;
    padding: 2rem 0;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
    margin-bottom: 2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 204, 51, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    border-color: rgba(255, 204, 51, 0.4);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 204, 51, 0.1);
}

.question-text {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.tamil-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

.options-grid {
    display: grid;
    gap: 1rem;
}

.option-btn {
    background: transparent;
    border: 1px solid var(--gold);
    color: var(--text-white);
    padding: 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    transition: all 0.2s ease;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.option-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: scale(1.02);
}

.option-btn.selected {
    background: var(--gold);
    color: var(--bg-color);
}

.option-btn.correct {
    border-color: #4caf50;
    background: rgba(76, 175, 80, 0.2);
}

.option-btn.wrong {
    border-color: var(--cinema-red);
    background: rgba(229, 9, 20, 0.2);
}

.footer {
    position: fixed;
    bottom: max(env(safe-area-inset-bottom), 2rem);
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    z-index: 10;
}

.author-tag {
    font-size: 0.8rem;
    color: var(--gold);
    margin-top: 1rem;
    display: block;
    opacity: 0.7;
}

.sound-toggle {
    background: none;
    border: none;
    color: var(--gold);
    font-size: 1.5rem;
    cursor: pointer;
    margin-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    border-radius: 5px;
}

.tab-btn.active {
    color: var(--gold);
    background: rgba(255, 204, 51, 0.1);
}

.tab-btn:hover:not(.active) {
    color: var(--text-white);
}

.btn-secondary {
    background: none;
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 204, 51, 0.1);
}

.btn-danger {
    background: var(--cinema-red);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
}

.card.disabled {
    opacity: 0.6;
    border-style: dashed;
}

.card.disabled::before {
    content: 'DISABLED';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.7rem;
    color: var(--cinema-red);
    font-weight: bold;
    border: 1px solid var(--cinema-red);
    padding: 2px 5px;
    border-radius: 3px;
}

.btn-primary {
    background: var(--cinema-red);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(229, 9, 20, 0.6);
}

.achievement-panel {
    display: none;
    animation: fadeIn 0.5s ease;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.share-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 0.8rem;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-white);
    transition: background 0.2s;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

#level-indicator {
    position: absolute;
    top: max(env(safe-area-inset-top), 2rem);
    right: 2rem;
    color: var(--gold);
    font-weight: bold;
    border: 1px solid var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

.result-card {
    background: linear-gradient(135deg, #2d0202 0%, #1a0202 100%);
    border: 2px solid var(--gold);
    border-radius: 30px;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.result-card h2 {
    font-size: 3rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    text-shadow: 0 2px 10px rgba(212, 175, 55, 0.3);
}

.result-card p.desc {
    font-size: 1.2rem;
    max-width: 90%;
    margin-bottom: 2.5rem;
    line-height: 1.6;
    color: #e0e0e0;
}

.score-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 15px;
    padding: 1.5rem 3rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 400px;
}

.score-box h3 {
    font-size: 1.2rem;
    color: var(--gold);
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.score-box p {
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.watermark {
    font-family: 'Judson', serif;
    color: var(--gold);
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 2px;
    opacity: 0.8;
    margin-top: 1rem;
}

/* Premium Modern Share Card */
.premium-modern {
    background: linear-gradient(135deg, #2d0202 0%, #1a0202 100%);
    border: 3px solid var(--gold);
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    position: relative;
    overflow: hidden;
    color: var(--text-white);
    width: 100%;
    max-width: 450px;
    margin: 0 auto 2rem auto;
}

.premium-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(212, 175, 55, 0.1), transparent);
    pointer-events: none;
}

.premium-title {
    font-size: 2.5rem;
    color: var(--gold);
    text-transform: uppercase;
    margin-bottom: 1rem;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.premium-desc {
    font-size: 1.1rem;
    color: #dfdfdf;
    margin-bottom: 2rem;
    line-height: 1.5;
    font-style: italic;
}

.premium-score-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    min-width: 150px;
}

.premium-score-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--gold);
    letter-spacing: 1px;
    margin-bottom: 0.3rem;
}

.premium-score-val {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
}

.premium-footer {
    font-size: 0.9rem;
    color: var(--gold);
    letter-spacing: 2px;
    font-weight: bold;
    opacity: 0.8;
    margin-top: 1rem;
}

.leaderboard-list {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 1.5rem;
    width: 100%;
    max-width: 450px;
    margin: 1.5rem auto;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 204, 51, 0.1);
    font-size: 0.95rem;
    transition: background 0.2s;
    text-align: left;
}

.leaderboard-item img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    flex-shrink: 0;
}

.leaderboard-item .name {
    font-weight: bold;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item .stats {
    margin-left: auto;
    color: var(--gold);
    font-size: 0.85rem;
    white-space: nowrap;
}

.leaderboard-item:hover {
    background: rgba(255, 204, 51, 0.05);
}

.leaderboard-item:last-child {
    border-bottom: none;
}

body.is-admin .admin-only {
    display: inline-block;
}

.admin-only {
    display: none !important;
}

/* Question Feedback Animations */
@keyframes pulse-correct {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

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

.option-btn.correct {
    animation: pulse-correct 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-color: #4caf50 !important;
}

@keyframes shake-wrong {

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

    20%,
    60% {
        transform: translateX(-8px);
    }

    40%,
    80% {
        transform: translateX(8px);
    }
}

.option-btn.wrong {
    animation: shake-wrong 0.4s ease-in-out;
    border-color: var(--cinema-red) !important;
}

/* Background "Wow" Factors */
body::before,
body::after {
    content: '';
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

body::before {
    top: -100px;
    left: -100px;
    background: var(--cinema-red);
    animation: float 20s infinite alternate;
}

body::after {
    bottom: -100px;
    right: -100px;
    background: var(--gold);
    animation: float 25s infinite alternate-reverse;
}

@keyframes float {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(100px, 100px);
    }
}