/**
 * PHYSICS: THE FRACTURED UNIVERSE
 * Master Stylesheet - Cyberpunk Sci-Fi & Cambridge Science Aesthetic
 */

:root {
    --bg-dark: #090c15;
    --bg-card: rgba(15, 23, 42, 0.88);
    --bg-card-border: rgba(56, 189, 248, 0.25);
    --cyan-glow: #00d2d3;
    --cyan-dim: rgba(0, 210, 211, 0.15);
    --gold: #f39c12;
    --green: #2ecc71;
    --red: #e74c3c;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --font-heading: 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui: 'Rajdhani', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 16px;
}

#app-root {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* ========================================================
   MAIN MENU SCREEN
   ======================================================== */
#menu-screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #111a33 0%, #060913 100%);
    z-index: 10;
}

.menu-nebula-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 75% 25%, rgba(0, 210, 211, 0.12) 0%, transparent 50%),
                radial-gradient(circle at 20% 80%, rgba(243, 156, 18, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.menu-scanlines {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    opacity: 0.6;
}

.menu-container {
    position: relative;
    max-width: 780px;
    width: 90%;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 14px;
    box-shadow: 0 0 50px rgba(0, 210, 211, 0.15), inset 0 0 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    backdrop-filter: blur(12px);
    z-index: 2;
}

.menu-container::before {
    content: '';
    position: absolute;
    top: -1px; left: 30px; right: 30px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan-glow), transparent);
}

.title-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(0, 210, 211, 0.1);
    border: 1px solid var(--cyan-glow);
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    letter-spacing: 2px;
    color: var(--cyan-glow);
    margin-bottom: 18px;
}

.main-title {
    font-family: var(--font-heading);
    font-size: 3.6rem;
    font-weight: 900;
    letter-spacing: 6px;
    background: linear-gradient(180deg, #ffffff 30%, var(--cyan-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    margin-bottom: 4px;
}

.sub-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--gold);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.story-teaser {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 30px;
}

.story-teaser strong {
    color: var(--cyan-glow);
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 440px;
    margin: 0 auto 30px auto;
}

.menu-btn {
    position: relative;
    padding: 14px 24px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
}

.menu-btn:hover {
    background: rgba(0, 210, 211, 0.2);
    border-color: var(--cyan-glow);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 210, 211, 0.3);
}

.primary-menu-btn {
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.25) 0%, rgba(14, 165, 233, 0.35) 100%);
    border: 1px solid var(--cyan-glow);
    font-weight: 700;
}

.menu-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 18px;
}

.difficulty-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cyber-select {
    background: #0f172a;
    color: var(--cyan-glow);
    border: 1px solid var(--cyan-glow);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
}

.version-tag {
    font-size: 0.8rem;
    color: #64748b;
    letter-spacing: 1px;
}

/* ========================================================
   GAMEPLAY SCREEN & HUD
   ======================================================== */
#game-screen {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.hud-top-bar {
    height: 58px;
    background: rgba(10, 14, 26, 0.96);
    border-bottom: 1px solid rgba(0, 210, 211, 0.3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 5;
    contain: layout style;
}

.hud-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.hud-icon-btn {
    padding: 7px 14px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hud-icon-btn:hover, .hud-icon-btn.active {
    background: var(--cyan-dim);
    border-color: var(--cyan-glow);
    color: var(--cyan-glow);
}

.nova-btn {
    border-color: var(--gold);
    color: var(--gold);
}

.nova-btn:hover {
    background: rgba(243, 156, 18, 0.2);
    border-color: var(--gold);
    color: #fff;
}

.guide-btn {
    border-color: var(--gold) !important;
    color: var(--gold) !important;
}

.guide-btn:hover {
    background: rgba(243, 156, 18, 0.25) !important;
    color: #fff !important;
}

.seed-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(15, 23, 42, 0.8);
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.seed-label {
    color: var(--text-secondary);
}

.seed-code {
    color: var(--cyan-glow);
    letter-spacing: 1px;
}

.seed-reroll-btn {
    background: transparent;
    border: 1px solid rgba(0, 210, 211, 0.4);
    border-radius: 4px;
    color: var(--cyan-glow);
    font-size: 0.72rem;
    padding: 2px 6px;
    cursor: pointer;
}

.seed-reroll-btn:hover {
    background: var(--cyan-dim);
}

.hud-diff-select {
    font-size: 0.75rem;
    padding: 4px 8px;
    height: 30px;
    background: rgba(15, 23, 42, 0.9);
}

.mode-pill {
    padding: 5px 14px;
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.mode-building {
    background: rgba(0, 210, 211, 0.15);
    border: 1px solid var(--cyan-glow);
    color: var(--cyan-glow);
}

.mode-simulating {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid var(--red);
    color: #ff7675;
    animation: pulseRed 1s infinite alternate;
}

@keyframes pulseRed {
    from { box-shadow: 0 0 5px rgba(231, 76, 60, 0.4); }
    to { box-shadow: 0 0 16px rgba(231, 76, 60, 0.9); }
}

.metric-hud-item {
    min-width: 130px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.metric-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3px;
    color: var(--text-secondary);
}

.metric-top strong {
    color: #fff;
}

.hud-bar-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.hud-bar-fill {
    height: 100%;
    transition: width 0.15s ease;
}

.bar-safe {
    background: var(--green);
}

.bar-warning {
    background: var(--gold);
}

.bar-danger {
    background: var(--red);
}

.bar-fracture {
    background: #ff0055;
    box-shadow: 0 0 8px #ff0055;
}

/* ========================================================
   CANVAS CONTAINER & TELEMETRY
   ======================================================== */
#canvas-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100vh - 128px);
    overflow: hidden;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    transform: translateZ(0);
    backface-visibility: hidden;
    will-change: transform;
}

/* Scientific Telemetry Card */
.telemetry-card {
    position: absolute;
    top: 16px;
    left: 20px;
    background: rgba(10, 14, 26, 0.94);
    border: 1px solid rgba(0, 210, 211, 0.4);
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), inset 0 0 15px rgba(0, 210, 211, 0.08);
    z-index: 6;
    pointer-events: none;
    contain: layout style;
}

.telemetry-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: var(--cyan-glow);
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

.pulsing-dot {
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: blinkDot 1.2s infinite alternate;
}

@keyframes blinkDot {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 14px;
}

.telem-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.telem-item.telem-span-2 {
    grid-column: span 2;
    border-bottom: 1px dashed rgba(0, 242, 254, 0.2);
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.telem-item.telem-span-2:last-child {
    border-bottom: none;
    border-top: 1px dashed rgba(0, 242, 254, 0.2);
    padding-top: 4px;
    margin-top: 2px;
}

.hud-terrain-select {
    max-width: 175px;
    font-size: 0.78rem;
    padding: 4px 8px;
}

.telem-label {
    color: var(--text-secondary);
}

.telem-item strong {
    color: #fff;
    font-weight: 600;
}

/* NOVA Hint Toast */
.nova-toast {
    position: absolute;
    bottom: 24px;
    left: 24px;
    max-width: 480px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    gap: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    contain: layout style;
    z-index: 8;
    animation: slideUp 0.3s ease;
}

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

.nova-toast-avatar {
    font-size: 1.8rem;
}

.nova-toast-header {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: 4px;
}

.nova-toast-body {
    font-size: 0.92rem;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ========================================================
   BOTTOM CAD TOOLBAR
   ======================================================== */
.hud-bottom-bar {
    height: 70px;
    background: rgba(10, 14, 26, 0.96);
    border-top: 1px solid rgba(0, 210, 211, 0.25);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 5;
    contain: layout style;
}

.materials-palette {
    display: flex;
    gap: 8px;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.tool-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(0, 210, 211, 0.5);
}

.tool-btn.active {
    background: rgba(0, 210, 211, 0.2);
    border-color: var(--cyan-glow);
    box-shadow: 0 0 10px rgba(0, 210, 211, 0.25);
}

.tool-icon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

.deck-icon { background: #f39c12; }
.wood-icon { background: #d35400; }
.steel-icon { background: #3498db; }
.cable-icon { background: #ecf0f1; border: 1px dashed #7f8c8d; }
.concrete-icon { background: #95a5a6; }

.tool-info {
    display: flex;
    flex-direction: column;
}

.tool-name {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 700;
}

.tool-cost {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.delete-tool.active {
    background: rgba(231, 76, 60, 0.25);
    border-color: var(--red);
}

.bottom-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-secondary-btn {
    padding: 10px 16px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
    cursor: pointer;
}

.hud-secondary-btn:hover {
    background: rgba(51, 65, 85, 1);
}

.hud-primary-action-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    letter-spacing: 1.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

.hud-primary-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.hud-primary-action-btn.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

/* Simulation Speed Controls */
.sim-speed-controls {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 6px;
    padding: 3px 6px;
    gap: 4px;
}

.speed-label {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    color: var(--cyan-glow);
    margin-right: 2px;
    letter-spacing: 0.5px;
}

.speed-pill {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.speed-pill:hover {
    color: #fff;
    background: rgba(56, 189, 248, 0.2);
}

.speed-pill.active {
    background: var(--cyan-glow);
    color: #050b14;
    border-color: var(--cyan-glow);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.4);
}

.tremor-btn {
    border-color: rgba(230, 126, 34, 0.5);
    color: #f39c12;
}

.tremor-btn:hover {
    background: rgba(230, 126, 34, 0.25);
    color: #fff;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.4);
}

/* Star Rating in Debrief */
.star-rating-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--gold);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 18px;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.2);
}

.star-row {
    display: flex;
    gap: 8px;
    font-size: 2.2rem;
    line-height: 1;
}

.star-icon {
    color: rgba(255, 255, 255, 0.15);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.star-icon.earned {
    color: #f1c40f;
    text-shadow: 0 0 15px rgba(241, 196, 15, 0.8);
    transform: scale(1.15);
}

.star-tier-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1c40f;
    margin-top: 6px;
    letter-spacing: 1px;
}

.star-criteria {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ========================================================
   OVERLAYS & MODALS
   ======================================================== */
.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 9, 18, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 30px;
}

.cyber-btn {
    padding: 10px 20px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cyber-btn:hover {
    border-color: var(--cyan-glow);
    background: var(--cyan-dim);
}

.primary-cyber-btn {
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.3) 0%, rgba(14, 165, 233, 0.4) 100%);
    border-color: var(--cyan-glow);
    color: #fff;
    font-weight: 700;
}

.secondary-cyber-btn {
    background: rgba(243, 156, 18, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

.secondary-cyber-btn:hover {
    background: rgba(243, 156, 18, 0.25);
}

.disabled-btn {
    opacity: 0.4;
    cursor: not-allowed !important;
}

/* CINEMATIC */
.cinematic-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #0f172a 0%, #030712 100%);
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.cinematic-content {
    max-width: 820px;
    width: 100%;
}

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

.hologram-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--red);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

.pulsing-core {
    width: 10px;
    height: 10px;
    background: var(--red);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--red);
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

.skip-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    cursor: pointer;
}

.nova-terminal-card {
    background: var(--bg-card);
    border: 1px solid var(--cyan-glow);
    border-radius: 12px;
    padding: 30px;
    display: flex;
    gap: 24px;
    box-shadow: 0 0 40px rgba(0, 210, 211, 0.2);
    margin-bottom: 24px;
}

.nova-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 110px;
}

.nova-sphere {
    position: relative;
    width: 70px;
    height: 70px;
    margin-bottom: 12px;
}

.nova-eye {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    background: var(--cyan-glow);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--cyan-glow);
}

.nova-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(0, 210, 211, 0.5);
    border-radius: 50%;
}

.ring-1 {
    animation: spin1 4s linear infinite;
}

.ring-2 {
    border-color: rgba(243, 156, 18, 0.5);
    animation: spin2 3s linear infinite reverse;
}

@keyframes spin1 {
    from { transform: rotate(0deg) scaleX(1); }
    to { transform: rotate(360deg) scaleX(0.7); }
}

@keyframes spin2 {
    from { transform: rotate(0deg) scaleY(1); }
    to { transform: rotate(360deg) scaleY(0.7); }
}

.nova-label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--cyan-glow);
}

.nova-status {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--green);
}

.nova-dialogue-box {
    flex: 1;
}

.dialogue-speaker {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.mood-danger { color: var(--red); }
.mood-nova { color: var(--cyan-glow); }
.mood-mission { color: var(--gold); }

.dialogue-text {
    font-size: 1.15rem;
    line-height: 1.6;
    min-height: 90px;
    color: var(--text-primary);
}

.dialogue-prompt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 14px;
    font-family: var(--font-mono);
}

.cinematic-footer {
    display: flex;
    justify-content: flex-end;
}

/* WORLD MAP */
.world-map-container {
    align-items: flex-start;
}

.map-inner {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
}

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

.map-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    letter-spacing: 2px;
}

.map-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.core-stabilizer-bar {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 24px;
}

.core-bar-label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.highlight-cyan {
    color: var(--cyan-glow);
}

.progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-glow) 0%, #10b981 100%);
}

.worlds-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.world-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.world-card.unlocked {
    border-color: var(--cyan-glow);
    cursor: pointer;
}

.world-card.unlocked:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 210, 211, 0.25);
}

.world-card.locked {
    opacity: 0.65;
}

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

.world-icon {
    font-size: 2rem;
}

.world-badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-heading);
}

.badge-active { background: rgba(46, 204, 113, 0.2); color: var(--green); }
.badge-locked { background: rgba(255, 255, 255, 0.1); color: var(--text-secondary); }

.world-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cyan-glow);
    margin-bottom: 2px;
}

.world-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.world-topic {
    font-size: 0.85rem;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 10px;
}

.world-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 12px;
}

.world-curriculum {
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 14px;
    color: #cbd5e1;
}

/* SCIENCE LAB */
.science-lab-container {
    align-items: center;
}

.lab-inner {
    max-width: 1160px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 14px;
    padding: 26px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
}

.lab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
}

.lab-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.lab-subtitle {
    color: var(--cyan-glow);
    font-size: 0.9rem;
}

.lab-workbench {
    display: flex;
    gap: 20px;
}

.lab-canvas-wrapper {
    position: relative;
    background: #050811;
    border: 1px solid rgba(0, 210, 211, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

#lab-canvas {
    display: block;
}

.lab-canvas-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    display: flex;
    gap: 8px;
}

.legend-pill {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

.tension-pill { background: rgba(52, 152, 219, 0.3); color: #3498db; }
.comp-pill { background: rgba(231, 76, 60, 0.3); color: #e74c3c; }
.react-pill { background: rgba(46, 204, 113, 0.3); color: #2ecc71; }

.lab-control-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.control-box {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 14px;
}

.control-box h4 {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    color: var(--cyan-glow);
    margin-bottom: 10px;
}

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

.preset-btn {
    text-align: left;
    font-size: 0.78rem;
    padding: 8px 12px;
}

.preset-btn.active {
    border-color: var(--cyan-glow);
    background: var(--cyan-dim);
}

.slider-row {
    margin-bottom: 10px;
}

.slider-row label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.slider-row strong {
    color: #fff;
    font-family: var(--font-mono);
}

.slider-row input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.cur-card {
    background: rgba(15, 23, 42, 0.8);
    border-left: 3px solid var(--gold);
}

.curriculum-body {
    font-size: 0.85rem;
    line-height: 1.45;
    color: #cbd5e1;
}

.curriculum-body strong {
    color: var(--gold);
    display: block;
    margin-bottom: 4px;
}

/* DEBRIEF REPORT */
.debrief-container {
    align-items: center;
}

.debrief-inner {
    max-width: 820px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

.debrief-header {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
}

.header-success .status-badge {
    background: rgba(46, 204, 113, 0.2);
    color: var(--green);
    border: 1px solid var(--green);
}

.header-failed .status-badge {
    background: rgba(231, 76, 60, 0.2);
    color: var(--red);
    border: 1px solid var(--red);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.debrief-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.sector-tag {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.debrief-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.metric-val {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.metric-sub {
    font-size: 0.72rem;
    color: #94a3b8;
}

.val-danger { color: var(--red); }
.val-good { color: var(--green); }

.debrief-science-box {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(0, 210, 211, 0.3);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.science-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--cyan-glow);
    margin-bottom: 8px;
}

.equation-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--gold);
    margin-bottom: 8px;
}

.science-body p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.debrief-quiz-box {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(243, 156, 18, 0.4);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.quiz-title {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--gold);
    margin-bottom: 6px;
}

.quiz-question {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.quiz-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.quiz-option-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: var(--cyan-glow);
}

.option-letter {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--cyan-glow);
    width: 20px;
}

.quiz-option-btn.option-correct {
    background: rgba(46, 204, 113, 0.25) !important;
    border-color: var(--green) !important;
}

.quiz-option-btn.option-incorrect {
    background: rgba(231, 76, 60, 0.25) !important;
    border-color: var(--red) !important;
}

.quiz-feedback {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    font-size: 0.88rem;
    line-height: 1.4;
    color: #e2e8f0;
}

.debrief-actions-bar {
    display: flex;
    gap: 14px;
}

.debrief-actions-bar button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    text-align: center;
}

.debrief-actions-bar small {
    font-size: 0.72rem;
    opacity: 0.8;
    margin-top: 4px;
    font-weight: 400;
}

/* ACHIEVEMENTS */
.achievements-inner {
    max-width: 850px;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    padding: 26px;
}

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

.achievements-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
}

.achievements-sub {
    color: var(--cyan-glow);
    font-size: 0.9rem;
}

.level-progress-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.level-badge {
    padding: 10px 16px;
    background: linear-gradient(135deg, var(--gold) 0%, #e67e22 100%);
    border-radius: 8px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 900;
    color: #000;
}

.level-info {
    flex: 1;
}

.level-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.level-bar-track {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
}

.level-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan-glow) 0%, var(--green) 100%);
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.badge-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 12px;
}

.badge-unlocked {
    border-color: var(--cyan-glow);
}

.badge-locked {
    opacity: 0.45;
}

.badge-icon {
    font-size: 2rem;
}

.badge-info h4 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.badge-info p {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.badge-status-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    margin-left: auto;
}

.badge-unlocked .badge-status-tag {
    background: rgba(46, 204, 113, 0.2);
    color: var(--green);
}

.badge-locked .badge-status-tag {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* ACHIEVEMENT TOAST */
.achievement-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--cyan-glow);
    border-radius: 8px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 10px 30px rgba(0, 210, 211, 0.3);
    z-index: 100;
    transform: translateX(120%);
    transition: transform 0.35s ease;
}

.achievement-toast.visible {
    transform: translateX(0);
}

.toast-icon {
    font-size: 2.2rem;
}

.toast-tag {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    letter-spacing: 1.5px;
    color: var(--gold);
}

.toast-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.toast-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ========================================================
   GUIDE MODAL STYLES
   ======================================================== */
.guide-container {
    align-items: center;
}

.guide-inner {
    max-width: 920px;
    width: 100%;
    max-height: 85vh;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 12px;
    padding: 26px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.85);
}

.guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.guide-header h2 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    color: var(--cyan-glow);
}

.guide-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.guide-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
}

.guide-tab-btn {
    padding: 8px 16px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guide-tab-btn:hover {
    background: rgba(0, 210, 211, 0.15);
    color: #fff;
    border-color: var(--cyan-glow);
}

.guide-tab-btn.active {
    background: var(--cyan-dim);
    color: var(--cyan-glow);
    border-color: var(--cyan-glow);
    font-weight: 700;
}

.guide-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 12px;
    line-height: 1.55;
    font-size: 0.92rem;
    color: #cbd5e1;
}

.guide-section h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--gold);
    margin: 16px 0 10px 0;
}

.guide-list {
    margin-left: 20px;
    margin-bottom: 16px;
}

.guide-list li {
    margin-bottom: 8px;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 20px 0;
    font-size: 0.85rem;
}

.guide-table th, .guide-table td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 12px;
    text-align: left;
}

.guide-table th {
    background: rgba(30, 41, 59, 0.8);
    font-family: var(--font-heading);
    color: var(--cyan-glow);
    font-size: 0.78rem;
}

.guide-table tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.5);
}

.solution-card, .quiz-expl-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 3px solid var(--cyan-glow);
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 14px;
}

.solution-card h4, .quiz-expl-card h4 {
    font-family: var(--font-heading);
    font-size: 0.92rem;
    color: #fff;
    margin-bottom: 8px;
}

.correct-badge {
    color: var(--green);
    font-weight: 700;
    margin-bottom: 4px;
}

/* Blueprint Studio Styles in Guide Modal */
.blueprint-controls-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.bp-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.bp-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bp-pill {
    padding: 6px 14px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 20px;
    color: #cbd5e1;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bp-pill:hover {
    border-color: var(--cyan-glow);
    background: var(--cyan-dim);
    color: #fff;
}

.bp-pill.active {
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.3) 0%, rgba(14, 165, 233, 0.4) 100%);
    border-color: var(--cyan-glow);
    color: var(--cyan-glow);
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 210, 211, 0.3);
}

.blueprint-canvas-wrapper {
    position: relative;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 8px;
    overflow: hidden;
    background: #0a192f;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 210, 211, 0.05);
    margin-bottom: 10px;
}

#blueprint-canvas {
    display: block;
    width: 100%;
}

.blueprint-watermark {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(0, 210, 211, 0.35);
    letter-spacing: 1px;
    pointer-events: none;
}

.blueprint-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 14px;
}

.bp-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.bp-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.bp-steps-card {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(0, 210, 211, 0.25);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    padding: 16px 20px;
}

.bp-steps-card h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--gold);
    margin-bottom: 12px;
}

.bp-steps-list {
    margin-left: 20px;
}

.bp-steps-list li {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 0.9rem;
}

/* Ghost Blueprint Button */
.ghost-btn {
    border-color: #a855f7 !important;
    color: #c084fc !important;
}

.ghost-btn:hover, .ghost-btn.active {
    background: rgba(168, 85, 247, 0.25) !important;
    border-color: #c084fc !important;
    color: #fff !important;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

/* ==========================================================================
   THEORY QUIZ ASSESSMENT MODAL (≥ 80% SCORE REQUIREMENT)
   ========================================================================== */
.theory-quiz-container {
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 22, 0.94);
    backdrop-filter: blur(12px);
    padding: 20px;
}

.theory-quiz-inner {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.98), rgba(10, 15, 28, 0.99));
    border: 1px solid rgba(168, 85, 247, 0.45);
    box-shadow: 0 0 40px rgba(168, 85, 247, 0.25), 0 25px 50px -12px rgba(0, 0, 0, 0.9);
    border-radius: 14px;
    width: 95%;
    max-width: 860px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.theory-quiz-header {
    padding: 24px 28px 18px 28px;
    border-bottom: 1px solid rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.06);
}

.quiz-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.quiz-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid #a855f7;
    color: #e9d5ff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    letter-spacing: 0.08em;
}

.quiz-threshold-tag {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    padding: 3px 10px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.theory-quiz-header h2 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    color: #fff;
    margin: 4px 0 6px 0;
    letter-spacing: 0.05em;
    text-shadow: 0 0 12px rgba(168, 85, 247, 0.4);
}

.quiz-sub {
    font-size: 0.92rem;
    color: #94a3b8;
    line-height: 1.4;
}

.theory-quiz-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.theory-questions-scroll {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.theory-q-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 10px;
    padding: 18px 20px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.theory-q-card:hover {
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.theory-q-num {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #a855f7;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: 0.08em;
}

.theory-topic-pill {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.theory-q-title {
    font-family: var(--font-main);
    font-size: 1.05rem;
    font-weight: 600;
    color: #f1f5f9;
    line-height: 1.45;
    margin-bottom: 14px;
}

.theory-opt-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.theory-opt-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.theory-opt-label:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateX(4px);
}

.theory-opt-label input[type="radio"] {
    margin-top: 4px;
    accent-color: #a855f7;
    cursor: pointer;
}

.opt-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #38bdf8;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}

.opt-text {
    font-size: 0.94rem;
    color: #cbd5e1;
    line-height: 1.4;
}

.theory-opt-label input[type="radio"]:checked ~ .opt-indicator {
    background: #a855f7;
    color: #fff;
    border-color: #c084fc;
}

.theory-opt-label input[type="radio"]:checked ~ .opt-text {
    color: #fff;
    font-weight: 600;
}

.theory-quiz-footer {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

/* Results Card */
.theory-results-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 22px 26px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.theory-results-card.res-pass {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(6, 78, 59, 0.25));
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
}

.theory-results-card.res-fail {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(127, 29, 29, 0.25));
    border: 1px solid rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
}

.score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(10, 15, 28, 0.9);
    border: 3px solid;
    flex-shrink: 0;
}

.res-pass .score-circle {
    border-color: #10b981;
    color: #34d399;
}

.res-fail .score-circle {
    border-color: #ef4444;
    color: #f87171;
}

.score-num {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 700;
}

.score-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.res-message h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin: 0 0 8px 0;
}

.res-pass .res-message h3 {
    color: #34d399;
}

.res-fail .res-message h3 {
    color: #f87171;
}

.res-message p {
    font-size: 0.92rem;
    color: #cbd5e1;
    line-height: 1.5;
    margin: 0;
}

/* Review List */
.theory-review-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
}

.review-item {
    background: rgba(15, 23, 42, 0.7);
    border-radius: 8px;
    padding: 14px 18px;
    border-left: 4px solid;
}

.review-item.rev-correct {
    border-left-color: #10b981;
}

.review-item.rev-incorrect {
    border-left-color: #ef4444;
}

.rev-header {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.rev-correct .rev-header {
    color: #34d399;
}

.rev-incorrect .rev-header {
    color: #f87171;
}

.rev-q {
    font-size: 0.92rem;
    color: #e2e8f0;
    margin-bottom: 8px;
}

.rev-expl {
    font-size: 0.88rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.35);
    padding: 8px 12px;
    border-radius: 5px;
    line-height: 1.45;
}

.rev-expl strong {
    color: #38bdf8;
}

/* ========================================================
   CHALLENGE 2: THE RUNAWAY TRAIN LAB
   ======================================================== */
.train-challenge-container {
    align-items: center;
    justify-content: center;
    background: rgba(4, 8, 18, 0.96);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.train-inner {
    max-width: 980px;
    width: 95vw;
    background: #0b1329;
    border: 1px solid rgba(0, 242, 254, 0.35);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 0 40px rgba(0, 242, 254, 0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    max-height: 94vh;
    overflow-y: auto;
}

.train-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
}

.train-sector-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cyan-glow);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.train-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin: 0 0 4px 0;
    color: #fff;
    letter-spacing: 1px;
}

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

.train-top-actions {
    display: flex;
    gap: 10px;
}

.train-canvas-wrapper {
    position: relative;
    background: #050b14;
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 8px;
    overflow: hidden;
}

#train-sim-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.train-watermark {
    position: absolute;
    top: 8px;
    right: 12px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: rgba(56, 189, 248, 0.4);
    letter-spacing: 1px;
}

.train-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.train-card {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
}

.card-header-bar {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--cyan-glow);
    letter-spacing: 1px;
    border-bottom: 1px dashed rgba(56, 189, 248, 0.25);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.train-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin-bottom: 14px;
}

.t-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.t-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.t-metric strong {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #fff;
}

.formula-box {
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid var(--gold);
    padding: 10px 14px;
    border-radius: 4px;
}

.formula-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 4px;
}

.formula-body code {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #e2e8f0;
}

.control-row {
    margin-bottom: 14px;
}

.control-row label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.strategy-pills {
    display: flex;
    gap: 6px;
}

.strat-pill {
    flex: 1;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-size: 0.74rem;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.strat-pill:hover {
    color: #fff;
    background: rgba(56, 189, 248, 0.15);
}

.strat-pill.active {
    background: var(--cyan-glow);
    color: #030712;
    border-color: var(--cyan-glow);
    font-weight: 700;
}

.abs-row {
    background: rgba(0, 0, 0, 0.25);
    padding: 10px;
    border-radius: 6px;
}

.toggle-container {
    display: flex !important;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.toggle-container input {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.toggle-text {
    font-size: 0.76rem;
    color: #cbd5e1;
}

.train-actions-bar {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.engage-btn {
    flex: 2;
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    font-size: 0.95rem;
}

.engage-btn:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

/* Train Result Modal Overlay */
.train-result-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.train-result-box {
    max-width: 620px;
    width: 90%;
    background: #0f172a;
    border: 1px solid var(--cyan-glow);
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.3s ease;
}

.res-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.res-header.res-win h3 {
    color: #34d399;
    font-family: var(--font-heading);
    margin: 0 0 6px 0;
}

.res-header.res-fail h3 {
    color: #f87171;
    font-family: var(--font-heading);
    margin: 0 0 6px 0;
}

.res-sub {
    font-size: 0.88rem;
    color: #cbd5e1;
    line-height: 1.45;
}

.res-science-review {
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid #38bdf8;
    padding: 12px;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 0.84rem;
    color: #94a3b8;
    line-height: 1.5;
}

.res-science-review strong {
    color: #38bdf8;
    display: block;
    margin-bottom: 4px;
}

.res-science-review code {
    color: var(--gold);
}

.res-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}
