:root {
    --lcars-orange: #ff9966;
    --lcars-peach: #ffcc99;
    --lcars-red: #cc6666;
    --lcars-purple: #cc99cc;
    --lcars-blue: #9999ff;
    --lcars-sky: #99ccff;
    --lcars-tan: #ffcc99;
    --lcars-gold: #ffaa00;
    --background: #000000;
    --surface: #1a1a2e;
    --surface-light: #2d2d44;
    --text-primary: #ffffff;
    --text-secondary: #ccccff;
    --border-color: #9999ff;

    --rag-red: #cc3333;
    --rag-amber: #ff9900;
    --rag-green: #33cc66;
}

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

body {
    font-family: 'Antonio', 'Orbitron', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.4;
    overflow-x: hidden;
}

/* ─── SCREENS ─── */
.screen { display: none; min-height: 100vh; }
.screen.active {
    display: block;
    animation: screenFadeIn 0.4s ease;
}
@keyframes screenFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

/* ─── INSTRUCTOR PANEL ─── */
.instructor-panel {
    position: fixed;
    top: 0; right: -400px;
    width: 400px; height: 100vh;
    background: linear-gradient(180deg, var(--surface) 0%, #0d0d1a 100%);
    box-shadow: -4px 0 40px rgba(153,153,255,0.3);
    transition: right 0.4s cubic-bezier(0.4,0,0.2,1);
    z-index: 1000;
    padding: 30px;
    overflow-y: auto;
    border-left: 4px solid var(--lcars-blue);
}
.instructor-panel.visible { right: 0; }
.instructor-panel.hidden { right: -400px; }

.toggle-instructor {
    position: fixed; top: 20px; right: 20px;
    z-index: 1001;
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lcars-purple), var(--lcars-blue));
    border: 3px solid var(--lcars-blue);
    cursor: pointer; font-size: 1.8rem;
    transition: all 0.3s;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(153,153,255,0.5);
}
.toggle-instructor:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 6px 30px rgba(153,153,255,0.8);
}

.instructor-content h3 {
    margin-bottom: 20px;
    color: var(--lcars-orange);
    font-family: 'Antonio', sans-serif;
    font-size: 1.6rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 3px solid var(--lcars-purple);
    padding-bottom: 10px;
}

.weight-item {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(153,153,255,0.08);
    border-radius: 0 10px 0 10px;
    border-left: 3px solid var(--lcars-orange);
}
.weight-item label {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}
.weight-item input {
    width: 100%;
    padding: 10px;
    background: var(--background);
    border: 2px solid var(--lcars-blue);
    border-radius: 5px;
    color: var(--text-primary);
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
}
.weight-item input:focus {
    outline: none;
    border-color: var(--lcars-orange);
    box-shadow: 0 0 12px rgba(255,153,102,0.4);
}

/* ─── VARIABILITY CONTROL ─── */
.variability-control {
    margin: 20px 0;
    padding: 15px;
    background: rgba(153,153,255,0.08);
    border-radius: 0 10px 0 10px;
    border-left: 3px solid var(--lcars-purple);
}
.variability-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-family: 'Antonio', sans-serif;
    font-size: 1.2rem;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    user-select: none;
}
.variability-label input[type="checkbox"] {
    display: none;
}
.variability-check {
    width: 28px; height: 28px;
    border: 3px solid var(--lcars-purple);
    border-radius: 4px;
    background: var(--background);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all 0.25s;
}
.variability-check::after {
    content: '';
    width: 14px; height: 14px;
    border-radius: 2px;
    background: var(--lcars-purple);
    transform: scale(0);
    transition: transform 0.2s ease;
}
.variability-label input[type="checkbox"]:checked + .variability-check {
    border-color: var(--lcars-orange);
    box-shadow: 0 0 12px rgba(255,153,102,0.4);
}
.variability-label input[type="checkbox"]:checked + .variability-check::after {
    background: var(--lcars-orange);
    transform: scale(1);
}
.variability-options {
    display: flex; gap: 12px;
    margin-top: 12px;
    padding-left: 40px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}
.variability-options.active {
    max-height: 50px;
    opacity: 1;
}
.variability-option {
    display: flex; align-items: center; gap: 8px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 4px;
    background: var(--background);
    border: 2px solid var(--surface-light);
    transition: all 0.2s;
}
.variability-option:has(input:checked) {
    border-color: var(--lcars-orange);
    color: var(--lcars-orange);
    box-shadow: 0 0 10px rgba(255,153,102,0.3);
}
.variability-option input[type="radio"] {
    accent-color: var(--lcars-orange);
    width: 16px; height: 16px;
}

/* ─── MISSION HEADER ─── */
.mission-header {
    text-align: center;
    padding: 30px 0 40px;
    position: relative;
}
.mission-header::after {
    content: '';
    position: absolute; bottom: 0; left: 10%; right: 10%;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--lcars-orange) 20%, var(--lcars-blue) 50%, var(--lcars-purple) 80%, transparent);
}
.mission-header h1 {
    font-family: 'Antonio', sans-serif;
    font-size: 5rem; font-weight: 700;
    background: linear-gradient(135deg, var(--lcars-orange), var(--lcars-peach), var(--lcars-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 10px; text-transform: uppercase;
}
.mission-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    color: var(--text-secondary);
    letter-spacing: 6px;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ─── RESOURCE DISPLAY ─── */
.resources-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin: 30px 60px 40px;
}
.resource-bar {
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    padding: 25px 30px;
    border-radius: 0 25px 0 25px;
    border-left: 5px solid var(--lcars-orange);
    border-right: 5px solid var(--lcars-purple);
    box-shadow: 0 6px 24px rgba(153,153,255,0.15);
}
.resource-label {
    font-family: 'Antonio', sans-serif;
    font-size: 1.6rem; font-weight: 700;
    color: var(--lcars-orange);
    letter-spacing: 3px;
    text-align: center;
    text-transform: uppercase;
    margin-bottom: 15px;
}
.resource-meter {
    position: relative;
    height: 55px;
    background: var(--background);
    border-radius: 0 28px 0 28px;
    overflow: hidden;
    border: 3px solid var(--lcars-blue);
    box-shadow: inset 0 3px 15px rgba(0,0,0,0.5);
}
.meter-fill {
    position: absolute; top: 0; left: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--lcars-orange), var(--lcars-peach));
    box-shadow: 0 0 15px rgba(255,153,102,0.5);
    transition: all 0.5s cubic-bezier(0.4,0,0.2,1);
    border-radius: 0 28px 0 0;
}
.meter-fill::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* JS applies these classes */
.meter-fill.warning {
    background: linear-gradient(90deg, var(--lcars-gold), var(--lcars-orange));
    box-shadow: 0 0 20px rgba(255,170,0,0.6);
}
.meter-fill.danger {
    background: linear-gradient(90deg, var(--lcars-red), #ff4444);
    box-shadow: 0 0 20px rgba(204,51,51,0.7);
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.75; }
}

.meter-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem; font-weight: 900;
    color: #fff;
    text-shadow: 0 0 8px rgba(255,255,255,0.7), 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 10;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* ─── STORY GRID ─── */
.story-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 12px;
    padding: 10px 20px;
    margin-bottom: 30px;
}
.story-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    border: 3px solid var(--lcars-blue);
    border-radius: 0 18px 0 18px;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    position: relative; overflow: hidden;
    padding: 8px;
}
.story-number {
    font-family: 'Antonio', sans-serif;
    font-size: 3.2rem; font-weight: 700;
    color: var(--text-secondary);
    line-height: 1;
}
.story-costs {
    display: flex; gap: 6px;
    margin-top: 4px;
}
.cost-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    color: var(--lcars-purple);
    background: rgba(153,153,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.story-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 5px;
    background: var(--lcars-purple);
    transform: scaleX(0);
    transition: transform 0.25s;
}
.story-card:hover {
    transform: scale(1.08);
    border-color: var(--lcars-orange);
    box-shadow: 0 0 30px rgba(255,153,102,0.5);
}
.story-card:hover .story-number { color: var(--lcars-orange); }
.story-card:hover::before { transform: scaleX(1); }

.story-card.selected {
    background: linear-gradient(135deg, var(--lcars-orange), var(--lcars-peach));
    border-color: var(--lcars-gold);
    box-shadow: 0 0 35px rgba(255,153,102,0.7);
}
.story-card.selected .story-number { color: #000; font-weight: 900; }
.story-card.selected .cost-badge {
    color: #000; background: rgba(0,0,0,0.15);
}
.story-card.selected::before {
    background: var(--lcars-gold); transform: scaleX(1);
}

/* ─── ACTION BAR (Selection Screen) ─── */
.action-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 30px;
    padding: 0 40px;
}

.btn-launch {
    font-family: 'Antonio', sans-serif;
    font-size: 2.8rem; font-weight: 700;
    padding: 25px 70px;
    background: linear-gradient(135deg, var(--lcars-orange), var(--lcars-red));
    color: #000; border: none;
    border-radius: 0 35px 0 35px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 5px;
    transition: all 0.3s;
    box-shadow: 0 8px 35px rgba(255,153,102,0.6);
    position: relative; overflow: hidden;
}
.btn-launch::before {
    content: '';
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.25) 50%, transparent 70%);
    animation: launchShine 3s infinite;
}
@keyframes launchShine {
    0%   { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.btn-launch:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 50px rgba(255,153,102,0.9);
}

.btn-clear {
    font-family: 'Antonio', sans-serif;
    font-size: 1.4rem;
    padding: 18px 40px;
    background: transparent;
    color: var(--lcars-red);
    border: 3px solid var(--lcars-red);
    border-radius: 0 20px 0 20px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
}
.btn-clear:hover {
    background: var(--lcars-red); color: #000;
    box-shadow: 0 6px 25px rgba(204,102,102,0.5);
}

.btn-secondary {
    font-family: 'Antonio', sans-serif;
    font-size: 1.4rem;
    padding: 18px 40px;
    background: transparent;
    color: var(--lcars-blue);
    border: 3px solid var(--lcars-blue);
    border-radius: 0 20px 0 20px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
}
.btn-secondary:hover {
    background: var(--lcars-blue); color: #000;
    box-shadow: 0 6px 25px rgba(153,153,255,0.5);
}

/* ─── LAUNCH SEQUENCE ─── */
.launch-sequence {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, var(--surface) 0%, var(--background) 70%);
    position: relative;
}
.launch-sequence::before,
.launch-sequence::after {
    content: '';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    opacity: 0.3;
    animation: radarPulse 2s infinite;
}
.launch-sequence::before {
    width: 600px; height: 600px;
    border: 2px solid var(--lcars-blue);
}
.launch-sequence::after {
    width: 400px; height: 400px;
    border: 2px solid var(--lcars-orange);
    animation-delay: 0.5s;
}
@keyframes radarPulse {
    0%   { transform: translate(-50%,-50%) scale(0.8); opacity: 0.5; }
    100% { transform: translate(-50%,-50%) scale(1.4); opacity: 0; }
}

.countdown-display {
    font-family: 'Antonio', sans-serif;
    font-size: 28rem; font-weight: 900;
    color: var(--lcars-orange);
    text-shadow:
        0 0 60px rgba(255,153,102,0.9),
        0 0 120px rgba(255,153,102,0.5);
    animation: countdownPulse 1s infinite;
    z-index: 10; position: relative;
    line-height: 1;
}
@keyframes countdownPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.08); }
}

.launch-status {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    color: var(--text-secondary);
    letter-spacing: 10px;
    text-transform: uppercase;
    z-index: 10; position: relative;
    text-shadow: 0 0 20px rgba(153,153,255,0.5);
}

/* ─── RESULTS SCREEN ─── */
.results-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── LEFT: Outcome Ladder ── */
.outcome-panel {
    display: flex; flex-direction: column;
    background: var(--background);
    padding: 20px;
    border-right: 3px solid var(--surface-light);
}

.outcome-ladder {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
}

/* ── Individual Band ── */
.outcome-band {
    display: flex;
    align-items: center;
    padding: 14px 30px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    animation: bandSlideIn 0.4s ease forwards;
}
.outcome-band:nth-child(1) { animation-delay: 0.1s; }
.outcome-band:nth-child(2) { animation-delay: 0.25s; }
.outcome-band:nth-child(3) { animation-delay: 0.4s; }
.outcome-band:nth-child(4) { animation-delay: 0.55s; }

@keyframes bandSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Inactive bands: dimmed, thin */
.outcome-band:not(.active) {
    min-height: 60px;
    filter: brightness(0.45) saturate(0.4);
    border-radius: 0 8px 0 8px;
}
.outcome-band:not(.active):hover {
    filter: brightness(0.65) saturate(0.6);
}

/* Active band: expanded, vivid */
.outcome-band.active {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 30px;
    border-radius: 0 20px 0 20px;
    position: relative;
}
.outcome-band.active::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0.12;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 4px,
        rgba(255,255,255,0.04) 4px, rgba(255,255,255,0.04) 5px
    );
    pointer-events: none;
}

/* Band header (inactive) */
.band-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.band-label {
    font-family: 'Antonio', sans-serif;
    font-size: 1.4rem; font-weight: 700;
    color: rgba(255,255,255,0.85);
    letter-spacing: 3px;
    text-transform: uppercase;
}
.band-range {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 2px;
}

/* Active band elements */
.band-marker {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    margin-bottom: 15px;
    animation: markerPulse 2s ease-in-out infinite;
    position: relative; z-index: 1;
}
.band-icon {
    font-size: 5rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 30px rgba(255,255,255,0.3));
    animation: iconFloat 3s ease-in-out infinite;
    position: relative; z-index: 1;
}
@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}
.band-active-label {
    font-family: 'Antonio', sans-serif;
    font-size: 3.8rem; font-weight: 900;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 6px;
    line-height: 1.1;
    text-shadow: 0 0 30px rgba(255,255,255,0.3), 2px 2px 6px rgba(0,0,0,0.6);
    margin-bottom: 12px;
    position: relative; z-index: 1;
}
.band-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem; font-weight: 700;
    letter-spacing: 5px;
    margin-bottom: 8px;
    position: relative; z-index: 1;
}
.band-score-breakdown {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem; font-weight: 400;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 12px;
    position: relative; z-index: 1;
}
.band-description {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: rgba(255,255,255,0.7);
    letter-spacing: 2px;
    line-height: 1.6;
    max-width: 500px;
    position: relative; z-index: 1;
}

@keyframes markerPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ── Band Colors ── */
/* Blue — Mission Success (best) */
.band-mission-success {
    background: linear-gradient(135deg, #0a1a3e, #1a3366);
    border-left: 5px solid #4488ff;
}
.band-mission-success.active {
    background: linear-gradient(160deg, #060e22 0%, #1a4488 40%, #060e22 100%);
    border-left: 8px solid #4488ff;
    box-shadow: inset 0 0 120px rgba(68,136,255,0.12);
}
.band-mission-success .band-marker,
.band-mission-success .band-score { color: #66aaff; }

/* Green — Launch Approved */
.band-launch-approved {
    background: linear-gradient(135deg, #0a2e0a, #1a4c1a);
    border-left: 5px solid #33cc66;
}
.band-launch-approved.active {
    background: linear-gradient(160deg, #061e06 0%, #1a5c1a 40%, #061e06 100%);
    border-left: 8px solid #33cc66;
    box-shadow: inset 0 0 120px rgba(51,204,102,0.12);
}
.band-launch-approved .band-marker,
.band-launch-approved .band-score { color: #44dd77; }

/* Yellow — Marginal Clearance */
.band-marginal-clearance {
    background: linear-gradient(135deg, #2e1a00, #4c3300);
    border-left: 5px solid #ffaa00;
}
.band-marginal-clearance.active {
    background: linear-gradient(160deg, #1e1000 0%, #5c3300 40%, #1e1000 100%);
    border-left: 8px solid #ffaa00;
    box-shadow: inset 0 0 120px rgba(255,170,0,0.12);
}
.band-marginal-clearance .band-marker,
.band-marginal-clearance .band-score { color: #ffbb33; }

/* Red — Catastrophic Failure (worst) */
.band-catastrophic-failure {
    background: linear-gradient(135deg, #661111, #991111);
    border-left: 5px solid #ff4444;
}
.band-catastrophic-failure.active {
    background: linear-gradient(160deg, #5a0a0a 0%, #bb2222 40%, #5a0a0a 100%);
    border-left: 8px solid #ff4444;
    box-shadow: inset 0 0 120px rgba(255,68,68,0.4);
    animation: failureBandFlash 1.5s infinite;
    opacity: 1 !important; /* Override base opacity: 0 since custom animation replaces bandSlideIn */
}
.band-catastrophic-failure .band-marker,
.band-catastrophic-failure .band-score { color: #ff8888; }

@keyframes failureBandFlash {
    0%, 100% { box-shadow: inset 0 0 120px rgba(255,68,68,0.4); }
    50%      { box-shadow: inset 0 0 120px rgba(255,100,100,0.6); }
}

.results-action-bar {
    margin-top: 20px;
    padding: 0 30px;
    position: relative; z-index: 1;
    text-align: center;
}

/* ── RIGHT: Systems Panel ── */
.systems-panel {
    background: var(--background);
    padding: 40px 35px;
    display: flex; flex-direction: column;
    overflow-y: auto;
    min-width: 0; /* Prevent grid blowout */
    position: relative;
    z-index: 1;
}
.systems-header {
    font-family: 'Antonio', sans-serif;
    font-size: 2.4rem; font-weight: 700;
    color: var(--lcars-orange);
    text-transform: uppercase;
    letter-spacing: 5px;
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 4px solid var(--lcars-purple);
    position: relative;
    z-index: 2;
}

.system-list {
    display: flex; flex-direction: column;
    gap: 14px;
    flex: 1;
}

.system-row {
    display: flex; align-items: center;
    gap: 20px;
    padding: 18px 25px;
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    border-radius: 0 18px 0 18px;
    position: relative;
    overflow: hidden;
    animation: rowSlideIn 0.4s ease forwards;
    opacity: 1; /* Changed from 0 to 1 to ensure visibility */
    z-index: 2;
}
@keyframes rowSlideIn {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}
.system-row:nth-child(1) { animation-delay: 0.15s; }
.system-row:nth-child(2) { animation-delay: 0.30s; }
.system-row:nth-child(3) { animation-delay: 0.45s; }
.system-row:nth-child(4) { animation-delay: 0.60s; }
.system-row:nth-child(5) { animation-delay: 0.75s; }
.system-row:nth-child(6) { animation-delay: 0.90s; }
.system-row:nth-child(7) { animation-delay: 1.05s; }

/* RAG stripe on left */
.system-row::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 6px;
}
.system-row.rag-green::before  { background: var(--rag-green); }
.system-row.rag-amber::before  { background: var(--rag-amber); }
.system-row.rag-red::before    { background: var(--rag-red); }

/* RAG dot */
.rag-dot {
    width: 44px; height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.rag-green .rag-dot {
    background: radial-gradient(circle, var(--rag-green), #1a6633);
    box-shadow: 0 0 25px rgba(51,204,102,0.6);
}
.rag-amber .rag-dot {
    background: radial-gradient(circle, var(--rag-amber), #996600);
    box-shadow: 0 0 25px rgba(255,153,0,0.6);
    animation: amberPulse 1.5s infinite;
}
.rag-red .rag-dot {
    background: radial-gradient(circle, var(--rag-red), #661111);
    box-shadow: 0 0 25px rgba(204,51,51,0.6);
    animation: redPulse 0.8s infinite;
}
@keyframes amberPulse {
    0%, 100% { box-shadow: 0 0 25px rgba(255,153,0,0.6); }
    50%      { box-shadow: 0 0 45px rgba(255,153,0,0.9); }
}
@keyframes redPulse {
    0%, 100% { box-shadow: 0 0 25px rgba(204,51,51,0.6); }
    50%      { box-shadow: 0 0 45px rgba(255,0,0,0.9); }
}

.system-info {
    flex: 1;
}
.system-name {
    font-family: 'Antonio', sans-serif;
    font-size: 1.8rem; font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.2;
}
.system-comment {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.rag-label {
    font-family: 'Antonio', sans-serif;
    font-size: 1.4rem; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}
.rag-green .rag-label  { color: var(--rag-green); }
.rag-amber .rag-label  { color: var(--rag-amber); }
.rag-red .rag-label    { color: var(--rag-red); }

/* ─── MODAL ─── */
.modal {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 2000;
    justify-content: center; align-items: center;
}
.modal.active { display: flex; }
.modal.hidden { display: none; }

.modal-content {
    background: linear-gradient(135deg, var(--surface), var(--surface-light));
    padding: 50px;
    border-radius: 0 40px 0 40px;
    max-width: 900px; width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border: 5px solid var(--lcars-orange);
    position: relative;
    animation: modalSlideIn 0.4s ease;
}
@keyframes modalSlideIn {
    from { transform: translateY(-40px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-close {
    position: absolute; top: 15px; right: 20px;
    font-size: 2.5rem;
    background: transparent; border: none;
    color: var(--lcars-orange);
    cursor: pointer; transition: all 0.3s;
}
.modal-close:hover {
    color: #fff;
    transform: rotate(90deg);
}

.modal-body h2 {
    font-family: 'Antonio', sans-serif;
    font-size: 2.5rem;
    color: var(--lcars-orange);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 25px;
    border-bottom: 3px solid var(--lcars-purple);
    padding-bottom: 10px;
}

.detail-story {
    padding: 20px;
    margin-bottom: 15px;
    background: rgba(153,153,255,0.08);
    border-radius: 0 15px 0 15px;
    border-left: 4px solid var(--lcars-blue);
}
.detail-story.selected {
    border-left-color: var(--lcars-orange);
    background: rgba(255,153,102,0.1);
}
.detail-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 10px;
}
.detail-id {
    font-family: 'Antonio', sans-serif;
    font-size: 1.8rem; font-weight: 700;
    color: var(--lcars-orange);
}
.detail-costs { display: flex; gap: 10px; }
.detail-costs .cost-badge {
    font-size: 0.85rem;
    padding: 4px 10px;
}
.detail-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem; color: var(--text-primary);
    margin-bottom: 8px;
}
.detail-stakeholder {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem; color: var(--lcars-purple);
    margin-bottom: 8px;
}
.detail-story-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem; color: var(--text-secondary);
    line-height: 1.6;
}

/* ─── DEBUG ─── */
.debug-info {
    margin-top: 30px; padding: 25px;
    background: rgba(204,102,102,0.1);
    border-radius: 0 15px 0 15px;
    border: 2px solid var(--lcars-red);
}
.debug-info h3 {
    font-family: 'Antonio', sans-serif;
    font-size: 1.6rem; color: var(--lcars-red);
    text-transform: uppercase; margin-bottom: 15px;
}
.debug-info pre {
    font-family: 'Orbitron', monospace;
    font-size: 0.85rem;
    background: var(--background);
    padding: 15px; border-radius: 8px;
    overflow-x: auto; color: var(--text-secondary);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 1400px) {
    .story-grid { gap: 10px; }
    .story-number { font-size: 2.8rem; }
}
@media (max-width: 1200px) {
    .system-rag-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .story-grid { grid-template-columns: repeat(6, 1fr); }
    .resources-display { grid-template-columns: 1fr; margin: 20px; }
    .system-rag-grid { grid-template-columns: repeat(2, 1fr); }
}
