/* =========================================================
   SkyGame ATC — стили (тёмная неоновая тема)
   ========================================================= */

:root {
    --bg-0: #0a0f1a;
    --bg-1: #141c2b;
    --bg-2: #1a2436;
    --bg-3: #243044;
    --neon: #00d4ff;
    --neon-dim: #00d4ff55;
    --amber: #ffaa00;
    --pink: #ff4477;
    --green: #4dff9a;
    --text: #e8f0ff;
    --muted: #8a9bb0;
    --danger: #ff4477;
    --panel-w: 300px;
    --radius: 10px;
    --font: 'Roboto', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--font);
    background: var(--bg-0);
    color: var(--text);
    overflow: hidden;
    user-select: none;
}

button, select, input { font-family: inherit; }

.hidden { display: none !important; }

/* ——— Экраны ——— */
.screen {
    display: none;
    position: absolute;
    inset: 0;
}
.screen.active { display: flex; flex-direction: column; }

/* ——— Главное меню ——— */
#screen-menu {
    align-items: center;
    justify-content: center;
}

.menu-bg {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(10,15,26,0.35) 0%, rgba(10,15,26,0.85) 70%, #0a0f1a 100%),
        radial-gradient(ellipse at 30% 40%, #1a3a5c 0%, transparent 55%),
        radial-gradient(ellipse at 70% 60%, #0d2840 0%, transparent 50%),
        linear-gradient(135deg, #0a1628 0%, #141c2b 40%, #0a0f1a 100%);
    animation: skyShift 18s ease-in-out infinite alternate;
}

.menu-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(0,212,255,0.03) 80px, rgba(0,212,255,0.03) 81px),
        repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(0,212,255,0.03) 80px, rgba(0,212,255,0.03) 81px);
    opacity: 0.6;
}

.menu-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, transparent 20%, #0a0f1a 90%);
    pointer-events: none;
}

@keyframes skyShift {
    from { filter: hue-rotate(0deg) brightness(1); }
    to { filter: hue-rotate(12deg) brightness(1.08); }
}

.menu-content {
    position: relative;
    z-index: 2;
    text-align: center;
    animation: fadeUp 0.8s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.brand {
    margin: 0;
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 700;
    letter-spacing: 0.18em;
    color: var(--neon);
    text-shadow: 0 0 20px var(--neon-dim), 0 0 60px #00d4ff33;
    animation: brandPulse 3s ease-in-out infinite;
}

@keyframes brandPulse {
    0%, 100% { text-shadow: 0 0 20px var(--neon-dim), 0 0 60px #00d4ff33; }
    50% { text-shadow: 0 0 30px #00d4ff88, 0 0 80px #00d4ff44; }
}

.brand-sub {
    margin: 0.4rem 0 1.5rem;
    color: var(--muted);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    font-size: 0.85rem;
    font-weight: 300;
}

.menu-user {
    color: var(--amber);
    margin-bottom: 1.25rem;
    font-size: 0.95rem;
}

.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    min-width: 280px;
}

.menu-btn, .btn {
    background: transparent;
    border: 1px solid var(--neon-dim);
    color: var(--text);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.menu-btn:hover, .btn:hover {
    background: rgba(0, 212, 255, 0.12);
    border-color: var(--neon);
    box-shadow: 0 0 16px #00d4ff33;
    transform: translateY(-1px);
}

.menu-btn.primary, .btn.primary {
    background: linear-gradient(135deg, #00b8e0, #00d4ff);
    color: #0a0f1a;
    border-color: transparent;
    font-weight: 700;
}

.menu-btn.primary:hover, .btn.primary:hover {
    background: linear-gradient(135deg, #33d0ff, #66e0ff);
    box-shadow: 0 0 24px #00d4ff55;
}

/* ——— Setup ——— */
#screen-setup {
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #141c2b, #0a0f1a);
}

.setup-panel {
    width: min(420px, 92vw);
    padding: 1.75rem;
    background: var(--bg-1);
    border: 1px solid var(--neon-dim);
    border-radius: 12px;
    box-shadow: 0 0 40px #00d4ff22;
}

.setup-panel h2 { margin: 0 0 1rem; color: var(--neon); }

.setup-panel label {
    display: block;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.setup-panel select {
    display: block;
    width: 100%;
    margin-top: 0.4rem;
    padding: 0.65rem;
    background: var(--bg-0);
    border: 1px solid var(--bg-3);
    color: var(--text);
    border-radius: 8px;
}

.setup-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* ——— Игровой экран ——— */
#screen-game {
    background: var(--bg-0);
}

.top-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.55rem 1rem;
    background: linear-gradient(180deg, #141c2b, #101828);
    border-bottom: 1px solid var(--neon-dim);
    flex-shrink: 0;
    z-index: 5;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.95rem;
    font-weight: 500;
}

.stat .ico { font-size: 1rem; }

.mission-stat {
    color: var(--amber);
    margin-left: auto;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: 0.5rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--neon-dim);
    background: var(--bg-2);
    color: var(--text);
    cursor: pointer;
}

.icon-btn:hover { border-color: var(--neon); color: var(--neon); }

.coop-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--pink);
    color: #fff;
}

.game-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

.radar-wrap {
    flex: 1;
    position: relative;
    background:
        radial-gradient(ellipse at center, #0d1828 0%, #070b12 100%);
    overflow: hidden;
}

#radar {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.weather-label {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.35rem 0.7rem;
    background: rgba(10, 15, 26, 0.75);
    border: 1px solid var(--neon-dim);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--neon);
    pointer-events: none;
}

.camera-bar {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.4rem;
    background: rgba(10, 15, 26, 0.8);
    padding: 0.4rem;
    border-radius: 8px;
    border: 1px solid var(--neon-dim);
}

.cam-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.cam-btn:hover { color: var(--text); }
.cam-btn.active {
    color: var(--neon);
    border-color: var(--neon-dim);
    background: rgba(0, 212, 255, 0.1);
}

.coop-hint {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.75rem;
    color: var(--muted);
    background: rgba(10,15,26,0.7);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    max-width: 220px;
}

/* ——— Боковая панель ——— */
.side-panel {
    width: var(--panel-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-1);
    border-left: 1px solid var(--neon-dim);
}

.flight-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--bg-0);
    padding: 4px;
}

.ftab {
    background: var(--bg-2);
    border: none;
    color: var(--muted);
    padding: 0.5rem 0.3rem;
    font-size: 0.72rem;
    cursor: pointer;
    border-radius: 4px;
}

.ftab span {
    display: inline-block;
    min-width: 1.2em;
    color: var(--neon);
    font-weight: 700;
}

.ftab.active {
    color: var(--text);
    background: var(--bg-3);
    box-shadow: inset 0 -2px 0 var(--neon);
}

.flight-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.4rem;
    min-height: 120px;
    max-height: 42vh;
}

.flight-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.5rem;
    margin-bottom: 0.3rem;
    background: var(--bg-2);
    border-radius: 6px;
    border-left: 3px solid var(--neon);
    cursor: pointer;
    transition: background 0.15s;
}

.flight-item:hover { background: var(--bg-3); }
.flight-item.emergency { border-left-color: var(--pink); animation: blinkBorder 1s infinite; }
.flight-item.vip { border-left-color: var(--amber); }

@keyframes blinkBorder {
    50% { border-left-color: #fff; }
}

.flight-item .callsign { font-weight: 700; font-size: 0.9rem; }
.flight-item .meta { font-size: 0.72rem; color: var(--muted); margin-left: auto; text-align: right; }

.side-tabs {
    display: flex;
    border-top: 1px solid var(--neon-dim);
}

.stab {
    flex: 1;
    background: var(--bg-0);
    border: none;
    color: var(--muted);
    padding: 0.55rem 0.2rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.stab.active {
    color: var(--neon);
    background: var(--bg-2);
}

.side-content {
    padding: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
    overflow-y: auto;
    max-height: 28vh;
    border-top: 1px solid #1e2a3a;
}

.side-content ul { margin: 0.5rem 0 0; padding-left: 1.1rem; }
.side-content li { margin-bottom: 0.3rem; }

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem;
    margin-bottom: 0.4rem;
    background: var(--bg-2);
    border-radius: 6px;
}

.shop-item button {
    background: var(--neon);
    color: #0a0f1a;
    border: none;
    padding: 0.35rem 0.55rem;
    border-radius: 4px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.75rem;
    white-space: nowrap;
}

.shop-item button:disabled {
    background: #333;
    color: #777;
    cursor: not-allowed;
}

.shop-item .locked { color: var(--pink); font-size: 0.7rem; }

/* ——— Лог ——— */
.log-bar {
    height: 110px;
    flex-shrink: 0;
    background: #080c14;
    border-top: 1px solid var(--neon-dim);
    overflow: hidden;
}

#event-log {
    height: 100%;
    overflow-y: auto;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-family: 'Roboto', monospace;
}

.log-line {
    padding: 0.15rem 0;
    border-bottom: 1px solid #121a28;
    animation: fadeIn 0.3s ease;
}

.log-line.sys { color: var(--muted); }
.log-line.pilot { color: var(--neon); }
.log-line.warn { color: var(--amber); }
.log-line.danger { color: var(--pink); }
.log-line.ok { color: var(--green); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: none; }
}

/* ——— Модалки ——— */
.modal-root {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
}

.modal {
    position: relative;
    width: min(480px, 94vw);
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-1);
    border: 1px solid var(--neon-dim);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 0 50px #00d4ff22;
    animation: fadeUp 0.25s ease;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal h3 { margin: 0 0 0.75rem; color: var(--neon); }

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.modal-grid .label { color: var(--muted); }
.cmd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.cmd-grid .btn { width: 100%; font-size: 0.85rem; padding: 0.65rem 0.5rem; }
.cmd-grid .btn.danger {
    border-color: var(--pink);
    color: var(--pink);
}
.cmd-grid .btn.warn {
    border-color: var(--amber);
    color: var(--amber);
}

.form-row {
    margin-bottom: 0.85rem;
}

.form-row label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.form-row input {
    width: 100%;
    padding: 0.65rem;
    background: var(--bg-0);
    border: 1px solid var(--bg-3);
    border-radius: 8px;
    color: var(--text);
}

.form-error {
    color: var(--pink);
    font-size: 0.85rem;
    min-height: 1.2em;
    margin-bottom: 0.5rem;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.auth-tabs button {
    flex: 1;
}

.saves-list { max-height: 300px; overflow-y: auto; }
.save-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem;
    background: var(--bg-2);
    border-radius: 6px;
    margin-bottom: 0.4rem;
}

.save-row .actions { display: flex; gap: 0.35rem; }

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* ——— Оверлеи ——— */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 8, 14, 0.8);
    backdrop-filter: blur(4px);
}

.overlay-card {
    text-align: center;
    padding: 2rem;
    background: var(--bg-1);
    border: 1px solid var(--neon-dim);
    border-radius: 12px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.overlay-card.danger { border-color: var(--pink); }
.overlay-card h2 { margin: 0 0 0.5rem; color: var(--neon); }
.overlay-card.danger h2 { color: var(--pink); }

/* ——— Скроллбары ——— */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3a50; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-dim); }

/* ——— Адаптив ≥1024 ——— */
@media (max-width: 1100px) {
    :root { --panel-w: 260px; }
    .mission-stat { display: none; }
}

@media (max-width: 900px) {
    .game-body { flex-direction: column; }
    .side-panel {
        width: 100%;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--neon-dim);
    }
    .flight-list { max-height: 18vh; }
}
