body {
    margin: 0;
    padding: 0;
    background: #000;
    font-family: 'Courier New', monospace;
    color: #00ff00;
    overflow: hidden;
}

#gameContainer {
    display: flex;
    height: 100vh;
}

/* The play area: positioning context for overlays that must hug the
   canvas (mini-map) instead of the viewport, so they never cover the UI */
#canvasWrap {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    overflow: hidden;
}

#gameCanvas {
    background: #000;
    border: 2px solid #00ff00;
    display: block;
}

#ui {
    width: 300px;
    max-width: 30vw;
    background: #001100;
    border: 2px solid #00ff00;
    padding: 0 10px 10px;
    overflow-y: auto;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

/* Ship Status stays pinned while the rest of the panel scrolls,
   so credits/cargo are visible during transactions */
#shipStatusPanel {
    position: sticky;
    top: 0;
    z-index: 20;
    margin-top: 0;
    background: #002200;
    box-shadow: 0 6px 12px rgba(0, 10, 0, 0.9);
}

/* Toast notifications — a stack, not a single slot: bursts of messages
   (kill + loot + mission + save) each get their own toast and timer */
#hudToastStack {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.hud-toast {
    padding: 10px 18px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-align: center;
    max-width: 60vw;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
    opacity: 1;
    transition: opacity 0.35s ease;
}

.hud-toast.fading {
    opacity: 0;
}

/* Pending perk choice — pulses until the pilot redeems it */
#trainingChip {
    color: #ffdd44;
    font-size: 12px;
    margin: 3px 0;
    cursor: pointer;
    animation: chipPulse 1.6s ease-in-out infinite;
}
#trainingChip:hover {
    color: #ffffff;
}
@keyframes chipPulse {
    0%, 100% { text-shadow: 0 0 2px #ffdd4400; }
    50% { text-shadow: 0 0 10px #ffdd44; }
}

/* Credits flash green when a bounty or sale lands */
@keyframes creditsPulse {
    0% { color: #aaffcc; text-shadow: 0 0 10px #00ff88; }
    100% { color: inherit; text-shadow: none; }
}
.credits-pulse {
    animation: creditsPulse 0.9s ease-out;
    display: inline-block;
}

/* Compact rows in the ledger and mission panels */
.ledger-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin: 2px 0;
}

/* Compact quantity buttons on trade rows */
.qty-buttons {
    display: flex;
    gap: 3px;
}
.qty-buttons button {
    padding: 3px 6px;
    font-size: 11px;
}

#ui.trading {
    width: 400px;
    max-width: 40vw;
}

.panel {
    border: 1px solid #00ff00;
    margin: 10px 0;
    padding: 10px;
    background: #002200;
}

.panel h3 {
    margin: 0 0 10px 0;
    color: #00ffff;
}

.cargo-item {
    display: flex;
    justify-content: space-between;
    margin: 5px 0;
}

#tradeDialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #002200;
    border: 3px solid #00ff00;
    padding: 20px;
    display: none;
    max-width: 500px;
    z-index: 1000;
}

.trade-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 5px;
    border: 1px solid #004400;
}

button {
    background: #004400;
    color: #00ff00;
    border: 1px solid #00ff00;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
}

button:hover {
    background: #006600;
}

button:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

#controls {
    position: fixed;
    bottom: 10px;
    left: 10px;
    color: #00ff00;
    font-size: 12px;
}

/* Mini-map — absolute within #canvasWrap: pinned to the play area's
   top-right corner, never over the sidebar's Ship Status panel */
#miniMap {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 150px;
    height: 170px;
    background: #001100;
    border: 2px solid #00ff00;
    padding: 5px;
    z-index: 100;
}

#miniMapCanvas {
    border: 1px solid #004400;
    background: #000;
}

#miniMapTitle {
    color: #00ffff;
    font-size: 10px;
    text-align: center;
    margin-top: 5px;
}

/* Full map overlay */
#fullMapOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

#fullMapContainer {
    width: 80vw;
    height: 80vh;
    max-width: 800px;
    max-height: 600px;
    background: #001100;
    border: 3px solid #00ff00;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#fullMapCanvas {
    flex: 1;
    border: 2px solid #004400;
    background: #000;
}

#fullMapTitle {
    color: #00ffff;
    font-size: 14px;
    text-align: center;
    margin-bottom: 10px;
}

#mapLegend {
    color: #00ff00;
    font-size: 10px;
    text-align: center;
    margin-top: 10px;
}

#mapLegend div {
    margin: 2px 0;
}