/* =============================================================================
   CSS Variables & Reset
   ============================================================================= */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #475569;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

body.page-display {
    background: radial-gradient(ellipse at top, #1e0a3c 0%, #0a0f1e 60%, #0f172a 100%);
}

/* =============================================================================
   Layout
   ============================================================================= */

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* =============================================================================
   Typography
   ============================================================================= */

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.125rem;
}

.large-text {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.muted {
    color: var(--text-muted);
}

.brand-gradient {
    background: linear-gradient(135deg, #a78bfa 0%, #60a5fa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
    background: var(--bg-card);
    color: var(--text);
}

.btn:hover {
    background: var(--bg-input);
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--secondary);
}

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

.btn-warning {
    background: var(--warning);
    color: black;
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* =============================================================================
   Forms
   ============================================================================= */

textarea,
input[type="text"] {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    resize: vertical;
}

textarea:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
}

.char-count {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* =============================================================================
   Status Badges
   ============================================================================= */

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--bg-card);
}

.status-badge.connected {
    background: var(--success);
    color: white;
}

.round-pill {
    background: var(--accent);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-weight: 600;
}

/* =============================================================================
   Cards & Panels
   ============================================================================= */

.state-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
}

.hidden {
    display: none !important;
}

.scenario-card {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    text-align: left;
}

.round-indicator {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
}

.winner-card {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: black;
    padding: 20px 40px;
    border-radius: var(--radius);
    display: inline-block;
    margin: 20px 0;
}

.winner-label {
    display: block;
    font-size: 0.875rem;
    text-transform: uppercase;
    opacity: 0.8;
}

.winner-name {
    font-size: 1.5rem;
    font-weight: 700;
}


/* =============================================================================
   Spinner
   ============================================================================= */

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(167, 139, 250, 0.2);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-bottom: 16px;
}

.spinner-large {
    width: 80px;
    height: 80px;
    border-width: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =============================================================================
   Results — Scenario recap
   ============================================================================= */

.results-scenario {
    background: var(--bg-input);
    border-left: 4px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.results-scenario-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--accent-light);
    margin-bottom: 4px;
}

.results-scenario-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* =============================================================================
   Results — Table Response Cards
   ============================================================================= */

.results-submissions {
    margin-bottom: 24px;
}

.results-submissions-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.response-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.response-card {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.response-card.winner {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.08);
}

.response-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.response-table-name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.response-card.winner .response-table-name {
    color: #fbbf24;
}

.response-winner-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fbbf24;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.response-text {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text);
    font-style: italic;
}

/* =============================================================================
   Judgment Commentary Cards
   ============================================================================= */

.judgment-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

.judgment-card {
    border-left: 4px solid var(--border);
    padding: 14px 18px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--bg-input);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.reveal-card-entering {
    opacity: 0;
    transform: translateY(20px);
}

.judgment-best {
    border-left-color: var(--success);
}

.judgment-worst {
    border-left-color: var(--danger);
}

.judgment-mention {
    border-left-color: var(--primary);
}

.judgment-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.judgment-best .judgment-label {
    color: #4ade80;
}

.judgment-worst .judgment-label {
    color: #f87171;
}

.judgment-mention .judgment-label {
    color: #60a5fa;
}

.judgment-response {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
}

.judgment-response::before { content: '\201C'; }
.judgment-response::after  { content: '\201D'; }

.judgment-text {
    font-size: 1.05rem;
    line-height: 1.6;
}

.judging-subtitle {
    color: var(--text-muted);
    margin-top: 8px;
}

/* =============================================================================
   Robot Scene (judging animation)
   ============================================================================= */

.judging-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 32px;
    height: 100%;
}

.judging-title {
    margin: 0;
}

.robot-scene {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Data lanes */
.data-lane {
    position: relative;
    width: 150px;
    height: 120px;
    overflow: hidden;
}

.data-pkt {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    top: var(--row, 50%);
    transform: translateY(-50%);
    animation-duration: 1.6s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-delay: calc(var(--i) * 0.2s);
}

.input-lane .data-pkt {
    background: #60a5fa;
    box-shadow: 0 0 6px #60a5fa;
    animation-name: pkt-in;
}

.output-lane .data-pkt {
    background: #a78bfa;
    box-shadow: 0 0 6px #a78bfa;
    animation-name: pkt-out;
}

@keyframes pkt-in {
    0%   { left: -12px; opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

@keyframes pkt-out {
    0%   { left: -12px; opacity: 0; }
    8%   { opacity: 1; }
    92%  { opacity: 1; }
    100% { left: 100%; opacity: 0; }
}

/* Robot */
.robo {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.robo-antenna {
    width: 4px;
    height: 22px;
    background: var(--border);
    position: relative;
}

.robo-tip {
    width: 14px;
    height: 14px;
    background: var(--accent-light);
    border-radius: 50%;
    position: absolute;
    top: -9px;
    left: -5px;
    box-shadow: 0 0 14px var(--accent-light), 0 0 28px var(--accent);
    animation: tip-pulse 0.9s ease-in-out infinite;
}

@keyframes tip-pulse {
    0%, 100% { transform: scale(1);   box-shadow: 0 0 10px var(--accent-light); }
    50%       { transform: scale(1.4); box-shadow: 0 0 24px var(--accent-light), 0 0 40px var(--accent); }
}

.robo-head {
    width: 90px;
    height: 70px;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    box-shadow: 0 0 24px rgba(124, 58, 237, 0.5);
}

.robo-eye {
    width: 20px;
    height: 20px;
    background: #60a5fa;
    border-radius: 50%;
    box-shadow: 0 0 14px #60a5fa, 0 0 28px rgba(96, 165, 250, 0.4);
    animation: eye-blink 3s ease-in-out infinite;
}

.robo-eye:nth-child(2) {
    animation-delay: 0.08s;
}

@keyframes eye-blink {
    0%, 88%, 100% { transform: scaleY(1); }
    93%            { transform: scaleY(0.08); }
}

.robo-body {
    width: 90px;
    height: 84px;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 8px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(124, 58, 237, 0.5);
    position: relative;
}

.robo-body::before,
.robo-body::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 8px currentColor;
}

.robo-body::before {
    left: -7px;
    background: #60a5fa;
    color: #60a5fa;
}

.robo-body::after {
    right: -7px;
    background: #a78bfa;
    color: #a78bfa;
}

.robo-core {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--accent-light);
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 16px var(--accent);
}

/* Deliberation variants */
.deliberation-courtroom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.judging-quip {
    min-height: 2.4em;
    max-width: 720px;
    font-style: italic;
    font-size: 1.3rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.judging-quip-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    margin-left: 3px;
    vertical-align: text-bottom;
    background: var(--accent-light);
    animation: quip-cursor-blink 0.9s steps(1) infinite;
}

@keyframes quip-cursor-blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0; }
}

.judge-console {
    width: min(880px, 92%);
    background: rgba(8,8,20,0.85);
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: 12px;
    overflow: hidden;
    text-align: left;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 24px rgba(99,102,241,0.15);
}

.judge-console-header {
    padding: 10px 18px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #a5b4fc;
    background: rgba(99,102,241,0.12);
    border-bottom: 1px solid rgba(99,102,241,0.25);
}

.judge-console-lines {
    height: 300px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.judge-console-line {
    font-size: 1rem;
    color: #86efac;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    animation: console-line-in 0.25s ease-out;
}

.judge-console-line::before {
    content: '\25B8  ';
    color: #6366f1;
}

.judge-console-line:last-child::after {
    content: '\258A';
    margin-left: 6px;
    color: #86efac;
    animation: quip-cursor-blink 0.9s steps(1) infinite;
}

@keyframes console-line-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.page-display .judging-quip { font-size: 1.7rem; }
.page-display .judge-console-line { font-size: 1.25rem; }
.page-display .judge-console-header { font-size: 0.95rem; }

.judging-stream {
    text-align: left;
    width: 100%;
}

.judging-stream-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.judging-stream-text {
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text);
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 28px 32px;
    white-space: pre-wrap;
    min-height: 180px;
    max-height: 55vh;
    overflow-y: auto;
}

.stream-cursor {
    display: inline-block;
    width: 3px;
    height: 1.1em;
    background: var(--accent-light);
    margin-left: 1px;
    vertical-align: text-bottom;
    border-radius: 1px;
    animation: blink-cursor 0.6s ease-in-out infinite;
}

@keyframes blink-cursor {
    0%, 45% { opacity: 1; }
    55%, 100% { opacity: 0; }
}

/* =============================================================================
   Scoreboard Sidebar
   ============================================================================= */

.scoreboard-entry {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
}

.scoreboard-entry:last-child {
    border-bottom: none;
}

.scoreboard-entry.leader {
    background: rgba(251, 191, 36, 0.1);
    border-radius: var(--radius-sm);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.3);
}

.scoreboard-rank {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.scoreboard-entry.leader .scoreboard-rank {
    color: #fbbf24;
}

.scoreboard-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scoreboard-entry.leader .scoreboard-name {
    color: #fbbf24;
}

.scoreboard-pts {
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.scoreboard-entry.leader .scoreboard-pts {
    color: #fbbf24;
}

/* =============================================================================
   Table View Icon States
   ============================================================================= */

.waiting-icon,
.judging-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.success-icon {
    font-size: 3rem;
    color: var(--success);
    display: block;
    margin-bottom: 16px;
}

#state-submitted {
    border: 2px solid rgba(22, 163, 74, 0.4);
    box-shadow: 0 0 16px rgba(22, 163, 74, 0.1);
}

.submission-preview {
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 20px;
    text-align: left;
}

/* =============================================================================
   Index Page
   ============================================================================= */

.page-index .container {
    text-align: center;
    padding-top: 60px;
}

.nav-links {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 40px 0;
}

.table-links {
    margin-top: 40px;
}

.table-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

/* =============================================================================
   Table Page
   ============================================================================= */

.page-table .container {
    padding-top: 20px;
}

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

#response-form {
    margin-top: 20px;
}

#response-form .btn {
    width: 100%;
    margin-top: 16px;
}

/* =============================================================================
   Display Page
   ============================================================================= */

#display-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    height: 100%;
}

#display-main.scoreboard-visible {
    grid-template-columns: 1fr 300px;
}

#display-main .scoreboard-sidebar {
    display: none;
}

#display-main.scoreboard-visible .scoreboard-sidebar {
    display: block;
}

.display-panel {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 40px;
}

.scenario-display {
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-left: 4px solid var(--accent);
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(30, 41, 59, 0.8));
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.scenario-display h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--accent-light);
}

.scenario-display p {
    font-size: 1.3rem;
    line-height: 1.8;
}

.round-timer {
    font-size: 3.5rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: var(--accent-light);
    margin: 12px 0;
    transition: color 0.3s;
}

.round-timer.timer-urgent {
    color: var(--danger);
    animation: timer-pulse 1s infinite;
}

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.submissions-tracker {
    font-size: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    margin-top: 20px;
}

.submissions-tracker h3 {
    font-size: 1.125rem;
    margin-bottom: 12px;
}

.scoreboard-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
}

.commentary-box {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 24px;
    text-align: left;
    max-height: 60vh;
    overflow-y: auto;
}

.thinking-dots span {
    animation: blink 1.4s infinite both;
    font-size: 4rem;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.teams-grid .team-card {
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

/* =============================================================================
   Game Controls (inline on display page)
   ============================================================================= */

.game-controls-center {
    margin-top: 24px;
    text-align: center;
}

/* =============================================================================
   Team Status Grid (submission tracking during active round)
   ============================================================================= */

.team-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.team-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.team-status-card.submitted {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.15);
}

.team-status-card.pending {
    opacity: 0.7;
}

.team-status-icon {
    font-size: 1.25rem;
    font-weight: 700;
    width: 24px;
    text-align: center;
}

.team-status-card.submitted .team-status-icon {
    color: var(--success);
}

.team-status-card.pending .team-status-icon {
    color: var(--text-muted);
}

.team-status-name {
    font-weight: 600;
    font-size: 0.95rem;
}

/* =============================================================================
   Final Standings (game over screen)
   ============================================================================= */

.final-summary-table {
    color: var(--text-muted);
}

.final-summary-title {
    font-size: 1.1rem;
    font-weight: 700;
    font-style: italic;
    margin-bottom: 8px;
    color: var(--text);
}

.judgment-best .final-summary-title {
    color: #4ade80;
}

.final-standings {
    margin-top: 24px;
}

.final-standings h3 {
    margin-bottom: 16px;
}

.final-standing-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    margin-bottom: 8px;
}

.final-standing-entry.champion {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
    border: 2px solid #fbbf24;
}

.standing-rank {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-muted);
    min-width: 32px;
}

.final-standing-entry.champion .standing-rank {
    color: #fbbf24;
}

.standing-name {
    flex: 1;
    font-weight: 600;
}

.standing-points {
    font-weight: 600;
    color: var(--primary);
}

/* =============================================================================
   Display Page — Large Room / Projector Sizes
   ============================================================================= */

.page-display .scenario-display h2 {
    font-size: 2.6rem;
}

.page-display .scenario-display p {
    font-size: 1.7rem;
    line-height: 1.7;
}


.page-display .submissions-tracker h3 {
    font-size: 1.4rem;
}

.page-display .team-status-name {
    font-size: 1.15rem;
}

.page-display .team-status-icon {
    font-size: 1.5rem;
}

.page-display .team-status-card {
    padding: 16px 20px;
}

.page-display .judgment-label {
    font-size: 1rem;
    letter-spacing: 0.1em;
}

.page-display .judgment-text {
    font-size: 1.35rem;
    line-height: 1.7;
}

.page-display .judgment-response {
    font-size: 1.1rem;
}

.page-display .judgment-card {
    padding: 20px 24px;
}

.page-display .results-scenario-title {
    font-size: 1.2rem;
}

.page-display .results-scenario-desc {
    font-size: 1.1rem;
}

.page-display .scoreboard-entry {
    padding: 14px 10px;
    font-size: 1.1rem;
}

.page-display .scoreboard-name {
    font-size: 1.1rem;
}

.page-display .scoreboard-pts {
    font-size: 1rem;
}

.page-display h2 {
    font-size: 2rem;
}

.page-display #display-judging {
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-display .judging-title {
    font-size: 2.8rem;
}

/* Scale up robot scene for projector */
.page-display .data-lane {
    width: 260px;
    height: 200px;
}

.page-display .data-pkt {
    width: 16px;
    height: 16px;
}

.page-display .robo-antenna {
    width: 6px;
    height: 38px;
}

.page-display .robo-tip {
    width: 22px;
    height: 22px;
    top: -13px;
    left: -8px;
}

.page-display .robo-head {
    width: 160px;
    height: 124px;
    gap: 32px;
    border-radius: 22px;
}

.page-display .robo-eye {
    width: 34px;
    height: 34px;
}

.page-display .robo-body {
    width: 160px;
    height: 150px;
}

.page-display .robo-core {
    width: 58px;
    height: 58px;
    border-width: 5px;
}

/* =============================================================================
   Mobile Responsive
   ============================================================================= */

@media (max-width: 768px) {
    #display-main {
        grid-template-columns: 1fr;
    }

    .scoreboard-sidebar {
        order: -1;
    }

    .nav-links {
        flex-direction: column;
    }

    .team-status-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

/* =============================================================================
   Display Page — Professional Refinements
   ============================================================================= */

/* Gradient action buttons on display page */
body.page-display .btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
    border: none;
}

body.page-display .btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #4338ca, #6d28d9);
    box-shadow: 0 4px 28px rgba(124, 58, 237, 0.5);
}

body.page-display .btn-success {
    background: linear-gradient(135deg, #059669, #16a34a);
    box-shadow: 0 4px 20px rgba(22, 163, 74, 0.3);
    border: none;
}

body.page-display .btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #047857, #15803d);
    box-shadow: 0 4px 28px rgba(22, 163, 74, 0.45);
}

/* Tighter title tracking for display */
body.page-display h1.brand-gradient {
    letter-spacing: -0.02em;
}

/* Panel depth */
.display-panel {
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Round pill gradient */
.round-pill {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    letter-spacing: 0.02em;
}

/* Waiting screen — bigger, more impactful headline */
#display-waiting h2 {
    font-size: 2.8rem;
    letter-spacing: -0.02em;
}

/* Scoreboard sidebar accent */
.scoreboard-sidebar {
    border-top: 3px solid var(--accent);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.scoreboard-sidebar h3 {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Scenario display glow */
.scenario-display {
    box-shadow: 0 0 48px rgba(124, 58, 237, 0.12);
}

/* Submitted team card glow */
.team-status-card.submitted {
    box-shadow: 0 0 14px rgba(22, 163, 74, 0.25);
}

/* Game controls separator */
.game-controls-center {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding-top: 24px;
}

/* Results scenario block */
.results-scenario {
    border-left-width: 4px;
}

/* =============================================================================
   Passcode Overlay
   ============================================================================= */

.passcode-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 30, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.passcode-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 56px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 320px;
}

.passcode-input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 16px;
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 0.4em;
    outline: none;
    width: 100%;
}

.passcode-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
}

.passcode-error {
    color: var(--danger);
    font-size: 0.875rem;
    min-height: 1.2em;
}



/* =============================================================================
   Round Dropdown
   ============================================================================= */

.round-dropdown-wrapper {
    position: relative;
}

.round-pill-has-dropdown {
    cursor: pointer;
    user-select: none;
}

.round-pill-has-dropdown:hover {
    filter: brightness(1.2);
}

.round-dropdown-arrow {
    margin-left: 6px;
    font-size: 0.75em;
    opacity: 0.8;
}

.round-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    z-index: 200;
    min-width: 130px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.round-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: background 0.12s;
}

.round-dropdown-item:hover {
    background: var(--bg-input);
}

.round-dropdown-item.active {
    color: var(--accent-light);
    background: rgba(124, 58, 237, 0.1);
}

.round-dropdown-item.disabled {
    color: var(--text-muted);
    cursor: default;
    opacity: 0.5;
}

.round-dropdown-item.disabled:hover {
    background: transparent;
}

/* =============================================================================
   Special Award judgment card
   ============================================================================= */

.judgment-special {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-card) 60%);
}

.judgment-special .judgment-label {
    color: #fbbf24;
}



/* =============================================================================
   Host Interface — Variables
   ============================================================================= */

:root {
    --host-bg: #080d17;
    --host-surface: #0f1623;
    --host-card: #141d2e;
    --host-card-hover: #182235;
    --host-border: #1e2d45;
    --host-border-light: #253550;
    --indigo: #6366f1;
    --indigo-dark: #4f46e5;
    --indigo-glow: rgba(99,102,241,0.15);
    --green: #10b981;
    --amber: #f59e0b;
    --red: #ef4444;
    --host-heading: #ffffff;
    --host-text: #e2e8f0;
    --host-muted: #64748b;
    --host-muted-light: #94a3b8;
}

/* =============================================================================
   Host Layout
   ============================================================================= */

.host-layout {
    min-height: 100vh;
    background: var(--host-bg);
    color: var(--host-text);
    font-family: 'Inter', sans-serif;
}

.host-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8,13,23,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--host-border);
}

.host-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    color: var(--host-text);
    letter-spacing: -0.01em;
}

.nav-logo img { opacity: 0.9; }

.nav-logo span {
    background: linear-gradient(135deg, #e2e8f0 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-email {
    font-size: 0.82rem;
    color: var(--host-muted);
}

.nav-email-link {
    text-decoration: none;
    transition: color 0.15s;
}

.nav-email-link:hover { color: var(--host-text); }

.login-footer {
    margin-top: 22px;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.7;
}

.login-footer-link {
    color: var(--host-muted-light);
    text-decoration: none;
}

.login-footer-link:hover {
    color: var(--host-text);
    text-decoration: underline;
}

.login-footer-sep {
    color: var(--host-muted);
    margin: 0 6px;
}

.login-footer-note {
    color: var(--host-muted-light);
}

/* Six-digit sign-in code: wide tracking so digits are easy to check
   against the email while typing. */
.input-code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.4em;
    text-indent: 0.4em;
}

.input-code::placeholder {
    letter-spacing: 0.4em;
    opacity: 0.35;
    font-weight: 400;
}

.btn-ghost-sm {
    font-size: 0.82rem;
    color: var(--host-muted-light);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.btn-ghost-sm:hover {
    color: var(--host-text);
    background: var(--host-card);
}

.host-main {
    min-height: calc(100vh - 56px);
}

/* =============================================================================
   Page Container
   ============================================================================= */

.page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 24px;
}

.page-container-narrow {
    max-width: 640px;
}

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

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.page-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--host-heading);
    line-height: 1.2;
}

.page-sub {
    color: var(--host-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.back-link {
    display: inline-block;
    color: var(--host-muted);
    text-decoration: none;
    font-size: 0.82rem;
    margin-bottom: 8px;
    transition: color 0.15s;
}

.back-link:hover { color: var(--host-text); }

/* =============================================================================
   Buttons (host)
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--indigo);
    color: #fff;
}
.btn-primary:hover { background: var(--indigo-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }

.btn-secondary {
    background: var(--host-card);
    color: var(--host-text);
    border: 1px solid var(--host-border-light);
}
.btn-secondary:hover { background: var(--host-card-hover); border-color: var(--host-muted); }

.btn-ghost {
    background: transparent;
    color: var(--host-muted-light);
    border: 1px solid var(--host-border);
}
.btn-ghost:hover { color: var(--host-text); border-color: var(--host-border-light); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* =============================================================================
   Login
   ============================================================================= */

.page-login {
    min-height: 100vh;
    background: var(--host-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-bg {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--host-card);
    border: 1px solid var(--host-border);
    border-radius: 16px;
    padding: 48px 40px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.login-brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e2e8f0 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--host-text);
    margin-bottom: 6px;
}

.login-sub {
    color: var(--host-muted);
    font-size: 0.875rem;
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =============================================================================
   Form Fields
   ============================================================================= */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--host-text);
    letter-spacing: 0.02em;
}

.field input, .field textarea {
    padding: 10px 14px;
    background: var(--host-surface);
    border: 1px solid var(--host-border);
    border-radius: 8px;
    color: var(--host-text);
    font-size: 0.925rem;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

.field input:focus, .field textarea:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-glow);
}

.field textarea { resize: vertical; }

.field-hint {
    font-size: 0.75rem;
    color: var(--host-muted);
}

.field-desc {
    display: block;
    font-size: 0.78rem;
    color: var(--host-muted);
    line-height: 1.5;
    margin: 2px 0 10px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-section {
    padding: 24px;
    background: var(--host-card);
    border: 1px solid var(--host-border);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--host-heading);
}

.event-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}

/* =============================================================================
   Judge Toggle Groups
   ============================================================================= */

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-group-row {
    flex-direction: row;
    gap: 10px;
}

.toggle-option {
    position: relative;
    cursor: pointer;
}

.toggle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    background: var(--host-surface);
    border: 1px solid var(--host-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.toggle-group-row .toggle-label {
    flex: 1;
    align-items: center;
    text-align: center;
}

.toggle-option input:checked + .toggle-label {
    background: var(--indigo-glow);
    border-color: var(--indigo);
}

.toggle-option:hover .toggle-label {
    border-color: var(--host-border-light);
    background: var(--host-card);
}

.toggle-option input:checked + .toggle-label .toggle-name {
    color: #a5b4fc;
}

.toggle-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--host-text);
}

.toggle-desc {
    font-size: 0.775rem;
    color: var(--host-muted);
    line-height: 1.4;
}

/* =============================================================================
   Alerts
   ============================================================================= */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.alert-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.3);
    color: #86efac;
}

/* =============================================================================
   Dashboard — Event Cards
   ============================================================================= */

.event-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-card {
    background: var(--host-card);
    border: 1px solid var(--host-border);
    border-radius: 12px;
    padding: 20px 24px;
    transition: border-color 0.15s, background 0.15s;
}

.event-card:hover {
    background: var(--host-card-hover);
    border-color: var(--host-border-light);
}

.event-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.event-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--host-text);
    margin-bottom: 4px;
}

.event-card-meta {
    font-size: 0.8rem;
    color: var(--host-muted);
}

.event-card-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-card-code {
    display: flex;
    align-items: center;
    gap: 10px;
}

.code-label {
    font-size: 0.75rem;
    color: var(--host-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.join-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--indigo);
    background: var(--indigo-glow);
    padding: 4px 10px;
    border-radius: 6px;
}

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

/* Status Pills */

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}

.status-waiting  { background: rgba(100,116,139,0.15); color: var(--host-muted-light); }
.status-active   { background: rgba(16,185,129,0.15); color: #34d399; }
.status-judging  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-complete { background: rgba(99,102,241,0.15); color: #a5b4fc; }

/* Empty State */

.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--host-muted);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 1.2rem;
    color: var(--host-text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* =============================================================================
   Event Manage
   ============================================================================= */

.manage-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .manage-grid { grid-template-columns: 1fr; }
    .manage-col-side { order: -1; }
}

.card {
    background: var(--host-card);
    border: 1px solid var(--host-border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
}

.card:last-child { margin-bottom: 0; }

.card-header {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--host-heading);
    margin-bottom: 8px;
}

.card-sub {
    font-size: 0.825rem;
    color: var(--host-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Info rows */

.info-rows { display: flex; flex-direction: column; gap: 12px; }

.theme-field { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--host-border); }
.theme-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--host-muted-light); margin-bottom: 6px; }
.theme-field textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--host-surface);
    border: 1px solid var(--host-border);
    border-radius: 8px;
    color: var(--host-text);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.theme-field textarea:focus { border-color: var(--indigo); }

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.info-row-label {
    color: var(--host-muted-light);
    font-size: 0.8rem;
}

.join-code-lg {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--indigo);
}

/* Link rows */

.link-rows { display: flex; flex-direction: column; gap: 16px; }

.link-item { display: flex; flex-direction: column; gap: 6px; }

.link-item-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--host-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.link-item-row { display: flex; gap: 8px; }

.link-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--host-surface);
    border: 1px solid var(--host-border);
    border-radius: 8px;
    color: var(--host-muted-light);
    font-size: 0.78rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    cursor: pointer;
    min-width: 0;
}

/* Scenario editor */

.scenarios-list { display: flex; flex-direction: column; }

.scenario-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    grid-template-rows: auto auto;
    gap: 16px;
    align-items: start;
    padding: 16px 0;
    border-bottom: 1px solid var(--host-border);
}

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

.scenario-round {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--host-muted);
    padding-top: 10px;
}

.scenario-fields { display: flex; flex-direction: column; gap: 8px; }

.scenario-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }

.scenario-preview {
    grid-column: 2 / 4;
    background: var(--host-surface);
    border: 1px solid var(--indigo);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--indigo);
}

.preview-fields { display: flex; flex-direction: column; gap: 8px; }

.preview-title-input,
.preview-desc-input {
    padding: 9px 12px;
    background: rgba(99,102,241,0.06);
    border: 1px solid var(--host-border);
    border-radius: 8px;
    color: var(--host-text);
    font-size: 0.875rem;
    font-family: inherit;
    width: 100%;
    outline: none;
}

.preview-desc-input { resize: vertical; min-height: 80px; }

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

.scenario-title-input,
.scenario-desc-input {
    padding: 9px 12px;
    background: var(--host-surface);
    border: 1px solid var(--host-border);
    border-radius: 8px;
    color: var(--host-text);
    font-size: 0.875rem;
    font-family: inherit;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.scenario-title-input:focus,
.scenario-desc-input:focus {
    border-color: var(--indigo);
}

.scenario-desc-input { resize: vertical; }

.loading-row {
    padding: 32px 0;
    text-align: center;
    color: var(--host-muted);
    font-size: 0.875rem;
}

/* =============================================================================
   Misc utilities
   ============================================================================= */

.muted { color: var(--host-muted); }

/* =============================================================================
   Display View — Refresh
   ============================================================================= */

body.page-display {
    background: radial-gradient(ellipse at 20% 0%, #1a0a3c 0%, #080d1a 50%, #0a0f1e 100%);
    overflow: hidden;
}

.display-container {
    height: 100vh;
    display: grid;
    grid-template-rows: 60px 1fr;
    padding: 0;
    gap: 0;
}

/* Header */
.display-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid rgba(99,102,241,0.2);
    background: rgba(8,8,20,0.6);
    backdrop-filter: blur(12px);
    position: relative;
    z-index: 100;
}

.display-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

.display-header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.display-icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    opacity: 0.5;
    font-size: 0.85rem;
    color: var(--text);
    border-radius: 6px;
    transition: opacity 0.15s;
}

.display-icon-btn:hover { opacity: 0.9; }

/* Main grid */
#display-main {
    display: grid;
    grid-template-columns: 1fr;
    overflow: hidden;
    position: relative;
}

#display-main.scoreboard-visible {
    grid-template-columns: 1fr 260px;
}

#display-main .scoreboard-sidebar { display: none; }
#display-main.scoreboard-visible .scoreboard-sidebar { display: flex; }

/* Panels */
.display-panel {
    padding: 32px 40px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Waiting screen */
.waiting-content {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.waiting-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.waiting-title {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
}

.waiting-join {
    text-align: center;
    background: rgba(99,102,241,0.1);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 14px;
    padding: 16px 28px;
    flex-shrink: 0;
}

.waiting-join-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
}

.waiting-join-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    color: #a5b4fc;
}

.preview-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}

.teams-grid .team-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Scenario display */
.scenario-display {
    background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(30,20,60,0.6) 100%);
    border: 1px solid rgba(99,102,241,0.25);
    border-left: 4px solid #6366f1;
    border-radius: 14px;
    padding: 28px 32px;
    margin-bottom: 20px;
}

.scenario-display h2 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #c7d2fe;
    margin-bottom: 14px;
    line-height: 1.2;
}

.scenario-display p {
    font-size: 1.45rem;
    line-height: 1.75;
    color: var(--text);
}

/* Timer */
.round-timer {
    font-size: 4rem;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.3);
    margin: 8px 0;
    transition: color 0.3s;
}

.round-timer.timer-urgent {
    color: #ef4444;
    animation: timer-pulse 1s infinite;
}

/* Submissions tracker */
.submissions-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.team-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.team-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: all 0.3s ease;
}

.team-status-card.submitted {
    background: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.4);
}

.team-status-icon {
    font-size: 1.3rem;
    font-weight: 700;
    width: 24px;
    text-align: center;
}

.team-status-card.submitted .team-status-icon { color: #34d399; }
.team-status-card.pending .team-status-icon { color: rgba(255,255,255,0.2); }
.team-status-name { font-weight: 600; font-size: 1rem; }

/* Judgment cards */
.judgment-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
}

.judgment-card {
    border-radius: 12px;
    padding: 20px 24px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
    border: 1px solid transparent;
}

.reveal-card-entering {
    opacity: 0;
    transform: translateY(24px);
}

.judgment-best {
    background: rgba(16,185,129,0.1);
    border-color: rgba(16,185,129,0.3);
}

.judgment-worst {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
}

.judgment-mention {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.3);
}

.judgment-special {
    background: rgba(245,158,11,0.1);
    border-color: rgba(245,158,11,0.3);
}

.judgment-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
}

.judgment-best .judgment-label    { color: #34d399; }
.judgment-worst .judgment-label   { color: #f87171; }
.judgment-mention .judgment-label { color: #a5b4fc; }
.judgment-special .judgment-label { color: #fbbf24; }

.judgment-response {
    font-style: italic;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.judgment-response::before { content: '\201C'; }
.judgment-response::after  { content: '\201D'; }

.judgment-text {
    font-size: 1.2rem;
    line-height: 1.65;
    color: var(--text);
}

/* Results scenario recap */
.results-scenario {
    background: rgba(99,102,241,0.08);
    border-left: 3px solid rgba(99,102,241,0.5);
    border-radius: 0 8px 8px 0;
    padding: 12px 18px;
    margin-bottom: 20px;
}

.results-scenario-title {
    font-weight: 700;
    font-size: 1rem;
    color: #a5b4fc;
    margin-bottom: 4px;
}

.results-scenario-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Reveal header */
.reveal-header { margin-bottom: 20px; }
.reveal-header h2 { font-size: 1.8rem; margin-bottom: 12px; }

/* Scoreboard sidebar */
.scoreboard-sidebar {
    background: rgba(0,0,0,0.3);
    border-left: 1px solid rgba(99,102,241,0.15);
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

.scoreboard-sidebar-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.scoreboard-entry {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-radius: 8px;
}

.scoreboard-entry:last-child { border-bottom: none; }

.scoreboard-entry.leader {
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
}

.scoreboard-rank { font-weight: 700; color: var(--text-muted); font-size: 0.875rem; }
.scoreboard-entry.leader .scoreboard-rank { color: #fbbf24; }
.scoreboard-name { font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard-entry.leader .scoreboard-name { color: #fbbf24; }
.scoreboard-pts { font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; }
.scoreboard-entry.leader .scoreboard-pts { color: #fbbf24; }

/* Round pill */
.round-pill {
    background: rgba(99,102,241,0.2);
    border: 1px solid rgba(99,102,241,0.4);
    color: #c7d2fe;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: default;
}

.round-pill.round-pill-has-dropdown { cursor: pointer; }

/* Final standings */
.final-standings { margin-top: 24px; }
.final-standings h3 { margin-bottom: 16px; font-size: 1.1rem; }

.final-standing-entry {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    margin-bottom: 8px;
}

.final-standing-entry.champion {
    background: rgba(251,191,36,0.1);
    border-color: rgba(251,191,36,0.35);
}

.standing-rank { font-weight: 700; font-size: 1.1rem; color: var(--text-muted); min-width: 32px; }
.final-standing-entry.champion .standing-rank { color: #fbbf24; }
.standing-name { flex: 1; font-weight: 600; font-size: 1.1rem; }
.standing-points { font-weight: 700; color: #6366f1; font-size: 1.05rem; }

/* Game controls */
.game-controls-center { margin-top: 20px; text-align: center; }

/* Judging title scale */
.page-display .judging-title { font-size: 2.6rem; }

/* =============================================================================
   Theme toggle (participant pages)
   ============================================================================= */

.theme-toggle-bare {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.75);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.15s;
}
.theme-toggle-bare:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
html[data-theme="light"] .theme-toggle-bare {
    background: rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.15);
    color: rgba(0,0,0,0.55);
}
html[data-theme="light"] .theme-toggle-bare:hover {
    background: rgba(0,0,0,0.12);
    color: rgba(0,0,0,0.8);
}

/* =============================================================================
   Onboarding: nav link, empty-state flow, checklist, guide, spectator banner
   ============================================================================= */

.nav-link {
    font-size: 0.82rem;
    color: var(--host-muted-light);
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
    color: var(--host-text);
    background: var(--host-card);
}

.empty-flow {
    display: inline-block;
    text-align: left;
    margin: 0 auto 28px;
    padding-left: 20px;
    font-size: 0.9rem;
    color: var(--host-muted-light);
    line-height: 1.9;
}

.empty-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

/* Getting-started checklist (event manage) */

.checklist-card {
    border-color: rgba(99,102,241,0.35);
}

.checklist-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.checklist-header {
    cursor: pointer;
    user-select: none;
}

.checklist-header-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.checklist-progress {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--host-muted);
    background: rgba(99,102,241,0.12);
    border-radius: 10px;
    padding: 1px 8px;
}

.checklist-chevron {
    color: var(--host-muted);
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.checklist-card.collapsed .checklist-chevron { transform: rotate(-90deg); }

.checklist-card.collapsed .checklist-body { display: none; }

.checklist-steps {
    list-style: none;
    margin: 10px 0 14px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checklist-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: var(--host-text);
    line-height: 1.45;
}

.checklist-check {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 1.5px solid var(--host-border-light);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    transition: all 0.2s;
}

.checklist-step.done .checklist-check {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.checklist-step.done .checklist-check::before { content: '✓'; }

.checklist-step.done {
    color: var(--host-muted);
}

.checklist-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
}

.checklist-guide-link {
    color: var(--indigo);
    text-decoration: none;
}

.checklist-guide-link:hover { text-decoration: underline; }

.checklist-done-msg {
    color: var(--green);
    font-weight: 600;
}

/* Guide page */

.guide-container {
    max-width: 780px;
}

.guide-section {
    background: var(--host-card);
    border: 1px solid var(--host-border);
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 16px;
}

.guide-section h2 {
    font-size: 1.05rem;
    color: var(--host-heading);
    margin-bottom: 14px;
}

.guide-section p {
    font-size: 0.9rem;
    color: var(--host-text);
    line-height: 1.65;
    margin-bottom: 14px;
}

.guide-section p:last-child { margin-bottom: 0; }

.guide-flow-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.guide-flow-step {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--host-surface);
    border: 1px solid var(--host-border-light);
    border-radius: 999px;
    padding: 6px 14px 6px 6px;
    font-size: 0.82rem;
    color: var(--host-text);
    white-space: nowrap;
}

.guide-flow-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--indigo);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.guide-flow-arrow {
    color: var(--host-muted);
    font-size: 0.85rem;
}

.guide-list {
    margin: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--host-text);
    line-height: 1.6;
}

.guide-list li::marker { color: var(--host-muted); }

.guide-list strong { color: var(--host-heading); }

.guide-callout {
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.35);
    border-left: 3px solid var(--amber);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--host-text);
    line-height: 1.55;
    margin-bottom: 16px;
}

/* Spectator banner (display view, logged-out) */

.spectator-banner {
    position: fixed;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 90;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(8,8,20,0.85);
    border: 1px solid rgba(245,158,11,0.5);
    border-radius: 999px;
    padding: 8px 18px;
    font-size: 0.85rem;
    color: #fcd34d;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}

.spectator-banner-link {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.spectator-banner-link:hover { text-decoration: underline; }

/* =============================================================================
   Light mode
   ============================================================================= */

html[data-theme="light"] {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --host-bg: #f1f5f9;
    --host-surface: #ffffff;
    --host-card: #ffffff;
    --host-card-hover: #f8fafc;
    --host-border: #e2e8f0;
    --host-border-light: #cbd5e1;
    --host-heading: #0f172a;
    --host-text: #1e293b;
    --host-muted: #64748b;
    --host-muted-light: #475569;
    --indigo-glow: rgba(99,102,241,0.08);
}

html[data-theme="light"] body.page-display {
    background: radial-gradient(ellipse at top, #e0e7ff 0%, #f8fafc 60%, #f1f5f9 100%);
}

html[data-theme="light"] .host-nav {
    background: rgba(241,245,249,0.92);
}

html[data-theme="light"] .display-header {
    background: rgba(241,245,249,0.7);
    border-bottom-color: rgba(99,102,241,0.15);
}

html[data-theme="light"] .judging-quip {
    color: #475569;
}

html[data-theme="light"] .judge-console {
    border-color: rgba(67,56,202,0.45);
    box-shadow: 0 8px 40px rgba(15,23,42,0.18), 0 0 24px rgba(99,102,241,0.12);
}

html[data-theme="light"] .scenario-display {
    background: linear-gradient(135deg, rgba(99,102,241,0.10) 0%, rgba(224,231,255,0.55) 100%);
    border-color: rgba(99,102,241,0.3);
}

html[data-theme="light"] .scenario-display h2 {
    color: #4338ca;
}

html[data-theme="light"] .results-scenario-title {
    color: #4f46e5;
}

html[data-theme="light"] .round-pill {
    background: rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.35);
    color: #4338ca;
}

html[data-theme="light"] .judgment-response {
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(15,23,42,0.1);
    color: #334155;
}

html[data-theme="light"] .judgment-best .judgment-label    { color: #059669; }
html[data-theme="light"] .judgment-worst .judgment-label   { color: #dc2626; }
html[data-theme="light"] .judgment-mention .judgment-label { color: #4f46e5; }
html[data-theme="light"] .judgment-special .judgment-label { color: #b45309; }

html[data-theme="light"] .nav-logo span {
    background: linear-gradient(135deg, #0f172a 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

html[data-theme="light"] .form-section,
html[data-theme="light"] .card {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

html[data-theme="light"] .spectator-banner {
    background: rgba(255,251,235,0.95);
    border-color: rgba(180,83,9,0.4);
    color: #92400e;
    box-shadow: 0 4px 20px rgba(15,23,42,0.12);
}

html[data-theme="light"] .spectator-banner-link {
    color: #4f46e5;
}

html[data-theme="light"] .guide-callout {
    background: rgba(245,158,11,0.1);
    color: #78350f;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--host-border-light);
    color: var(--host-muted-light);
    border-radius: 6px;
    padding: 5px 9px;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover {
    color: var(--host-text);
    border-color: var(--host-muted);
    background: var(--host-card);
}

/* =============================================================================
   Event form: judge cast grid + humor heat gauge
   ============================================================================= */

.judge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.judge-option { --j-accent: var(--indigo); }
.judge-arc        { --j-accent: #818cf8; --j-accent-2: #c084fc; }
.judge-skeptic    { --j-accent: #38bdf8; }
.judge-enthusiast { --j-accent: #fbbf24; }
.judge-overlord   { --j-accent: #f87171; }

html[data-theme="light"] .judge-arc        { --j-accent: #4f46e5; --j-accent-2: #9333ea; }
html[data-theme="light"] .judge-skeptic    { --j-accent: #0369a1; }
html[data-theme="light"] .judge-enthusiast { --j-accent: #b45309; }
html[data-theme="light"] .judge-overlord   { --j-accent: #dc2626; }

.judge-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    height: 100%;
}

.judge-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.judge-mark {
    flex: 0 0 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--host-border-light);
    color: var(--host-muted);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.judge-option input:checked + .judge-card {
    background: color-mix(in srgb, var(--j-accent) 9%, transparent);
    border-color: color-mix(in srgb, var(--j-accent) 55%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--j-accent) 10%, transparent);
}

.judge-option input:checked + .judge-card .judge-mark {
    background: color-mix(in srgb, var(--j-accent) 16%, transparent);
    border-color: var(--j-accent);
    color: var(--j-accent);
}

.judge-option input:checked + .judge-card .toggle-name {
    color: var(--j-accent);
}

/* The Arc escalates — its selected state ramps indigo to violet */
.judge-arc input:checked + .judge-card .judge-mark {
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--j-accent) 22%, transparent),
        color-mix(in srgb, var(--j-accent-2) 22%, transparent));
    border-color: var(--j-accent-2);
}

.judge-arc input:checked + .judge-card .toggle-name {
    background: linear-gradient(90deg, var(--j-accent), var(--j-accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Humor heat gauge: levels are cumulative, so wicks fill up to the pick */
.humor-group { --h-accent: var(--indigo); }
.humor-group:has(input[value="safe"]:checked)     { --h-accent: #34d399; }
.humor-group:has(input[value="edgy"]:checked)     { --h-accent: #fbbf24; }
.humor-group:has(input[value="unhinged"]:checked) { --h-accent: #f87171; }

html[data-theme="light"] .humor-group:has(input[value="safe"]:checked)     { --h-accent: #059669; }
html[data-theme="light"] .humor-group:has(input[value="edgy"]:checked)     { --h-accent: #b45309; }
html[data-theme="light"] .humor-group:has(input[value="unhinged"]:checked) { --h-accent: #dc2626; }

.humor-card {
    position: relative;
    padding-bottom: 22px;
}

.humor-wick {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 10px;
    height: 3px;
    border-radius: 2px;
    background: var(--host-border);
    transition: background 0.2s, box-shadow 0.2s;
}

.humor-group:has(input[value="safe"]:checked) .humor-option:nth-child(1) .humor-wick,
.humor-group:has(input[value="edgy"]:checked) .humor-option:nth-child(-n+2) .humor-wick,
.humor-group:has(input[value="unhinged"]:checked) .humor-option .humor-wick {
    background: var(--h-accent);
    box-shadow: 0 0 8px color-mix(in srgb, var(--h-accent) 45%, transparent);
}

.humor-option input:checked + .humor-card {
    background: color-mix(in srgb, var(--h-accent) 9%, transparent);
    border-color: color-mix(in srgb, var(--h-accent) 55%, transparent);
}

.humor-option input:checked + .humor-card .toggle-name {
    color: var(--h-accent);
}

/* Keyboard focus on hidden radios lights up the card */
.judge-option input:focus-visible + .toggle-label,
.humor-option input:focus-visible + .toggle-label {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--j-accent, var(--h-accent)) 35%, transparent);
}

@media (max-width: 640px) {
    .judge-grid { grid-template-columns: 1fr; }
    .humor-group { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    .toggle-label, .judge-mark, .humor-wick { transition: none; }
}

/* =============================================================================
   Public landing page
   The hero borrows the Display view's radial wash on purpose: it is already
   this product's "showtime" signal, so the front door looks like the thing
   it is selling.
   ============================================================================= */

body.page-landing {
    background: radial-gradient(ellipse at top, #1e0a3c 0%, #0a0f1e 55%, var(--bg) 100%);
    background-attachment: fixed;
}

html[data-theme="light"] body.page-landing {
    background: radial-gradient(ellipse at top, #ede9fe 0%, #f8fafc 55%, var(--bg) 100%);
    background-attachment: fixed;
}

.lp-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 28px;
    max-width: 1120px;
    margin: 0 auto;
}

.lp-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.lp-nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lp {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 28px 80px;
}

.lp-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 56px;
    align-items: center;
    padding: 56px 0 72px;
}

/* Wide tracking on a small uppercase label is this product's existing
   structural voice — lifted from .judgment-label on the Display. */
.lp-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-light);
    margin-bottom: 18px;
}

.lp-title {
    font-size: clamp(2.1rem, 4.6vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
    font-weight: 700;
    margin-bottom: 20px;
}

.lp-lede {
    font-size: 1.08rem;
    line-height: 1.65;
    color: var(--text-muted);
    max-width: 46ch;
    margin-bottom: 30px;
}

.lp-hero-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.lp-textlink {
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
}

.lp-textlink:hover { text-decoration: underline; }

/* --- the demo: a real round, in the app's own components --- */

.lp-demo {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

html[data-theme="light"] .lp-demo {
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.12);
}

.lp-demo-chrome {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 16px;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid var(--border);
}

html[data-theme="light"] .lp-demo-chrome {
    background: var(--bg-input);
}

.lp-demo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-light);
    box-shadow: 0 0 10px var(--accent);
    flex: none;
}

.lp-demo-chrome-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.lp-demo-body { padding: 22px 20px 24px; }

.lp-demo-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.lp-demo-scenario {
    font-size: 1.02rem;
    line-height: 1.55;
    margin-bottom: 20px;
}

.lp-demo-cards { gap: 10px; }

/* Mirrors how the real Display reveals judgments: one at a time. */
.lp-card-reveal {
    animation: lpReveal 0.55s ease both;
    animation-delay: var(--d, 0s);
}

@keyframes lpReveal {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- sections --- */

.lp-section { padding: 64px 0 8px; }

.lp-h2 {
    font-size: clamp(1.5rem, 2.5vw, 1.95rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 10px;
}

.lp-section-sub {
    color: var(--text-muted);
    margin-bottom: 30px;
    max-width: 54ch;
}

.lp-steps {
    list-style: none;
    display: grid;
    gap: 2px;
    counter-reset: none;
}

.lp-step {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 18px 0;
    border-top: 1px solid var(--border);
}

.lp-step:last-child { border-bottom: 1px solid var(--border); }

.lp-step-n {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-light);
    border: 1px solid var(--accent);
    background: rgba(124, 58, 237, 0.12);
}

.lp-step h3 {
    font-size: 1.02rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.lp-step p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
}

.lp-section-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
}

.lp-needs {
    list-style: none;
    display: grid;
    gap: 12px;
}

.lp-needs li {
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.55;
    padding-left: 16px;
    border-left: 2px solid var(--border);
}

.lp-needs strong { color: var(--text); font-weight: 600; }

.lp-cta {
    margin-top: 78px;
    padding: 48px 32px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.lp-cta .lp-section-sub { margin: 0 auto 26px; }

.lp-cta-note {
    margin-top: 18px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.lp-foot {
    margin-top: 56px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

@media (max-width: 860px) {
    .lp-hero {
        grid-template-columns: 1fr;
        gap: 38px;
        padding: 36px 0 52px;
    }
    .lp-section-split { grid-template-columns: 1fr; gap: 34px; }
    .lp, .lp-nav { padding-left: 20px; padding-right: 20px; }
    .lp-section { padding-top: 52px; }
    .lp-cta { margin-top: 56px; padding: 38px 22px; }
}

@media (prefers-reduced-motion: reduce) {
    .lp-card-reveal { animation: none; }
}

/* --- Scenario theme note + auto-save status ------------------------------- */

.scenario-theme-note {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(124, 58, 237, 0.10);
    border: 1px solid rgba(124, 58, 237, 0.30);
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--host-text);
}

.scenario-theme-note.scenario-theme-unset {
    background: var(--host-card-hover);
    border-color: var(--host-border-light);
    color: var(--host-muted-light);
}

.scenario-theme-icon { flex: none; }
.scenario-theme-unset .scenario-theme-icon { opacity: 0.45; }
.scenario-theme-text { flex: 1 1 260px; }
.scenario-theme-text em { font-style: italic; }

.scenario-theme-link {
    flex: none;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.scenario-theme-link:hover { text-decoration: underline; }

.scenario-status {
    font-size: 0.78rem;
    min-height: 1em;
    transition: color 0.2s ease;
}

.scenario-status-pending { color: var(--host-muted); }
.scenario-status-saved   { color: var(--success); }
.scenario-status-error   { color: var(--danger); font-weight: 600; }
