:root {
    --primary-bg: #1a1a2e;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --accent-color: #FF5F5F;
    /* Default accent */
    --accent-hover: #FF3F3F;
    --gold-color: #FFD700;
    --success-color: #4cd137;
    --error-color: #e84118;
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("../../data/gameshow_bg.jpg") no-repeat center center/cover;
    opacity: 0.4;
    z-index: -1;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h4 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #e0e0e0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.social-icons {
    display: flex;
    gap: 0.5rem;
}

.social-link,
.stats-btn,
.mute-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.social-link:hover,
.stats-btn:hover,
.mute-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Main Container - Tactile Glass */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 930px;
    /* Removed relative positioning as it's now handled by game-main-row */
}

/* New Wrapper for Container + Ladder */
.game-main-row {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

#game-container {
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(20px);
    border: 0px solid var(--glass-border);
    /* Thicker border */
    border-radius: 24px;
    padding: 2rem;
    /* Ambient Glow - Dynamic via JS */
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: box-shadow 0.5s ease, border-color 0.5s ease, background 0.5s ease;
    background-clip: padding-box;

}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Ladder (Attached) */
#progress-ladder-container {
    position: absolute;
    right: -60px;
    /* Attach to outside right */
    top: 0;
    bottom: 0;
    /* Stretch to full height */
    z-index: 10;
    display: none;
}

/* Show ladder only when game is active */
body.game-active #progress-ladder-container {
    display: block;
}

.progress-ladder {
    display: flex;
    flex-direction: column-reverse;
    /* 1 at bottom, 15 at top */
    justify-content: space-between;
    /* Distribute evenly */
    height: 100%;
    /* Fill the container height */
    padding: 1rem 0;
    /* Add some padding so steps don't touch edges exactly */
}

.ladder-step {
    padding: 0.2rem 0;
    /* Reduced padding to fit better */
    width: 40px;
    height: 28px;
    /* Fixed height for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.ladder-step.active {
    background: white;
    color: black;
    font-weight: 800;
    transform: scale(1.1) translateX(-5px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    border-color: white;
}

.ladder-step.correct {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
    opacity: 1;
}

.ladder-step.wrong {
    background: var(--error-color);
    color: white;
    border-color: var(--error-color);
    opacity: 1;
}

.ladder-step.milestone {
    border-color: var(--gold-color);
    color: var(--gold-color);
}

.ladder-step.milestone.active {
    background: var(--gold-color);
    color: black;
}

/* Stats Pill (External) */
.stats-pill {
    margin-top: 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 0.8rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}

.stats-pill.visible {
    opacity: 1;
    pointer-events: auto;
}

.pill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pill-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    opacity: 0.6;
    letter-spacing: 1px;
}

.pill-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
}

.pill-divider {
    width: 1px;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
}

/* Question Area */
.question-area {
    text-align: center;
    margin-bottom: 2rem;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#question-text {
    font-size: 1.6rem;
    line-height: 1.4;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Tactile Buttons */
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    margin-bottom: 2rem;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: 4px solid rgba(0, 0, 0, 0.3);
    /* 3D Depth */
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.1s ease;
    /* Snappy transition */
    font-family: var(--font-main);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    border-color: var(--accent-color);
    border-bottom-color: rgba(0, 0, 0, 0.5);
}

.option-btn:active:not(:disabled) {
    transform: translateY(2px);
    /* Press down */
    border-bottom-width: 1px;
    margin-top: 3px;
    /* Compensate for border loss */
}

.option-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    border-bottom-color: #2e8b23;
    box-shadow: 0 0 20px rgba(76, 209, 55, 0.5);
}

.option-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
    border-bottom-color: #a82e12;
    animation: shake 0.5s;
}

/* Start, Mode, Theme Screens (Shared) */
.start-content,
.mode-container,
.carousel-container,
.intro-content,
.end-content {
    text-align: center;
}

.game-logo {
    max-width: 250px;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.2));
}

.start-content h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 800;
}

.sub-text {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    font-style: italic;
}

.rules-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 16px;
    margin: 1rem auto 2rem;
    max-width: 400px;
    text-align: left;
}

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

.rules-box li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.rules-box li::before {
    content: '🎬';
    position: absolute;
    left: 0;
}

/* Mode Cards */
.mode-container {
    display: flex;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-bottom: 4px solid rgba(0, 0, 0, 0.3);
    /* Tactile */
    border-radius: 16px;
    padding: 2rem;
    width: 250px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mode-card:hover:not(.disabled) {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.mode-card:active:not(.disabled) {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-card.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(1);
}

.coming-soon-badge {
    position: absolute;
    top: 25px;
    right: -30px;
    background: var(--gold-color);
    color: black;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 2rem;
    transform: rotate(45deg);
}

/* Buttons */
.primary-btn,
.secondary-btn,
.small-btn {
    padding: 1rem 2.5rem;
    border-radius: 12px;
    border: none;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.1s ease;
    font-family: var(--font-main);
    border-bottom: 4px solid rgba(0, 0, 0, 0.2);
    /* Tactile */
}

.small-btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
}

.primary-btn:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--glass-border);
    border-bottom: 4px solid rgba(0, 0, 0, 0.3);
}

.secondary-btn:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.pulse-btn {
    animation: pulse 2s infinite;
}

/* Theme Selection */
.carousel-container {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.carousel-track {
    flex: 1;
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 1.5rem;
    padding: 1rem 0.5rem;
    scrollbar-width: none;
}

.theme-card {
    min-width: 200px;
    height: 280px;
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease;
    overflow: hidden;
    border: 0px solid rgb(41, 161, 185);
}

.theme-card:hover {
    transform: scale(1.05);
    border-color: var(--accent-color);
    border: 5px solid var(--accent-color);
}

.theme-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    padding: 1.5rem 1rem 1rem;
    text-align: center;
}

.theme-card-logo {
    max-width: 80%;
    max-height: 60px;
    margin-bottom: 0.5rem;
    object-fit: contain;
}

.carousel-nav {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-select-bar {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.quick-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
    background: #000;
    object-fit: contain;
    padding: 2px;
}

.quick-icon:hover {
    transform: scale(1.2);
    border-color: var(--accent-color);
}

/* Intro */
.intro-logo {
    max-width: 300px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

.highlight-text {
    color: var(--gold-color);
    font-weight: 700;
    font-size: 1.2rem;
    margin: 1rem 0;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

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

#timer-bar {
    width: 100%;
    height: 100%;
    background: var(--accent-color);
    transition: width 1s linear;
    box-shadow: 0 0 10px var(--accent-color);
}

/* Power Ups */
.power-ups-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.power-up-btn {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--gold-color);
    color: var(--gold-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    border-bottom: 3px solid rgba(255, 215, 0, 0.3);
}

.power-up-btn:hover:not(:disabled) {
    background: var(--gold-color);
    color: black;
}

.power-up-btn:active:not(:disabled) {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

.power-up-btn:disabled {
    opacity: 0.3;
    cursor: default;
    border-color: #666;
    color: #666;
}

/* Game Over */
.end-content h2 {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: var(--gold-color);
}

.stats-grid-end {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--glass-border);
}

.rank-badge {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: black;
    padding: 0.5rem 2rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 1.2rem;
    display: inline-block;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.share-btn {
    background: #1DA1F2;
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s;
    border-bottom: 4px solid rgba(0, 0, 0, 0.2);
}

.share-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.share-btn:active {
    transform: translateY(2px);
    border-bottom-width: 1px;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.8rem;
}

.version {
    opacity: 0.5;
    margin-top: 0.2rem;
}

/* Responsive */
@media (max-width: 1000px) {
    #progress-ladder-container {
        position: static;
        transform: none;
        margin-bottom: 1rem;
        display: none !important;
        /* Hide on mobile/tablet for simplicity, or make horizontal */
    }

    .stats-pill {
        width: 100%;
        justify-content: space-around;
        gap: 0;
        padding: 0.8rem 1rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    #game-container {
        padding: 1rem;
    }
}