body {
    background-color: #0D0D1A;
    color: white;
    font-family: 'Exo 2', sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
}

h1, h2, h3 {
    text-transform: uppercase;
}

.screen-state {
    display: none;
    height: 100%;
    width: 100%;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    /* Use clamp for responsive padding to keep it tight on small screens but spacious on large projectors */
    padding: clamp(1rem, 4vh, 4rem) clamp(1rem, 4vw, 4rem);
    box-sizing: border-box;
}

.screen-state.active {
    display: flex;
}

.question-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
}

.question-content-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
}

.question-layout.has-media-options .question-content-grid {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.question-media {
    margin: 2rem 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.question-layout.has-media-options .question-media {
    margin: 0;
    flex: 1;
    max-width: 50%;
}

.question-media img, .question-media video {
    max-width: 100%;
    max-height: 40vh;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    object-fit: contain;
}

.question-layout.has-media-options .answers-grid,
.question-layout.has-media-options .match-display-container,
.question-layout.has-media-options .sort-list-static {
    flex: 1;
    width: auto; /* Override default 90% width */
}

/* Match / Koppelen Specifiek */
.match-display-container {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 4rem;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.match-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-divider {
    width: 2px;
    background-color: var(--primary-color, #6C3CE1);
    opacity: 0.5;
    border-radius: 2px;
}

/* Sorteren Specifiek */
.sort-list-static {
    padding-left: 0;
    margin: 0;
    list-style-type: none;
    width: 90%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}


/* Wachtkamer */
#quiz-title {
    /* Use responsive scaling typography */
    font-size: clamp(3rem, 6vw, 6rem);
    margin-bottom: 2rem;
    text-shadow: 0 0 30px rgba(108, 60, 225, 0.8);
}

.pulsating-text {
    font-size: 3rem;
    animation: pulse 2s infinite;
    color: var(--kleur-secundair);
    margin-top: 4rem;
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.teams-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    max-width: 90%;
    margin-top: 40px;
}

.team-card-display {
    background: rgba(255,255,255,0.1);
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 2rem;
    border-top: 6px solid var(--kleur-primair);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 15px;
}

.team-avatar {
    font-size: 2.5rem;
}

/* Ronde Intro */
.dramatic-title {
    font-size: 4rem;
    color: var(--kleur-secundair);
    margin-bottom: 1rem;
}

#ronde-naam {
    font-size: 8rem;
    text-shadow: 0 0 30px rgba(108, 60, 225, 0.8);
    margin: 0;
}

.category-icon {
    font-size: 8rem;
    margin: 40px 0;
}

.rules-text {
    font-size: 2.5rem;
    max-width: 70%;
    color: #ccc;
}

/* Vraag Layout */
.header-bar {
    width: 100%;
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 2.5rem;
    background: rgba(0,0,0,0.3);
    box-sizing: border-box;
    /* Remove absolute positioning to keep it in flow */
    min-height: 80px;
    gap: 20px;
}

.header-question-text {
    flex: 1;
    text-align: center;
    font-size: clamp(2rem, 3.5vw, 4.5rem);
    margin: 0;
    font-weight: 700;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    /* Avoid pushing timer out of bounds */
    max-height: 2.4em;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.timer-container {
    width: 120px;
    height: 120px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#timer-text, .timer-text, #global-timer-text {
    font-size: 2.5rem;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    z-index: 10;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
    position: absolute;
}

.timer-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 8;
}

.timer-progress, .timer-progress-media, .timer-progress-open, .timer-progress-koppelen, .timer-progress-sorteren {
    fill: none;
    stroke: var(--kleur-secundair);
    stroke-width: 8;
    stroke-dasharray: 283; /* 2 * PI * 45 */
    stroke-dashoffset: 0;
}

.content-wrapper {
    width: 100%;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Prevent internal scaling from blowing out the bounds */
    overflow: hidden;
}

.question-text {
    font-size: clamp(2rem, 4vw, 4rem);
    max-width: 95%;
    line-height: 1.2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
}

.question-text-large {
    font-size: clamp(2.5rem, 5vw, 5rem);
}

.instruction-text {
    font-size: clamp(1.5rem, 2.5vw, 2.5rem);
    color: #aaa;
    margin-top: 1rem;
    text-transform: none;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 90%;
    margin-top: 40px;
}

.answer-card {
    padding: 50px;
    font-size: 3rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    border: 4px solid transparent;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    align-items: center;
}

.answer-card.option-a { border-color: #e63946; color: white; background: rgba(230, 57, 70, 0.2); }
.answer-card.option-b { border-color: #457b9d; color: white; background: rgba(69, 123, 157, 0.2); }
.answer-card.option-c { border-color: #fca311; color: white; background: rgba(252, 163, 17, 0.2); }
.answer-card.option-d { border-color: #2a9d8f; color: white; background: rgba(42, 157, 143, 0.2); }

/* Section Titles */
.section-title {
    font-size: clamp(2rem, 5vw, 4rem);
    margin-bottom: 2rem;
}

/* Antwoord Onthulling */
.highlight-answer {
    font-size: clamp(3rem, 6vw, 6rem);
    color: #28a745;
    margin: 40px 0;
    text-shadow: 0 0 40px rgba(40, 167, 69, 0.6);
    background: rgba(40, 167, 69, 0.1);
    padding: 30px 60px;
    border-radius: 20px;
    border: 4px solid #28a745;
}

/* Scorebord */
.leaderboard-container {
    width: 100%;
    max-width: 1800px;
    flex-grow: 1; /* Neemt resterende hoogte van content-wrapper in */
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

#leaderboard-list {
    /* CSS Multiple Columns */
    column-width: clamp(300px, 25vw, 450px); /* Schaal kolombreedte mee */
    column-gap: clamp(15px, 2vw, 40px);
    max-height: 100%; /* Beperk tot container */
    padding-bottom: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.08);
    padding: clamp(10px, 1.5vh, 20px) clamp(15px, 2vw, 30px);
    margin-bottom: clamp(10px, 1.5vh, 15px);
    border-radius: 15px;
    font-size: clamp(1.2rem, 2.5vh, 2.2rem); /* Schaal tekst met schermhoogte */
    animation: slideIn 0.5s ease forwards;
    /* Voorkom dat een item over 2 kolommen splitst */
    break-inside: avoid;
    page-break-inside: avoid;
}

.leaderboard-item:nth-child(1) { background: linear-gradient(90deg, rgba(255,215,0,0.3) 0%, rgba(255,215,0,0.1) 100%); border-left: 10px solid #FFD700; transform: scale(1.02); font-weight: bold; font-size: clamp(1.4rem, 2.8vh, 2.5rem); }
.leaderboard-item:nth-child(2) { background: linear-gradient(90deg, rgba(192,192,192,0.3) 0%, rgba(192,192,192,0.1) 100%); border-left: 10px solid #C0C0C0; font-size: clamp(1.3rem, 2.6vh, 2.3rem); }
.leaderboard-item:nth-child(3) { background: linear-gradient(90deg, rgba(205,127,50,0.3) 0%, rgba(205,127,50,0.1) 100%); border-left: 10px solid #CD7F32; font-size: clamp(1.3rem, 2.6vh, 2.3rem); }

@keyframes slideIn {
    to { opacity: 1; transform: translateX(0); }
    from { opacity: 0; transform: translateX(-20px); }
}

/* Winnaar */
.winner-title {
    font-size: clamp(4rem, 8vw, 8rem);
    color: #FFD700;
    text-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
    margin-bottom: 2rem;
}

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

.trophy {
    font-size: clamp(6rem, 15vw, 15rem);
    margin-bottom: 20px;
}

#winner-name {
    font-size: clamp(3rem, 6vw, 6rem);
    margin: 0;
}

#winner-score {
    font-size: clamp(2rem, 4vw, 3rem);
    color: #aaa;
}

/* Pauze */
.pause-overlay {
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    /* Uses normal screen-state layout which is handled by .screen-state active */
}

.pause-title {
    font-size: clamp(4rem, 10vw, 10rem);
    letter-spacing: clamp(5px, 2vw, 20px);
    color: white;
    text-shadow: 0 0 30px rgba(255,255,255,0.5);
}

.countdown-display {
    font-size: clamp(4rem, 12vw, 12rem);
    font-family: monospace;
    color: var(--kleur-secundair);
    margin-top: 40px;
}

/* Custom Modules Styling (Scale up content like in standard screens) */
#state-spelregels .content-wrapper, #state-pauze .content-wrapper, #state-wachtkamer .content-wrapper, #state-custom .content-wrapper {
    font-size: clamp(1.5rem, 1.5vw, 1.5rem); /* Zorgt dat paragraph teksten beter in bounds blijven voor opschalen */
    line-height: 1.5;
    /* We force the wrapper to not expand infinitely so we can scale it */
    max-height: max-content;
    height: auto;
}

/* Because we are dynamically scaling the parent font-size in JS, we must use em units here so they scale with it */
#state-spelregels .content-wrapper h1, #state-pauze .content-wrapper h1, #state-wachtkamer .content-wrapper h1, #state-custom .content-wrapper h1 {
    font-size: 3em;
    color: var(--kleur-secundair);
    margin-bottom: clamp(1rem, 2vw, 2rem);
    text-shadow: 0 0 30px rgba(108, 60, 225, 0.8);
    line-height: 1.1;
    text-transform: uppercase;
}

#state-spelregels .content-wrapper h2, #state-pauze .content-wrapper h2, #state-wachtkamer .content-wrapper h2, #state-custom .content-wrapper h2 {
    font-size: 2em;
    color: var(--kleur-accent);
    margin-bottom: clamp(1rem, 2vw, 2rem);
    line-height: 1.2;
}

#state-spelregels .content-wrapper h3, #state-pauze .content-wrapper h3, #state-wachtkamer .content-wrapper h3, #state-custom .content-wrapper h3 {
    font-size: 1.5em;
    margin-bottom: clamp(1rem, 2vw, 2rem);
}

#state-spelregels .content-wrapper p, #state-pauze .content-wrapper p, #state-wachtkamer .content-wrapper p, #state-custom .content-wrapper p {
    margin-bottom: 1.5em;
}

#state-spelregels .content-wrapper ul, #state-pauze .content-wrapper ul, #state-wachtkamer .content-wrapper ul, #state-custom .content-wrapper ul {
    margin-bottom: 1.5em;
    padding-left: 2em;
}

#state-spelregels .content-wrapper li, #state-pauze .content-wrapper li, #state-wachtkamer .content-wrapper li, #state-custom .content-wrapper li {
    margin-bottom: 0.5em;
}

/* Letterrace */
.letterrace-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    max-width: 90%;
    margin: 0 auto;
}
.letterrace-box {
    display: flex;
    justify-content: center;
    align-items: center;
    width: clamp(3rem, 6vw, 6rem);
    height: clamp(4rem, 8vw, 8rem);
    background-color: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: bold;
    color: transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.letterrace-box.revealed {
    background-color: var(--kleur-succes, #10b981);
    border-color: #fff;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8);
}
.letterrace-space {
    width: clamp(2rem, 4vw, 4rem);
    background: transparent;
    border: none;
    box-shadow: none;
}
