:root {
    --bg: #070c0a;
    --panel: #111916;
    --panel-soft: #17231f;
    --line: #2b4a3f;
    --green: #64ff9a;
    --amber: #f7c948;
    --red: #ff5f56;
    --cyan: #65d8ff;
    --text: #d9ffe8;
    --muted: #83a493;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at 14% 16%, rgba(100, 255, 154, .12), transparent 24%),
        radial-gradient(circle at 78% 10%, rgba(255, 95, 86, .14), transparent 22%),
        linear-gradient(135deg, #050806 0%, #0e1713 42%, #14100b 100%);
    font-family: "Courier New", Consolas, monospace;
}

button, input { font: inherit; }

.crt-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
    opacity: .16;
    background:
        repeating-linear-gradient(0deg, rgba(255,255,255,.08) 0 1px, transparent 1px 4px),
        radial-gradient(circle, transparent 45%, rgba(0,0,0,.45));
    mix-blend-mode: screen;
}

.workstation-shell {
    width: min(1680px, 100%);
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

.topbar {
    display: grid;
    grid-template-columns: 180px 1fr auto;
    gap: 16px;
    align-items: center;
    min-height: 72px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 16, 13, .9);
    box-shadow: 0 0 30px rgba(100,255,154,.08), inset 0 0 24px rgba(100,255,154,.04);
    padding: 14px 16px;
}

.brand-link {
    color: var(--green);
    font-weight: 900;
    text-decoration: none;
    letter-spacing: .06em;
}

.topbar-title span {
    display: block;
    font-size: 28px;
    font-weight: 900;
    color: #ffffff;
}

.topbar-title small,
.status-strip span,
.system-label,
.kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.status-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: end;
}

.status-strip span,
.intel-heading span,
#playerBadge,
.choice-panel button,
.command-form button,
.login-panel button {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(100,255,154,.08);
    color: var(--green);
    padding: 8px 10px;
    font-weight: 900;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(280px, .85fr) minmax(440px, 1.25fr) minmax(320px, .85fr);
    gap: 16px;
    margin-top: 16px;
    align-items: start;
    height: calc(100vh - 120px);
    min-height: 640px;
}

.scene-panel,
.terminal-card,
.intel-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(12, 22, 18, .92);
    box-shadow: 0 16px 60px rgba(0,0,0,.35), inset 0 0 28px rgba(100,255,154,.035);
}

.scene-panel {
    overflow: hidden;
    height: 100%;
    min-height: 0;
}

.window-view {
    position: relative;
    height: min(44vh, 430px);
    min-height: 280px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(9,18,16,.12), rgba(6,8,7,.96)),
        radial-gradient(circle at 50% 22%, rgba(100,255,154,.12), transparent 20%),
        linear-gradient(135deg, #1b211c, #0a0e0c);
}

.window-view::before {
    content: "SECTOR URAL-17";
    position: absolute;
    top: 18px;
    left: 18px;
    color: rgba(217,255,232,.72);
    font-size: 12px;
    font-weight: 900;
}

.radar-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(100,255,154,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(100,255,154,.08) 1px, transparent 1px);
    background-size: 34px 34px;
    transform: perspective(500px) rotateX(58deg) translateY(130px);
    transform-origin: bottom;
}

.reactor-glow {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    left: calc(50% - 90px);
    top: 72px;
    background: radial-gradient(circle, rgba(100,255,154,.9), rgba(100,255,154,.22) 38%, transparent 70%);
    filter: blur(1px);
    animation: pulse 2.8s ease-in-out infinite;
}

.satellite-orbit {
    position: absolute;
    width: 260px;
    height: 260px;
    border: 1px dashed rgba(101,216,255,.55);
    border-radius: 999px;
    left: calc(50% - 130px);
    top: 32px;
    animation: rotate 12s linear infinite;
}

.satellite-orbit::after {
    content: "";
    position: absolute;
    width: 26px;
    height: 14px;
    border: 1px solid var(--cyan);
    background: rgba(101,216,255,.2);
    top: 18px;
    left: 42px;
    box-shadow: 0 0 18px rgba(101,216,255,.45);
}

.desk {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 170px;
    background: linear-gradient(180deg, rgba(31,28,23,.95), #080807);
    border-top: 1px solid rgba(247,201,72,.3);
}

.monitor-stack {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 20px;
}

.mini-monitor {
    min-height: 72px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #08100d;
    font-size: 12px;
    font-weight: 900;
}

.mini-monitor.ok { color: var(--green); }
.mini-monitor.warn { color: var(--amber); }
.mini-monitor.danger { color: var(--red); }

.keyboard {
    width: 76%;
    height: 34px;
    margin: 4px auto 0;
    border-radius: 5px;
    background:
        repeating-linear-gradient(90deg, #27332e 0 18px, #101713 18px 22px);
    border: 1px solid #40584d;
}

.mission-brief {
    padding: 22px;
    max-height: calc(100% - min(44vh, 430px));
    overflow: auto;
}

.mission-brief h1 {
    margin: 6px 0 12px;
    color: #fff;
    font-size: 30px;
    line-height: 1;
}

.mission-brief p {
    color: #b9d4c5;
    line-height: 1.55;
}

.terminal-card {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.terminal-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 12px;
    background: rgba(100,255,154,.06);
}

.led {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-right: 6px;
}

.led-red { background: var(--red); }
.led-amber { background: var(--amber); }
.led-green { background: var(--green); }

.login-panel {
    margin: auto;
    width: min(520px, calc(100% - 32px));
    border: 1px solid var(--line);
    background: rgba(4,9,7,.72);
    border-radius: 8px;
    padding: 24px;
}

.login-panel h2 {
    margin: 8px 0;
    color: #fff;
    font-size: 26px;
}

.login-panel p {
    color: #afd0bf;
    line-height: 1.5;
}

.login-panel form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 18px;
}

.login-panel input,
.command-form input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    background: #06110d;
    color: var(--green);
    border-radius: 6px;
    padding: 12px;
    outline: none;
}

.login-panel input:focus,
.command-form input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(100,255,154,.14);
}

.game-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.terminal-output {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto;
    padding: 18px;
    scroll-behavior: smooth;
}

.line {
    margin: 0 0 12px;
    color: #d7ffe7;
    line-height: 1.45;
    white-space: pre-wrap;
}

.line.system { color: var(--green); }
.line.warning { color: var(--amber); }
.line.danger { color: var(--red); }
.line.user { color: var(--cyan); }
.line.adela { color: #ffffff; }

.command-form {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding: 12px;
    background: rgba(0,0,0,.35);
}

.command-form span {
    color: var(--green);
    font-weight: 900;
    font-size: 20px;
}

.intel-panel {
    display: grid;
    gap: 16px;
    height: 100%;
    overflow: auto;
    padding-right: 2px;
}

.intel-card {
    padding: 16px;
}

.intel-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.intel-heading h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.meter-row {
    display: grid;
    grid-template-columns: 76px 1fr 48px;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
    font-size: 13px;
    font-weight: 900;
}

.meter {
    height: 10px;
    background: #06110d;
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.meter i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--amber));
    transition: width .35s ease;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.metric-grid div {
    border: 1px solid var(--line);
    background: rgba(100,255,154,.05);
    border-radius: 6px;
    padding: 10px;
}

.metric-grid small {
    display: block;
    color: var(--muted);
    font-weight: 900;
    margin-bottom: 4px;
}

.metric-grid strong {
    color: #fff;
    font-size: 22px;
}

.reactor-list,
.news-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.reactor-list li,
.news-card li {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(0,0,0,.22);
    padding: 10px;
    font-size: 13px;
}

.reactor-list strong {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: #fff;
}

.reactor-list small,
.news-card small {
    color: var(--muted);
    font-weight: 900;
}

.choice-panel {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.choice-panel button,
.quick-commands button {
    text-align: left;
    cursor: pointer;
}

.choice-panel button:hover,
.quick-commands button:hover,
.login-panel button:hover,
.command-form button:hover {
    border-color: var(--green);
    background: rgba(100,255,154,.14);
}

.learner-card p {
    margin: 0 0 12px;
    color: #b9d4c5;
    font-size: 13px;
    line-height: 1.45;
}

.quick-commands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.quick-commands button {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(101,216,255,.08);
    color: var(--cyan);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 900;
}

.lesson-box {
    display: grid;
    gap: 4px;
    margin-top: 12px;
    border: 1px solid rgba(247,201,72,.35);
    border-radius: 6px;
    background: rgba(247,201,72,.08);
    padding: 10px;
}

.lesson-box strong {
    color: var(--amber);
}

.lesson-box span {
    color: #decf9f;
    font-size: 12px;
    line-height: 1.35;
}

@keyframes pulse {
    0%, 100% { transform: scale(.96); opacity: .72; }
    50% { transform: scale(1.08); opacity: 1; }
}

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

@media (max-width: 1180px) {
    .game-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .terminal-card {
        min-height: auto;
        height: auto;
    }

    .scene-panel,
    .intel-panel {
        height: auto;
    }

    .intel-panel {
        overflow: visible;
    }
}

@media (max-width: 720px) {
    .workstation-shell { padding: 10px; }
    .topbar { grid-template-columns: 1fr; }
    .status-strip { justify-content: start; }
    .login-panel form,
    .command-form {
        grid-template-columns: 1fr;
    }
    .command-form span { display: none; }
    .terminal-output { min-height: 420px; }
    .quick-commands { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .reactor-glow,
    .satellite-orbit {
        animation: none;
    }
}
