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

:root {
    --bg: #0a0a1a;
    --bg-card: #14142b;
    --accent: #a855f7;
    --accent-bright: #c084fc;
    --accent-dim: #7c3aed;
    --green: #22c55e;
    --red: #ef4444;
    --gold: #facc15;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font: 'Outfit', system-ui, sans-serif;
}

html,
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

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

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

/* ─── Join Screen ──────────────────────────────────────────────── */
.join-container {
    text-align: center;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
}

.logo-small {
    font-size: 2.5rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin-bottom: 2rem;
    text-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
}

.accent {
    color: var(--accent);
}

#join-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#join-form input {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    font-size: 1.2rem;
    font-family: var(--font);
    color: var(--text);
    text-align: center;
    font-weight: 600;
    letter-spacing: 2px;
    transition: border-color 0.3s;
    outline: none;
    -webkit-appearance: none;
}

#join-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

#join-form input::placeholder {
    color: var(--text-dim);
    font-weight: 400;
    letter-spacing: 3px;
}

.btn-join {
    background: linear-gradient(135deg, var(--accent-dim), var(--accent));
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
    -webkit-appearance: none;
}

.btn-join:active {
    transform: scale(0.97);
}

.error-msg {
    color: var(--red);
    font-size: 0.9rem;
    min-height: 1.2em;
}

/* ─── Lobby ────────────────────────────────────────────────────── */
.lobby-container {
    text-align: center;
    padding: 2rem;
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-top: 1.5rem;
}

.player-greeting {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.player-greeting span {
    color: var(--accent-bright);
}

.pulse-ring {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    margin: 0 auto 1.5rem;
    animation: pulseRing 2s ease-in-out infinite;
}

@keyframes pulseRing {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.5);
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
        box-shadow: 0 0 0 20px rgba(168, 85, 247, 0);
    }
}

.waiting-text {
    color: var(--text-dim);
    font-size: 1rem;
}

/* ─── Answering ────────────────────────────────────────────────── */
.answering-container {
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.round-pill {
    display: inline-block;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.prompt-card-player {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.prompt-text-player {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.5;
}

.prompt-text-player .blank {
    color: var(--accent-bright);
    border-bottom: 2px solid var(--accent);
    padding: 0 0.2em;
    font-weight: 900;
}

#answer-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

#input-answer {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    font-family: var(--font);
    color: var(--text);
    text-align: center;
    font-weight: 600;
    outline: none;
    transition: border-color 0.3s;
    -webkit-appearance: none;
}

#input-answer:focus {
    border-color: var(--accent);
}

#input-answer::placeholder {
    color: var(--text-dim);
    font-weight: 400;
}

.btn-submit {
    background: linear-gradient(135deg, var(--accent-dim), var(--accent));
    color: white;
    border: none;
    padding: 0.9rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.3);
    -webkit-appearance: none;
}

.btn-submit:active {
    transform: scale(0.97);
}

.timer-small {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dim);
}

.timer-small.warning {
    color: var(--red);
    animation: pulse 0.5s ease infinite alternate;
}

@keyframes pulse {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.5;
    }
}

/* ─── Waiting screens ──────────────────────────────────────────── */
.center-status {
    text-align: center;
    padding: 2rem;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green), #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    animation: popIn 0.4s ease;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.3);
}

.truth-check {
    background: linear-gradient(135deg, var(--gold), #d4a017);
    box-shadow: 0 0 30px rgba(250, 204, 21, 0.3);
}

@keyframes popIn {
    from {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    to {
        transform: scale(1);
    }
}

.center-status p {
    font-size: 1.3rem;
    font-weight: 600;
}

.sub-text {
    color: var(--text-dim) !important;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    margin-top: 0.5rem;
}

/* ─── Voting ───────────────────────────────────────────────────── */
.voting-container-player {
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
}

.vote-instruction {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-bright);
    margin-bottom: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.vote-choices {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.vote-btn {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    padding: 1rem 1.2rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s ease;
    text-align: left;
    -webkit-appearance: none;
}

.vote-btn:active {
    transform: scale(0.97);
}

.vote-btn:not(:disabled):hover {
    border-color: var(--accent);
    background: rgba(168, 85, 247, 0.1);
}

.vote-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.vote-btn.selected {
    border-color: var(--accent);
    background: rgba(168, 85, 247, 0.15);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
}

/* ─── Results ──────────────────────────────────────────────────── */
.results-player-container,
.final-player-container {
    text-align: center;
    padding: 2rem;
}

.results-heading,
.final-heading {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
}

.score-display {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.your-score-label {
    color: var(--text-dim);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.your-score {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--accent-bright);
    text-shadow: 0 0 30px rgba(168, 85, 247, 0.4);
}

.wait-next {
    color: var(--text-dim);
    font-size: 1rem;
}

.score-display.final {
    box-shadow: 0 0 40px rgba(250, 204, 21, 0.15);
    border-color: rgba(250, 204, 21, 0.2);
}

.final-message {
    color: var(--text-dim);
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* ─── Disconnected ─────────────────────────────────────────────── */
.center-status.error {
    color: var(--red);
}

.disconnect-msg {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.btn-rejoin {
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    padding: 0.8rem 2rem;
    border-radius: 14px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    -webkit-appearance: none;
}

/* ─── Background ───────────────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 30%, rgba(168, 85, 247, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* ─── Rules Hints ──────────────────────────────────────────────── */
.rules-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    margin-top: 1.2rem;
    padding: 0.6rem 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    text-align: center;
}