:root {
    --bg-base: #040712;
    --bg-shell: linear-gradient(160deg, rgba(8, 13, 26, 0.95) 0%, rgba(13, 20, 40, 0.95) 55%, rgba(6, 12, 28, 0.9) 100%);
    --panel: rgba(10, 18, 38, 0.92);
    --panel-soft: rgba(15, 26, 50, 0.82);
    --border-soft: rgba(102, 220, 255, 0.18);
    --border-strong: rgba(255, 120, 200, 0.28);
    --text-primary: #e9f6ff;
    --text-secondary: rgba(186, 210, 238, 0.78);
    --accent-cyan: #63f5ff;
    --accent-amber: #ffca6b;
    --accent-magenta: #ff6acb;
    --accent-green: #6dffb5;
    --lane-good: #5efa9b;
    --lane-risk: #ffc15b;
    --lane-danger: #ff7a88;
    --shadow-strong: 0 34px 92px rgba(0, 8, 22, 0.7);
    --shadow-soft: 0 26px 64px rgba(2, 11, 30, 0.55);
    --radius-lg: 26px;
    --radius-md: 18px;
    --radius-sm: 12px;
    font-family: "Inter", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 12%, rgba(120, 226, 255, 0.24), transparent 60%),
        radial-gradient(circle at 82% 18%, rgba(255, 126, 194, 0.18), transparent 62%),
        var(--bg-base);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 32px 26px;
}

.shell {
    width: min(1240px, 100%);
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.masthead {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 24px;
    padding: 28px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-strong);
    backdrop-filter: blur(12px);
}

.masthead__brand {
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.masthead__brand h1 {
    margin: 0;
    font-size: clamp(1.8rem, 2.2vw, 2.4rem);
}

.masthead__brand p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.masthead__meta {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-end;
}

.stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(100px, 1fr));
    gap: 12px;
}

.stat {
    background: var(--panel-soft);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border: 1px solid var(--border-soft);
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.stat__label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat__value {
    font-size: 1.3rem;
    font-weight: 600;
}

.actions {
    display: flex;
    gap: 12px;
}

.btn {
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    border: 1px solid var(--border-soft);
    background: rgba(14, 24, 46, 0.7);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn--primary {
    background: var(--accent-cyan);
    color: #021626;
    border-color: var(--accent-cyan);
    font-weight: 600;
}

.btn--accent {
    background: var(--accent-magenta);
    border-color: var(--accent-magenta);
    color: #180419;
    font-weight: 600;
}

.lang-switch {
    display: flex;
    gap: 8px;
}

.lang-btn {
    border: 1px solid var(--border-soft);
    background: rgba(8, 16, 32, 0.6);
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lang-btn.is-active {
    background: var(--accent-cyan);
    color: #021626;
    border-color: var(--accent-cyan);
    font-weight: 600;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 26px;
}

.panel {
    background: var(--panel);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel__header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.panel__header p {
    margin: 6px 0 0;
    color: var(--text-secondary);
    line-height: 1.45;
}

.map-frame {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: radial-gradient(circle at 50% -10%, rgba(120, 226, 255, 0.28), transparent 55%),
        linear-gradient(180deg, rgba(6, 14, 32, 0.98) 0%, rgba(4, 9, 22, 0.98) 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.map-frame__glow,
.map-frame__grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.map-frame__glow {
    background: radial-gradient(circle at 20% 0%, rgba(255, 135, 205, 0.35), transparent 58%),
        radial-gradient(circle at 80% 8%, rgba(126, 236, 255, 0.28), transparent 60%);
    mix-blend-mode: screen;
    opacity: 0.5;
}

.map-frame__grid {
    background:
        repeating-linear-gradient(to right, rgba(99, 240, 255, 0.08) 0 1px, transparent 1px 60px),
        repeating-linear-gradient(to bottom, rgba(99, 240, 255, 0.06) 0 1px, transparent 1px 48px);
    opacity: 0.35;
}

.lane-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.lane-btn {
    flex: 1;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    background: rgba(10, 20, 38, 0.82);
    border: 1px solid rgba(99, 240, 255, 0.24);
    color: var(--text-primary);
    cursor: pointer;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lane-btn:hover,
.lane-btn:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(5, 12, 26, 0.45);
    border-color: rgba(255, 255, 255, 0.2);
}

.card {
    background: var(--panel-soft);
    border-radius: var(--radius-md);
    padding: 18px;
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.card__header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 140px;
}

.order {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.order:hover,
.order:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.order.is-selected {
    box-shadow: 0 0 0 2px var(--accent-cyan);
}

.order__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order__code {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

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

.order__reward {
    font-weight: 600;
}

.order-list__empty {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.telemetry {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.95rem;
}

.telemetry__row {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.telemetry__row dd {
    margin: 0;
    color: var(--text-primary);
    font-weight: 600;
}

.telemetry__note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.lane-report {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.lane-report__row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.lane-report__row span[data-state="clear"] {
    color: var(--lane-good);
}

.lane-report__row span[data-state="busy"] {
    color: var(--lane-risk);
}

.lane-report__row span[data-state="blocked"] {
    color: var(--lane-danger);
}

.status-bar {
    background: var(--panel);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    border: 1px solid var(--border-soft);
    font-size: 0.95rem;
    color: var(--text-secondary);
    box-shadow: var(--shadow-soft);
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 8, 20, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 40;
}

.overlay.hidden {
    display: none;
}

.overlay__panel {
    background: var(--panel);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 420px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-strong);
}

.overlay__title {
    margin: 0;
    font-size: 1.5rem;
    text-align: center;
}

.overlay__stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.overlay__stats strong {
    color: var(--text-primary);
}

.overlay__actions {
    display: flex;
    justify-content: center;
    gap: 14px;
}

@media (max-width: 1160px) {
    .stats {
        grid-template-columns: repeat(3, minmax(100px, 1fr));
    }

    .layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    body {
        padding: 24px 16px;
    }

    .masthead {
        padding: 22px;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .actions {
        width: 100%;
        flex-direction: column;
    }

    .lane-controls {
        flex-direction: column;
    }
}
