/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #000;
    overflow: hidden;
    font-family: 'Courier New', Courier, monospace;
    color: #00ff88;
    user-select: none;
}

/* ===== Canvas ===== */
#renderCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    outline: none;
    touch-action: none;
}

/* ===== Loading Screen ===== */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at center, #0a1a2e 0%, #050d1a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: #00ff88;
    gap: 20px;
}

#loading-plane {
    font-size: 72px;
    animation: loadingFloat 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 20px #00ff8866);
}

@keyframes loadingFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-12px) rotate(5deg); }
}

#loading-title {
    font-size: 26px;
    font-weight: bold;
    letter-spacing: 6px;
    text-transform: uppercase;
    color: #00ff88;
    text-shadow: 0 0 20px #00ff88;
}

#loading-text {
    font-size: 13px;
    color: #00cc66;
    letter-spacing: 2px;
    min-height: 20px;
}

#loading-bar-wrap {
    width: 320px;
    height: 6px;
    background: rgba(0, 255, 136, 0.12);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

#loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #006633, #00ff88, #66ffbb);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px #00ff88;
}

#loading-hint {
    font-size: 11px;
    color: rgba(0, 255, 136, 0.4);
    letter-spacing: 1px;
}

/* ===== HUD Overlay ===== */
#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #00ff88;
}

/* HUD Panel shared style */
.hud-panel {
    position: absolute;
    background: rgba(0, 8, 4, 0.72);
    border: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 4px;
    padding: 10px 14px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.08), inset 0 0 12px rgba(0, 0, 0, 0.5);
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin: 3px 0;
    white-space: nowrap;
}

.hud-label {
    color: rgba(0, 255, 136, 0.55);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    min-width: 40px;
}

.hud-value {
    color: #00ff88;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: right;
    min-width: 56px;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

.hud-unit {
    color: rgba(0, 255, 136, 0.45);
    font-size: 10px;
    letter-spacing: 1px;
}

/* ===== Left Panel: Speed, Pitch, Roll ===== */
#hud-left {
    top: 16px;
    left: 16px;
    min-width: 140px;
}

/* ===== Right Panel: Altitude, Heading, VS ===== */
#hud-right {
    top: 16px;
    right: 16px;
    min-width: 160px;
}

/* ===== Status bar (bottom left) ===== */
#hud-status-bar {
    bottom: 16px;
    left: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
}

#hud-status {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
}

#hud-brake {
    color: #ff4400;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 2px;
    display: none;
    animation: blinkBrake 0.4s linear infinite;
}

@keyframes blinkBrake {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ===== Throttle Bar (bottom center) ===== */
#hud-throttle-bar {
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    padding: 8px 14px 10px;
}

#throttle-label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

#throttle-track {
    width: 100%;
    height: 8px;
    background: rgba(0, 255, 136, 0.08);
    border: 1px solid rgba(0, 255, 136, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

#throttle-fill {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, #006633, #00ff88);
    border-radius: 4px;
    transition: width 0.1s ease;
    box-shadow: 0 0 6px rgba(0, 255, 136, 0.4);
}

/* ===== Attitude Indicator (center) ===== */
#ai-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
}

#ai-outer {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 136, 0.5);
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.15), inset 0 0 10px rgba(0, 0, 0, 0.5);
    background: rgba(0, 8, 4, 0.5);
}

#ai-horizon {
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    transition: transform 0.05s linear;
}

#ai-sky {
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #1a4a8a 0%, #2a6abf 70%, #3a7fd4 100%);
}

#ai-ground {
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #5a3a1a 0%, #4a2e10 60%, #3a2008 100%);
}

#ai-horizon-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    transform: translateY(-50%);
}

/* AI crosshair/reference */
#ai-ref {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 12px;
    pointer-events: none;
}

#ai-ref::before,
#ai-ref::after {
    content: '';
    position: absolute;
    top: 50%;
    height: 2px;
    width: 22px;
    background: #ffcc00;
    transform: translateY(-50%);
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.5);
}

#ai-ref::before { left: 0; }
#ai-ref::after  { right: 0; }

/* AI center dot */
#ai-center-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    background: #ffcc00;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255, 204, 0, 0.8);
}

/* AI pitch ladder marks */
#ai-pitch-marks {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
}

.ai-pitch-line {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    height: 1px;
    background: rgba(255, 255, 255, 0.6);
}

/* ===== Stall Warning ===== */
#stall-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -80px);
    color: #ff2222;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 4px;
    text-shadow: 0 0 12px #ff0000, 0 0 24px #ff0000;
    display: none;
    padding: 4px 12px;
    border: 1px solid #ff2222;
    background: rgba(255, 0, 0, 0.1);
}

/* ===== Controls Help Panel ===== */
#controls-help {
    position: fixed;
    top: 16px;
    right: 16px;
    background: rgba(0, 8, 4, 0.88);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    padding: 14px 18px;
    z-index: 20;
    color: #00ff88;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    display: none;
    min-width: 210px;
    backdrop-filter: blur(4px);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.08);
    pointer-events: none;
}

#controls-help h3 {
    color: #00ff88;
    font-size: 13px;
    letter-spacing: 3px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0, 255, 136, 0.2);
    padding-bottom: 6px;
    text-transform: uppercase;
}

.help-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0;
}

.help-key {
    color: #ffcc00;
    font-weight: bold;
    min-width: 80px;
}

.help-action {
    color: rgba(0, 255, 136, 0.7);
}

.help-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 255, 136, 0.1);
    color: rgba(0, 255, 136, 0.4);
    font-size: 10px;
    letter-spacing: 1px;
}

/* ===== H key hint ===== */
#h-hint {
    position: fixed;
    bottom: 16px;
    right: 16px;
    font-size: 11px;
    color: rgba(0, 255, 136, 0.35);
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 10;
}

/* ===== HUD dividers ===== */
.hud-divider {
    height: 1px;
    background: rgba(0, 255, 136, 0.12);
    margin: 6px 0;
}
