/* ==========================================================================
   R.U.R. CTF by Noibit — Main Stylesheet
   BSides Prague 2026 · Dark cyberpunk/robot themed UI
   ========================================================================== */

/* --- CSS Variables --- */
:root {
    --bg-primary: #0a0b0f;
    --bg-secondary: #111219;
    --bg-card: #161822;
    --bg-input: #1a1c28;
    --border: #2a2d3a;
    --border-glow: #00ff8833;
    --text-primary: #e0e0e8;
    --text-secondary: #8a8d9a;
    --text-muted: #5a5d6a;
    --accent-green: #00ff88;
    --accent-cyan: #00ccff;
    --accent-red: #ff4455;
    --accent-orange: #ff9933;
    --accent-purple: #aa66ff;
    --vote-a-bg: #0a2a1a;
    --vote-a-border: #00ff88;
    --vote-b-bg: #2a0a1a;
    --vote-b-border: #ff4455;
    --font-main: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent-cyan); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-green); }

img { max-width: 100%; height: auto; display: block; }

/* --- Navigation --- */
.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
    letter-spacing: 0.5px;
}
.nav-brand:hover { color: var(--accent-cyan); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-user {
    color: var(--accent-cyan);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.lang-switch {
    font-weight: 700;
    color: var(--accent-orange);
    border: 1px solid var(--accent-orange);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}
.lang-switch:hover {
    background: var(--accent-orange);
    color: var(--bg-primary);
}

.nav-logout { color: var(--accent-red); }
.nav-logout:hover { color: #ff6677; }

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* --- Flash Messages --- */
.flash-messages { margin-bottom: 1.5rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    border-left: 4px solid;
    margin-bottom: 0.5rem;
}
.flash-success {
    background: rgba(0, 255, 136, 0.08);
    border-color: var(--accent-green);
    color: var(--accent-green);
}
.flash-error {
    background: rgba(255, 68, 85, 0.08);
    border-color: var(--accent-red);
    color: var(--accent-red);
}
.flash-warning {
    background: rgba(255, 153, 51, 0.08);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    font-family: var(--font-main);
}

.btn-primary {
    background: var(--accent-green);
    color: var(--bg-primary);
}
.btn-primary:hover {
    background: #33ff99;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
    color: var(--bg-primary);
}

.btn-lg {
    padding: 0.9rem 2.5rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-dev {
    background: var(--accent-purple);
    color: white;
}
.btn-dev:hover { background: #bb77ff; }

/* --- Login Page --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-layout {
    display: flex;
    align-items: stretch;
    gap: 3rem;
    max-width: 900px;
    width: 100%;
}

.login-image {
    flex: 0 0 340px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.15), var(--shadow);
    border: 1px solid var(--border);
}

.login-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-lg);
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow);
    flex: 1;
}

.login-card h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--accent-green);
}

.login-sub {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.key-icon {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.key-svg { animation: float 3s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.pulse-ring {
    animation: pulseRing 2s ease-in-out infinite;
    transform-origin: center;
}
@keyframes pulseRing {
    0%, 100% { r: 20; opacity: 1; }
    50% { r: 28; opacity: 0.4; }
}

.waiting-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: dotPulse 1.4s ease-in-out infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

.waiting-text {
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.dev-panel {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border);
}
.dev-panel h3 {
    font-size: 0.85rem;
    color: var(--accent-purple);
    margin-bottom: 0.75rem;
}

.dev-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.dev-form input {
    padding: 0.5rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 150px;
}

/* --- Prologue --- */
.prologue-container {
    max-width: 720px;
    margin: 0 auto;
}

.prologue-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.prologue-header h1 {
    font-size: 2.2rem;
    color: var(--accent-green);
    margin-bottom: 0.3rem;
}
.prologue-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.prologue-story {
    margin-bottom: 2.5rem;
}

.story-paragraph {
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.prologue-rules {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}
.prologue-rules h2 {
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}
.rules-list {
    list-style: none;
    padding: 0;
}
.rules-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}
.rules-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-green);
}

.prologue-closing {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-red);
    margin: 2rem 0;
    letter-spacing: 1px;
}

.prologue-action {
    text-align: center;
    margin: 2rem 0;
}

/* --- Email Section (Prologue) --- */
.email-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    margin-top: 2rem;
}
.email-section h2 {
    color: var(--accent-cyan);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}
.email-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}
.email-prize-note {
    font-size: 1rem;
    font-weight: 700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    margin-bottom: 1.2rem;
}
.email-form {
    margin-bottom: 0.75rem;
}
.email-input-group {
    display: flex;
    gap: 0.75rem;
}
.email-input {
    flex: 1;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}
.email-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
}
.email-skip-row {
    text-align: center;
    margin-top: 0.5rem;
}

/* --- Scenarios Grid --- */
.page-title {
    font-size: 1.8rem;
    color: var(--accent-green);
    margin-bottom: 1.5rem;
}

.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.scenario-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
}
.scenario-card:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 30px rgba(0, 204, 255, 0.1);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.scenario-card-image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--bg-primary);
}
.scenario-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.scenario-card:hover .scenario-card-image img {
    transform: scale(1.05);
}

.solved-overlay, .locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.solved-overlay {
    background: rgba(0, 255, 136, 0.15);
}
.locked-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.solved-badge {
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 0.4rem 1.2rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.locked-badge {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
}

.scenario-card-body {
    padding: 1rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.scenario-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scenario-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
}

.scenario-card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.scenario-card-synopsis {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-top: 0.3rem;
}

.scenario-card-theme {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: auto;
    padding-top: 0.5rem;
}

.scenario-solved {
    opacity: 0.65;
}
.scenario-solved:hover { opacity: 0.85; }

.scenario-locked {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

/* --- Scenario Detail --- */
.scenario-detail {
    max-width: 860px;
    margin: 0 auto;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.back-link:hover { color: var(--accent-cyan); }

.scenario-header {
    margin-bottom: 2rem;
}
.scenario-number-lg {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-green);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 0.3rem;
}
.scenario-header h1 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.scenario-subtitle-lg {
    font-size: 1rem;
    color: var(--text-secondary);
}
.scenario-theme-lg {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-top: 0.3rem;
}

.scenario-scene {
    margin-bottom: 2rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}
.scene-image {
    width: 100%;
    display: block;
}

.scenario-story {
    margin-bottom: 2rem;
}
.story-text {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.8;
}

/* --- Flag Input --- */
.flag-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

.flag-input-group {
    display: flex;
    gap: 0.75rem;
}

.flag-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--accent-green);
    font-family: var(--font-mono);
    font-size: 1rem;
    outline: none;
    transition: border-color var(--transition);
}
.flag-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.15);
}
.flag-input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* --- Solved Section --- */
.solved-section { margin-top: 2rem; }

.just-solved-highlight {
    animation: solvedFlash 0.6s ease-out;
}
@keyframes solvedFlash {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.solved-banner {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--accent-green);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.solved-check {
    font-size: 1.4rem;
}

.first-solver-badge {
    background: var(--accent-orange);
    color: var(--bg-primary);
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-left: auto;
}

/* --- Vote Section --- */
.vote-section, .vote-result {
    margin-top: 1.5rem;
}
.vote-section h2, .vote-result h2 {
    font-size: 1.4rem;
    color: var(--accent-cyan);
    margin-bottom: 0.5rem;
}

.vote-prompt {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.vote-options, .voted-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.vote-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    transition: all var(--transition);
}

.vote-card h3 {
    font-size: 1.1rem;
    margin: 0.75rem 0 0.5rem;
}
.vote-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.vote-image {
    border-radius: var(--radius);
    width: 100%;
}

.vote-card-a { border-color: rgba(0, 255, 136, 0.2); }
.vote-card-a:hover { border-color: var(--accent-green); }
.vote-card-a h3 { color: var(--accent-green); }

.vote-card-b { border-color: rgba(255, 68, 85, 0.2); }
.vote-card-b:hover { border-color: var(--accent-red); }
.vote-card-b h3 { color: var(--accent-red); }

.btn-vote {
    width: 100%;
    padding: 0.7rem;
    font-weight: 700;
    font-size: 1rem;
}
.btn-vote-a {
    background: var(--accent-green);
    color: var(--bg-primary);
}
.btn-vote-a:hover { background: #33ff99; }
.btn-vote-b {
    background: var(--accent-red);
    color: white;
}
.btn-vote-b:hover { background: #ff6677; }

.vote-selected {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.15);
}
.vote-dimmed {
    opacity: 0.35;
}

.vote-choice {
    font-family: var(--font-mono);
    font-size: 1.1rem;
}
.vote-choice-a { color: var(--accent-green); }
.vote-choice-b { color: var(--accent-red); }

/* --- Epilogue Verdict --- */
.epilogue-verdict {
    margin-top: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.epilogue-verdict h2 {
    color: var(--accent-cyan);
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.verdict-intro {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-style: italic;
}

.epilogue-result-image {
    margin: 1.5rem 0;
}

.epilogue-narrative-text {
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-left: 4px solid var(--text-secondary);
    font-style: italic;
}
.epilogue-narrative-text p {
    font-size: 1.05rem;
    line-height: 1.9;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}
.epilogue-narrative-text p:last-child {
    margin-bottom: 0;
}

.epilogue-story-text {
    padding: 1.5rem;
    border-radius: var(--radius);
    margin-top: 1.5rem;
    background: rgba(0, 204, 255, 0.05);
    border-left: 4px solid var(--accent-cyan);
}

.epilogue-story-text p {
    font-size: 1.05rem;
    line-height: 1.9;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.epilogue-story-text p:last-child {
    margin-bottom: 0;
}

/* --- Reward Section --- */
.reward-section {
    margin-top: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.reward-section h2 {
    color: var(--accent-orange);
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}
.reward-note {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.reward-slot {
    margin-bottom: 1.5rem;
}
.reward-slot h3 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.05rem;
}

.reward-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.reward-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.reward-option:hover {
    border-color: var(--accent-orange);
}
.reward-option input[type="radio"] {
    accent-color: var(--accent-orange);
    width: 16px;
    height: 16px;
}
.reward-option-label {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.reward-chosen {
    background: rgba(255, 153, 51, 0.1);
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.chosen-label {
    color: var(--accent-orange);
    font-weight: 600;
}

/* --- Admin --- */
.admin-container {
    max-width: 1100px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.admin-header h1 {
    color: var(--accent-cyan);
    font-size: 1.8rem;
}
.admin-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}
.stat-a { color: var(--accent-green); }
.stat-b { color: var(--accent-red); }

.admin-section {
    margin-bottom: 2.5rem;
}
.admin-section h2 {
    font-size: 1.3rem;
    color: var(--accent-green);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th, .admin-table td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.admin-table td {
    background: var(--bg-card);
}
.admin-table tr:hover td {
    background: var(--bg-secondary);
}

.epilogue-preview-cell { max-width: 400px; }
.epilogue-preview-cell details summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}
.epilogue-full-text {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

.flag-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    background: rgba(0, 204, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    color: var(--accent-cyan);
    word-break: break-all;
}

.scenario-col {
    text-align: center;
    min-width: 50px;
}

.points-cell {
    text-align: center;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}
.scenario-cell {
    text-align: center;
}

.cell-solved {
    color: var(--accent-green);
    font-weight: 700;
}
.cell-unsolved {
    color: var(--text-muted);
}

.vote-indicator {
    display: inline-block;
    margin-left: 2px;
    font-weight: 700;
}
.vote-indicator-a { color: var(--accent-green); }
.vote-indicator-b { color: var(--accent-red); }

.first-indicator {
    color: var(--accent-orange);
    margin-left: 2px;
}

.first-solver-tag {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-orange);
}

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

/* --- Admin Delete / Action Buttons --- */
.btn-danger {
    background: var(--accent-red);
    color: white;
    border: none;
}
.btn-danger:hover {
    background: #ff4466;
    box-shadow: 0 0 10px rgba(255, 68, 102, 0.4);
}

.inline-form {
    display: inline;
}

.cell-actions {
    display: flex;
    gap: 2px;
    justify-content: center;
    margin-top: 2px;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 3px;
    line-height: 1;
    transition: all 0.2s;
}
.btn-danger-icon {
    color: var(--accent-red);
}
.btn-danger-icon:hover {
    background: var(--accent-red);
    color: white;
}
.btn-warn-icon {
    color: var(--accent-orange);
}
.btn-warn-icon:hover {
    background: var(--accent-orange);
    color: white;
}

/* --- Flag Attempt Log --- */
.attempt-bad td {
    background: rgba(255, 68, 102, 0.05);
}
.attempt-ok td {
    background: rgba(0, 255, 136, 0.05);
}

.bad-count {
    color: var(--accent-red);
    font-weight: 700;
    font-family: var(--font-mono);
}

.badge-ok {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 255, 136, 0.15);
    color: var(--accent-green);
}
.badge-bad {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 68, 102, 0.15);
    color: var(--accent-red);
}

.flag-text {
    font-size: 0.8em;
    word-break: break-all;
}

.attempt-count {
    text-align: center;
}

/* --- Serial Warning --- */
.serial-warning {
    padding: 1rem;
    border: 1px solid var(--accent-orange);
    border-radius: var(--radius);
    color: var(--accent-orange);
    background: rgba(255, 170, 0, 0.1);
    margin-bottom: 1rem;
}
.serial-warning p {
    margin: 0;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-input);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

/* --- Admin Login --- */
.admin-login-card {
    max-width: 400px;
}
.admin-form .form-group {
    margin-bottom: 1rem;
    text-align: left;
}
.admin-form label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.admin-form input[type="password"] {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
}
.admin-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-cyan);
}
.admin-form .btn { width: 100%; }

/* --- Error Page --- */
.error-container {
    text-align: center;
    padding: 4rem 0;
}
.error-code {
    font-size: 5rem;
    font-weight: 700;
    color: var(--accent-red);
    font-family: var(--font-mono);
}
.error-message {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 1rem 0 2rem;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .topnav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }
    .nav-right { flex-wrap: wrap; justify-content: center; }

    .container { padding: 1rem; }

    .scenarios-grid {
        grid-template-columns: 1fr;
    }

    .vote-options, .voted-options {
        grid-template-columns: 1fr;
    }

    .flag-input-group {
        flex-direction: column;
    }

    .admin-summary {
        grid-template-columns: 1fr 1fr;
    }

    .login-card { padding: 2rem 1.5rem; }

    .login-layout {
        flex-direction: column;
        gap: 1.5rem;
    }

    .login-image {
        flex: 0 0 auto;
        max-width: 280px;
    }

    .scenario-header h1 { font-size: 1.5rem; }
}

@media (max-width: 480px) {
    .admin-summary {
        grid-template-columns: 1fr;
    }
}

/* --- XP Game Section --- */
.xpgame-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.xpgame-msg {
    color: var(--accent);
    font-size: 0.9rem;
}

.xpgame-pts-input {
    width: 70px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    text-align: center;
}

.xpgame-set-form {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
}

/* --- Helprim Image Generation --- */
.helprim-image-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.helprim-upload-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.helprim-file-input {
    font-size: 0.9rem;
    color: var(--text);
}

.helprim-image-box h3 {
    font-size: 1rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.helprim-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
