*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f4f4f5;
    --surface: #ffffff;
    --border: #e4e4e7;
    --text: #18181b;
    --muted: #71717a;
    --accent: #E0711B;
    --accent-light: rgba(224, 113, 27, 0.08);
    --accent-border: rgba(224, 113, 27, 0.3);
    --danger: #c0392b;
    --success: #22c55e;
    --top-bar-height: 52px;
}

[data-theme="dark"] {
    --bg: #111113;
    --surface: #1c1c1f;
    --border: #2e2e33;
    --text: #f1f1f3;
    --muted: #8c8c96;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ================================================
   TOP BAR
   ================================================ */

#topBar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 8px;
    z-index: 100;
}

.logo {
    grid-column: 2;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 7px;
    color: var(--text);
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.logo-scavcraft {
    font-family: 'Young Serif', serif;
    font-size: 1.2rem;
}

.logo-sub {
    font-size: 0.85rem;
    color: var(--muted);
    letter-spacing: 0.01em;
}

.btn-back {
    grid-column: 1;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.05rem;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    transition: opacity 0.15s;
    justify-self: start;
}

.btn-back:hover { opacity: 0.7; }

.btn-logout {
    grid-column: 3;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 6px 8px;
    font-size: 1rem;
    border-radius: 6px;
    transition: color 0.15s;
    justify-self: end;
}

.btn-logout:hover { color: var(--text); }

/* ================================================
   MAIN CONTENT
   ================================================ */

#mainContent {
    margin-top: var(--top-bar-height);
    min-height: calc(100vh - var(--top-bar-height));
}

/* ================================================
   PAGES
   ================================================ */

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-content {
    padding: 10px 16px 40px;
    max-width: 600px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-game-label {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: 'Young Serif', serif;
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 2px;
    text-align: left;
}

.page-game-label i {
    font-size: 0.8rem;
    flex-shrink: 0;
}

.page-title {
    font-family: 'Young Serif', serif;
    font-size: 1.35rem;
    font-weight: normal;
    color: var(--text);
}

/* ================================================
   SECTION LABELS
   ================================================ */

.section-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin: 20px 0 6px 2px;
}

/* ================================================
   GAMES LIST (on games page)
   ================================================ */

#newGameSection {
    margin-bottom: 24px;
}

#gamesListSection {
    margin-top: 4px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

/* ================================================
   SETTINGS LIST
   ================================================ */

.settings-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.settings-list + .settings-list {
    margin-top: 8px;
}

.settings-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:hover,
.settings-row:active {
    background: var(--bg);
}

.settings-row-icon {
    color: var(--accent);
    width: 22px;
    text-align: center;
    margin-right: 12px;
    font-size: 0.88rem;
    flex-shrink: 0;
}

.settings-row-label {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.settings-row-chevron {
    color: #c4c4c8;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.settings-row.accent-row {
    background: var(--accent);
    border-bottom-color: rgba(255, 255, 255, 0.2);
    justify-content: center;
    transition: opacity 0.15s;
}

.settings-row.accent-row:hover,
.settings-row.accent-row:active {
    background: var(--accent);
    opacity: 0.88;
}

.settings-row.accent-row .settings-row-label {
    color: white;
    text-align: center;
}

.settings-row.danger-row {
    background: var(--danger);
    border-bottom-color: rgba(255, 255, 255, 0.2);
    justify-content: center;
    transition: opacity 0.15s;
}

.settings-row.danger-row:hover,
.settings-row.danger-row:active {
    background: var(--danger);
    opacity: 0.88;
}

.settings-row.danger-row .settings-row-label {
    color: white;
    text-align: center;
}

.settings-row.danger-dark-row {
    background: var(--danger);
    border-bottom-color: rgba(255, 255, 255, 0.2);
    justify-content: center;
    transition: opacity 0.15s;
}

.settings-row.danger-dark-row:hover,
.settings-row.danger-dark-row:active {
    background: var(--danger);
    opacity: 0.88;
}

.settings-row.danger-dark-row .settings-row-label {
    color: white;
    text-align: center;
}

.settings-row.accent-row:disabled,
.settings-row.danger-row:disabled,
.settings-row.danger-dark-row:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================
   GAME DETAIL HEADER
   ================================================ */

.game-header {
    margin-bottom: 4px;
}

.game-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.game-detail-title {
    font-family: 'Young Serif', serif;
    font-size: 1.5rem;
    font-weight: normal;
    color: var(--text);
    line-height: 1.2;
}

#gameActiveIndicator {
    margin-bottom: 8px;
}

/* ================================================
   NO GAME MESSAGE
   ================================================ */

.no-game-msg {
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.no-game-msg i {
    font-size: 1.8rem;
    margin-bottom: 14px;
    display: block;
    color: #d4d4d8;
}

/* ================================================
   CLUES & TEAMS
   ================================================ */

.clue-item,
.team-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.clue-header,
.team-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.clue-header:hover,
.team-header:hover {
    background: var(--bg);
}

.clue-header h3,
.team-header h3 {
    font-size: 0.95rem;
    font-weight: 500;
}

.collapsible,
.collapsible-team {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.edit-field {
    margin-bottom: 12px;
}

.edit-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 5px;
}

.edit-field input,
.edit-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
}

.edit-field textarea {
    min-height: 80px;
    resize: vertical;
}

.edit-field input:focus,
.edit-field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.edit-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

label.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    color: var(--text);
    cursor: pointer;
    margin-bottom: 12px;
}

label.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: var(--text);
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.team-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-color-indicator {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
}

.color-input-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input-group input[type="color"] {
    width: 38px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    flex-shrink: 0;
}

.color-input-group input[type="text"] {
    flex: 1;
}

.clue-item img,
.clue-edit img {
    max-width: 100%;
    border-radius: 6px;
    margin: 8px 0;
}

/* ================================================
   ADD FORMS
   ================================================ */

.add-clue-form,
.add-team-form {
    background: var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.add-clue-form h3,
.add-team-form h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--accent);
}

/* ================================================
   RULES
   ================================================ */

.rules-display-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px 14px 36px;
    list-style: disc;
    margin-top: 12px;
}

.rule-item {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text);
    padding: 3px 0;
    display: list-item;
}

.rules-empty {
    padding: 2px 0 2px 0;
    margin-left: -20px;
    list-style: none;
    color: var(--muted);
    font-size: 0.88rem;
}

.rules-hint {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.rules-hint code {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.85em;
}

#rulesInput {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    background: var(--surface);
    resize: vertical;
    margin-bottom: 12px;
    color: var(--text);
    transition: border-color 0.15s;
}

#rulesInput:focus {
    outline: none;
    border-color: var(--accent);
}

/* ================================================
   INLINE FORM
   ================================================ */

.inline-form {
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.inline-form input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 10px;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.15s;
}

.inline-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 8px;
}

/* ================================================
   BUTTONS
   ================================================ */

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary:hover { opacity: 0.88; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
    background: none;
    color: var(--muted);
    border: 1px solid #a1a1aa;
    padding: 9px 18px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s;
}

.btn-ghost:hover { border-color: var(--text); }

.btn-danger {
    background: none;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 9px 18px;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    padding: 4px 6px;
    font-size: 0.82rem;
    transition: color 0.15s;
    border-radius: 4px;
}

.btn-icon:hover { color: var(--accent); }

/* ================================================
   STATUS MESSAGES
   ================================================ */

.status-message {
    font-size: 0.82rem;
    margin-top: 8px;
    display: none;
}

.status-message.success { color: var(--success); }
.status-message.error   { color: var(--danger); }
.status-message.loading { color: var(--muted); }

/* ================================================
   BADGES
   ================================================ */

.game-code-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.game-code-value {
    flex: 1;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--text);
    text-align: center;
    font-family: 'DM Sans', sans-serif;
}

.game-active-badge {
    font-size: 0.68rem;
    font-weight: 500;
    background: var(--success);
    color: white;
    padding: 2px 8px;
    border-radius: 99px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-block;
}

.final-clue-badge {
    font-size: 0.65rem;
    font-weight: 500;
    background: var(--accent);
    color: white;
    padding: 2px 7px;
    border-radius: 99px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-left: 6px;
}

/* ================================================
   MODAL
   ================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 10px;
    max-width: 420px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 16px 20px;
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.6;
}

.modal-buttons {
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--border);
}

/* ================================================
   LEFT MENU DRAWER (mobile only)
   ================================================ */

/* On mobile: show hamburger, hide back button, hide sidebar */
#menuBtn { display: block; }
#backBtn { display: none !important; }
#leftSidebar { display: none; }

.left-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.left-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.left-menu-drawer {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.left-menu-overlay.active .left-menu-drawer {
    transform: translateX(0);
}

.left-menu-game-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    height: 60px;
    overflow: hidden;
}

.left-menu-game-btn span {
    font-family: 'Young Serif', serif;
    line-height: 1.25;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

.left-menu-game-btn i {
    color: var(--muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.left-menu-no-game {
    font-size: 0.8rem;
    color: var(--muted);
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.left-menu-nav {
    display: flex;
    flex-direction: column;
}

.left-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--text);
    text-align: left;
    border-radius: 0;
    transition: background 0.1s;
}

.left-menu-item:hover {
    background: var(--bg);
}

.left-menu-item.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 500;
}

.left-menu-item i {
    width: 18px;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.left-menu-item.active i {
    color: var(--accent);
}

/* ================================================
   USER MENU DRAWER
   ================================================ */

.user-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.user-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.user-menu-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 260px;
    background: var(--surface);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.user-menu-overlay.active .user-menu-drawer {
    transform: translateX(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-menu-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.user-menu-identity {
    padding: 10px 0 4px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.user-menu-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.user-menu-email {
    font-size: 0.78rem;
    color: var(--muted);
}

.user-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.user-menu-item-label {
    font-size: 0.9rem;
    color: var(--text);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 99px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.user-menu-section {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.user-menu-section-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: default;
}

.info-tip i {
    font-size: 0.75rem;
    color: var(--muted);
    opacity: 0.6;
    transition: opacity 0.15s;
}

.info-tip:hover i { opacity: 1; }

.info-tip-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    line-height: 1.5;
    width: 220px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 200;
}

.info-tip:hover .info-tip-text { opacity: 1; }

.user-menu-url-prefix {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
    margin-bottom: 4px;
}

.user-menu-url-row {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
}

.user-menu-url-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.85rem;
    background: var(--surface);
    color: var(--text);
    min-width: 0;
}

.user-menu-url-display {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.user-menu-url-display-inner {
    flex: 1;
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    min-width: 0;
}

.url-copy-btn {
    flex-shrink: 0;
    padding: 0 10px;
    color: var(--muted);
    border-left: 1px solid var(--border);
    height: 100%;
    border-radius: 0;
}

.user-menu-url-value {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
    padding: 8px 10px;
    word-break: break-all;
}

.user-menu-url-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ================================================
   MISC
   ================================================ */

.hidden { display: none !important; }

.muted-text {
    color: var(--muted);
    font-size: 0.88rem;
    padding: 8px 0;
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: inherit;
    text-decoration: underline;
    padding: 0;
}

/* ================================================
   DESKTOP
   ================================================ */

@media (min-width: 768px) {
    /* Hide hamburger and back button — sidebar handles navigation */
    #menuBtn { display: none; }
    #backBtn { display: none !important; }

    .page-content {
        padding: 32px 24px 60px;
        max-width: 560px;
    }

    /* ================================================
       SPLIT LAYOUT
       ================================================ */

    #mainContent {
        display: flex;
        height: calc(100vh - var(--top-bar-height));
        overflow: hidden;
    }

    /* Left sidebar — always visible */
    #leftSidebar {
        display: flex;
        flex-direction: column;
        width: 200px;
        flex-shrink: 0;
        border-right: 1px solid var(--border);
        background: var(--surface);
        overflow-y: auto;
        height: 100%;
        padding: 12px 0;
    }

    /* Right panel — all pages */
    #page-games,
    #page-game-detail,
    #page-clues,
    #page-teams,
    #page-rules {
        flex: 1;
        overflow-y: auto;
        height: 100%;
    }

    /* Highlight the currently selected game in the games list */
    #page-games .settings-row.selected {
        background: var(--accent-light);
        border-left: 3px solid var(--accent);
    }

    #page-games .settings-row.selected .settings-row-label {
        color: var(--accent);
    }
}

/* ============================================================
   Live dashboard — scores tab
   ============================================================ */

.live-score-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
}

.live-score-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.live-score-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.live-score-name {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
}

.live-score-value {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 500;
}

.score-bar-track {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
}

.score-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
    min-width: 4px;
}

.live-clue-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    overflow: hidden;
}

.live-clue-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
}

.live-clue-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
}

.live-clue-teams {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

.live-clue-team-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.live-clue-unsolved {
    color: var(--muted);
    font-size: 0.85rem;
}

.live-clue-detail {
    display: none;
    padding: 8px 14px 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.live-clue-row:not(.expanded) .live-clue-detail {
    display: none;
}

.live-clue-row.expanded .live-clue-detail {
    display: flex;
}

.live-clue-team-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.82rem;
    color: var(--muted);
    background: var(--bg);
    border-radius: 99px;
    padding: 3px 10px 3px 6px;
}
