/* ═══════════════════════════════════════════
   SPACE TRADER — Cyberpunk Starship HUD
   ═══════════════════════════════════════════ */

/* ── Viewport ── */

.viewport {
    background: #000;
}

.viewport-vignette {
    background: radial-gradient(ellipse at 60% 50%, transparent 30%, rgba(0, 0, 0, 0.75) 100%);
}

.viewport-scanlines {
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.03) 2px,
            rgba(0, 0, 0, 0.03) 4px);
}

/* ── Planet layers (video + CSS fallback) ── */

.planet-layer {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.planet-layer-active {
    opacity: 1;
}

.planet-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.planet-video.is-playing {
    opacity: 1;
}

.planet-fallback {
    position: absolute;
    inset: -10%;
    animation: planet-drift 30s ease-in-out infinite;
}

.planet-fallback-ziemia {
    background:
        radial-gradient(circle at 35% 35%, #67e8f9 0%, #0891b2 30%, #0c4a6e 55%, transparent 70%),
        radial-gradient(ellipse at 70% 80%, rgba(34, 211, 238, 0.15), transparent 50%),
        #020617;
}

.planet-fallback-mars {
    background:
        radial-gradient(circle at 40% 38%, #fca5a5 0%, #dc2626 28%, #7f1d1d 55%, transparent 72%),
        radial-gradient(ellipse at 60% 70%, rgba(239, 68, 68, 0.12), transparent 50%),
        #0a0000;
}

.planet-fallback-cybertron {
    background:
        radial-gradient(circle at 38% 36%, #e9d5ff 0%, #a855f7 25%, #581c87 52%, transparent 70%),
        repeating-linear-gradient(45deg,
            transparent,
            transparent 20px,
            rgba(148, 163, 184, 0.03) 20px,
            rgba(148, 163, 184, 0.03) 21px),
        #050010;
}

.planet-atmosphere {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.planet-atmosphere-cyan {
    background: radial-gradient(ellipse at 55% 45%, rgba(34, 211, 238, 0.12), transparent 60%);
}

.planet-atmosphere-red {
    background: radial-gradient(ellipse at 55% 45%, rgba(239, 68, 68, 0.1), transparent 60%);
}

.planet-atmosphere-purple {
    background: radial-gradient(ellipse at 55% 45%, rgba(168, 85, 247, 0.12), transparent 60%);
}

/* ── Planet display (zoom target) ── */

.planet-display {
    position: absolute;
    right: -15%;
    top: 50%;
    z-index: 10;
    width: 85%;
    height: 85%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
}

.planet-halo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: 0.4;
    filter: blur(60px);
    background: radial-gradient(circle, rgba(34, 211, 238, 0.5), transparent 70%);
}

.planet-zoom-idle {
    transform: translateY(-50%) scale(1);
}

.planet-zoom-arrive {
    animation: planet-brake 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.planet-zoom-warp {
    transform: translateY(-50%) scale(1.6);
    opacity: 0.3;
}

/* ── Starship ── */

.starship {
    position: absolute;
    left: 28%;
    top: 48%;
    z-index: 15;
    width: 5rem;
    height: 6rem;
    animation: starship-float 5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.5));
    transition: filter 0.3s ease, transform 0.3s ease;
}

.starship-hull {
    position: absolute;
    left: 50%;
    top: 1rem;
    width: 1.5rem;
    height: 3rem;
    transform: translateX(-50%);
    border-radius: 50% 50% 15% 15%;
    background: linear-gradient(180deg, #f1f5f9, #64748b);
    box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.3);
}

.starship-cockpit {
    position: absolute;
    left: 50%;
    top: 1.4rem;
    width: 0.7rem;
    height: 1.2rem;
    transform: translateX(-50%);
    border-radius: 40%;
    background: linear-gradient(180deg, #22d3ee, #0891b2);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.8);
}

.starship-wing {
    position: absolute;
    top: 2.5rem;
    width: 2.2rem;
    height: 0.55rem;
    background: linear-gradient(90deg, #475569, #94a3b8);
}

.starship-wing-l {
    left: 0;
    transform: skewY(-10deg);
    border-radius: 3px 0 0 3px;
}

.starship-wing-r {
    right: 0;
    transform: skewY(10deg);
    border-radius: 0 3px 3px 0;
}

.starship-thruster {
    position: absolute;
    left: 50%;
    bottom: 0.5rem;
    width: 0.8rem;
    height: 1.4rem;
    transform: translateX(-50%);
    border-radius: 0 0 50% 50%;
    background: linear-gradient(180deg, #22d3ee, transparent);
    animation: thruster-pulse 0.8s ease-in-out infinite;
}

.starship-warp {
    animation: starship-warp 0.1s linear infinite, starship-float 5s ease-in-out infinite;
    filter: drop-shadow(0 0 40px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 80px rgba(34, 211, 238, 0.6));
}

/* ── Warp overlay ── */

.warp-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.warp-overlay-active {
    opacity: 1;
}

.warp-radial-blur {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, transparent 0%, rgba(0, 0, 0, 0.3) 40%, rgba(0, 0, 0, 0.85) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.warp-overlay-active .warp-radial-blur {
    opacity: 1;
    animation: radial-blur-in 0.8s ease forwards;
}

.warp-flash {
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
}

.warp-overlay-active .warp-flash {
    animation: white-flash 0.8s ease forwards;
}

.warp-lens-flare {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 200%;
    height: 4px;
    transform: translate(-50%, -50%) rotate(-15deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    opacity: 0;
}

.warp-overlay-active .warp-lens-flare {
    animation: lens-flare 0.8s ease forwards;
}

.warp-streaks {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.warp-streaks span {
    position: absolute;
    top: 50%;
    width: 3px;
    height: 200%;
    transform: translateY(-50%);
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: warp-streak-move 0.3s linear infinite;
}

.warp-streaks span:nth-child(1) {
    left: 8%;
    animation-delay: 0s;
}

.warp-streaks span:nth-child(2) {
    left: 22%;
    animation-delay: 0.05s;
}

.warp-streaks span:nth-child(3) {
    left: 38%;
    animation-delay: 0.02s;
}

.warp-streaks span:nth-child(4) {
    left: 55%;
    animation-delay: 0.08s;
}

.warp-streaks span:nth-child(5) {
    left: 72%;
    animation-delay: 0.03s;
}

.warp-streaks span:nth-child(6) {
    left: 88%;
    animation-delay: 0.06s;
}

/* ── Glitch / Pirate attack ── */

.glitch-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(127, 0, 0, 0.25);
    animation: glitch-bg 0.15s steps(2) infinite;
}

.glitch-overlay.active {
    display: flex;
}

.glitch-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            rgba(255, 0, 0, 0.08),
            rgba(255, 0, 0, 0.08) 1px,
            transparent 1px,
            transparent 3px);
    animation: crt-flicker 0.1s steps(2) infinite;
}

.glitch-noise {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: noise-shift 0.2s steps(4) infinite;
}

.glitch-alert {
    position: relative;
    z-index: 1;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: #fca5a5;
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
    animation: glitch-text 0.3s steps(3) infinite;
}

.cockpit-glitch {
    animation: cockpit-shake 0.12s linear infinite;
}

.cockpit-glitch .hud-panel {
    animation: hud-glitch 0.15s steps(2) infinite;
}

/* ── HUD Panel ── */

.hud-panel-glass {
    border-left: 2px solid rgba(34, 211, 238, 0.35);
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(24px);
    box-shadow:
        -8px 0 40px rgba(34, 211, 238, 0.08),
        inset 1px 0 0 rgba(34, 211, 238, 0.15);
}

.hud-panel {
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.7s ease, filter 0.7s ease;
}

.hud-panel-hidden {
    transform: translateX(105%);
    opacity: 0;
    filter: blur(8px);
}

.hud-panel-slide-out {
    transform: translateX(110%);
    opacity: 0;
    filter: blur(12px);
}

.hud-panel-slide-in {
    animation: hud-slide-in 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hud-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22d3ee;
    box-shadow: 0 0 16px rgba(34, 211, 238, 0.9);
}

/* ── HUD bars ── */

.hud-bar-track-lg {
    height: 6px;
}

.hud-bar-track {
    height: 3px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.hud-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    animation: bar-glow 2.5s ease-in-out infinite;
}

.hud-bar-cyan {
    background: linear-gradient(90deg, #0891b2, #22d3ee);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.6);
}

.hud-bar-green {
    background: linear-gradient(90deg, #15803d, #4ade80);
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.hud-glow-pink {
    text-shadow: 0 0 20px rgba(244, 114, 182, 0.5);
}

/* ── HUD buttons ── */

.hud-btn {
    padding: 0.65rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    border-radius: 6px;
    border: 2px solid;
    transition: all 0.2s ease;
    cursor: pointer;
}

.hud-btn-lg {
    padding: 0.9rem 1.25rem;
    font-size: 0.85rem;
}

.hud-nav-btn-lg {
    padding: 1rem 1.25rem;
    font-size: 1rem;
}

.hud-btn-cyan {
    border-color: rgba(34, 211, 238, 0.4);
    background: rgba(8, 145, 178, 0.15);
    color: #67e8f9;
}

.hud-btn-cyan:hover {
    background: rgba(8, 145, 178, 0.3);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.2);
}

.hud-btn-pink {
    border-color: rgba(244, 114, 182, 0.4);
    background: rgba(157, 23, 77, 0.15);
    color: #f9a8d4;
}

.hud-btn-pink:hover {
    background: rgba(157, 23, 77, 0.3);
    box-shadow: 0 0 20px rgba(244, 114, 182, 0.2);
}

.hud-nav-btn {
    padding: 0.9rem 1.1rem;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-align: left;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.35);
    color: #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.hud-nav-btn:hover:not(:disabled) {
    border-color: rgba(168, 85, 247, 0.4);
    background: rgba(88, 28, 135, 0.15);
    color: #e9d5ff;
}

.hud-nav-btn:disabled,
.hud-nav-active {
    border-color: rgba(34, 211, 238, 0.3);
    background: rgba(8, 145, 178, 0.1);
    color: #67e8f9;
    cursor: default;
    opacity: 0.7;
}

/* ── Keyframes ── */

@keyframes planet-drift {

    0%,
    100% {
        transform: scale(1) translate(0, 0);
    }

    50% {
        transform: scale(1.03) translate(-1%, 0.5%);
    }
}

@keyframes planet-brake {
    0% {
        transform: translateY(-50%) scale(1.5);
        opacity: 0.6;
    }

    100% {
        transform: translateY(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes starship-float {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    33% {
        transform: translateY(-14px) rotate(-0.5deg);
    }

    66% {
        transform: translateY(-6px) rotate(0.5deg);
    }
}

@keyframes starship-warp {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px) rotate(-1deg);
    }

    75% {
        transform: translateX(4px) rotate(1deg);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes starship-cargo-bump {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    30% {
        transform: translateY(4px) scale(1.05);
    }

    60% {
        transform: translateY(-2px) scale(0.98);
    }
}

.starship-cargo-bump {
    animation: starship-cargo-bump 0.45s ease-out;
}

/* ── Cargo fly animation ── */

.cargo-fly-layer {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
}

.cargo-flyer {
    position: fixed;
    z-index: 61;
    font-size: 3rem;
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 1;
    filter: drop-shadow(0 0 16px rgba(34, 211, 238, 0.8));
    transition: all 0.7s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   PEŁNOEKRANOWE EFEKTY LOTU — per planeta
   ═══════════════════════════════════════════ */

.travel-fx {
    position: fixed;
    inset: 0;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.travel-fx-active {
    opacity: 1;
    visibility: visible;
}

.travel-fx-scene {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.travel-fx-scene-active {
    animation: fx-scene-in 0.4s ease forwards;
}

/* ── ZIEMIA: atmosfera, chmury, para ── */

.fx-ziemia-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #0c1929 0%, #1e3a5f 40%, #7dd3fc 75%, #e0f2fe 100%);
}

.fx-ziemia-clouds {
    position: absolute;
    inset: 0;
}

.fx-cloud {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(186, 230, 253, 0.6) 40%, transparent 70%);
    filter: blur(12px);
    animation: fx-cloud-fly 2.2s ease-in-out infinite;
}

.fx-cloud-1 {
    width: 45vw;
    height: 22vh;
    left: -10%;
    top: 15%;
    animation-duration: 2s;
}

.fx-cloud-2 {
    width: 55vw;
    height: 28vh;
    left: 30%;
    top: 35%;
    animation-duration: 2.4s;
    animation-delay: 0.3s;
}

.fx-cloud-3 {
    width: 40vw;
    height: 20vh;
    left: 60%;
    top: 10%;
    animation-duration: 1.8s;
    animation-delay: 0.6s;
}

.fx-cloud-4 {
    width: 50vw;
    height: 25vh;
    left: 10%;
    top: 55%;
    animation-duration: 2.6s;
    animation-delay: 0.2s;
}

.fx-cloud-5 {
    width: 35vw;
    height: 18vh;
    left: 70%;
    top: 50%;
    animation-duration: 2.1s;
    animation-delay: 0.8s;
}

.fx-cloud-6 {
    width: 60vw;
    height: 30vh;
    left: 25%;
    top: 70%;
    animation-duration: 3s;
    animation-delay: 0.1s;
}

.fx-ziemia-vapor span {
    position: absolute;
    bottom: -10%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 12px rgba(186, 230, 253, 0.9);
    animation: fx-vapor-rise 1.8s ease-out infinite;
}

.fx-ziemia-vapor span:nth-child(1) {
    left: 8%;
    animation-delay: 0s;
}

.fx-ziemia-vapor span:nth-child(2) {
    left: 16%;
    animation-delay: 0.15s;
}

.fx-ziemia-vapor span:nth-child(3) {
    left: 24%;
    animation-delay: 0.3s;
}

.fx-ziemia-vapor span:nth-child(4) {
    left: 32%;
    animation-delay: 0.1s;
}

.fx-ziemia-vapor span:nth-child(5) {
    left: 40%;
    animation-delay: 0.45s;
}

.fx-ziemia-vapor span:nth-child(6) {
    left: 48%;
    animation-delay: 0.2s;
}

.fx-ziemia-vapor span:nth-child(7) {
    left: 56%;
    animation-delay: 0.55s;
}

.fx-ziemia-vapor span:nth-child(8) {
    left: 64%;
    animation-delay: 0.35s;
}

.fx-ziemia-vapor span:nth-child(9) {
    left: 72%;
    animation-delay: 0.05s;
}

.fx-ziemia-vapor span:nth-child(10) {
    left: 80%;
    animation-delay: 0.5s;
}

.fx-ziemia-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 80%, rgba(255, 255, 255, 0.35), transparent 60%);
    animation: fx-ziemia-glow 2s ease-in-out infinite;
}

.cockpit-flight-ziemia .viewport {
    filter: blur(3px) brightness(1.2);
    transition: filter 0.5s ease;
}

.starship-warp-ziemia {
    animation: starship-float 5s ease-in-out infinite, fx-ship-atmosphere 1.5s ease-in-out infinite !important;
    filter: drop-shadow(0 0 30px rgba(186, 230, 253, 0.9)) !important;
}

/* ── MARS: burza piaskowa ── */

.fx-mars-sky {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a0505 0%, #7f1d1d 40%, #c2410c 70%, #431407 100%);
    animation: fx-mars-pulse 0.8s ease-in-out infinite;
}

.fx-mars-particles span {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(251, 146, 60, 0.9);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
    animation: fx-mars-particle 0.6s linear infinite;
}

.fx-mars-particles span:nth-child(1) {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
    animation-duration: 0.4s;
}

.fx-mars-particles span:nth-child(2) {
    top: 20%;
    left: 15%;
    animation-delay: 0.05s;
    animation-duration: 0.35s;
}

.fx-mars-particles span:nth-child(3) {
    top: 30%;
    left: 25%;
    animation-delay: 0.1s;
    animation-duration: 0.5s;
}

.fx-mars-particles span:nth-child(4) {
    top: 15%;
    left: 40%;
    animation-delay: 0.02s;
    animation-duration: 0.3s;
}

.fx-mars-particles span:nth-child(5) {
    top: 45%;
    left: 10%;
    animation-delay: 0.15s;
    animation-duration: 0.45s;
}

.fx-mars-particles span:nth-child(6) {
    top: 55%;
    left: 55%;
    animation-delay: 0.08s;
    animation-duration: 0.38s;
}

.fx-mars-particles span:nth-child(7) {
    top: 65%;
    left: 70%;
    animation-delay: 0.12s;
    animation-duration: 0.42s;
}

.fx-mars-particles span:nth-child(8) {
    top: 75%;
    left: 30%;
    animation-delay: 0.03s;
    animation-duration: 0.33s;
}

.fx-mars-particles span:nth-child(9) {
    top: 85%;
    left: 80%;
    animation-delay: 0.18s;
    animation-duration: 0.48s;
}

.fx-mars-particles span:nth-child(10) {
    top: 40%;
    left: 90%;
    animation-delay: 0.06s;
    animation-duration: 0.36s;
}

.fx-mars-particles span:nth-child(11) {
    top: 60%;
    left: 45%;
    animation-delay: 0.14s;
    animation-duration: 0.4s;
}

.fx-mars-particles span:nth-child(12) {
    top: 25%;
    left: 60%;
    animation-delay: 0.09s;
    animation-duration: 0.37s;
}

.fx-mars-particles span:nth-child(13) {
    top: 50%;
    left: 20%;
    animation-delay: 0.11s;
    animation-duration: 0.44s;
}

.fx-mars-particles span:nth-child(14) {
    top: 70%;
    left: 65%;
    animation-delay: 0.04s;
    animation-duration: 0.32s;
}

.fx-mars-particles span:nth-child(15) {
    top: 35%;
    left: 85%;
    animation-delay: 0.16s;
    animation-duration: 0.46s;
}

.fx-mars-streaks span {
    position: absolute;
    left: -30%;
    width: 60%;
    height: 4px;
    background: linear-gradient(90deg, transparent, rgba(251, 146, 60, 1), rgba(239, 68, 68, 0.8), transparent);
    filter: blur(1px);
    animation: fx-mars-streak 0.25s linear infinite;
}

.fx-mars-streaks span:nth-child(1) {
    top: 12%;
    animation-delay: 0s;
    height: 3px;
}

.fx-mars-streaks span:nth-child(2) {
    top: 22%;
    animation-delay: 0.04s;
    height: 5px;
}

.fx-mars-streaks span:nth-child(3) {
    top: 32%;
    animation-delay: 0.02s;
}

.fx-mars-streaks span:nth-child(4) {
    top: 42%;
    animation-delay: 0.06s;
    height: 6px;
}

.fx-mars-streaks span:nth-child(5) {
    top: 52%;
    animation-delay: 0.01s;
}

.fx-mars-streaks span:nth-child(6) {
    top: 62%;
    animation-delay: 0.05s;
    height: 4px;
}

.fx-mars-streaks span:nth-child(7) {
    top: 72%;
    animation-delay: 0.03s;
    height: 5px;
}

.fx-mars-streaks span:nth-child(8) {
    top: 82%;
    animation-delay: 0.07s;
}

.fx-mars-streaks span:nth-child(9) {
    top: 28%;
    animation-delay: 0.08s;
    height: 7px;
}

.fx-mars-streaks span:nth-child(10) {
    top: 68%;
    animation-delay: 0.02s;
    height: 3px;
}

.fx-mars-wind {
    position: absolute;
    inset: 0;
    background: rgba(127, 29, 29, 0.25);
    backdrop-filter: blur(4px);
    animation: fx-mars-wind 0.3s linear infinite;
}

.cockpit-flight-mars .viewport {
    filter: sepia(0.5) hue-rotate(-20deg) contrast(1.2);
    animation: fx-mars-shake 0.15s linear infinite;
}

.starship-warp-mars {
    animation: starship-warp 0.08s linear infinite !important;
    filter: drop-shadow(0 0 25px rgba(239, 68, 68, 0.9)) !important;
}

/* ── CYBERTRON: glitch CRT, siatka, matrix ── */

.fx-cyber-grid {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(168, 85, 247, 0.25) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.2) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(55deg) scale(2);
    transform-origin: center bottom;
    animation: fx-cyber-grid-move 0.6s linear infinite;
}

.fx-cyber-matrix span {
    position: absolute;
    top: -5%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 18px;
    font-weight: 700;
    writing-mode: vertical-rl;
    letter-spacing: 0.2em;
    animation: fx-matrix-fall 1s linear infinite;
}

.fx-cyber-matrix span::before {
    content: '01アイウエオ';
    color: rgba(74, 222, 128, 0.85);
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.9);
}

.fx-cyber-matrix span:nth-child(odd)::before {
    content: 'CYBER_TRON_X';
    color: rgba(192, 132, 252, 0.85);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.9);
}

.fx-cyber-matrix span:nth-child(1) {
    left: 3%;
    animation-delay: 0s;
    animation-duration: 0.9s;
}

.fx-cyber-matrix span:nth-child(2) {
    left: 10%;
    animation-delay: 0.2s;
    animation-duration: 1.1s;
}

.fx-cyber-matrix span:nth-child(3) {
    left: 17%;
    animation-delay: 0.05s;
    animation-duration: 0.8s;
}

.fx-cyber-matrix span:nth-child(4) {
    left: 24%;
    animation-delay: 0.35s;
    animation-duration: 1.2s;
}

.fx-cyber-matrix span:nth-child(5) {
    left: 31%;
    animation-delay: 0.1s;
    animation-duration: 0.95s;
}

.fx-cyber-matrix span:nth-child(6) {
    left: 38%;
    animation-delay: 0.45s;
    animation-duration: 1s;
}

.fx-cyber-matrix span:nth-child(7) {
    left: 45%;
    animation-delay: 0.15s;
    animation-duration: 0.85s;
}

.fx-cyber-matrix span:nth-child(8) {
    left: 52%;
    animation-delay: 0.3s;
    animation-duration: 1.15s;
}

.fx-cyber-matrix span:nth-child(9) {
    left: 59%;
    animation-delay: 0.08s;
    animation-duration: 0.9s;
}

.fx-cyber-matrix span:nth-child(10) {
    left: 66%;
    animation-delay: 0.4s;
    animation-duration: 1.05s;
}

.fx-cyber-matrix span:nth-child(11) {
    left: 73%;
    animation-delay: 0.18s;
    animation-duration: 0.88s;
}

.fx-cyber-matrix span:nth-child(12) {
    left: 80%;
    animation-delay: 0.28s;
    animation-duration: 1.1s;
}

.fx-cyber-matrix span:nth-child(13) {
    left: 87%;
    animation-delay: 0.12s;
    animation-duration: 0.92s;
}

.fx-cyber-matrix span:nth-child(14) {
    left: 93%;
    animation-delay: 0.38s;
    animation-duration: 1.08s;
}

.fx-cyber-matrix span:nth-child(15) {
    left: 97%;
    animation-delay: 0.22s;
    animation-duration: 0.87s;
}

.fx-cyber-crt {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6) 100%);
    box-shadow: inset 0 0 120px rgba(168, 85, 247, 0.3);
}

.fx-cyber-glitch-rgb {
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
    animation: fx-cyber-rgb 0.12s steps(2) infinite;
}

.fx-cyber-glitch-rgb::before,
.fx-cyber-glitch-rgb::after {
    content: '';
    position: absolute;
    inset: 0;
}

.fx-cyber-glitch-rgb::before {
    background: rgba(255, 0, 0, 0.08);
    transform: translateX(-4px);
    animation: fx-rgb-shift-l 0.1s steps(2) infinite;
}

.fx-cyber-glitch-rgb::after {
    background: rgba(0, 255, 255, 0.08);
    transform: translateX(4px);
    animation: fx-rgb-shift-r 0.1s steps(2) infinite;
}

.fx-cyber-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.25) 2px,
            rgba(0, 0, 0, 0.25) 4px);
    animation: fx-crt-flicker 0.08s steps(2) infinite;
}

.fx-cyber-barrier {
    position: absolute;
    inset: 0;
    border: 4px solid rgba(168, 85, 247, 0.6);
    box-shadow:
        inset 0 0 60px rgba(34, 211, 238, 0.3),
        0 0 80px rgba(168, 85, 247, 0.4);
    animation: fx-cyber-barrier 0.5s ease-in-out infinite;
}

.cockpit-flight-cybertron .viewport {
    animation: fx-cyber-viewport-glitch 0.15s steps(3) infinite;
}

.cockpit-flight-cybertron .hud-panel {
    animation: hud-glitch 0.12s steps(2) infinite;
}

.starship-warp-cybertron {
    animation: fx-ship-digital 0.2s steps(2) infinite !important;
    filter: drop-shadow(0 0 30px rgba(168, 85, 247, 0.9)) hue-rotate(90deg) !important;
}

/* ── Game modal ── */

.game-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.game-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
}

.game-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 32rem;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    border: 3px solid;
    background: #020617;
    text-align: center;
    animation: modal-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-modal-error {
    border-color: #ef4444;
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.35), inset 0 0 30px rgba(239, 68, 68, 0.08);
}

.game-modal-success {
    border-color: #22c55e;
    box-shadow: 0 0 40px rgba(34, 197, 94, 0.35), inset 0 0 30px rgba(34, 197, 94, 0.08);
}

.game-modal-warning {
    border-color: #f59e0b;
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.35), inset 0 0 30px rgba(245, 158, 11, 0.08);
}

.game-modal-info {
    border-color: #22d3ee;
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.25);
}

.game-modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.game-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin-bottom: 1rem;
}

.game-modal-error .game-modal-title {
    color: #fca5a5;
}

.game-modal-success .game-modal-title {
    color: #86efac;
}

.game-modal-warning .game-modal-title {
    color: #fcd34d;
}

.game-modal-info .game-modal-title {
    color: #67e8f9;
}

.game-modal-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 2rem;
}

.game-modal-btn {
    padding: 1rem 3rem;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    border-radius: 8px;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.2s ease;
}

.game-modal-error .game-modal-btn {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.game-modal-success .game-modal-btn {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.3);
}

.game-modal-warning .game-modal-btn {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

.game-modal-info .game-modal-btn {
    border-color: #22d3ee;
    background: rgba(34, 211, 238, 0.12);
    color: #67e8f9;
}

.game-modal-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.03);
}

@keyframes modal-pop {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fx-scene-in {
    0% {
        opacity: 0;
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fx-cloud-fly {
    0% {
        transform: translateX(-15vw) scale(0.9);
        opacity: 0.4;
        filter: blur(16px);
    }

    50% {
        transform: translateX(10vw) scale(1.1);
        opacity: 1;
        filter: blur(8px);
    }

    100% {
        transform: translateX(25vw) scale(1.2);
        opacity: 0.6;
        filter: blur(20px);
    }
}

@keyframes fx-vapor-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(-110vh) scale(3);
        opacity: 0;
    }
}

@keyframes fx-ziemia-glow {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

@keyframes fx-ship-atmosphere {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px) scale(1.02);
    }
}

@keyframes fx-mars-pulse {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

@keyframes fx-mars-particle {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateX(120vw) translateY(-30px);
        opacity: 0;
    }
}

@keyframes fx-mars-streak {
    0% {
        transform: translateX(0);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    100% {
        transform: translateX(180vw);
        opacity: 0;
    }
}

@keyframes fx-mars-wind {
    0% {
        transform: translateX(0);
        opacity: 0.6;
    }

    100% {
        transform: translateX(-20px);
        opacity: 0.9;
    }
}

@keyframes fx-mars-shake {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-6px, 4px);
    }

    50% {
        transform: translate(5px, -3px);
    }

    75% {
        transform: translate(-4px, -2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes fx-cyber-grid-move {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 50px;
    }
}

@keyframes fx-matrix-fall {
    0% {
        transform: translateY(-10%);
        opacity: 0;
    }

    15% {
        opacity: 1;
    }

    100% {
        transform: translateY(110vh);
        opacity: 0;
    }
}

@keyframes fx-cyber-rgb {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

@keyframes fx-rgb-shift-l {
    0% {
        transform: translateX(-6px);
    }

    100% {
        transform: translateX(-2px);
    }
}

@keyframes fx-rgb-shift-r {
    0% {
        transform: translateX(6px);
    }

    100% {
        transform: translateX(2px);
    }
}

@keyframes fx-crt-flicker {
    0% {
        opacity: 0.85;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.9;
    }
}

@keyframes fx-cyber-barrier {

    0%,
    100% {
        border-color: rgba(168, 85, 247, 0.5);
        box-shadow: inset 0 0 40px rgba(34, 211, 238, 0.2), 0 0 60px rgba(168, 85, 247, 0.3);
    }

    50% {
        border-color: rgba(34, 211, 238, 0.8);
        box-shadow: inset 0 0 80px rgba(168, 85, 247, 0.4), 0 0 100px rgba(34, 211, 238, 0.5);
    }
}

@keyframes fx-cyber-viewport-glitch {
    0% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }

    33% {
        transform: translate(-4px, 2px);
        filter: hue-rotate(30deg);
    }

    66% {
        transform: translate(3px, -2px);
        filter: hue-rotate(-20deg);
    }

    100% {
        transform: translate(0);
        filter: hue-rotate(0deg);
    }
}

@keyframes fx-ship-digital {
    0% {
        transform: translate(0) skewX(0deg);
    }

    50% {
        transform: translate(-3px, 2px) skewX(-2deg);
    }

    100% {
        transform: translate(3px, -1px) skewX(2deg);
    }
}

@keyframes earth-clouds-drift {

    0%,
    100% {
        opacity: 0.7;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(20px);
    }
}

@keyframes vapor-rise {
    0% {
        transform: translateY(0) scale(0.5);
        opacity: 0;
    }

    30% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-300px) scale(1.5);
        opacity: 0;
    }
}

@keyframes mars-streak {
    0% {
        transform: translateX(-150px);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateX(600px);
        opacity: 0;
    }
}

@keyframes cyber-grid-scroll {
    0% {
        transform: perspective(400px) rotateX(20deg) translateY(0);
    }

    100% {
        transform: perspective(400px) rotateX(20deg) translateY(40px);
    }
}

@keyframes matrix-fall {
    0% {
        transform: translateY(-20%);
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    100% {
        transform: translateY(120vh);
        opacity: 0;
    }
}

@keyframes cyber-glitch-bars {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(4px);
    }
}

@keyframes thruster-pulse {

    0%,
    100% {
        opacity: 0.7;
        height: 1.4rem;
    }

    50% {
        opacity: 1;
        height: 1.8rem;
    }
}

@keyframes radial-blur-in {
    0% {
        opacity: 0;
        backdrop-filter: blur(0);
    }

    50% {
        opacity: 1;
        backdrop-filter: blur(20px);
    }

    100% {
        opacity: 0.6;
        backdrop-filter: blur(8px);
    }
}

@keyframes white-flash {
    0% {
        opacity: 0;
    }

    35% {
        opacity: 0.95;
    }

    100% {
        opacity: 0;
    }
}

@keyframes lens-flare {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(-15deg) scaleX(0);
    }

    40% {
        opacity: 1;
        transform: translate(-50%, -50%) rotate(-15deg) scaleX(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) rotate(-15deg) scaleX(0.5);
    }
}

@keyframes warp-streak-move {
    0% {
        transform: translateY(-50%) translateX(-200px);
        opacity: 0;
    }

    30% {
        opacity: 1;
    }

    100% {
        transform: translateY(-50%) translateX(400px);
        opacity: 0;
    }
}

@keyframes hud-slide-in {
    0% {
        transform: translateX(105%);
        opacity: 0;
        filter: blur(8px);
    }

    100% {
        transform: translateX(0);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes bar-glow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.2);
    }
}

@keyframes glitch-bg {
    0% {
        background: rgba(127, 0, 0, 0.2);
    }

    50% {
        background: rgba(200, 0, 0, 0.35);
    }

    100% {
        background: rgba(80, 0, 0, 0.25);
    }
}

@keyframes crt-flicker {
    0% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.7;
    }
}

@keyframes noise-shift {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-2%, 1%);
    }

    50% {
        transform: translate(1%, -2%);
    }

    75% {
        transform: translate(-1%, 2%);
    }

    100% {
        transform: translate(2%, -1%);
    }
}

@keyframes glitch-text {
    0% {
        transform: translate(0);
        clip-path: inset(0 0 90% 0);
    }

    33% {
        transform: translate(-3px, 1px);
        clip-path: inset(30% 0 40% 0);
    }

    66% {
        transform: translate(3px, -1px);
        clip-path: inset(60% 0 10% 0);
    }

    100% {
        transform: translate(0);
        clip-path: inset(0 0 90% 0);
    }
}

@keyframes cockpit-shake {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-5px, 3px);
    }

    50% {
        transform: translate(5px, -4px);
    }

    75% {
        transform: translate(-3px, -2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes hud-glitch {
    0% {
        transform: translateX(0);
        filter: hue-rotate(0deg);
    }

    50% {
        transform: translateX(2px);
        filter: hue-rotate(20deg);
    }

    100% {
        transform: translateX(-1px);
        filter: hue-rotate(-10deg);
    }
}

/* ── Start screen (ship selection) ── */

.start-screen {
    min-height: 100vh;
}

.start-ship-card {
    min-height: 18rem;
}

.start-btn {
    font-size: 1.25rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ── Language switcher ── */

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(34, 211, 238, 0.25);
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(8px);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    z-index: 50;
}

.lang-switcher-hud {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    pointer-events: auto;
}

.lang-switcher-start {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 20;
}

.lang-switch-btn {
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    color: rgba(148, 163, 184, 0.8);
    transition: color 0.2s ease, background 0.2s ease, text-shadow 0.2s ease;
}

.lang-switch-btn:hover {
    color: #67e8f9;
}

.lang-switch-btn.lang-switch-active {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.12);
    text-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
}

.lang-switch-divider {
    color: rgba(100, 116, 139, 0.5);
    user-select: none;
}

/* ── Transaction toasts ── */

.toast-container {
    position: fixed;
    top: 5.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
}

.transaction-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(120%);
}

.transaction-toast.toast-visible {
    animation: toast-slide-in 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.transaction-toast.toast-float {
    animation: toast-float 1.8s ease-in-out infinite;
}

.transaction-toast.toast-exit {
    animation: toast-slide-out 0.45s cubic-bezier(0.55, 0, 1, 0.45) forwards;
}

.transaction-toast.toast-gain {
    color: #6ee7b7;
    background: rgba(6, 78, 59, 0.85);
    border-color: rgba(52, 211, 153, 0.4);
    box-shadow: 0 0 24px rgba(16, 185, 129, 0.25);
}

.transaction-toast.toast-spend {
    color: #fca5a5;
    background: rgba(69, 10, 10, 0.85);
    border-color: rgba(248, 113, 113, 0.4);
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.25);
}

.toast-amount {
    font-variant-numeric: tabular-nums;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    color: inherit;
    opacity: 0.6;
    transition: opacity 0.15s ease, background 0.15s ease;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

@keyframes toast-slide-in {
    0% {
        opacity: 0;
        transform: translateX(120%);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@keyframes toast-slide-out {
    0% {
        opacity: 1;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(120%);
    }
}

/* ── Responsive ── */

@media (max-width: 1024px) {
    .cockpit {
        flex-direction: column;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .viewport,
    .hud-panel {
        width: 100% !important;
    }

    .viewport {
        flex: 0 0 auto;
        height: clamp(180px, 38vh, 320px);
    }

    .hud-panel {
        flex: 1 1 0;
        height: auto !important;
        min-height: 0;
        overflow: hidden;
        border-left: none;
        border-top: 2px solid rgba(34, 211, 238, 0.35);
        box-shadow:
            0 -8px 40px rgba(34, 211, 238, 0.08),
            inset 0 1px 0 rgba(34, 211, 238, 0.15);
    }

    .hud-panel-hidden {
        transform: translateY(105%);
    }

    .hud-panel-slide-out {
        transform: translateY(110%);
    }

    .hud-panel-slide-in {
        animation-name: hud-slide-in-mobile;
    }

    .starship {
        left: calc(50% - 2.5rem);
    }

    .planet-display {
        right: -8%;
        width: 78%;
        height: 78%;
    }

    .viewport-hud {
        transform: scale(0.9);
        transform-origin: bottom left;
    }

    .viewport-hud.text-right {
        transform-origin: top right;
    }

    .lang-switcher-hud {
        top: 0.75rem;
        right: 0.75rem;
    }

    .toast-container {
        top: 4.5rem;
        right: 0.75rem;
        left: 0.75rem;
        align-items: stretch;
    }

    .transaction-toast {
        justify-content: space-between;
    }

    .glitch-alert {
        font-size: 0.55rem;
        letter-spacing: 0.15em;
        padding: 0 1rem;
        text-align: center;
    }
}

@media (max-width: 640px) {
    .viewport {
        height: clamp(160px, 32vh, 260px);
    }

    .viewport-hud {
        transform: scale(0.82);
    }

    .viewport .viewport-hud:first-of-type {
        bottom: 0.75rem;
        left: 0.75rem;
    }

    .viewport .viewport-hud.text-right {
        right: 0.75rem;
        top: 3.25rem;
    }

    .hud-panel-header h1 {
        font-size: 1.25rem;
    }

    .hud-btn,
    .hud-nav-btn,
    .travel-btn {
        min-height: 2.75rem;
    }

    .game-modal {
        padding: 1rem;
        align-items: flex-end;
    }

    .game-modal-box {
        padding: 1.5rem 1.25rem;
        max-height: min(85vh, 100%);
        overflow-y: auto;
    }

    .game-modal-icon {
        font-size: 2.25rem;
    }

    .game-modal-title {
        font-size: 1rem;
        letter-spacing: 0.08em;
    }

    .game-modal-text {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    .game-modal-btn {
        width: 100%;
        padding: 0.85rem 1.5rem;
    }

    .start-ship-card {
        min-height: auto;
    }

    .start-btn {
        font-size: 1rem;
        padding-top: 1.25rem;
        padding-bottom: 1.25rem;
    }

    .hud-panel-body section {
        margin-bottom: 2rem;
    }

    .hud-panel [data-market-item] {
        padding: 1rem;
    }

    .lang-switcher-start {
        top: max(0.75rem, env(safe-area-inset-top));
        right: max(0.75rem, env(safe-area-inset-right));
    }
}

@media (max-width: 380px) {
    .viewport-hud h2 {
        font-size: 1.1rem;
    }

    .hud-btn-lg,
    .hud-nav-btn-lg {
        font-size: 0.75rem;
        letter-spacing: 0.08em;
    }
}

@keyframes hud-slide-in-mobile {
    0% {
        transform: translateY(105%);
        opacity: 0;
        filter: blur(8px);
    }

    100% {
        transform: translateY(0);
        opacity: 1;
        filter: blur(0);
    }
}

/* Safe areas & touch */
.cockpit-body {
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
}

.cockpit-body,
.start-body {
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

.hud-panel-body {
    -webkit-overflow-scrolling: touch;
}

.hud-btn,
.hud-nav-btn,
.travel-btn,
.lang-switch-btn,
.game-modal-btn,
.start-btn {
    touch-action: manipulation;
}