/* Basic reset */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

/* Shared page layout */

.page {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

/* Header */

.pageHeader {
    text-align: center;
    margin-bottom: 24px;
}

.pageHeaderInner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.siteLogo {
    width: 64px;
    height: auto;
    display: block;
}

.gameTitle {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #111827;
}

.gameSubtitle {
    margin-top: 6px;
    font-size: 14px;
    color: #4b5563;
}

/* Status area */

.statusArea {
    text-align: center;
    margin-bottom: 20px;
}

.statusMessage {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 999px;
    background: #eef2ff;
    color: #111827;
    font-size: 14px;
    border: 1px solid #e5e7eb;
}

/* Sections */

.sectionTitle {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #111827;
}

.sectionText {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 10px;
}

/* Inputs and buttons */

.textInput {
    flex: 1;
    min-width: 0;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 14px;
    background: #ffffff;
    color: #111827;
    outline: none;
}

.textInput::placeholder {
    color: #9ca3af;
}

.textInput:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
}

/* Button base */

.primaryButton,
.secondaryButton,
.dangerButton {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
    white-space: nowrap;
}

/* CanCham style red accent for main actions */

.primaryButton {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fef2f2;
    box-shadow: 0 8px 20px rgba(185, 28, 28, 0.35);
}

.primaryButton:hover:enabled {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(185, 28, 28, 0.5);
}

.primaryButton:disabled {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.secondaryButton {
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
}

.secondaryButton:hover:enabled {
    background: #f9fafb;
    transform: translateY(-1px);
}

.dangerButton {
    background: #ef4444;
    color: #fef2f2;
}

.dangerButton:hover:enabled {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Helper text */

.helperText {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.smallText {
    font-size: 11px;
}

/* Error message */

.errorMessage {
    margin-top: 6px;
    font-size: 13px;
    color: #b91c1c;
}

/* Simple containers */

.infoBox {
    background: #ffffff;
    border-radius: 16px;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    margin-bottom: 18px;
}

/* Join area */

.joinArea {
    margin-bottom: 22px;
    text-align: center;
}

.joinLabel {
    font-size: 15px;
    margin-bottom: 10px;
    color: #111827;
}

.joinRow {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    max-width: 420px;
    margin: 0 auto;
}

/* Lobby area */

.lobbyArea {
    margin-top: 10px;
}

.lobbyCount {
    font-size: 14px;
    color: #4b5563;
    margin-bottom: 8px;
}

.nameList {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.nameList li {
    background: #ffffff;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    color: #111827;
    border: 1px solid #e5e7eb;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Question area player */

.questionArea {
    margin-top: 16px;
}

.questionHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.questionNumber {
    font-size: 14px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #111827;
}

.questionText {
    font-size: 18px;
    line-height: 1.45;
    margin-bottom: 14px;
    color: #111827;
}

/* Answer buttons */

.answerList {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 14px;
}

.answerButton {
    width: 100%;
    text-align: left;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.answerButton span.answerLabel {
    font-weight: 600;
    font-size: 13px;
    display: inline-block;
    min-width: 22px;
    text-align: center;
    border-radius: 999px;
    padding: 3px 0;
    background: #e5e7eb;
    color: #111827;
}

.answerButton span.answerText {
    flex: 1;
}

.answerButton:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.answerButton.selected {
    border-color: #2563eb;
    background: #eff6ff;
}

.answerButton.disabled {
    opacity: 0.5;
    cursor: default;
}

.questionFooter {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* Waiting and eliminated */

.waitingArea,
.eliminatedArea,
.finalArea {
    margin-top: 24px;
}

.infoBox strong {
    color: #111827;
}

/* Admin layout and screen layout */

.adminMainLayout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 20px;
    align-items: flex-start;
    margin-top: 10px;
}

.adminLeftColumn {
    position: sticky;
    top: 12px;
}

.adminRightColumn {
    min-height: 260px;
}

/* Game code display */

.gameCodeDisplay {
    font-size: 24px;
    letter-spacing: 0.25em;
    font-weight: 700;
    margin: 4px 0 4px;
    color: #b91c1c;
}

/* QR area */

.qrArea {
    background: radial-gradient(circle at top, #fca5a5 0, #fee2e2 40%, #ffffff 100%);
    border-radius: 20px;
    padding: 18px 18px 22px;
    border: 1px solid #fecaca;
    box-shadow: 0 18px 40px rgba(248, 113, 113, 0.35);
}

.qrBox {
    display: flex;
    justify-content: center;
    margin: 10px 0 4px;
}

/* doubled from 180 to 360 for screen */

.qrPlaceholder {
    width: 360px;
    height: 360px;
    border-radius: 24px;
    border: 2px dashed #fecaca;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #9ca3af;
}

/* Make QR SVG fill the placeholder cleanly */

.qrPlaceholder svg,
.qrBox svg {
    width: 100%;
    height: 100%;
}

/* Admin and screen question and results containers */

.adminQuestionArea {
    background: #ffffff;
    padding: 18px 18px 16px;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    margin-top: 14px;
}

.adminResultsArea {
    background: #ffffff;
    padding: 18px 18px 16px;
    border-radius: 18px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    margin-top: 14px;
}

/* Results bar chart */

.resultsBars {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resultRow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #111827;
}

.resultLabel {
    min-width: 22px;
    text-align: center;
    padding: 3px 0;
    border-radius: 999px;
    background: #e5e7eb;
}

.resultBarTrack {
    flex: 1;
    height: 14px;
    border-radius: 999px;
    background: #e0f2fe;
    overflow: hidden;
}

.resultBarFill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    width: 0%;
    transition: width 220ms ease, background 160ms ease;
}

/* When admin presses Reveal correct answer JS adds .correct */

.resultBarFill.correct {
    background: linear-gradient(90deg, #22c55e, #16a34a);
}

.resultPercent {
    min-width: 38px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #111827;
}

/* Scoreboard */

.scoreboardArea .nameList li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.scoreName {
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.scoreValue {
    font-variant-numeric: tabular-nums;
    color: #16a34a;
}

/* Admin controls */

.adminControls {
    margin-top: 26px;
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
}

.buttonRow {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

/* Utility */

.hidden {
    display: none !important;
}

/* Responsive tweaks */

@media (max-width: 768px) {
    .adminMainLayout {
        grid-template-columns: 1fr;
    }

    .adminLeftColumn {
        position: static;
    }

    .page {
        padding: 16px 12px 28px;
    }

    .gameTitle {
        font-size: 22px;
    }

    .questionText {
        font-size: 16px;
    }
}
