:root {
    color-scheme: dark;
    --bg: #06090b;
    --panel: rgba(12, 17, 20, 0.9);
    --panel-strong: rgba(17, 23, 27, 0.98);
    --line: rgba(215, 196, 162, 0.18);
    --line-strong: rgba(235, 210, 167, 0.42);
    --ink: #f3ecdf;
    --muted: rgba(243, 236, 223, 0.64);
    --amber: #d9a75f;
    --red: #d85f4d;
    --red-soft: rgba(216, 95, 77, 0.16);
    --blue: #8db3c7;
    --green: #8dbf9c;
    --dark: #091014;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background:
        radial-gradient(circle at 72% 18%, rgba(141, 179, 199, 0.18), transparent 27%),
        radial-gradient(circle at 18% 80%, rgba(216, 95, 77, 0.12), transparent 34%),
        linear-gradient(115deg, rgba(6, 9, 11, 0.98), rgba(6, 9, 11, 0.84) 48%, rgba(6, 9, 11, 0.96)),
        var(--bg);
    color: var(--ink);
}

button {
    font: inherit;
}

h1,
h2,
h3,
p {
    margin: 0;
}

.warboard {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(680px, 1.4fr) minmax(340px, 0.62fr);
    grid-template-rows: auto minmax(560px, 1fr) auto;
    gap: 1rem;
    padding: 1rem;
}

.panel,
.command,
.map-shell {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
}

.command {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    gap: 1.2rem;
    padding: 1rem 1.2rem;
}

.command-right {
    display: grid;
    gap: 0.65rem;
    align-content: center;
}

.eyebrow {
    margin-bottom: 0.35rem;
    color: var(--amber);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

h1 {
    font-size: clamp(2rem, 5vw, 4.7rem);
    line-height: 0.92;
    text-transform: uppercase;
}

.brief {
    max-width: 660px;
    margin-top: 0.55rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.45;
}

.scoreline {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 0.65rem;
    align-content: center;
}

.audio-controls {
    display: grid;
    grid-template-columns: auto auto auto minmax(130px, 1fr);
    gap: 0.55rem;
    align-items: center;
    justify-self: end;
    width: min(100%, 520px);
    padding: 0.58rem 0.65rem;
    border: 1px solid rgba(215, 196, 162, 0.14);
    background: rgba(238, 226, 202, 0.045);
}

.audio-controls button,
.site-return {
    padding: 0.42rem 0.58rem;
    border: 1px solid rgba(217, 167, 95, 0.38);
    background: rgba(217, 167, 95, 0.12);
    color: var(--ink);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
}

.site-return:hover,
.audio-controls button:hover {
    border-color: rgba(217, 167, 95, 0.74);
    background: rgba(217, 167, 95, 0.22);
}

.audio-controls label {
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.audio-controls input {
    width: 100%;
    accent-color: var(--amber);
}

.outcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    margin-top: 1rem;
}

.scoreline div,
.metric {
    border: 1px solid rgba(215, 196, 162, 0.14);
    background: rgba(238, 226, 202, 0.045);
    padding: 0.75rem;
}

.scoreline span,
.metric span,
.stat-row span {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.scoreline strong,
.metric strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 1.06rem;
}

.map-shell {
    position: relative;
    overflow: hidden;
    min-height: 560px;
    background:
        linear-gradient(0deg, rgba(6, 9, 11, 0.38), rgba(6, 9, 11, 0.22)),
        radial-gradient(circle at 42% 45%, rgba(217, 167, 95, 0.08), transparent 24%),
        radial-gradient(circle at 74% 36%, rgba(216, 95, 77, 0.1), transparent 22%),
        url("./assets/map/svarog_industrial_heart_background.png") center / cover no-repeat,
        #071014;
}

.map-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.032) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
        linear-gradient(135deg, transparent 0 46%, rgba(141, 179, 199, 0.08) 46% 48%, transparent 48% 100%),
        repeating-linear-gradient(23deg, rgba(217, 167, 95, 0.05) 0 2px, transparent 2px 28px);
    background-size: 52px 52px, 52px 52px, 220px 220px, auto;
    opacity: 0.58;
}

.map-title {
    position: absolute;
    z-index: 3;
    top: 1rem;
    left: 1rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(215, 196, 162, 0.14);
    background: rgba(7, 13, 16, 0.76);
}

.map-title h2 {
    font-size: 1.15rem;
}

.map {
    position: absolute;
    inset: 0;
}

.node {
    position: absolute;
    z-index: 2;
    width: 146px;
    min-height: 104px;
    transform: translate(-50%, -50%);
    padding: 0.65rem;
    border: 1px solid rgba(215, 196, 162, 0.24);
    background: rgba(8, 13, 16, 0.9);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.node::before {
    content: "";
    display: block;
    height: 42px;
    margin: -0.2rem -0.2rem 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background:
        linear-gradient(0deg, rgba(8, 13, 16, 0.42), rgba(8, 13, 16, 0.06)),
        var(--node-art) center / cover no-repeat,
        rgba(238, 226, 202, 0.055);
}

.node.factory::before {
    background:
        linear-gradient(0deg, rgba(217, 167, 95, 0.16), rgba(8, 13, 16, 0.06)),
        var(--node-art) center / cover no-repeat,
        rgba(238, 226, 202, 0.06);
}

.node.starport::before {
    background:
        radial-gradient(circle at 70% 48%, rgba(141, 179, 199, 0.18), transparent 18%),
        linear-gradient(0deg, rgba(8, 13, 16, 0.38), rgba(8, 13, 16, 0.03)),
        var(--node-art) center / cover no-repeat;
}

.node.federation::before {
    background:
        linear-gradient(0deg, rgba(34, 12, 14, 0.48), rgba(34, 12, 14, 0.06)),
        var(--node-art) center / cover no-repeat;
}

.node.federation {
    border-color: rgba(216, 95, 77, 0.5);
    background: rgba(34, 12, 14, 0.9);
}

.node.relay {
    width: 92px;
    min-height: 72px;
    transform: translate(-50%, -50%) rotate(45deg);
    padding: 0.55rem;
}

.node.relay > * {
    transform: rotate(-45deg);
}

.node.selected {
    border-color: var(--line-strong);
    box-shadow: 0 0 0 2px rgba(217, 167, 95, 0.16), 0 0 36px rgba(217, 167, 95, 0.22);
}

.node h3 {
    font-size: 0.84rem;
    line-height: 1.12;
}

.node small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.68rem;
    line-height: 1.25;
}

.node .tag {
    display: inline-block;
    margin-top: 0.45rem;
    padding: 0.18rem 0.34rem;
    color: #ffd0ca;
    background: rgba(216, 95, 77, 0.22);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ship-marker {
    position: absolute;
    z-index: 4;
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 22px;
    padding: 0 0.35rem;
    border: 1px solid rgba(243, 236, 223, 0.5);
    background: #9fc9d7;
    color: #061015;
    font-size: 0.65rem;
    font-weight: 900;
    cursor: pointer;
}

.ship-marker.transport {
    min-width: 42px;
    background: #d69b70;
}

.ship-marker.unavailable {
    opacity: 0.34;
    filter: grayscale(1);
}

.ship-marker.selected {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.76), 0 0 24px rgba(141, 179, 199, 0.48);
}

.side {
    display: grid;
    grid-template-rows: minmax(220px, auto) 1fr;
    gap: 1rem;
}

.profile,
.resources {
    padding: 1rem;
}

.portrait {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin-bottom: 0.8rem;
    border: 1px solid rgba(215, 196, 162, 0.22);
    background:
        radial-gradient(circle at 50% 32%, rgba(217, 167, 95, 0.28), transparent 24%),
        linear-gradient(135deg, rgba(141, 179, 199, 0.18), rgba(216, 95, 77, 0.1)),
        rgba(238, 226, 202, 0.045);
    color: rgba(243, 236, 223, 0.9);
    font-size: 1.55rem;
    font-weight: 900;
    overflow: hidden;
}

.portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-portrait {
    width: 112px;
    height: 112px;
    margin-bottom: 0.9rem;
}

.profile h2 {
    font-size: 1.22rem;
}

.profile-art {
    height: 118px;
    margin: -0.25rem -0.25rem 0.9rem;
    border: 1px solid rgba(215, 196, 162, 0.14);
    overflow: hidden;
}

.profile-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile p {
    margin-top: 0.5rem;
    color: var(--muted);
    line-height: 1.42;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
}

.metric.warning strong {
    color: #ffd0ca;
}

.metric.good strong {
    color: #bdd9e7;
}

.card-stage {
    grid-column: 1 / -1;
    padding: 1rem;
}

.card-progress {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.pip {
    min-width: 74px;
    padding: 0.32rem 0.46rem;
    border: 1px solid rgba(215, 196, 162, 0.12);
    color: var(--muted);
    background: rgba(238, 226, 202, 0.035);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pip.active {
    border-color: rgba(217, 167, 95, 0.55);
    color: var(--ink);
    background: rgba(217, 167, 95, 0.13);
}

.pip.done {
    opacity: 0.45;
}

.decision-card {
    min-height: 320px;
    display: grid;
    grid-template-columns: minmax(280px, 0.62fr) minmax(320px, 1fr);
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(215, 196, 162, 0.16);
    background: rgba(238, 226, 202, 0.035);
}

.card-copy h2 {
    font-size: clamp(1.7rem, 4vw, 3.2rem);
    line-height: 0.98;
    text-transform: uppercase;
}

.card-copy p {
    margin-top: 0.75rem;
    color: var(--muted);
    line-height: 1.48;
}

.command-quote {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
    margin-top: 1rem;
    padding: 0.72rem 0.78rem;
    border: 1px solid rgba(217, 167, 95, 0.22);
    border-left: 3px solid rgba(217, 167, 95, 0.72);
    background: rgba(217, 167, 95, 0.08);
}

.command-portrait {
    width: 54px;
    height: 54px;
    margin: 0;
}

.command-quote span {
    display: block;
    color: var(--amber);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.command-quote p {
    margin-top: 0.25rem;
    color: var(--ink);
    font-size: 0.98rem;
    line-height: 1.36;
}

.stat-list {
    display: grid;
    gap: 0.45rem;
    margin-top: 1rem;
}

.stat-row {
    padding: 0.52rem 0.6rem;
    border: 1px solid rgba(215, 196, 162, 0.12);
    background: rgba(238, 226, 202, 0.035);
}

.stat-row strong {
    display: block;
    margin-top: 0.15rem;
}

.card-options {
    display: grid;
    gap: 0.65rem;
    align-content: start;
}

.option {
    width: 100%;
    padding: 0.82rem;
    border: 1px solid rgba(215, 196, 162, 0.16);
    background: rgba(238, 226, 202, 0.055);
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.option:hover {
    border-color: rgba(217, 167, 95, 0.52);
    background: rgba(217, 167, 95, 0.12);
}

.option.high-risk {
    border-color: rgba(178, 119, 226, 0.66);
    background: rgba(122, 64, 176, 0.2);
    box-shadow: inset 3px 0 0 rgba(178, 119, 226, 0.76);
}

.option strong {
    display: block;
}

.option span {
    display: block;
    margin-top: 0.24rem;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.option .category {
    margin-bottom: 0.25rem;
    color: var(--amber);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.option-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.7rem;
    align-items: end;
    margin-top: 0.42rem;
}

.risk-chip {
    display: inline-grid;
    gap: 0.22rem;
    min-width: 106px;
    padding: 0.36rem 0.44rem;
    border: 1px solid rgba(215, 196, 162, 0.16);
    background: rgba(8, 13, 16, 0.62);
    color: var(--ink);
}

.risk-chip strong {
    margin: 0;
    font-size: 0.72rem;
    line-height: 1;
}

.risk-dots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.18rem;
    margin: 0;
}

.risk-dots i {
    display: block;
    height: 4px;
    background: rgba(243, 236, 223, 0.18);
}

.risk-low {
    border-color: rgba(141, 191, 156, 0.44);
}

.risk-low .risk-dots i:nth-child(-n+1) {
    background: #8dbf9c;
}

.risk-medium {
    border-color: rgba(217, 167, 95, 0.48);
}

.risk-medium .risk-dots i:nth-child(-n+2) {
    background: var(--amber);
}

.risk-high {
    border-color: rgba(216, 95, 77, 0.52);
}

.risk-high .risk-dots i:nth-child(-n+3) {
    background: var(--red);
}

.risk-severe {
    border-color: rgba(216, 95, 77, 0.76);
    background: rgba(216, 95, 77, 0.12);
}

.risk-severe .risk-dots i {
    background: var(--red);
}

.risk-extreme {
    border-color: rgba(178, 119, 226, 0.8);
    background: rgba(122, 64, 176, 0.22);
}

.risk-extreme .risk-dots i {
    background: #b277e2;
}

.ledger-panel {
    grid-column: 1 / -1;
    padding: 1rem;
}

.ledger-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.ledger-head h2 {
    font-size: 1.2rem;
}

.ledger-head button,
.outcome-card button {
    padding: 0.64rem 0.82rem;
    border: 1px solid rgba(217, 167, 95, 0.38);
    background: rgba(217, 167, 95, 0.12);
    color: var(--ink);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ledger-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.ledger {
    display: grid;
    gap: 0.45rem;
    max-height: 220px;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.ledger li {
    min-height: 46px;
    padding: 0.58rem 0.68rem;
    border: 1px solid rgba(215, 196, 162, 0.12);
    background: rgba(238, 226, 202, 0.035);
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.36;
}

.outcome {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    place-items: center;
    padding: 1rem;
    background: rgba(4, 7, 10, 0.86);
}

.outcome.is-open {
    display: grid;
}

.turn-modal {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: none;
    place-items: center;
    padding: 1rem;
    background: rgba(4, 7, 10, 0.74);
}

.turn-modal.is-open {
    display: grid;
}

.turn-card {
    width: min(100%, 760px);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1.25rem;
    border: 1px solid rgba(217, 167, 95, 0.34);
    background: var(--panel-strong);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.52);
}

.turn-card h2 {
    font-size: clamp(1.9rem, 5vw, 4rem);
    line-height: 1;
    text-transform: uppercase;
}

.turn-modal-portrait:empty {
    display: none;
}

.modal-portrait {
    width: 128px;
    height: 128px;
    margin-bottom: 1rem;
}

.modal-art {
    height: 220px;
    margin-bottom: 1rem;
    border: 1px solid rgba(215, 196, 162, 0.18);
    overflow: hidden;
}

.modal-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.turn-modal-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    margin: 1rem 0;
}

.turn-modal-stats div {
    padding: 0.62rem;
    border: 1px solid rgba(215, 196, 162, 0.14);
    background: rgba(238, 226, 202, 0.04);
}

.turn-modal-stats span {
    display: block;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.turn-modal-stats strong {
    display: block;
    margin-top: 0.2rem;
}

.turn-card ol {
    display: grid;
    gap: 0.45rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.turn-card li {
    padding: 0.62rem 0.7rem;
    border: 1px solid rgba(215, 196, 162, 0.12);
    background: rgba(238, 226, 202, 0.035);
    color: var(--muted);
    line-height: 1.36;
}

.turn-card button {
    width: 100%;
    padding: 0.82rem 1rem;
    border: 1px solid rgba(217, 167, 95, 0.42);
    background: rgba(217, 167, 95, 0.14);
    color: var(--ink);
    cursor: pointer;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.outcome-card {
    width: min(100%, 860px);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    padding: 1.25rem;
    border: 1px solid rgba(217, 167, 95, 0.34);
    background: var(--panel-strong);
}

.outcome-card h2 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    text-transform: uppercase;
}

.outcome-card pre {
    white-space: pre-wrap;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid rgba(215, 196, 162, 0.14);
    background: rgba(238, 226, 202, 0.035);
    color: var(--ink);
    font-family: "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}

@media (max-width: 1100px) {
    .warboard {
        grid-template-columns: 1fr;
    }

    .command {
        display: block;
    }

    .command-right {
        margin-top: 1rem;
    }

    .scoreline {
        margin-top: 1rem;
    }

    .side {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }
}

@media (max-width: 720px) {
    .warboard {
        padding: 0.55rem;
    }

    .scoreline,
    .audio-controls,
    .side,
    .stat-grid,
    .decision-card,
    .ledger-grid,
    .turn-modal-stats {
        grid-template-columns: 1fr;
    }

    .map-shell {
        min-height: 620px;
    }

    .node {
        width: 126px;
    }
}
