:root {
    --bg-1: #070707;
    --bg-2: #131313;
    --ink: #ffffff;
    --card: rgba(12, 12, 12, 0.92);
    --card-border: rgba(214, 175, 89, 0.45);
    --accent-1: #d6af59;
    --accent-2: #f0d98a;
    --accent-3: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 8% 15%, rgba(240, 217, 138, 0.16), transparent 42%),
        radial-gradient(circle at 88% 80%, rgba(214, 175, 89, 0.20), transparent 35%),
        linear-gradient(140deg, var(--bg-1), var(--bg-2));
}

.page-wrap {
    width: min(1200px, 96vw);
    margin: 0 auto;
    padding: 28px 0 260px;
}

.question-shell {
    position: relative;
    border-radius: 24px;
    padding: 2px;
    overflow: hidden;
}

.question-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(from 0deg,
            rgba(214, 175, 89, 0.95),
            rgba(255, 255, 255, 0.82),
            rgba(214, 175, 89, 0.88),
            rgba(214, 175, 89, 0.95));
    animation: spin-cw 28s linear infinite;
    pointer-events: none;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
}

.question-shell::after {
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 22px;
    background: #080808;
    z-index: 0;
    pointer-events: none;
}

.question-box {
    position: relative;
    z-index: 1;
    border-radius: 22px;
    background: var(--card);
    padding: 24px 28px;
    text-align: center;
    border: 1px solid var(--card-border);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.question-label {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    opacity: 0.82;
    color: var(--accent-2);
}

.question-text {
    margin: 8px 0 0;
    font-size: clamp(1.35rem, 2.3vw, 2.3rem);
    line-height: 1.25;
}

.answers-grid {
    margin-top: 22px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
        "slot1 slot4"
        "slot2 slot5"
        "slot3 slot6";
}

.answer-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    background: var(--card);
    padding: 14px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 86px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.slot-1 {
    grid-area: slot1;
}

.slot-2 {
    grid-area: slot2;
}

.slot-3 {
    grid-area: slot3;
}

.slot-4 {
    grid-area: slot4;
}

.slot-5 {
    grid-area: slot5;
}

.slot-6 {
    grid-area: slot6;
}

.slot-num {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--card-border);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--accent-2);
    background: rgba(214, 175, 89, 0.08);
}

.answer-text {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.answer-text.hidden {
    filter: blur(8px);
    opacity: 0.26;
}

body.viewer .answer-card.just-opened .answer-text {
    animation: reveal-deblur 0.48s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    will-change: filter, opacity, transform;
}

.points-chip {
    position: relative;
    isolation: isolate;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    padding: 6px 10px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    color: var(--accent-2);
    background: rgba(214, 175, 89, 0.08);
}

.answer-card.revealed {
    border-color: rgba(240, 217, 138, 0.95);
    box-shadow: 0 0 0 1px rgba(240, 217, 138, 0.36) inset;
}

/* Style 1: halo pulse around points chip. */
.answer-card.revealed.value-style-1 .points-chip {
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.10),
        0 0 calc(6px + (18px * var(--value-power, 0.5))) rgba(240, 188, 86, calc(0.28 + (0.42 * var(--value-power, 0.5))));
}

.answer-card.revealed.value-style-1.just-opened .points-chip {
    animation: halo-grow-once 0.48s ease-out forwards;
}

/* Style 2: animated energy line near right edge. */
.answer-card.value-style-2::after {
    content: "";
    position: absolute;
    top: 14px;
    right: 10px;
    bottom: 14px;
    width: 4px;
    border-radius: 999px;
    opacity: 0;
    background: linear-gradient(180deg, rgba(255, 244, 205, 0.95), rgba(240, 168, 72, 0.9), rgba(255, 244, 205, 0.95));
}

.answer-card.revealed.value-style-2::after {
    opacity: calc(0.1 + (0.9 * var(--value-power, 0.5)));
    box-shadow: 0 0 calc(4px + (12px * var(--value-power, 0.5))) rgba(240, 168, 72, 0.7);
    animation: energy-line 1.6s linear infinite;
}

/* Style 3: heat fill inside points chip. */
.answer-card.value-style-3 .points-chip::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: inherit;
    z-index: -1;
    transform-origin: left center;
    transform: scaleX(0);
    opacity: 0;
    background: linear-gradient(90deg, rgba(216, 148, 52, 0.5), rgba(255, 220, 140, 0.75));
}

.answer-card.revealed.value-style-3 .points-chip::before {
    opacity: calc(0.3 + (0.45 * var(--value-power, 0.5)));
    transform: scaleX(calc(0.2 + (0.8 * var(--value-power, 0.5))));
    animation: chip-flow 2.4s ease-in-out infinite;
}

/* Style 4: opening burst + calm glow near score side. */
.answer-card.value-style-4::before {
    content: "";
    position: absolute;
    right: 66px;
    top: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transform: translateY(-50%);
    opacity: 0;
    background: rgba(255, 220, 140, 0.9);
}

.answer-card.revealed.value-style-4::before {
    opacity: calc(0.15 + (0.55 * var(--value-power, 0.5)));
    box-shadow: 0 0 calc(6px + (10px * var(--value-power, 0.5))) rgba(255, 188, 84, 0.72);
    animation: calm-spark 2.2s ease-in-out infinite;
}

.answer-card.value-style-4.just-opened::after {
    content: "";
    position: absolute;
    right: 56px;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 235, 180, 0.95);
    transform: translateY(-50%);
    animation: opening-burst 0.46s ease-out;
}

.host-wrap {
    width: min(1280px, 96vw);
}

.host-topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.token-wrap,
.controls-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

input,
button {
    border-radius: 10px;
    border: 1px solid rgba(214, 175, 89, 0.55);
    font: inherit;
    padding: 8px 10px;
    background: #0f0f0f;
    color: #ffffff;
}

button {
    cursor: pointer;
}

.host-grid .answer-card {
    grid-template-columns: auto 1fr auto auto;
}

.host-grid .answer-actions {
    display: flex;
    gap: 6px;
}

.btn-reveal {
    border-color: rgba(240, 217, 138, 0.95);
    background: rgba(214, 175, 89, 0.20);
}

.btn-hide {
    border-color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.10);
}

.status-pill {
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

@keyframes spin-cw {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes halo-grow-once {
    0% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.10),
            0 0 calc(2px + (2px * var(--value-power, 0.5))) rgba(240, 188, 86, 0.06);
    }

    100% {
        box-shadow:
            inset 0 0 0 1px rgba(255, 255, 255, 0.10),
            0 0 calc(6px + (18px * var(--value-power, 0.5))) rgba(240, 188, 86, calc(0.28 + (0.42 * var(--value-power, 0.5))));
    }
}

@keyframes energy-line {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 48px;
    }
}

@keyframes chip-flow {
    0% {
        filter: saturate(0.95);
    }

    50% {
        filter: saturate(1.2);
    }

    100% {
        filter: saturate(0.95);
    }
}

@keyframes calm-spark {
    0% {
        transform: translateY(-50%) scale(0.92);
    }

    50% {
        transform: translateY(-50%) scale(1.12);
    }

    100% {
        transform: translateY(-50%) scale(0.92);
    }
}

@keyframes opening-burst {
    0% {
        opacity: 0.96;
        transform: translateY(-50%) scale(0.6);
        box-shadow: 0 0 0 0 rgba(255, 220, 140, 0.85);
    }

    100% {
        opacity: 0;
        transform: translateY(-50%) scale(2.6);
        box-shadow: 0 0 0 18px rgba(255, 220, 140, 0);
    }
}

@keyframes reveal-deblur {
    from {
        filter: blur(8px);
        opacity: 0.26;
        transform: scale(1);
    }

    to {
        filter: blur(0);
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 860px) {
    .answers-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "slot1"
            "slot2"
            "slot3"
            "slot4"
            "slot5"
            "slot6";
    }

    .answer-card,
    .host-grid .answer-card {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        align-items: start;
    }

    .points-chip,
    .host-grid .answer-actions {
        grid-column: 2;
    }
}

/* Scoreboard: two vertical team bars anchored to the bottom of the screen. */
.scoreboard {
    margin-top: auto;
    padding-top: 26px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 44px;
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    background: rgba(8, 8, 8, 0.82);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    min-width: 92px;
}

.team-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-3);
    line-height: 1;
}

.team-bar {
    position: relative;
    width: 28px;
    height: 170px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.team-bar-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0%;
    border-radius: inherit;
    transition: height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.team-icon {
    font-size: 1.7rem;
    line-height: 1;
}

.team-name {
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--accent-2);
}

.team-boys .team-bar-fill {
    background: linear-gradient(0deg, #4f8bff, #8fc0ff);
    box-shadow: 0 0 14px rgba(79, 139, 255, 0.55);
}

.team-girls .team-bar-fill {
    background: linear-gradient(0deg, #ff5fa2, #ffa6cf);
    box-shadow: 0 0 14px rgba(255, 95, 162, 0.55);
}

/* Team pick modal (host only). */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.66);
    z-index: 50;
    backdrop-filter: blur(2px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: min(420px, 92vw);
    border-radius: 18px;
    border: 1px solid var(--card-border);
    background: #101010;
    padding: 22px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-title {
    margin: 0 0 16px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-2);
}

.modal-actions {
    display: grid;
    gap: 10px;
}

.modal-btn {
    padding: 14px;
    font-size: 1.05rem;
    font-weight: 700;
}

.modal-btn[data-team="boys"] {
    border-color: #4f8bff;
    background: rgba(79, 139, 255, 0.18);
}

.modal-btn[data-team="girls"] {
    border-color: #ff5fa2;
    background: rgba(255, 95, 162, 0.18);
}

.modal-btn-neutral {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.modal-cancel {
    margin-top: 14px;
    background: transparent;
    border-color: transparent;
    color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 860px) {
    .scoreboard {
        gap: 24px;
    }

    .team-bar {
        height: 120px;
    }
}