/* Quizterious — Phase 4 Styles */
:root {
    --bg: #0a0a0f;
    --card: #12122a;
    --card2: #1a1a3a;
    --border: rgba(99, 102, 241, 0.15);
    --accent: #818cf8;
    --accent2: #a78bfa;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --text: rgba(255, 255, 255, 0.92);
    --text2: rgba(255, 255, 255, 0.6);
    --text3: rgba(255, 255, 255, 0.3);
    --radius: 12px;
    --font: 'Inter', system-ui, sans-serif;
    --display: 'Outfit', system-ui, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
}

/* ── Screens ── */
.screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.screen.hidden {
    display: none;
}

/* ── Landing ── */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 2rem;
}

.landing__title {
    font-family: var(--display);
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing__subtitle {
    color: var(--text2);
    font-size: 1.1rem;
    margin: 0.5rem 0 2.5rem;
}

.landing__actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn--primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.btn--primary:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn--secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn--secondary:hover {
    border-color: var(--accent);
}

.btn--ghost {
    background: transparent;
    color: var(--text2);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    border-color: var(--accent);
    color: var(--text);
}

.btn--danger {
    background: rgba(239, 68, 68, 0.12);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn--lg {
    padding: 0.8rem 2rem;
    font-size: 1rem;
}

.btn--sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn-back {
    background: none;
    border: none;
    color: var(--text3);
    cursor: pointer;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.btn-back:hover {
    color: var(--text2);
}

/* ── Auth Card ── */
.auth-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
    text-align: center;
}

.auth-card h2 {
    font-family: var(--display);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.auth-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 999px;
    padding: 3px;
}

.auth-tab {
    padding: 0.4rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.auth-tab.active {
    background: var(--accent);
    color: white;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
    max-width: 300px;
}

.auth-form input {
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
}

.auth-form input:focus {
    border-color: var(--accent);
}

.auth-error {
    color: var(--error);
    font-size: 0.8rem;
    min-height: 1.2em;
}

/* ── Host Dashboard ── */
.host-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.host-header h1 {
    font-family: var(--display);
    font-size: 1.3rem;
}

.host-content {
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.host-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.host-section__header h2 {
    font-family: var(--display);
    font-size: 1.3rem;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.session-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.session-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.session-card__info h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

.session-card__meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text3);
}

.session-card__code {
    font-family: monospace;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.15em;
}

.session-card__actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.session-card--expired {
    opacity: 0.5;
}

.session-card--expired .session-card__code {
    color: var(--text3);
}

/* ── Code Badge ── */
.code-badge {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.code-badge-sm {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

/* ── Duration Picker ── */
.duration-picker {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.duration-btn {
    flex: 1;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.duration-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.label {
    color: var(--text2);
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    text-align: left;
}

/* ── QM Layout ── */
.qm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.qm-header__left,
.qm-header__right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qm-header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.qm-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 1px;
    flex: 1;
    background: var(--border);
}

.qm-left,
.qm-right {
    background: var(--bg);
    padding: 1rem 1.5rem;
    overflow-y: auto;
}

.qm-section {
    margin-bottom: 1.5rem;
}

.qm-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.qm-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
}

/* ── Round & Question Items ── */
.round-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: var(--card);
    border-radius: 8px;
    margin-bottom: 0.3rem;
    cursor: pointer;
    transition: background 0.15s;
}

.round-item:hover {
    background: var(--card2);
}

.round-item.active {
    border-left: 3px solid var(--accent);
}

.round-item__name {
    font-weight: 600;
    font-size: 0.85rem;
}

.round-item__actions {
    display: flex;
    gap: 0.3rem;
}

.q-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: var(--card);
    border-radius: 8px;
    margin-bottom: 0.3rem;
    font-size: 0.82rem;
}

.q-item__text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.q-item__actions {
    display: flex;
    gap: 0.2rem;
}

.q-item.revealed {
    opacity: 0.5;
}

.q-item.active-q {
    border-left: 3px solid var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem;
    color: var(--text3);
}

.icon-btn:hover {
    color: var(--text);
}

/* ── Player Header ── */
.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.player-header__left,
.player-header__right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-name {
    font-weight: 700;
    color: var(--accent);
}

.player-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    flex: 1;
    gap: 1px;
    background: var(--border);
}

.player-main {
    background: var(--bg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.player-side {
    background: var(--bg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

.player-section h3 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ── Waiting ── */
.waiting-msg {
    text-align: center;
}

.waiting-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ── Question Display ── */
.question-display {
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.question-display__number {
    color: var(--text3);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.question-display__text {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.question-display__media {
    margin-bottom: 1.5rem;
}

.question-display__media img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius);
}

.question-display__input {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.question-display__input input {
    flex: 1;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    text-align: center;
}

.question-display__input input:focus {
    border-color: var(--accent);
}

.question-display__answer {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 700;
}

.question-display__answer.correct {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.question-display__answer.wrong {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* ── Chat ── */
.chat-messages {
    height: 200px;
    overflow-y: auto;
    background: var(--card);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.chat-msg {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.chat-msg strong {
    color: var(--accent);
}

.chat-form {
    display: flex;
    gap: 0.3rem;
}

.chat-form input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.8rem;
    outline: none;
}

/* ── Leaderboard ── */
.lb-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.lb-row:first-child {
    color: var(--warning);
    font-weight: 700;
}

.lb-row__pts {
    font-weight: 600;
    color: var(--accent);
}

/* ── Modal ── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal.hidden {
    display: none;
}

.modal__card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
}

.modal__card--wide {
    max-width: 500px;
}

.modal__card h3 {
    font-family: var(--display);
    margin-bottom: 1rem;
}

.modal__card form {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.modal__card input,
.modal__card textarea,
.modal__card select {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font);
}

.modal__card textarea {
    min-height: 80px;
    resize: vertical;
}

.modal__card input:focus,
.modal__card textarea:focus {
    border-color: var(--accent);
}

.modal__actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.form-row {
    display: flex;
    gap: 0.5rem;
}

.form-row>* {
    flex: 1;
}

.media-section {
    margin-top: 0.5rem;
}

.media-section summary {
    cursor: pointer;
    color: var(--text2);
    font-size: 0.85rem;
}

/* ── Badges ── */
.badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.badge--live {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge--expired {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* ── Utilities ── */
.text-muted {
    color: var(--text2);
    font-size: 0.85rem;
}

.text-center {
    text-align: center;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .qm-body {
        grid-template-columns: 1fr;
    }

    .player-body {
        grid-template-columns: 1fr;
    }

    .qm-header {
        padding: 0.5rem 0.8rem;
    }

    .qm-header__right {
        flex-wrap: wrap;
    }

    .session-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .session-card__actions {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .landing__title {
        font-size: 2rem;
    }

    .landing__actions {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
    }

    .qm-left,
    .qm-right {
        padding: 0.8rem;
    }
}