:root {
    --primary: #00f3ff;
    --danger: #ff0055;
    --success: #00ff66;
    --warning: #ffaa00;
    --bg: #000000;
    --panel: rgba(10, 10, 25, 0.85);
    --ai-color: #b066ff;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    touch-action: none;
}

canvas {
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ── HUD ─────────────────────────────────────────── */

#hud {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.5) 70%, transparent 100%);
    pointer-events: auto;
    flex-wrap: wrap;
    gap: 10px;
}

.hud-stat {
    font-size: 1rem;
    text-shadow: 0 0 5px var(--primary);
    font-weight: bold;
    display: flex;
    flex-direction: column;
}

.hud-stat span {
    font-size: 0.75rem;
    color: #aaa;
    text-shadow: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.bar-container {
    width: 120px;
    height: 10px;
    background: #222;
    border: 1px solid #444;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 4px;
}

.fill-bar {
    height: 100%;
    width: 100%;
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
    transition: width 0.1s linear, background-color 0.3s;
}

#cargo-type-badge {
    font-size: 0.7rem;
    margin-top: 3px;
    padding: 2px 6px;
    border-radius: 3px;
    display: none;
    font-weight: bold;
    letter-spacing: 1px;
}

#urgent-timer {
    font-size: 1.1rem;
    font-weight: bold;
    display: none;
}

.mineral-hud {
    font-size: 0.9rem;
    color: var(--warning);
    text-shadow: 0 0 5px rgba(255, 170, 0, 0.4);
}

/* ── Screens ─────────────────────────────────────── */

.screen {
    position: absolute;
    top: calc(50% + 40px);
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--panel);
    border: 1px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.2);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    pointer-events: auto;
    backdrop-filter: blur(2px);
    min-width: 320px;
    max-width: 450px;
    width: 450px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
    overflow-x: hidden;
    display: none;
}

.screen::-webkit-scrollbar {
    width: 6px;
}

.screen::-webkit-scrollbar-track {
    background: transparent;
}

.screen::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.screen.active {
    display: block;
}

#screen-settings {
    overflow-y: hidden;
}

#screen-settings .lang-toggle {
    display: none;
}

#screen-settings::before {
    content: '';
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: -1;
}

/* ── Shop: two-column dashboard layout ─────────────── */

#screen-shop {
    overflow: hidden;
    padding: 0;
    width: 90%;
    max-width: 850px;
}

#screen-shop.active {
    display: flex;
    flex-direction: column;
}

.shop-header {
    flex-shrink: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #333;
}

.shop-header h2 {
    margin-bottom: 10px;
}

.shop-header h2 .base-id {
    display: block;
    font-size: 0.7rem;
    font-weight: normal;
    color: #8899aa;
    margin-top: 2px;
}

.shop-header .shop-info {
    margin-bottom: 10px;
}

.shop-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.shop-body::-webkit-scrollbar {
    width: 6px;
}

.shop-body::-webkit-scrollbar-track {
    background: transparent;
}

.shop-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.shop-footer {
    flex-shrink: 0;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.shop-footer button {
    margin: 0;
}

/* ── Accordion ─────────────────────────────────────── */

.accordion-section {
    border-bottom: 1px solid #222;
}

.accordion-section:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background 0.2s;
    border-radius: 4px;
}

.accordion-header:hover {
    background: rgba(0, 243, 255, 0.05);
}

.accordion-icon {
    font-size: 0.65rem;
    color: var(--primary);
    transition: transform 0.3s ease;
    display: inline-block;
    width: 14px;
    text-align: center;
}

.accordion-section.open .accordion-icon {
    transform: rotate(90deg);
}

.accordion-title {
    font-size: 0.8rem;
    color: #aaa;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: bold;
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

/* ── Maintenance row (flex) ─────────────────────── */

.maintenance-row {
    display: flex;
    gap: 8px;
    flex-direction: row;
    margin-bottom: 4px;
}

.maint-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #1a2233;
    transition: all 0.1s;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.maint-btn .maint-icon {
    font-size: 1.4rem;
    margin-bottom: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.maint-btn .maint-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.maint-btn .maint-cost {
    font-size: 0.65rem;
    color: #aaa;
    margin-top: 3px;
    font-weight: normal;
    letter-spacing: 0;
    text-transform: none;
}

.maint-btn.keyboard-focus {
    border-color: #00f3ff;
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.2);
}

.maint-btn.active-press {
    transform: scale(0.95);
}

.kb-hint {
    font-size: 0.6rem;
    color: #556;
    text-align: center;
    padding: 3px 0 6px;
    letter-spacing: 0.03em;
}

@media (max-width: 450px) {
    .maintenance-row {
        flex-direction: column;
    }
    .maint-btn {
        flex-direction: row;
        justify-content: space-between;
        padding: 12px 15px;
        margin: 0;
    }
    .maint-btn .maint-icon {
        margin-bottom: 0;
        margin-right: 8px;
        font-size: 1.1rem;
    }
    .maint-btn .maint-label {
        flex: 1;
        text-align: left;
    }
    .maint-btn .maint-cost {
        margin-top: 0;
    }
}

.shop-section-note {
    font-size: 0.7rem;
    color: #556;
    text-align: left;
    margin: 6px 0 4px;
}

h1, h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.text-danger {
    color: var(--danger);
    text-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
}

.text-success {
    color: var(--success);
    text-shadow: 0 0 10px rgba(0, 255, 102, 0.5);
}

.text-warning {
    color: var(--warning);
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

/* ── Buttons ─────────────────────────────────────── */

button {
    background: transparent;
    color: white;
    border: 1px solid var(--primary);
    padding: 10px 15px;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin: 5px 0;
    width: 100%;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

button:hover:not(:disabled) {
    background: rgba(0, 243, 255, 0.15);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

button:active:not(:disabled) {
    transform: scale(0.98);
}

button:disabled {
    border-color: #555;
    color: #777;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-primary {
    background: rgba(0, 243, 255, 0.1);
    justify-content: center;
}

.btn-repair {
    border-color: var(--warning);
    color: var(--warning);
}

.btn-repair:hover:not(:disabled) {
    background: rgba(255, 170, 0, 0.15);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.4);
}

.btn-shield {
    border-color: var(--ai-color);
    color: var(--ai-color);
}

.btn-shield:hover:not(:disabled) {
    background: rgba(176, 102, 255, 0.15);
    box-shadow: 0 0 15px rgba(176, 102, 255, 0.5);
}

.btn-comp {
    border-color: #cc44ff;
    color: #cc44ff;
}

.btn-comp:hover:not(:disabled) {
    background: rgba(204, 68, 255, 0.15);
    box-shadow: 0 0 15px rgba(204, 68, 255, 0.4);
}

.btn-urgent {
    border-color: var(--warning);
    color: var(--warning);
}

.btn-urgent:hover:not(:disabled) {
    background: rgba(255, 170, 0, 0.15);
    box-shadow: 0 0 15px rgba(255, 170, 0, 0.5);
}

.btn-contraband {
    border-color: #ff4488;
    color: #ff4488;
}

.btn-contraband:hover:not(:disabled) {
    background: rgba(255, 68, 136, 0.15);
    box-shadow: 0 0 15px rgba(255, 68, 136, 0.5);
}

.btn-fragile {
    border-color: #88ffcc;
    color: #88ffcc;
}

.btn-fragile:hover:not(:disabled) {
    background: rgba(136, 255, 204, 0.15);
    box-shadow: 0 0 15px rgba(136, 255, 204, 0.5);
}

.btn-normal {
    border-color: #cccccc;
    color: #cccccc;
}

.btn-normal:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* ── Shop tooltip ────────────────────────────────── */

.shop-tooltip {
    position: fixed;
    z-index: 1000;
    max-width: 260px;
    padding: 8px 12px;
    background: rgba(8, 8, 20, 0.95);
    border: 1px solid var(--primary);
    border-radius: 6px;
    color: #ccd;
    font-size: 0.75rem;
    line-height: 1.4;
    letter-spacing: 0.02em;
    text-transform: none;
    font-weight: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.25);
    text-align: left;
}

.shop-tooltip.visible {
    opacity: 1;
}

/* ── Shop ────────────────────────────────────────── */

.shop-info {
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    text-align: left;
}

.shop-info p {
    margin: 5px 0;
    font-size: 0.9rem;
}

.ai-terminal {
    background: #050508;
    border: 1px solid #333;
    border-left: 3px solid var(--ai-color);
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #ccc;
    display: none;
}

.ai-terminal.active {
    display: block;
}

.ai-terminal strong {
    color: var(--ai-color);
}

.divider {
    height: 1px;
    background: #333;
    margin: 10px 0;
}

#cargo-offers-container {
    margin-bottom: 5px;
}

/* Hide shop sections when on a crater pad — keep only header + cargo info + footer */
.crater-mode .maintenance-row,
.crater-mode .kb-hint,
.crater-mode .accordion-section[data-section="upgrades"],
.crater-mode .accordion-section[data-section="debt"],
.crater-mode #mineral-sell-section,
.crater-mode #balance-info,
.crater-mode #tp-shop-notify,
.crater-mode #tp-session-display,
.crater-mode .radio-deck {
    display: none !important;
}

.crater-mode .accordion-header {
    display: none !important;
}

.crater-mode .accordion-content {
    max-height: none !important;
}

/* ── Placement ───────────────────────────────────── */

#placement-preview {
    display: block;
    margin: 0 auto;
    border: 1px solid #333;
    border-radius: 8px;
    background: #050508;
}

.place-btns {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.place-btns button {
    flex: 1;
}

/* ── Settings Block ─────────────────────────────────── */

.settings-block {
    display: flex; flex-direction: column; gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    padding: 15px; border-radius: 8px; border: 1px solid #1a2233;
    margin-bottom: 20px;
}
.slider-row { display: flex; flex-direction: column; gap: 8px; }
.slider-header { display: flex; justify-content: space-between; font-size: 0.9rem; color: #aaddff; }
.slider-value { color: #00f3ff; font-weight: bold; }

/* Custom Range Slider */
input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]:focus { outline: none; }
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 6px; cursor: pointer;
    background: #1a2233; border-radius: 3px; border: 1px solid #334;
}
input[type=range]::-webkit-slider-thumb {
    height: 16px; width: 16px; border-radius: 50%;
    background: #00f3ff; cursor: pointer; -webkit-appearance: none;
    margin-top: -6px; box-shadow: 0 0 10px rgba(0, 243, 255, 0.8);
}

/* ── Mobile touch zones ─────────────────────────────── */

#mobile-touch-hint {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s;
}

#mobile-touch-hint.visible {
    opacity: 1;
}

.touch-zone-left, .touch-zone-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.18);
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.touch-zone-left {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.touch-hint-sub {
    font-size: 0.7rem;
    margin-top: 4px;
    font-weight: normal;
    opacity: 0.7;
}

/* Floating ping button */
.ping-float {
    display: none;
    position: absolute;
    bottom: 14px;
    left: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 18px;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 5;
    user-select: none;
    -webkit-user-select: none;
}

.ping-float.active {
    background: rgba(0, 243, 255, 0.3);
    border-color: var(--primary);
}

/* ── Gyroscope permission overlay ──────────────────── */

#gyro-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

#gyro-overlay.visible {
    display: flex;
}

.gyro-overlay-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
}

#btn-enable-gyro {
    margin-top: 1.5rem;
    padding: 12px 32px;
    font-size: 1.2rem;
    background: var(--primary);
    color: #000;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: bold;
}

@media (max-width: 768px), (pointer: coarse) {
    #mobile-touch-hint {
        display: flex;
    }

    /* ping-float visibility is controlled by JS based on scannerLvl */

    .screen {
        width: 85%;
        padding: 15px;
    }

    .shop-header {
        padding-bottom: 8px;
    }

    .shop-body {
        padding: 0;
    }

    .shop-footer {
        padding-top: 8px;
    }

    #hud {
        padding: 5px 10px;
    }

    .hud-stat {
        font-size: 0.85rem;
    }

    .bar-container {
        width: 80px;
    }
}

/* ── Start / Menu screen ─────────────────────────────────────────── */

#screen-start {
    position: absolute;
    background: radial-gradient(ellipse at center, rgba(15, 20, 25, 0.85) 0%, rgba(0, 0, 0, 0.5) 60%, transparent 100%);
    border: none;
    box-shadow: none;
    backdrop-filter: blur(3px);
    /* Centered on screen, logo overlaps the blurred panel */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    min-width: 320px;
    padding: 20px 40px 30px;
}

/* Menu mute button */
#menu-mute {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s, text-shadow 0.2s;
    user-select: none;
    -webkit-user-select: none;
    z-index: 2;
}

#menu-mute:hover {
    opacity: 1;
    text-shadow: 0 0 12px var(--primary);
}

.menu-logo {
    display: block;
    width: 70%;
    max-width: 340px;
    height: auto;
    margin: 0 auto 6px;
    filter: drop-shadow(0 0 24px rgba(255, 160, 60, 0.45)) drop-shadow(0 0 12px rgba(0, 220, 255, 0.3));
    pointer-events: none;
}

#menu-tagline {
    font-size: clamp(0.75rem, 1.8vw, 1rem);
    color: rgba(180, 220, 255, 0.75);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    margin-bottom: 20px;
    text-shadow: 0 0 12px rgba(0, 160, 255, 0.4);
}

#screen-start .btn-primary {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 20px;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    border-width: 2px;
    background: rgba(0, 243, 255, 0.12);
    border-color: var(--primary);
    box-shadow: 0 0 18px rgba(0, 243, 255, 0.3), inset 0 0 18px rgba(0, 243, 255, 0.06);
    justify-content: center;
    margin-bottom: 0;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    animation: btnPulse 2.5s ease-in-out infinite;
}

@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 18px rgba(0,243,255,0.3), inset 0 0 18px rgba(0,243,255,0.06); }
    50%      { box-shadow: 0 0 32px rgba(0,243,255,0.55), inset 0 0 24px rgba(0,243,255,0.12); }
}

/* ── Storm warning ──────────────────────────────── */
#storm-warning {
    display: none;
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: bold;
    color: #ff4400;
    text-shadow: 0 0 15px rgba(255,68,0,0.8);
    letter-spacing: 0.15em;
    z-index: 100;
    text-align: center;
    pointer-events: none;
    animation: stormBlink 0.5s ease-in-out infinite;
}
@keyframes stormBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#screen-start .btn-primary:hover {
    background: rgba(0, 243, 255, 0.25);
    box-shadow: 0 0 40px rgba(0, 243, 255, 0.7), inset 0 0 24px rgba(0, 243, 255, 0.15);
    transform: scale(1.05);
    animation: none;
}

#screen-start .btn-settings {
    width: auto;
    padding: 12px 40px;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(200, 230, 255, 0.8);
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.08);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
}

#screen-start .btn-settings:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    transform: scale(1.03);
}

#menu-version {
    margin-top: 12px;
    font-size: 0.65rem;
    color: rgba(120, 160, 200, 0.35);
    letter-spacing: 0.15em;
}

#menu-controls-hint {
    margin-top: 22px;
    font-size: 0.72rem;
    color: rgba(120, 160, 200, 0.45);
    letter-spacing: 0.1em;
    line-height: 1.8;
}

@media (max-width: 600px) {
    #screen-start .btn-primary {
        width: 100%;
    }
    #screen-start .menu-row-game .btn-settings,
    #screen-start .menu-row-util .btn-settings {
        padding: 10px 4px;
        font-size: 0.75rem;
    }
}

/* ── Menu buttons container (flex layout) ──────────────────────── */

.menu-buttons-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

/* Game row: 2 equal columns */
.menu-row-game {
    display: flex;
    gap: 10px;
}
#screen-start .menu-row-game .btn-settings {
    flex: 1;
    min-width: 0;
    padding: 12px 8px;
    letter-spacing: 0.08em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Utility row: 3 equal columns */
.menu-row-util {
    display: flex;
    gap: 10px;
}
#screen-start .menu-row-util .btn-settings {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Menu top bar (TP counter & language toggle at screen corners) ── */

.menu-top-bar {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    pointer-events: auto;
}

#screen-start.active ~ .menu-top-bar {
    display: flex;
}

.menu-top-bar .lang-toggle {
    margin: 0;
}

.menu-top-bar .btn-lang {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #1a2233;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 1.2rem;
    cursor: pointer;
    filter: grayscale(70%);
    opacity: 0.7;
    transition: filter 0.2s, opacity 0.2s;
}

.menu-top-bar .btn-lang.btn-lang-active {
    filter: grayscale(0%);
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.menu-top-bar .btn-lang:hover {
    filter: grayscale(0%);
    opacity: 1;
}

/* ── Leaderboard dark background ───────────────────────────────── */

#records-start {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 6px 8px;
    margin-top: 10px;
}

/* ── Help screen ────────────────────────────────── */

.help-section {
    text-align: left;
    margin-bottom: 14px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.help-label {
    font-size: 0.7rem;
    color: var(--primary);
    letter-spacing: 0.15em;
    margin-bottom: 8px;
    text-shadow: 0 0 6px rgba(0, 243, 255, 0.3);
}

.help-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 12px;
    font-size: 0.82rem;
    align-items: baseline;
}

.help-key {
    color: var(--primary);
    font-weight: bold;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* ── Academy — CRT green theme ──────────────────── */

.academy-screen {
    border-color: #00cc00;
    box-shadow: 0 0 30px rgba(0, 204, 0, 0.2);
    background: rgba(0, 10, 0, 0.92);
}

.academy-screen h2 {
    color: #00ff00;
    text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.academy-screen p {
    color: #00cc88;
}

.academy-screen button {
    border-color: #00aa00;
    color: #00ff00;
}

.academy-screen button:hover:not(:disabled) {
    background: rgba(0, 255, 0, 0.15);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.4);
}

.academy-screen button:disabled {
    border-color: #003300;
    color: #005500;
}

#academy-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 8px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: bold;
    color: #00ff00;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
    background: linear-gradient(180deg, rgba(0, 8, 0, 0.85) 0%, transparent 100%);
    z-index: 10;
    letter-spacing: 0.08em;
}

#academy-hud button {
    background: transparent;
    border: 1px solid #00aa00;
    color: #00ff00;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    letter-spacing: 0.05em;
    pointer-events: auto;
    width: auto;
}

#academy-hud button:hover {
    background: rgba(0, 255, 0, 0.15);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* ── Story screens ────────────────────────────────────────────────────────── */
#screen-prologue {
    border-color: var(--warning);
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.2);
}

#screen-buyout {
    border-color: var(--success);
    box-shadow: 0 0 40px rgba(0, 255, 102, 0.25);
}

.buyout-title {
    animation: buyoutPulse 2s ease-in-out infinite;
}

@keyframes buyoutPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(0, 255, 102, 0.5); }
    50%      { text-shadow: 0 0 30px rgba(0, 255, 102, 0.9), 0 0 60px rgba(0, 255, 102, 0.3); }
}

/* ── Outro / Demo Ending screen ───────────────── */

#screen-outro {
    border-color: var(--success);
    box-shadow: 0 0 40px rgba(0, 255, 102, 0.25);
}

#outro-title {
    animation: buyoutPulse 2s ease-in-out infinite;
}

.outro-stats {
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
}

.outro-tg-link {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 16px;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.outro-tg-link:hover {
    background: rgba(0, 243, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.3);
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.5);
}

/* ── Phobos Escape dialog ──────────────────────── */

.phobos-escape-screen {
    border-color: #ff0055 !important;
    box-shadow: 0 0 40px rgba(255, 0, 85, 0.3), inset 0 0 60px rgba(255, 0, 85, 0.05) !important;
    background: rgba(5, 0, 8, 0.95) !important;
}

.glitch-text {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ff0055;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    text-align: center;
    margin-bottom: 15px;
    position: relative;
    animation: glitchFlicker 3s infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    right: 0;
    overflow: hidden;
}

.glitch-text::before {
    top: -2px;
    color: #00f3ff;
    clip-path: inset(0 0 60% 0);
    animation: glitchShift 2s infinite linear alternate-reverse;
}

.glitch-text::after {
    top: 2px;
    color: #ff0055;
    clip-path: inset(60% 0 0 0);
    animation: glitchShift 1.5s infinite linear alternate;
}

@keyframes glitchFlicker {
    0%, 92%, 100% { opacity: 1; }
    93% { opacity: 0.7; }
    94% { opacity: 1; }
    95% { opacity: 0.4; }
    96% { opacity: 1; }
}

@keyframes glitchShift {
    0%, 80% { transform: translateX(0); }
    85% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
    95% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

.phobos-terminal {
    background: #050508;
    border: 1px solid #333;
    border-left: 3px solid #ff0055;
    padding: 12px;
    border-radius: 4px;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    color: #ccc;
    line-height: 1.7;
}

.phobos-sender {
    color: #ff0055;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.85rem;
    text-shadow: 0 0 8px rgba(255, 0, 85, 0.5);
}

#phobos-choice-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

#phobos-choice-buttons button {
    flex: 1;
    justify-content: center;
}

.btn-phobos-accept {
    border-color: var(--success) !important;
    color: var(--success) !important;
}

.btn-phobos-accept:hover:not(:disabled) {
    background: rgba(0, 255, 102, 0.15) !important;
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.4) !important;
}

.btn-phobos-refuse {
    border-color: #888 !important;
    color: #aaa !important;
}

.btn-phobos-refuse:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08) !important;
}

.btn-phobos-refuse.refused {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
    background: rgba(255, 0, 85, 0.2) !important;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.4) !important;
    animation: refuseFlash 0.3s ease-out;
}

@keyframes refuseFlash {
    0% { background: rgba(255, 0, 85, 0.6); }
    100% { background: rgba(255, 0, 85, 0.2); }
}

.btn-emergency-takeoff {
    border-color: var(--danger) !important;
    color: var(--danger) !important;
    background: rgba(255, 0, 85, 0.1) !important;
    font-size: 1rem !important;
    padding: 14px !important;
    margin-top: 12px;
    justify-content: center;
    animation: emergencyPulse 1s ease-in-out infinite;
}

.btn-emergency-takeoff:hover:not(:disabled) {
    background: rgba(255, 0, 85, 0.25) !important;
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.5) !important;
}

@keyframes emergencyPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 0, 85, 0.3); }
    50% { box-shadow: 0 0 25px rgba(255, 0, 85, 0.6), inset 0 0 15px rgba(255, 0, 85, 0.1); }
}

#phobos-aftermath .phobos-terminal {
    border-left-color: var(--danger);
}

#screen-phobos {
    border-color: var(--warning);
    box-shadow: 0 0 30px rgba(255, 170, 0, 0.15);
}

#buyout-progress {
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

#debt-pay-input {
    -moz-appearance: textfield;
}
#debt-pay-input::-webkit-inner-spin-button,
#debt-pay-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ── Records table ─────────────────────────────────────────────────────────── */
.records-title {
    font-size: 0.7rem;
    color: #556;
    letter-spacing: 0.15em;
    text-align: center;
    margin: 10px 0 4px;
    text-transform: uppercase;
}
.record-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    padding: 3px 4px;
    border-bottom: 1px solid #111122;
    font-family: 'Courier New', monospace;
}
.rec-medal { min-width: 20px; }
.rec-ship  { color: var(--primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-score { color: var(--warning); min-width: 56px; text-align: right; }
.rec-dist  { color: #ccd; min-width: 62px; text-align: right; }
.rec-date  { color: #556; font-size: 0.63rem; min-width: 52px; text-align: right; }
.records-empty { font-size: 0.72rem; color: #445; text-align: center; padding: 8px 0; }
.rec-flag { min-width: 18px; font-size: 0.85rem; }

/* ── Leaderboard tabs ────────────────────────────── */

.records-tabs-container { margin: 10px 0 4px; }
.records-tab-buttons { display: flex; gap: 0; margin-bottom: 6px; }
.records-tab-btn {
    flex: 1;
    background: transparent;
    border: 1px solid #222;
    color: #556;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    padding: 5px 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.2s, border-color 0.2s;
}
.records-tab-btn.active {
    color: var(--primary);
    border-color: var(--primary);
    text-shadow: 0 0 6px rgba(0, 243, 255, 0.3);
}
.records-tab-content { display: none; }
.records-tab-content.active { display: block; }

.records-loading {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--primary);
    text-align: center;
    padding: 12px 0;
    animation: blink-loading 1.2s ease-in-out infinite;
}
@keyframes blink-loading {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.records-error {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--danger);
    text-align: center;
    padding: 12px 0;
}
.btn-show-more {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid #333;
    color: #667;
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    padding: 4px 8px;
    margin-top: 4px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.2s, border-color 0.2s;
}
.btn-show-more:hover { color: var(--primary); border-color: var(--primary); }

/* ── Callsign / ship name input ──────────────────── */

.callsign-block {
    margin: 10px 0 8px;
    text-align: center;
}
.callsign-block label {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #889;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.callsign-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.callsign-input {
    background: rgba(0, 10, 20, 0.8);
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 6px 10px;
    width: 140px;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}
.callsign-input::placeholder { color: #335; }
.callsign-input.invalid { border-color: var(--danger); color: var(--danger); }
.callsign-hint {
    font-family: 'Courier New', monospace;
    font-size: 0.6rem;
    color: #445;
    margin-top: 3px;
}
.flag-picker-btn {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    background: rgba(0, 10, 20, 0.8);
    border: 1px solid #334;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}
.flag-picker-btn:hover { border-color: var(--primary); }
.flag-picker-dropdown {
    position: relative;
    max-height: 180px;
    overflow-y: auto;
    background: rgba(5, 8, 18, 0.95);
    border: 1px solid #334;
    border-radius: 4px;
    margin-top: 4px;
    padding: 4px;
}
.flag-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.flag-option {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px;
    border-radius: 3px;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.flag-option .fi {
    font-size: 1.2em;
}
.flag-option:hover { background: rgba(0, 243, 255, 0.15); border-color: var(--primary); }
.flag-separator {
    height: 1px;
    background: #223;
    margin: 4px 0;
}
.btn-submit-record {
    margin-top: 6px;
    font-size: 0.7rem !important;
    letter-spacing: 0.1em;
}
.btn-submit-record:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}
.submit-status {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    margin-top: 4px;
    min-height: 1em;
}
.submit-status.ok { color: var(--success); }
.submit-status.fail { color: var(--danger); }
.hidden { display: none !important; }

/* ── Telemetry ───────────────────────────────────── */

.telemetry-menu-display {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--primary);
    letter-spacing: 0.1em;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

.telemetry-upgrade-row {
    margin-bottom: 12px;
}

.telemetry-upgrade-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 4px;
    color: #ccd;
}

.tp-pct {
    font-family: 'Courier New', monospace;
    color: var(--primary);
    font-size: 0.8rem;
}

.telemetry-bar-bg {
    width: 100%;
    height: 8px;
    background: #1a1a2e;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.telemetry-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00f3ff, #00cc88);
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 6px rgba(0, 243, 255, 0.4);
}

.tp-earned-line {
    font-size: 0.9rem;
    margin-top: 4px;
}

.tp-notify {
    font-size: 0.82rem;
    color: var(--primary);
    text-align: center;
    padding: 4px 8px;
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.08em;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

/* ── Debug panel ─────────────────────────────────────────────────────────── */

#debug-panel {
    position: fixed;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.78);
    color: #00f3ff;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    padding: 10px 14px;
    border: 1px solid #00f3ff;
    border-radius: 4px;
    z-index: 9999;
    pointer-events: auto;
    max-width: 340px;
    line-height: 1.5;
    user-select: none;
}

#debug-panel .debug-title {
    color: #ff0055;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 6px;
    letter-spacing: 0.15em;
}

#debug-panel .debug-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

#debug-panel .debug-label { color: #888; }
#debug-panel .debug-value { color: #00ff66; }

#debug-panel .debug-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 243, 255, 0.2);
}

#debug-panel .debug-cheat {
    color: #ff0055;
    font-size: 11px;
}

#debug-panel .debug-cheat.off {
    color: #555;
}

#debug-levels {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

#debug-panel button {
    background: rgba(0, 243, 255, 0.12);
    color: #00f3ff;
    border: 1px solid #00f3ff;
    padding: 3px 10px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    border-radius: 2px;
}

#debug-panel button:hover {
    background: rgba(0, 243, 255, 0.3);
}

#debug-panel button.dev {
    opacity: 0.5;
    border-style: dashed;
}

/* ── Port Fee Receipt ────────────────────────────────────────────────────── */

.port-fee-receipt {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #8899aa;
    background: rgba(15, 18, 30, 0.7);
    border: 1px dashed #334;
    padding: 8px 10px;
    margin: 6px 0;
    line-height: 1.6;
    white-space: pre;
    text-shadow: 0 0 3px rgba(136,153,170,0.3);
    overflow-x: auto;
}
.port-fee-receipt .receipt-header {
    color: #667;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.65rem;
}
.port-fee-receipt .receipt-item {
    color: #cc6644;
}
.port-fee-receipt .receipt-total {
    color: #ff4400;
    font-weight: bold;
}
.port-fee-receipt .receipt-debt {
    color: #ff0055;
    font-size: 0.7rem;
}
.port-fee-receipt .receipt-dead {
    color: #556;
    font-style: italic;
}
.port-fee-receipt .receipt-toggle {
    display: block;
    cursor: pointer;
    color: #ff4400;
    font-weight: bold;
    font-size: 0.75rem;
    white-space: pre;
    user-select: none;
}
.port-fee-receipt .receipt-toggle:hover {
    color: #ff6633;
}
.port-fee-receipt .receipt-body {
    overflow: hidden;
    transition: max-height 0.4s ease;
}

/* ── Mars Radio Deck ───────────────────────────────────────────────────────── */

.radio-deck {
    background: #0a0e14;
    border: 1px solid #334455;
    border-radius: 8px;
    padding: 12px;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 1);
    margin-bottom: 20px;
}

/* Terminal Screen */
.radio-screen {
    background: #031005;
    border: 1px solid #00ff66;
    border-radius: 4px;
    padding: 10px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.1);
    overflow: hidden;
}
.radio-title {
    font-size: 0.65rem;
    color: #008833;
    letter-spacing: 2px;
    margin-bottom: 5px;
}
.radio-marquee-wrap {
    overflow: hidden;
    white-space: nowrap;
    height: 1.3em;
}
.radio-marquee {
    display: inline-block;
    color: #00ff66;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    font-weight: bold;
    text-shadow: 0 0 5px #00ff66;
    animation: radio-scroll 10s linear infinite;
}
.radio-marquee.stopped {
    animation: none;
}
@keyframes radio-scroll {
    0%   { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

/* Player Controls (one horizontal row) */
.radio-controls {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}
.control-btn {
    flex: 1;
    background: #111822;
    border: 1px solid #2a3545;
    color: #8899aa;
    padding: 8px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
}
.control-btn:hover {
    background: #1a2533;
    border-color: #00f3ff;
    color: #00f3ff;
}
.control-btn:active {
    background: rgba(0, 243, 255, 0.1);
}
.control-btn.active {
    background: #002211;
    border-color: #00ff66;
    color: #00ff66;
}

/* Playlist & Scrollbar */
.playlist {
    max-height: 120px;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
    padding-right: 5px;
}
.playlist::-webkit-scrollbar { width: 6px; }
.playlist::-webkit-scrollbar-track { background: #0a0e14; border-radius: 3px; }
.playlist::-webkit-scrollbar-thumb { background: #334455; border-radius: 3px; }

/* Track Items */
.track-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: transparent;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.track-item:hover:not(.locked) {
    background: rgba(255, 255, 255, 0.05);
}
.track-item.selected {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 243, 255, 0.05);
}
.track-item.playing {
    background: rgba(0, 255, 102, 0.1);
    border-color: rgba(0, 255, 102, 0.3);
    color: #00ff66;
}
.track-item.locked {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.track-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.track-tag {
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 3px;
    border: 1px solid #445;
    color: #889;
}
.playing .track-tag {
    border-color: #00ff66;
    color: #00ff66;
}

/* ── Track Find Notification ─────────────────────────────────────────────── */

.track-find-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    justify-content: center;
    align-items: center;
}

.track-find-overlay.visible {
    display: flex;
    pointer-events: auto;
    animation: track-find-in 0.4s ease-out;
}

.track-find-overlay.hiding {
    animation: track-find-out 0.6s ease-in forwards;
}

.track-find-content {
    background: rgba(0, 10, 0, 0.92);
    border: 1px solid #33ff66;
    border-radius: 8px;
    padding: 16px 24px;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 0 30px rgba(51, 255, 102, 0.3), inset 0 0 20px rgba(51, 255, 102, 0.05);
}

#track-find-text {
    color: #33ff66;
    font-family: monospace;
    font-size: 0.85rem;
    line-height: 1.5;
    text-shadow: 0 0 6px rgba(51, 255, 102, 0.5);
}

@keyframes track-find-in {
    0%   { opacity: 0; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes track-find-out {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.9) translateY(-20px); }
}

/* ── Lore block in track-find notification ─────────────────────────────────── */

.track-find-lore {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed rgba(51, 255, 102, 0.3);
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
}
.track-find-lore .lore-divider {
    color: #33aa44;
    font-size: 0.65rem;
    letter-spacing: 2px;
    opacity: 0.5;
    overflow: hidden;
    white-space: nowrap;
}
.track-find-lore .lore-scan-status {
    color: #ffaa00;
    font-size: 0.7rem;
    letter-spacing: 1px;
    margin: 4px 0 2px;
    animation: lore-blink 1.5s ease-in-out 2;
}
.track-find-lore .lore-source {
    color: #33ff66;
    font-size: 0.7rem;
    margin-bottom: 2px;
}
.track-find-lore .lore-author {
    color: #44aa55;
    font-size: 0.65rem;
    font-style: italic;
    margin-bottom: 8px;
    opacity: 0.7;
}
.track-find-lore .lore-body {
    color: #33dd55;
    font-size: 0.75rem;
    line-height: 1.5;
    text-shadow: 0 0 4px rgba(51, 221, 85, 0.3);
    white-space: pre-wrap;
    max-height: 160px;
    overflow-y: auto;
}
.track-find-lore .lore-body::-webkit-scrollbar { width: 3px; }
.track-find-lore .lore-body::-webkit-scrollbar-track { background: transparent; }
.track-find-lore .lore-body::-webkit-scrollbar-thumb { background: #33aa44; border-radius: 2px; }

@keyframes lore-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.track-find-takeoff-hint {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed rgba(51, 255, 102, 0.3);
    color: #33ff66;
    font-family: monospace;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-align: center;
    animation: lore-blink 1.5s ease-in-out infinite;
}

/* ── Shop Layout Wrapper (two-column dashboard) ───────────────────────────── */

.shop-layout {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 0;
}

#screen-shop .col-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
    padding: 15px 18px;
}

#screen-shop .col-right {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    overflow-y: auto;
    padding: 15px 18px;
    border-left: 1px solid #333;
}

#screen-shop .col-right .shop-body {
    overflow-y: auto;
}

/* Pin radio to bottom of right column */
#screen-shop .radio-deck {
    margin-top: auto;
}

/* Scrollbar for col-right */
#screen-shop .col-right::-webkit-scrollbar { width: 6px; }
#screen-shop .col-right::-webkit-scrollbar-track { background: transparent; }
#screen-shop .col-right::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }

/* ── Compact Radio Layout (in shop) ──────────────────────────────────────── */

.radio-compact {
    padding: 10px;
    gap: 8px;
}

.radio-compact .radio-top-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.radio-compact .radio-top-row .radio-screen {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
}

.radio-compact .radio-top-row .radio-controls {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
}

.radio-compact .control-btn {
    flex: none;
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 0.8rem;
}

/* Playlist hidden by default, shown via toggle */
.radio-compact .playlist {
    display: none;
    max-height: 150px;
    overflow-y: auto;
    margin-top: 5px;
    border-top: 1px solid #2a3545;
    padding-top: 5px;
}

.radio-compact .playlist.open {
    display: flex;
}

/* ── Mobile: stack to single column ──────────────────────────────────────── */

@media (max-width: 800px) {
    #screen-shop {
        max-width: 450px;
        width: 95%;
    }
    .shop-layout {
        flex-direction: column;
    }
    #screen-shop .col-right {
        overflow-y: visible;
    }
}

/* ── Fullscreen Toggle Button ──────────────────────────────────────────────── */

.btn-fullscreen {
    justify-content: center;
}

.btn-fullscreen.is-fullscreen {
    border-color: var(--success);
    color: var(--success);
}

.btn-fullscreen.is-fullscreen:hover:not(:disabled) {
    background: rgba(0, 255, 102, 0.15);
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.4);
}

/* ── Landscape Mobile Adaptive Layout ──────────────────────────────────────── */

@media (max-height: 600px) and (orientation: landscape) {

    /* General screens: wider for landscape phones */
    .screen {
        max-width: 90vw;
        width: 90vw;
        max-height: 90vh;
        padding: 12px;
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    /* === SETTINGS SCREEN: compact in landscape === */
    .settings-left-panel {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
        overflow-y: auto;
    }

    .settings-left-panel h2 {
        text-align: center;
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .settings-left-panel .settings-block {
        margin-bottom: 10px;
    }

    /* === SHOP SCREEN: landscape tweaks === */
    #screen-shop {
        padding: 0;
    }

    #screen-shop.active {
        display: flex;
        flex-direction: column;
    }

    #screen-shop .col-left {
        flex: 0 0 45%;
        max-width: 45%;
        overflow-y: auto;
    }

    #screen-shop .col-left {
        padding: 12px;
    }

    #screen-shop .col-left .shop-header {
        flex-shrink: 0;
        padding-bottom: 8px;
    }

    #screen-shop .col-left .shop-footer {
        padding-top: 8px;
    }

    #screen-shop .col-right {
        flex: 1;
        overflow-y: auto;
        border-left: 1px solid #333;
        padding: 12px;
    }

    /* HUD: more compact in landscape */
    #hud {
        gap: 6px;
    }
}

/* ── Language toggle ─────────────────────────────────────────────────────── */

.lang-toggle {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 6px 0;
}

.btn-lang {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    padding: 4px 12px;
    border-radius: 3px;
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.btn-lang:hover {
    opacity: 1;
    background: rgba(0, 255, 200, 0.08);
}

.btn-lang.btn-lang-active {
    background: var(--primary);
    color: #000;
    opacity: 1;
}

