:root {
    --bg: #132238;
    --bg-2: #22415f;
    --panel: #fff4d8;
    --panel-2: #fffaf0;
    --ink: #1a2430;
    --muted: #52606d;
    --line: #111;
    --gold: #ffcf5c;
    --mint: #9be7c4;
    --sky: #9fd3ff;
    --rose: #ffb4c7;
    --stone: #dde6ef;
    --shadow: 0 6px 0 rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", sans-serif;
    color: white;
    background:
        radial-gradient(circle at top, rgba(255, 220, 120, 0.18), transparent 30%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

.game-shell {
    width: min(1380px, calc(100% - 24px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.game-hero,
.panel,
.pixel-btn,
.incident-btn,
.choice-btn,
.station,
.status-box,
.result-box {
    border: 4px solid var(--line);
    box-shadow: var(--shadow);
}

.game-hero,
.panel {
    background: rgba(255, 255, 255, 0.08);
}

.game-hero {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    padding: 24px;
    margin-bottom: 22px;
}

.eyebrow,
.panel-tag,
.status-label {
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
    color: #ffe39b;
}

.game-hero h1,
.panel-head h2,
.result-card h3 {
    margin: 12px 0 10px;
    font-family: "Press Start 2P", monospace;
    line-height: 1.4;
}

.game-hero h1 {
    font-size: clamp(1.15rem, 2vw, 1.8rem);
}

.hero-copy,
.stage-description,
.scene-main p,
.result-card p,
.log-list li {
    line-height: 1.6;
    color: #eef4ff;
}

.hero-actions,
.choices,
.incident-picker,
.agent-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.pixel-btn,
.agent-btn,
.incident-btn,
.choice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 14px;
    text-decoration: none;
    cursor: pointer;
}

.pixel-btn {
    background: var(--gold);
    color: var(--ink);
    font-family: "Press Start 2P", monospace;
    font-size: 0.64rem;
}

.pixel-btn.secondary {
    background: var(--sky);
}

.pixel-btn.full {
    width: 100%;
}

.game-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 22px;
    align-items: start;
}

.panel {
    padding: 20px;
}

.panel-head {
    margin-bottom: 16px;
}

.panel-head.mini {
    margin-top: 20px;
}

.incident-picker {
    margin-bottom: 18px;
}

.picker-section {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
}

.picker-label {
    margin: 0 0 10px;
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
    color: #ffe39b;
}

.picker-empty {
    margin: 0;
    color: #eef4ff;
    line-height: 1.5;
}

.agent-btn {
    background: var(--sky);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 700;
}

.incident-btn {
    background: var(--panel);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
}

.agent-btn.active,
.incident-btn.active {
    outline: 4px solid #fff;
    transform: translateY(-2px);
}

.playfield {
    position: relative;
    min-height: 560px;
    border: 4px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03)),
        linear-gradient(180deg, #355c7d 0%, #2f4858 100%);
    overflow: hidden;
}

.lane {
    position: absolute;
    left: 40px;
    right: 40px;
    height: 16px;
    border-top: 4px dashed rgba(255, 255, 255, 0.18);
}

.lane-top { top: 110px; }
.lane-mid { top: 275px; }
.lane-bottom { top: 430px; }

.station {
    position: absolute;
    width: 160px;
    min-height: 150px;
    padding: 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    color: var(--ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: center;
}

.station.active {
    filter: drop-shadow(0 0 10px rgba(255, 224, 130, 0.55));
}

.station.correct-target {
    filter: drop-shadow(0 0 10px rgba(155, 231, 196, 0.6));
}

.station.wrong-target {
    filter: drop-shadow(0 0 10px rgba(255, 180, 199, 0.65));
}

.station[data-station="user"] { top: 30px; left: 28px; }
.station[data-station="itsm"] { top: 30px; left: 260px; }
.station[data-station="devsecops"] { top: 30px; right: 28px; }
.station[data-station="cloud"] { top: 235px; left: 130px; }
.station[data-station="data"] { top: 235px; right: 130px; }
.station[data-station="edtech"] { bottom: 35px; left: 200px; }
.station[data-station="close"] { bottom: 35px; right: 200px; }

.station-name {
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
    line-height: 1.5;
    color: #fff7d6;
    text-shadow: 2px 2px 0 rgba(17, 17, 17, 0.45);
}

.station-role {
    font-size: 0.82rem;
    color: #dce8f7;
    font-weight: 700;
    max-width: 140px;
}

.station-avatar {
    position: relative;
    width: 74px;
    height: 82px;
    display: block;
}

.avatar-head,
.avatar-body,
.avatar-tool {
    position: absolute;
    display: block;
    border: 3px solid var(--line);
    image-rendering: pixelated;
}

.avatar-head {
    top: 4px;
    left: 21px;
    width: 30px;
    height: 24px;
    background: #ffd7b3;
}

.avatar-body {
    top: 27px;
    left: 15px;
    width: 42px;
    height: 42px;
}

.avatar-tool {
    top: 36px;
    left: 50px;
    width: 16px;
    height: 16px;
    background: white;
}

.avatar-user .avatar-body {
    background: #8ecae6;
}

.avatar-user .avatar-tool {
    display: none;
}

.avatar-itsm .avatar-body {
    background: #ffd166;
}

.avatar-itsm .avatar-tool {
    background: #3a86ff;
}

.avatar-devsecops .avatar-body {
    background: #cdb4db;
}

.avatar-devsecops .avatar-tool {
    background: #d84f4f;
}

.avatar-cloud .avatar-body {
    background: #8ecae6;
}

.avatar-cloud .avatar-tool {
    background: #7bdff2;
}

.avatar-data .avatar-body {
    background: #90be6d;
}

.avatar-data .avatar-tool {
    background: #344e41;
}

.avatar-edtech .avatar-body {
    background: #ffafcc;
}

.avatar-edtech .avatar-tool {
    background: #8338ec;
}

.avatar-close .avatar-body {
    background: #bde0fe;
}

.avatar-close .avatar-tool {
    background: #06d6a0;
}

.courier {
    position: absolute;
    top: 0;
    left: 0;
    width: 92px;
    height: 82px;
    z-index: 3;
    transition: transform 0.9s ease;
}

.courier-sprite {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 44px;
    height: 64px;
}

.courier-cap,
.courier-face,
.courier-body,
.courier-arm,
.courier-leg {
    position: absolute;
    display: block;
    border: 3px solid var(--line);
}

.courier-cap {
    top: 0;
    left: 6px;
    width: 30px;
    height: 14px;
    background: #d84f4f;
}

.courier-face {
    top: 12px;
    left: 9px;
    width: 24px;
    height: 18px;
    background: #ffd7b3;
}

.courier-body {
    top: 28px;
    left: 5px;
    width: 32px;
    height: 20px;
    background: #3c78d8;
}

.courier-arm {
    top: 30px;
    left: 28px;
    width: 14px;
    height: 10px;
    background: #ffd7b3;
}

.courier-leg {
    top: 46px;
    width: 11px;
    height: 18px;
    background: #7b4f2a;
}

.courier-leg.left {
    left: 9px;
}

.courier-leg.right {
    left: 23px;
}

.courier.walking .courier-leg.left {
    transform: translateY(2px);
}

.courier.walking .courier-leg.right {
    transform: translateY(-2px);
}

.package {
    position: absolute;
    top: 8px;
    left: 40px;
    width: 56px;
    height: 56px;
    border: 4px solid var(--line);
    background: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink);
    font-family: "Press Start 2P", monospace;
    font-size: 0.62rem;
}

.package-label {
    transform: scale(0.9);
}

.route-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.status-box,
.result-box {
    padding: 12px;
    background: var(--panel);
    color: var(--ink);
}

.status-box strong,
.result-box strong {
    display: block;
    margin-top: 6px;
}

.scene-card,
.result-card {
    padding: 16px;
    border: 3px solid #fff;
    background: rgba(255,255,255,0.08);
}

.scene-main {
    padding: 14px;
    border: 3px solid var(--line);
    background: var(--panel-2);
    color: var(--ink);
    margin-bottom: 14px;
}

.scene-main p {
    color: var(--ink);
    margin: 0;
}

.detail-flow {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.detail-step {
    padding: 12px;
    border: 3px solid var(--line);
    background: rgba(255, 255, 255, 0.92);
}

.detail-label {
    display: inline-block;
    margin-bottom: 8px;
    font-family: "Press Start 2P", monospace;
    font-size: 0.58rem;
    color: #7b5a2c;
}

.detail-step p {
    margin: 0;
    color: var(--ink);
    line-height: 1.55;
}

.choice-btn {
    background: var(--mint);
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 700;
}

.choice-btn.alt {
    background: var(--rose);
}

.choice-btn:disabled,
.incident-btn:disabled,
.agent-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.log-list {
    margin: 0;
    padding-left: 18px;
}

.log-list li + li {
    margin-top: 10px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.hidden {
    display: none;
}

@media (max-width: 1180px) {
    .game-grid,
    .game-hero {
        grid-template-columns: 1fr;
        display: grid;
    }

    .playfield {
        min-height: 760px;
    }

    .station[data-station="devsecops"] { top: 170px; left: 28px; right: auto; }
    .station[data-station="cloud"] { top: 170px; right: 28px; left: auto; }
    .station[data-station="data"] { top: 320px; left: 28px; right: auto; }
    .station[data-station="edtech"] { top: 320px; right: 28px; left: auto; bottom: auto; }
    .station[data-station="close"] { top: 510px; left: 50%; transform: translateX(-50%); right: auto; bottom: auto; }
    .lane-top { top: 135px; }
    .lane-mid { top: 285px; }
    .lane-bottom { top: 470px; }
}

@media (max-width: 760px) {
    .game-shell {
        width: min(100% - 16px, 100%);
    }

    .route-row,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .playfield {
        min-height: 930px;
    }

    .station {
        width: calc(100% - 40px);
        left: 20px !important;
        right: auto !important;
        transform: none !important;
    }

    .station[data-station="user"] { top: 18px; }
    .station[data-station="itsm"] { top: 130px; }
    .station[data-station="devsecops"] { top: 242px; }
    .station[data-station="cloud"] { top: 354px; }
    .station[data-station="data"] { top: 466px; }
    .station[data-station="edtech"] { top: 578px; bottom: auto; }
    .station[data-station="close"] { top: 690px; bottom: auto; }
    .lane-top { top: 105px; left: 26px; right: 26px; }
    .lane-mid { top: 442px; left: 26px; right: 26px; }
    .lane-bottom { top: 666px; left: 26px; right: 26px; }
}
