/* ================================
   ASTEROID MINER: DEEP SPACE OPS
   Retro Terminal Space Mining Style
   ================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* DOS Green Phosphor (Default) */
    --term-bg: #000000;
    --term-text: #00ff00;
    --term-bright: #00ff00;
    --term-dim: #007700;
    --term-accent: #00cc00;
    --term-glow: 0 0 5px #00ff00;
    --term-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    
    /* Game Colors */
    --color-ship: #00ffff;
    --color-asteroid-common: #888888;
    --color-asteroid-rare: #ffaa00;
    --color-asteroid-legendary: #ff00ff;
    --color-hazard: #ff0000;
    --color-laser: #ffff00;
    --color-highlight: #ffffff;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    
    /* Font */
    --font-main: 'Courier New', 'Perfect DOS VGA 437', monospace;
    --font-size-xs: 10px;
    --font-size-sm: 12px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 20px;
}

/* ================================
   THEME VARIANTS
   ================================ */

/* Amber Terminal */
body.theme-amber {
    --term-bg: #000000;
    --term-text: #ffb000;
    --term-bright: #ffd700;
    --term-dim: #cc8800;
    --term-accent: #ffaa00;
    --term-glow: 0 0 5px #ffb000;
    --term-shadow: 0 0 10px rgba(255, 176, 0, 0.5);
}

/* Blue Terminal (IBM) */
body.theme-blue {
    --term-bg: #000000;
    --term-text: #55ddff;
    --term-bright: #aaffff;
    --term-dim: #2299cc;
    --term-accent: #33ccff;
    --term-glow: 0 0 8px #55ddff;
    --term-shadow: 0 0 15px rgba(85, 221, 255, 0.6);
}

/* Red Alert */
body.theme-red {
    --term-bg: #000000;
    --term-text: #ff0044;
    --term-bright: #ff3366;
    --term-dim: #cc0033;
    --term-accent: #ff6600;
    --term-glow: 0 0 5px #ff0044;
    --term-shadow: 0 0 10px rgba(255, 0, 68, 0.5);
}

/* White Monochrome */
body.theme-mono {
    --term-bg: #000000;
    --term-text: #ffffff;
    --term-bright: #ffffff;
    --term-dim: #888888;
    --term-accent: #cccccc;
    --term-glow: 0 0 3px #ffffff;
    --term-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* ================================
   GLOBAL STYLES
   ================================ */

body {
    font-family: var(--font-main);
    background-color: var(--term-bg);
    color: var(--term-text);
    overflow: hidden;
    /* Use dvh (dynamic viewport height) for mobile browsers - accounts for browser chrome */
    /* Falls back to 100vh for older browsers */
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height - preferred for mobile */
    width: 100vw;
    display: flex;
    flex-direction: column;
    /* Prevent pull-to-refresh and overscroll on mobile */
    overscroll-behavior: none;
    -webkit-overflow-scrolling: auto;
    /* Prevent touch callouts on long press */
    -webkit-touch-callout: none;
}

/* Disable text selection for game elements */
.game-container,
.terminal-header,
.side-panel,
canvas {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ================================
   BOOT SEQUENCE
   ================================ */

.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--term-bg);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.boot-sequence.hidden {
    opacity: 0;
    pointer-events: none;
}

.boot-content {
    max-width: 800px;
    padding: var(--space-lg);
}

.boot-text {
    font-size: var(--font-size-md);
    color: var(--term-text);
    text-shadow: var(--term-glow);
    white-space: pre-wrap;
    line-height: 1.4;
}

.boot-cursor {
    display: inline-block;
    color: var(--term-bright);
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes blinkRed {
    0%, 49% { color: #ff0000; }
    50%, 100% { color: var(--term-text); }
}

@keyframes flashWarning {
    0%, 100% { 
        background-color: rgba(255, 100, 0, 0.3);
        box-shadow: 0 0 10px rgba(255, 100, 0, 0.5);
    }
    50% { 
        background-color: rgba(255, 50, 0, 0.6);
        box-shadow: 0 0 20px rgba(255, 50, 0, 0.8);
    }
}

body.booting {
    overflow: hidden;
}

/* ================================
   TERMINAL HEADER
   ================================ */

.terminal-header {
    background-color: var(--term-bg);
    border-bottom: 2px solid var(--term-text);
    padding: 2px var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--term-shadow);
    position: relative; /* For absolute positioning of center */
}

.header-left,
.header-right {
    min-height: 40px;
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex: 1; /* Both take equal space */
    z-index: 1; /* Above center element */
}

.header-right {
    justify-content: flex-end; /* Align right content to the right */
}

.header-center {
    position: absolute; /* Position absolutely for true centering */
    left: 50%; /* Start at 50% */
    transform: translateX(-50%); /* Shift back by half its width */
    display: flex;
    justify-content: center;
    pointer-events: none; /* Allow clicks to pass through to buttons behind */
}

.title-box {
    text-align: center;
}

.title-line,
.title-text {
    font-size: 11px;
    color: var(--term-bright);
    text-shadow: var(--term-glow);
    line-height: 1;
}

.title-text {
    font-weight: bold;
}

.terminal-btn,
.exit-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: 2px var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    height: 24px;
    box-sizing: border-box;
    vertical-align: middle; /* Ensure consistent alignment */
    margin: 0; /* Remove default button margins */
}

/* Additional button-specific resets */
button.terminal-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.terminal-btn:hover,
.exit-btn:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.btn-bracket {
    color: inherit;
}

.btn-text {
    color: inherit;
}

/* ================================
   GAME CONTAINER
   ================================ */

.game-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* When canvas is width-constrained, center panel still fills height */
/* but allows canvas-container to shrink to its explicit height */
.center-panel.width-constrained {
    /* Still fill the available height */
    flex: 1;
    /* Allow children to have constrained heights */
    align-items: stretch;
}

.center-panel.width-constrained .game-wrapper {
    /* Don't force game-wrapper to fill height when width-constrained */
    flex: 0 0 auto;
}

/* ================================
   SIDE PANELS
   ================================ */

.side-panel {
    width: 350px;
    /* background-color: var(--term-bright); */
    border: 1px solid var(--term-text);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.left-panel {
    border-right: 2px solid var(--term-text);
}

.right-panel {
    border-left: 2px solid var(--term-text);
}

.panel-header {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--term-text);
    background-color: var(--term-bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-title {
    font-size: var(--font-size-md);
    color: var(--term-bright);
    text-shadow: var(--term-glow);
    text-align: center;
}

.panel-content {
    /* padding: var(--space-sm); */
    flex: 1;
}

/* Custom Scrollbar */
.side-panel::-webkit-scrollbar {
    width: 8px;
}

.side-panel::-webkit-scrollbar-track {
    background: var(--term-bg);
    border-left: 1px solid var(--term-dim);
}

.side-panel::-webkit-scrollbar-thumb {
    background: var(--term-text);
    border-radius: 0;
}

.side-panel::-webkit-scrollbar-thumb:hover {
    background: var(--term-bright);
}

/* ================================
   INFO SECTIONS (LEFT PANEL)
   ================================ */

.info-section {
    background: var(--term-bg);
    margin-bottom: var(--space-md);
    border: 1px solid var(--term-dim);
    padding: var(--space-sm);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--term-dim);
}

.section-icon {
    color: var(--term-bright);
    font-size: var(--font-size-lg);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    color: var(--term-bright);
    font-size: var(--font-size-md);
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
}

.stat-label {
    color: var(--term-dim);
}

.stat-value {
    color: var(--term-bright);
    text-shadow: var(--term-glow);
}

.stat-clickable {
    cursor: pointer;
    text-decoration: underline dotted;
    transition: all 0.2s ease;
}

.stat-clickable:hover {
    color: var(--term-text);
    text-shadow: 0 0 10px var(--term-text);
    text-decoration: underline solid;
}

/* ================================
   INVENTORY LIST
   ================================ */

.inventory-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs);
    border: 1px solid var(--term-dim);
    background-color: rgba(0, 255, 0, 0.05);
}

.inventory-item.empty {
    opacity: 0.5;
    justify-content: center;
}

.item-icon {
    font-size: var(--font-size-lg);
    color: var(--term-bright);
}

.item-text {
    font-size: var(--font-size-sm);
    color: var(--term-text);
}

.item-count {
    margin-left: auto;
    color: var(--term-accent);
}

/* ================================
   MISSIONS LIST
   ================================ */

/* Remove padding from info-section containing missions drawer */
.info-section:has(#missionsDrawerBtn) {
    padding: 0;
}

.missions-drawer-header {
    width: 100%;
    background: rgba(0, 255, 0, 0.05);
    color: var(--term-bright);
    padding: var(--space-sm);
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all 0.2s;
    margin-bottom: 0;
    border-left: none;
    border-top: none;
    border-right: none;
    border-bottom: 1px solid var(--term-dim);
}

.missions-drawer-header:hover {
    background-color: rgba(0, 255, 0, 0.15);
    box-shadow: var(--term-glow);
}

.missions-drawer-header .section-title {
    color: var(--term-bright);
    font-size: var(--font-size-md);
    font-weight: bold;
    font-family: var(--font-main);
}

.mission-count {
    margin-left: auto;
    color: var(--term-accent);
    font-size: var(--font-size-sm);
    font-weight: bold;
}

.missions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px;
    margin: 0;
}

.mission-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: clamp(6px, 0.8vw, 10px) clamp(8px, 1vw, 12px);
    border: 1px solid var(--term-dim);
    background-color: rgba(0, 0, 0, 0.3);
    position: relative;
    transition: all 0.2s;
}

.mission-item:hover:not(.empty) {
    border-color: var(--term-accent);
    background-color: rgba(0, 255, 0, 0.05);
}

.mission-item.empty {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
    opacity: 0.5;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.2);
}

.mission-item.completed {
    border-color: var(--term-accent);
    background-color: rgba(0, 255, 0, 0.1);
}

.mission-item.failed {
    border-color: #ff0000;
    background-color: rgba(255, 0, 0, 0.05);
    opacity: 0.7;
}

.mission-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.mission-title {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    font-weight: bold;
    flex: 1;
    min-width: 100px;
    line-height: 1.2;
}

.mission-status {
    font-size: var(--font-size-sm);
    color: var(--term-accent);
    text-transform: uppercase;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    line-height: 1.2;
}

.mission-description {
    font-size: var(--font-size-sm);
    color: var(--term-text);
    opacity: 0.9;
    line-height: 1.3;
    padding: 2px 0;
}

.mission-progress {
    font-size: var(--font-size-sm);
    color: var(--term-accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mission-progress > span {
    min-width: 60px;
    text-align: left;
}

.mission-progress-bar {
    flex: 1;
    height: clamp(6px, 0.8vw, 8px);
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--term-dim);
    position: relative;
    overflow: hidden;
}

.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--term-dim), var(--term-accent));
    transition: width 0.3s ease;
    box-shadow: 0 0 8px var(--term-accent);
}

.mission-reward {
    font-size: var(--font-size-sm);
    color: #ffaa00;
    margin-top: 2px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 170, 0, 0.5);
}

.mission-station-name {
    font-size: var(--font-size-sm);
    margin-top: 2px;
    opacity: 0.9;
    font-style: italic;
}

.mission-time,
.mission-hull {
    font-size: var(--font-size-xs);
    margin-top: 2px;
    font-weight: bold;
    text-shadow: 0 0 5px currentColor;
}

/* ================================
   MISSION BOARD (Right Panel)
   ================================ */

.mission-board-content {
    margin-top: var(--space-sm);
}

.mission-board-info {
    margin-bottom: var(--space-sm);
}

.board-description {
    font-size: var(--font-size-sm);
    color: var(--term-text);
    opacity: 0.7;
    text-align: center;
    padding: var(--space-xs);
    border-bottom: 1px solid var(--term-dim);
}

.mission-board-list {
    display: flex;
    flex-direction: column;
    /* gap: 6px; */ /* Removed gap for consistency with active missions */
    padding: var(--space-xs);
}

.mission-board-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: clamp(6px, 0.8vw, 10px) clamp(8px, 1vw, 12px);
    border: 1px solid var(--term-dim);
    background-color: rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
}

.mission-board-item:hover:not(.empty):not(.accepted):not(.completed):not(.failed) {
    background-color: rgba(0, 255, 0, 0.1);
    border-color: var(--term-accent);
    transform: translateX(2px);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
}

.mission-board-item.empty {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
    opacity: 0.5;
    justify-content: center;
    cursor: default;
    background-color: rgba(0, 0, 0, 0.2);
}

.mission-board-item.accepted,
.mission-board-item.completed,
.mission-board-item.failed {
    cursor: default;
}

.mission-board-item.accepted {
    background-color: rgba(0, 255, 0, 0.05);
    border-color: var(--term-accent);
}

.mission-board-item.completed {
    background-color: rgba(0, 255, 0, 0.1);
    border-color: var(--term-accent);
}

.mission-board-item.failed {
    background-color: rgba(255, 0, 0, 0.05);
    border-color: #ff0000;
}

.mission-board-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.mission-board-title {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    font-weight: bold;
    flex: 1;
    min-width: 100px;
    line-height: 1.2;
}

.mission-board-difficulty {
    font-size: var(--font-size-md);
    padding: 2px 6px;
    border: 1px solid;
    border-radius: 2px;
    white-space: nowrap;
    font-weight: bold;
}

.mission-board-difficulty.easy {
    color: #00ff00;
    border-color: #00ff00;
}

.mission-board-difficulty.medium {
    color: #ffaa00;
    border-color: #ffaa00;
}

.mission-board-difficulty.hard {
    color: #ff0000;
    border-color: #ff0000;
}

.mission-board-description {
    font-size: var(--font-size-xs);
    color: var(--term-text);
    opacity: 0.9;
    line-height: 1.4;
    padding: var(--space-xs) 0;
}

.mission-board-requirements {
    font-size: var(--font-size-xs);
    color: var(--term-accent);
}

.mission-board-reward {
    font-size: var(--font-size-xs);
    color: #ffaa00;
    font-weight: bold;
    margin-top: var(--space-xs);
    text-shadow: 0 0 5px rgba(255, 170, 0, 0.5);
}

.mission-board-completion {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 2px solid var(--term-accent);
}

.completion-header {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    font-weight: bold;
    margin-bottom: var(--space-sm);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.completed-mission-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--term-accent);
    background-color: rgba(0, 255, 0, 0.1);
    position: relative;
    transition: all 0.2s;
}

.completed-mission-item:hover {
    background-color: rgba(0, 255, 0, 0.15);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.completed-mission-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.completed-mission-title {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
}

.completed-mission-reward {
    font-size: var(--font-size-xs);
    color: #ffaa00;
}

.claim-reward-btn {
    background: transparent;
    border: 1px solid var(--term-accent);
    color: var(--term-accent);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all 0.2s;
    margin-top: var(--space-xs);
    font-weight: bold;
    letter-spacing: 1px;
}

.claim-reward-btn:hover {
    background-color: var(--term-accent);
    color: var(--term-bg);
    box-shadow: 0 0 15px var(--term-accent);
    transform: translateY(-1px);
}

.claim-reward-btn:active {
    transform: translateY(0);
}

/* ================================
   NAVIGATION CONTROLS
   ================================ */

.nav-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.nav-btn:hover:not(:disabled) {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn.flash-warning {
    animation: flashWarning 1s ease-in-out infinite;
}

/* Station Interface */
.station-info {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    border: 1px solid var(--term-text);
    background: rgba(0, 255, 0, 0.05);
}

.station-name {
    font-size: var(--font-size-md);
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--term-text);
}

.station-status {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

.station-btn {
    background: rgba(0, 255, 0, 0.1);
    border-color: var(--term-text);
}

.station-btn:hover:not(:disabled) {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.station-details {
    margin-top: var(--space-sm);
    padding: var(--space-sm);
    border: 1px solid var(--term-text);
    background: rgba(0, 0, 0, 0.2);
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: var(--font-size-sm);
}

.detail-label {
    opacity: 0.7;
}

.detail-value {
    font-weight: bold;
    color: var(--term-text);
}

.detail-divider {
    text-align: center;
    opacity: 0.3;
    font-size: var(--font-size-xs);
    line-height: 1;
    padding: 4px 0;
    user-select: none;
}

/* ================================
   CENTER PANEL - GAME AREA
   ================================ */

.center-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--term-bg);
    position: relative;
    overflow: hidden;
}

.game-wrapper {
    flex: 1; /* Grow to fill space normally */
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ================================
   STATS BAR (TOP)
   ================================ */

.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: var(--space-sm);
    background-color: var(--term-bg);
    border-bottom: 1px solid var(--term-text);
    gap: var(--space-md);
}

.stat-display {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
}

.stat-icon {
    color: var(--term-bright);
    font-size: var(--font-size-md);
}

.stat-text {
    color: var(--term-text);
    text-shadow: var(--term-glow);
}

/* ================================
   CANVAS CONTAINER
   ================================ */

.canvas-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    border: 2px solid var(--term-text);
    margin: var(--space-sm);
    overflow: hidden;
    flex: 1;
    min-width: 0;
    min-height: 0;
}

#gameCanvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* CRT Effect */
body.crt-mode .canvas-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.3),
        rgba(0, 0, 0, 0.3) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

/* CRT Fisheye/Barrel Distortion Effect */
body.crt-mode .canvas-container {
    perspective: 250px;
    transform-style: preserve-3d;
    overflow: hidden !important;
    padding: 0;
}

body.crt-mode #gameCanvas {
    /* CRT effect without bezel - canvas fills container */
    /* No rotation to avoid tilting/squishing */
    transform: 
        perspective(250px) 
        scale(1.02) !important;
    border-radius: 0;
    transform-origin: center center;
    transform-style: preserve-3d;
    will-change: transform;
    /* Apply a filter for additional curvature simulation */
    filter: contrast(1.12) brightness(1.05);
    /* Inset shadows for glass depth effect - no outer bezel */
    box-shadow: 
        inset 0 0 180px rgba(0, 0, 0, 0.7),
        inset 0 0 120px rgba(0, 0, 0, 0.6),
        inset 0 0 80px rgba(0, 0, 0, 0.5) !important;
}

/* Ensure minimap canvas is NOT affected by barrel distortion */
body.crt-mode #minimapCanvas {
    transform: none !important;
    border-radius: 0 !important;
    filter: none !important;
    box-shadow: none !important;
}

/* Vignette effect to simulate curved glass edges */
body.crt-mode .canvas-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 75% 65% at center,
        transparent 0%,
        transparent 30%,
        rgba(0, 0, 0, 0.15) 45%,
        rgba(0, 0, 0, 0.35) 60%,
        rgba(0, 0, 0, 0.55) 75%,
        rgba(0, 0, 0, 0.75) 90%,
        rgba(0, 0, 0, 0.9) 100%
    );
    pointer-events: none;
    z-index: 2;
    border-radius: 5%;
}

/* ================================
   PAUSE BUTTON
   ================================ */

.pause-btn {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto; /* Ensure it receives clicks */
}

.pause-btn:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: 0 0 10px var(--term-text);
    transform: scale(1.05);
}

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

.pause-icon {
    display: block;
    width: 24px;
    height: 24px;
    color: var(--term-text);
    filter: drop-shadow(0 0 2px var(--term-text));
}

.pause-btn:hover .pause-icon {
    color: var(--term-bg);
}

/* ================================
   MINIMAP
   ================================ */

.minimap {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid var(--term-text);
    padding: var(--space-xs);
    z-index: 10;
}

.minimap-header {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    text-align: center;
    margin-bottom: var(--space-xs);
    border-bottom: 1px solid var(--term-dim);
}

#minimapCanvas {
    display: block;
    border: 1px solid var(--term-dim);
    image-rendering: pixelated;
}

/* ================================
   AUTO-MINING BUTTON
   ================================ */

.auto-mine-btn {
    position: absolute;
    bottom: var(--space-md);
    left: var(--space-md);
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s ease;
    width: 120px;
    height: 120px;
    display: none; /* Hidden by default, shown for touch devices */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    pointer-events: auto;
}

.auto-mine-btn:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: 0 0 10px var(--term-text);
    transform: scale(1.02);
}

.auto-mine-btn:active {
    transform: scale(0.98);
}

.auto-mine-btn.active {
    background-color: rgba(0, 255, 0, 0.2);
    border-color: var(--term-bright);
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.auto-mine-icon {
    display: block;
    width: 48px;
    height: 48px;
    color: var(--term-text);
    filter: drop-shadow(0 0 3px var(--term-text));
    transition: all 0.2s ease;
}

.auto-mine-btn:hover .auto-mine-icon {
    filter: drop-shadow(0 0 6px currentColor);
    transform: scale(1.1);
}

.auto-mine-btn.active .auto-mine-icon {
    color: var(--term-bright);
    filter: drop-shadow(0 0 8px var(--term-bright));
}

.auto-mine-status {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: bold;
    text-shadow: var(--term-glow);
    margin-top: var(--space-xs);
}


/* ================================
   CONTROLS HINT OVERLAY
   ================================ */

.controls-hint {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    background-color: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--term-text);
    padding: var(--space-md);
    z-index: 10;
    min-width: 200px;
}

.controls-hint.hidden {
    display: none;
}

.hint-title {
    font-size: var(--font-size-md);
    color: var(--term-bright);
    text-align: center;
    margin-bottom: var(--space-sm);
}

.hint-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
}

.hint-key {
    color: var(--term-bright);
    padding: 2px var(--space-xs);
    border: 1px solid var(--term-text);
    background-color: rgba(0, 255, 0, 0.1);
}

.hint-desc {
    color: var(--term-text);
}

.hint-close {
    text-align: center;
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--term-dim);
    color: var(--term-dim);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.hint-close:hover {
    color: var(--term-bright);
}

/* ================================
   CONSOLE MESSAGES
   ================================ */

.console-messages {
    background-color: var(--term-bg);
    border-top: 1px solid var(--term-text);
    height: 120px;
    display: flex;
    flex-direction: column;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--term-dim);
    font-size: var(--font-size-sm);
    color: var(--term-bright);
}

.console-clear {
    background: transparent;
    border: 1px solid var(--term-dim);
    color: var(--term-text);
    padding: 2px var(--space-xs);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.console-clear:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
}

.console-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

.console-line {
    margin-bottom: 2px;
    color: var(--term-text);
}

.console-time {
    color: var(--term-dim);
    margin-right: var(--space-xs);
}

.console-text {
    color: var(--term-text);
}

.console-content::-webkit-scrollbar {
    width: 6px;
}

.console-content::-webkit-scrollbar-track {
    background: var(--term-bg);
}

.console-content::-webkit-scrollbar-thumb {
    background: var(--term-dim);
}

.console-input-area {
    display: flex;
    align-items: center;
    padding: 2px var(--space-xs); /* Much thinner padding */
    border-top: 1px solid var(--term-dim);
    background-color: rgba(0, 0, 0, 0.2);
    gap: var(--space-xs);
    min-height: 24px; /* Minimal height */
}

.console-prompt {
    color: var(--term-bright);
    font-weight: bold;
    font-size: var(--font-size-sm);
    line-height: 1; /* Tighter line height */
}

.console-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--term-text);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    padding: 2px 4px;
    line-height: 1.2; /* Tighter line height */
    min-height: 20px; /* Minimal input height */
}

.console-input::placeholder {
    color: var(--term-dim);
    opacity: 0.7;
}

.console-input:focus {
    background-color: rgba(0, 255, 0, 0.05);
}

/* ================================
   UPGRADES SECTION (RIGHT PANEL)
   ================================ */

.upgrade-categories {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.upgrade-category {
    /* border: 1px solid var(--term-dim); */
    background-color: rgba(0, 255, 0, 0.02);
}

.category-header {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--term-bright);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.2s;
    text-align: left;
}

.category-header:hover {
    background-color: rgba(0, 255, 0, 0.1);
    box-shadow: var(--term-glow);
}

.category-icon {
    font-size: var(--font-size-sm);
    color: var(--term-accent);
    transition: transform 0.3s;
    min-width: 12px;
}

.category-title {
    font-weight: bold;
    letter-spacing: 1px;
}

.category-content {
    padding: var(--space-sm);
    border-top: 1px solid var(--term-dim);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
        padding-top: var(--space-sm);
        padding-bottom: var(--space-sm);
    }
}

/* Master Upgrades Drawer */
.info-section:has(#upgradesDrawerBtn),
.info-section:has(#missionBoardDrawerBtn) {
    padding: 0;
}

.master-drawer-header {
    width: 100%;
    background: rgba(0, 255, 0, 0.05);
    /* border: 1px solid var(--term-bright); */
    color: var(--term-bright);
    padding: var(--space-sm);
    font-family: var(--font-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all 0.2s;
    margin-bottom: 0;
    border-left: none;
    border-top: none;
    border-right: none;
    border-bottom: 1px solid var(--term-dim);
    /* border: none; */
}

.master-drawer-header:hover {
    background-color: rgba(0, 255, 0, 0.15);
    box-shadow: var(--term-glow);
}

.drawer-icon {
    font-size: var(--font-size-sm);
    color: var(--term-accent);
    transition: transform 0.3s;
    min-width: 12px;
}

#upgradesDrawerContent {
    animation: slideDown 0.3s ease-out;
    /* border: 1px solid var(--term-dim); */
    border-top: none;
    padding: 0;
    background-color: rgba(0, 255, 0, 0.01);
}

#upgradesDrawerContent .upgrade-category:first-child {
    border-top: none;
}

.upgrade-section {
    margin-bottom: var(--space-lg);
}

.upgrade-item {
    border: 1px solid var(--term-dim);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background-color: rgba(0, 255, 0, 0.03);
}

.upgrade-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.upgrade-icon {
    font-size: var(--font-size-lg);
    color: var(--term-bright);
}

.upgrade-name {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    font-weight: bold;
}

.upgrade-info {
    margin-bottom: var(--space-sm);
}

.upgrade-desc {
    font-size: var(--font-size-sm);
    color: var(--term-dim);
    margin-bottom: var(--space-xs);
}

.upgrade-stats {
    font-size: var(--font-size-sm);
    color: var(--term-text);
}

.upgrade-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.upgrade-btn:hover:not(:disabled) {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.upgrade-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ================================
   SPECIAL MODULES
   ================================ */

.special-item {
    border: 1px solid var(--term-dim);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background-color: rgba(0, 255, 0, 0.03);
}

.special-item.locked {
    opacity: 0.7;
}

.special-item.unlocked {
    border-color: var(--term-accent);
    background-color: rgba(0, 255, 0, 0.1);
}

.special-header {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xs);
}

.special-icon {
    font-size: var(--font-size-lg);
    color: var(--term-bright);
}

.special-name {
    font-size: var(--font-size-sm);
    color: var(--term-bright);
    font-weight: bold;
}

.special-desc {
    font-size: var(--font-size-sm);
    color: var(--term-dim);
    margin-bottom: var(--space-sm);
}

.special-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.special-btn:hover:not(:disabled) {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.special-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ================================
   PRESTIGE SECTION
   ================================ */

.prestige-info {
    border: 1px solid var(--term-accent);
    padding: var(--space-sm);
    background-color: rgba(0, 255, 0, 0.05);
}

.prestige-desc {
    font-size: var(--font-size-sm);
    color: var(--term-text);
    margin-bottom: var(--space-sm);
}

.prestige-stats {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-xs);
}

.prestige-btn {
    background: transparent;
    border: 2px solid var(--term-accent);
    color: var(--term-accent);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: var(--space-sm);
    font-weight: bold;
}

.prestige-btn:hover:not(:disabled) {
    background-color: var(--term-accent);
    color: var(--term-bg);
    box-shadow: 0 0 15px var(--term-accent);
}

.prestige-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ================================
   MODALS
   ================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--term-bg);
    border: 2px solid var(--term-text);
    padding: var(--space-lg);
    min-width: 300px;
    max-width: 500px;
    box-shadow: var(--term-shadow);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-size: var(--font-size-lg);
    color: var(--term-bright);
    text-align: center;
    text-shadow: var(--term-glow);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.modal-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-md);
    font-family: var(--font-main);
    font-size: var(--font-size-md);
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.modal-btn:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: var(--term-glow);
}

.modal-message {
    font-size: var(--font-size-md);
    color: var(--term-text);
    text-align: center;
    padding: var(--space-lg);
    line-height: 1.6;
    border: 1px dashed var(--term-dim);
    margin-bottom: var(--space-lg);
    background-color: rgba(0, 255, 0, 0.03);
    white-space: pre-line;
    font-family: var(--font-main);
}

.modal-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

.modal-btn-confirm {
    flex: 1;
    background-color: rgba(0, 255, 0, 0.1);
}

.modal-btn-confirm:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: 0 0 20px var(--term-text);
}

.modal-btn-confirm:disabled {
    background-color: rgba(80, 80, 80, 0.2);
    border-color: #555555;
    color: #666666;
    cursor: not-allowed;
    opacity: 0.5;
}

.modal-btn-confirm:disabled:hover {
    background-color: rgba(80, 80, 80, 0.2);
    box-shadow: none;
}

.modal-btn-cancel {
    flex: 1;
    background-color: rgba(255, 0, 0, 0.1);
    border-color: #ff4444;
}

.modal-btn-cancel:hover {
    background-color: #ff4444;
    color: var(--term-bg);
    box-shadow: 0 0 20px #ff4444;
}

/* Modal Large Size (for pause menu with save/load) */
.modal-large {
    max-width: 600px;
    max-height: 80vh;
    max-height: 80dvh; /* Use dynamic viewport height for mobile browsers */
    overflow-y: auto;
}

/* ================================================
   MODERN FANCY TRADING MODAL REDESIGN
   ================================================ */

/* Extra Large Modal for Trading */
.modal-xlarge {
    max-width: 95vw;
    width: 1400px;
    max-height: 90vh;
    overflow: hidden;
}

.trade-modal-redesign {
    background: #000000;
    border: 3px solid var(--primary-color);
    box-shadow: 
        0 0 40px rgba(0, 255, 0, 0.4),
        inset 0 0 80px rgba(0, 100, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Retro Terminal Header */
.trade-modal-header {
    position: relative;
    background: rgba(0, 100, 0, 0.2);
    border-bottom: 3px double var(--primary-color);
    padding: 20px 30px;
    overflow: hidden;
}

.header-scan-line {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: var(--bright-color);
    animation: scanLine 3s linear infinite;
    opacity: 0.6;
}

@keyframes scanLine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.header-icon {
    font-size: 36px;
    color: var(--bright-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.header-text {
    flex: 1;
}

.header-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--bright-color);
    letter-spacing: 3px;
    text-shadow: 0 0 10px var(--primary-color);
    text-transform: uppercase;
}

.header-subtitle {
    font-size: 11px;
    color: var(--dim-color);
    margin-top: 4px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.trade-close-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ff3333;
    color: #ff6666;
    width: 40px;
    height: 40px;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.trade-close-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: #ff6666;
    color: #ffaaaa;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

/* Modal Body */
.trade-modal-body {
    padding: 25px 30px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* NPC Profile Card */
.npc-profile-card {
    position: relative;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--primary-color);
    border-radius: 0;
    padding: 20px;
    margin-bottom: 25px;
    overflow: hidden;
}

.profile-border-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 1px solid var(--dim-color);
    opacity: 0.5;
    z-index: 0;
}

.profile-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar {
    position: relative;
    width: 70px;
    height: 70px;
}

.avatar-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--primary-color);
    border-radius: 0;
}

.avatar-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: var(--bright-color);
    text-shadow: 0 0 15px var(--primary-color);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 28px;
    font-weight: bold;
    color: var(--bright-color);
    margin-bottom: 15px;
    text-shadow: 0 0 10px var(--primary-color);
    letter-spacing: 2px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.stat-badge {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--dim-color);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-badge:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.2);
}

.stat-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 6px;
}

.stat-label {
    display: block;
    font-size: 9px;
    color: var(--dim-color);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 16px;
    font-weight: bold;
    color: var(--bright-color);
}

.reputation-value {
    color: #66ff66;
}

.multiplier-badge {
    border-color: var(--bright-color);
    background: rgba(0, 100, 0, 0.2);
}

/* Event Banner */
.event-banner {
    background: linear-gradient(135deg, rgba(100, 100, 0, 0.2) 0%, rgba(150, 100, 0, 0.2) 100%);
    border: 2px solid var(--bright-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.event-banner-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 0, 0.1), transparent 70%);
    animation: eventGlow 2s ease-in-out infinite;
}

@keyframes eventGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.event-banner-content {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.event-icon {
    font-size: 32px;
    color: var(--bright-color);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.event-text {
    flex: 1;
}

.event-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--bright-color);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.event-message {
    color: var(--primary-color);
    line-height: 1.6;
    font-size: 13px;
}

.event-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.event-actions .modal-btn-small {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--primary-color);
    padding: 8px 16px;
    color: var(--primary-color);
    font-weight: bold;
    transition: all 0.3s ease;
}

.event-actions .modal-btn-small:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px var(--primary-color);
}

/* Trading Interface */
.trade-interface-modern {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .trade-interface-modern {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .exchange-indicator {
        order: -1;
        flex-direction: row;
        padding: 15px 0;
    }
}

/* Cargo Panels */
.cargo-panel {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--primary-color);
    border-radius: 0;
    padding: 12px;
    transition: all 0.3s ease;
}

.cargo-panel:hover {
    border-color: var(--bright-color);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.3);
}

.panel-header-modern {
    margin-bottom: 12px;
}

.panel-title-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.panel-icon {
    font-size: 16px;
    color: var(--bright-color);
}

.panel-title {
    font-size: 12px;
    font-weight: bold;
    color: var(--bright-color);
    letter-spacing: 1px;
}

.panel-decorative-line {
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), transparent);
}

/* Cargo Grid */
.cargo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 768px) {
    .cargo-grid {
        grid-template-columns: 1fr;
    }
}

.cargo-card {
    position: relative;
    background: #000000;
    border: 2px solid var(--dim-color);
    border-radius: 0;
    padding: 14px;
    transition: all 0.3s ease;
    overflow: hidden;
    --resource-color: var(--primary-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.cargo-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--resource-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cargo-card:hover::before {
    opacity: 0.8;
}

.cargo-card:hover {
    border-color: var(--resource-color);
    box-shadow: 0 0 20px color-mix(in srgb, var(--resource-color) 30%, transparent);
}

.card-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    background: radial-gradient(circle at center, color-mix(in srgb, var(--resource-color) 20%, transparent), transparent 70%);
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.cargo-card:hover .card-glow {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--dim-color);
}

.resource-icon {
    width: 36px;
    height: 36px;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    border: 2px solid currentColor;
    background: rgba(0, 0, 0, 0.7);
    flex-shrink: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    /* Color is set dynamically via inline styles */
}

.resource-name {
    flex: 1;
    font-size: 13px;
    font-weight: bold;
    color: var(--bright-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 0 8px var(--resource-color);
}

.card-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 0;
    border: 1px solid var(--dim-color);
    position: relative;
    overflow: hidden;
}

.card-amount::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--resource-color);
    opacity: 0.05;
}

.amount-label {
    font-size: 9px;
    color: var(--dim-color);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.amount-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--bright-color);
    text-shadow: 0 0 12px var(--resource-color), 0 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1;
    position: relative;
    z-index: 1;
    font-family: 'Courier New', monospace;
}

.card-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.resource-input {
    flex: 1;
    min-width: 60px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--dim-color);
    color: var(--bright-color);
    padding: 10px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.resource-input:focus {
    outline: none;
    border-color: var(--resource-color);
    box-shadow: 0 0 15px color-mix(in srgb, var(--resource-color) 40%, transparent),
                inset 0 2px 4px rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.9);
    color: var(--resource-color);
    text-shadow: 0 0 8px var(--resource-color);
}

.transfer-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 16px;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.transfer-btn:hover {
    background: var(--primary-color);
    color: #000000;
    box-shadow: 0 0 20px var(--primary-color);
}

.transfer-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

.transfer-btn:disabled:hover {
    background: rgba(0, 0, 0, 0.8);
    color: var(--primary-color);
    transform: none;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.btn-icon {
    font-size: 14px;
}

.give-btn {
    border-color: #ff8800;
    color: #ff8800;
}

.give-btn:hover {
    background: #ff8800;
    border-color: #ff8800;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 136, 0, 0.7);
}

.take-btn {
    border-color: #00ff88;
    color: #00ff88;
}

.take-btn:hover {
    background: #00ff88;
    border-color: #00ff88;
    color: #000;
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.7);
}

/* Exchange Indicator */
.exchange-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 0;
}

.exchange-icon-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.exchange-pulse {
    position: absolute;
    inset: 0;
    border: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: pulse-ring 2s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.exchange-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--bright-color);
    text-shadow: 0 0 20px var(--primary-color);
    animation: rotate-slow 4s linear infinite;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.exchange-status {
    background: rgba(255, 50, 50, 0.2);
    border: 2px solid #ff6666;
    color: #ff8888;
    padding: 8px 16px;
    border-radius: 0;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    animation: flash 0.5s ease-in-out infinite alternate;
    margin-bottom: 8px;
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.3);
    letter-spacing: 1px;
    text-transform: uppercase;
}

@keyframes flash {
    from { opacity: 1; }
    to { opacity: 0.6; }
}

/* Trade Footer */
/* Card value display */
.card-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.12), rgba(255, 215, 0, 0.05));
    border-left: 3px solid #ffd700;
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(255, 215, 0, 0.2);
}

.value-label {
    font-size: 10px;
    color: #ffd700;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: bold;
}

.value-amount {
    font-size: 14px;
    font-weight: bold;
    color: #ffed4e;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Input controls with increment/decrement buttons */
.input-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.control-btn {
    background: rgba(0, 100, 0, 0.2);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    width: 34px;
    height: 34px;
    border-radius: 0;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.control-btn:hover {
    background: var(--primary-color);
    color: #000000;
    box-shadow: 0 0 20px var(--primary-color);
}

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

.resource-input {
    flex: 1;
    min-width: 0;
}

/* Trade Summary Section */
.trade-summary {
    margin: 25px 0 15px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--primary-color);
    border-radius: 0;
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.2);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
}

.summary-icon {
    font-size: 24px;
}

.summary-title {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
    color: var(--bright-color);
    text-transform: uppercase;
    text-shadow: 0 0 8px var(--bright-color);
}

.summary-content {
    display: flex;
    gap: 20px;
    align-items: stretch;
    margin-bottom: 15px;
}

.summary-section {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 0;
    border: 1px solid rgba(0, 255, 0, 0.3);
}

.summary-label {
    font-size: 12px;
    color: var(--dim-color);
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    font-weight: bold;
}

.summary-items {
    font-size: 13px;
    color: var(--primary-color);
    margin-bottom: 10px;
    min-height: 20px;
    line-height: 1.6;
}

.summary-value {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 255, 0, 0.2);
}

.value-text {
    font-size: 11px;
    color: var(--dim-color);
    letter-spacing: 1px;
}

.value-number {
    font-size: 15px;
    font-weight: bold;
    color: var(--bright-color);
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.summary-divider {
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider-icon {
    font-size: 32px;
    color: var(--primary-color);
    animation: pulse-ring 2s ease-in-out infinite;
}

.summary-balance {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 0;
    border: 2px solid var(--bright-color);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.balance-label {
    font-size: 14px;
    font-weight: bold;
    color: var(--bright-color);
    letter-spacing: 2px;
}

.balance-value {
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 10px currentColor;
    letter-spacing: 1px;
}

/* Custom scrollbar for trade modal body */
.trade-modal-body::-webkit-scrollbar {
    width: 10px;
}

.trade-modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-left: 1px solid var(--dim-color);
}

.trade-modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-left: 1px solid var(--bright-color);
}

.trade-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--bright-color);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.6);
}

.trade-modal-body::-webkit-scrollbar-thumb:active {
    background: #00ff00;
}

.trade-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px 20px;
    border-top: 2px solid var(--primary-color);
    background: rgba(0, 0, 0, 0.95);
    flex-shrink: 0;
}

/* Compact Trade Summary in Footer */
.trade-summary-compact {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--dim-color);
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 11px;
}

.summary-section-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.summary-label-compact {
    color: var(--dim-color);
    font-weight: bold;
    letter-spacing: 1px;
    white-space: nowrap;
}

.summary-items-compact {
    color: var(--primary-color);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.summary-value-compact {
    color: var(--bright-color);
    font-weight: bold;
    white-space: nowrap;
}

.summary-divider-compact {
    font-size: 16px;
    color: var(--primary-color);
    padding: 0 10px;
}

.summary-balance-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 100, 0, 0.2);
    border-left: 2px solid var(--primary-color);
    white-space: nowrap;
}

.balance-label-compact {
    color: var(--dim-color);
    font-weight: bold;
    letter-spacing: 1px;
    font-size: 10px;
}

.balance-value-compact {
    color: var(--bright-color);
    font-weight: bold;
    font-size: 12px;
    text-shadow: 0 0 8px var(--primary-color);
}

/* Trade Actions Container */
.trade-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.trade-action-btn {
    position: relative;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 30px;
    border-radius: 0;
    font-size: 13px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.btn-hover-effect {
    display: none;
}

.trade-action-btn:hover {
    background: var(--primary-color);
    color: #000000;
    border-color: var(--bright-color);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
}

.action-btn-icon {
    font-size: 16px;
}

.cancel-trade-btn {
    border-color: #ff3333;
    color: #ff6666;
}

.cancel-trade-btn:hover {
    background: #ff3333;
    color: #000000;
    border-color: #ff6666;
    box-shadow: 0 0 30px rgba(255, 50, 50, 0.6);
}

.propose-trade-btn {
    border-color: #00ff88;
    color: #00ff88;
}

.propose-trade-btn:hover {
    background: #00ff88;
    color: #000000;
    border-color: #66ffaa;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
}

/* Pause Menu Sections */
/* Retro Terminal Pause Modal */
#pauseModal {
    z-index: 3000; /* Higher than all other modals (2000) */
}

.pause-modal-redesign {
    max-width: 900px;
    max-height: 85vh;
    background: #000000;
    border: 3px solid var(--term-bright);
    box-shadow: 0 0 40px rgba(0, 255, 0, 0.4);
}

.pause-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-md);
}

/* Top Action Bar */
.pause-action-bar {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-sm);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--term-bright);
}

.pause-primary-btn {
    background: rgba(0, 100, 0, 0.3);
    border: 2px solid var(--term-bright);
    color: var(--term-bright);
    padding: var(--space-md);
    font-family: var(--font-main);
    font-size: var(--font-size-lg);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    text-shadow: 0 0 10px var(--term-bright);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.pause-primary-btn:hover {
    background: var(--term-bright);
    color: #000000;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.6);
}

.pause-secondary-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-md);
    font-family: var(--font-main);
    font-size: var(--font-size-md);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.pause-secondary-btn:hover {
    border-color: var(--term-bright);
    color: var(--term-bright);
    background: rgba(0, 100, 0, 0.2);
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
}

.pause-primary-btn .btn-icon {
    font-size: 1.5em;
}

.pause-secondary-btn .btn-icon {
    font-size: 1.2em;
}

/* Main Grid Layout */
.pause-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    flex: 1;
    min-height: 0;
}

/* Panel Styling */
.pause-panel {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--term-dim);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pause-panel-header {
    background: rgba(0, 100, 0, 0.2);
    border-bottom: 2px solid var(--term-text);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-md);
    font-weight: bold;
    color: var(--term-bright);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-shadow: 0 0 8px var(--term-bright);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.panel-icon {
    font-size: 1.2em;
}

/* Subsections within panels */
.pause-subsection {
    padding: var(--space-md);
    border-bottom: 1px dashed var(--term-dim);
}

.pause-subsection:last-child {
    border-bottom: none;
}

/* Quick Actions */
.pause-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
}

.pause-quick-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff9900;
    color: #ffaa00;
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.pause-quick-btn:hover {
    background: #ff9900;
    color: #000000;
    box-shadow: 0 0 20px rgba(255, 165, 0, 0.6);
}

/* Save Input Group */
.pause-save-input-group {
    display: flex;
    gap: var(--space-xs);
}

.pause-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--term-dim);
    color: var(--term-text);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-md);
    outline: none;
    transition: all 0.2s;
}

.pause-input:focus {
    border-color: var(--term-bright);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
    background: rgba(0, 0, 0, 0.7);
}

.pause-save-btn {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: 0 var(--space-md);
    font-family: var(--font-main);
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: all 0.2s;
    min-width: 50px;
}

.pause-save-btn:hover {
    border-color: var(--term-bright);
    color: var(--term-bright);
    background: rgba(0, 255, 0, 0.2);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.pause-message {
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-xs);
    min-height: 20px;
    margin-top: var(--space-xs);
}

.pause-message.success {
    color: var(--term-bright);
    text-shadow: 0 0 5px var(--term-bright);
}

.pause-message.error {
    color: #ff4444;
    text-shadow: 0 0 5px #ff4444;
}

/* Import/Export */
.pause-import-export {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xs);
}

.pause-utility-btn {
    background: rgba(0, 200, 255, 0.05);
    border: 1px solid rgba(0, 200, 255, 0.5);
    color: #00ccff;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
}

.pause-utility-btn:hover {
    background: rgba(0, 200, 255, 0.15);
    border-color: #00ccff;
    box-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
}

/* Save List Container */
.pause-save-list-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pause-save-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.pause-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-xl);
    color: var(--term-dim);
    font-size: var(--font-size-md);
}

.empty-icon {
    font-size: 3em;
    opacity: 0.3;
}

/* Save Item (Modern Design) */
.save-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--term-dim);
    border-left: 3px solid var(--term-text);
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    transition: all 0.2s;
}

.save-item:hover {
    border-left-color: var(--term-bright);
    background: rgba(0, 255, 0, 0.05);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.2);
    transform: translateX(3px);
}

.save-item-info {
    margin-bottom: var(--space-xs);
}

.save-item-name {
    font-size: var(--font-size-md);
    color: var(--term-bright);
    font-weight: bold;
    margin-bottom: 2px;
}

.save-item-details {
    font-size: var(--font-size-xs);
    color: var(--term-dim);
    display: flex;
    gap: var(--space-sm);
}

.version-warning {
    color: var(--term-warning);
    font-weight: bold;
}

.save-item-buttons {
    display: flex;
    gap: var(--space-xs);
}

.save-item-btn {
    background: transparent;
    border: 1px solid var(--term-dim);
    color: var(--term-text);
    padding: 4px 12px;
    font-family: var(--font-main);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
}

.save-item-btn:hover {
    border-color: var(--term-bright);
    color: var(--term-bright);
    background: rgba(0, 255, 0, 0.1);
}

.save-item-btn.delete:hover {
    background-color: rgba(255, 68, 68, 0.2);
    color: #ff4444;
    border-color: #ff4444;
}

/* Responsive Design for Small Screens */
@media (max-width: 768px) {
    .pause-modal-redesign {
        max-width: 95vw;
        max-height: 90vh;
    }

    .pause-modal-body {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }

    /* Stack action buttons vertically on small screens */
    .pause-action-bar {
        grid-template-columns: 1fr;
        gap: var(--space-xs);
        padding-bottom: var(--space-sm);
    }

    .pause-primary-btn,
    .pause-secondary-btn {
        padding: var(--space-sm);
        font-size: var(--font-size-md);
    }

    .pause-primary-btn .btn-icon {
        font-size: 1.2em;
    }

    .pause-secondary-btn .btn-icon {
        font-size: 1em;
    }

    /* Stack grid into single column */
    .pause-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .pause-panel-header {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-sm);
    }

    .pause-subsection {
        padding: var(--space-sm);
    }

    /* Adjust save list height for mobile */
    .pause-save-list-container {
        max-height: 200px;
    }

    .pause-save-list {
        padding: var(--space-sm);
    }

    /* Make input and buttons more mobile-friendly */
    .pause-input {
        font-size: var(--font-size-sm);
        padding: var(--space-xs);
    }

    .pause-save-btn {
        padding: 0 var(--space-sm);
        min-width: 40px;
    }

    /* Adjust quick action buttons */
    .pause-quick-actions {
        gap: var(--space-xs);
    }

    .pause-quick-btn {
        padding: var(--space-xs);
        font-size: var(--font-size-xs);
    }

    /* Adjust utility buttons */
    .pause-utility-btn {
        padding: var(--space-xs);
        font-size: var(--font-size-xs);
    }

    /* Smaller save items */
    .save-item {
        padding: var(--space-xs);
    }

    .save-item-name {
        font-size: var(--font-size-sm);
    }

    .save-item-details {
        font-size: 10px;
        flex-direction: column;
        gap: 2px;
    }

    .save-item-btn {
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* Extra small screens (phones in portrait) */
@media (max-width: 480px) {
    .pause-modal-redesign {
        max-width: 98vw;
        max-height: 95vh;
    }

    .modal-title {
        font-size: var(--font-size-md);
    }

    .pause-action-bar {
        gap: 4px;
    }

    .pause-primary-btn,
    .pause-secondary-btn {
        padding: 8px;
        font-size: var(--font-size-sm);
    }

    .pause-grid {
        gap: var(--space-xs);
    }

    .pause-panel-header {
        font-size: 11px;
        padding: 6px var(--space-xs);
    }

    .pause-subsection {
        padding: var(--space-xs);
    }

    .pause-quick-actions {
        gap: 4px;
    }

    .pause-quick-btn,
    .pause-utility-btn {
        padding: 6px;
        font-size: 11px;
        gap: 4px;
    }

    .pause-input {
        font-size: 12px;
        padding: 6px;
    }

    .pause-save-btn {
        padding: 0 8px;
        min-width: 35px;
        font-size: var(--font-size-md);
    }

    .pause-save-list-container {
        max-height: 150px;
    }

    .save-item {
        padding: 6px;
        margin-bottom: 4px;
    }

    .save-item-name {
        font-size: 12px;
    }

    .save-item-details {
        font-size: 9px;
    }

    .save-item-buttons {
        gap: 4px;
        flex-wrap: wrap;
    }

    .save-item-btn {
        padding: 2px 6px;
        font-size: 9px;
    }

    .pause-empty-state {
        padding: var(--space-md);
        font-size: var(--font-size-sm);
    }

    .empty-icon {
        font-size: 2em;
    }
}

/* Old section styles for compatibility */
.pause-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px dashed var(--term-dim);
}

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

.section-title {
    font-size: var(--font-size-md);
    color: var(--term-bright);
    text-align: center;
    text-shadow: var(--term-glow);
}

/* Save/Load Controls */
.save-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.save-input {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-md);
    outline: none;
}

.save-input:focus {
    border-color: var(--term-bright);
    box-shadow: 0 0 10px var(--term-text);
}

.save-message {
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-xs);
    min-height: 20px;
}

/* Ship Customization Styles */
.color-customization {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
}

.color-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid var(--term-dim);
}

.color-label {
    color: var(--term-text);
    font-size: var(--font-size-md);
}

/* Custom Color Swatch Button */
.color-swatch-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: transparent;
    border: 2px solid var(--term-text);
    padding: var(--space-xs);
    cursor: pointer;
    font-family: var(--font-main);
    transition: all 0.2s;
    min-width: 150px;
}

.color-swatch-btn:hover {
    border-color: var(--term-bright);
    box-shadow: 0 0 10px var(--term-text);
    background: rgba(0, 255, 0, 0.05);
}

.swatch-preview {
    width: 30px;
    height: 30px;
    border: 1px solid var(--term-text);
    display: inline-block;
    flex-shrink: 0;
}

.swatch-hex {
    color: var(--term-text);
    font-size: var(--font-size-sm);
    font-family: var(--font-main);
    text-transform: uppercase;
}

/* Color Picker Modal */
.color-picker-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.color-swatches-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: var(--space-xs);
    padding: var(--space-md);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--term-dim);
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    min-width: 30px;
    min-height: 30px;
    border: 2px solid var(--term-dim);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--swatch-color);
}

.color-swatch:hover {
    border-color: var(--term-bright);
    box-shadow: 0 0 15px var(--term-bright);
    transform: scale(1.1);
    z-index: 1;
}

.color-swatch.selected {
    border-color: var(--term-bright);
    box-shadow: 0 0 20px var(--term-bright), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Custom Hex Input */
.custom-hex-input {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(0, 255, 0, 0.05);
    border: 1px solid var(--term-dim);
}

.hex-input {
    flex: 1;
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs);
    font-family: var(--font-main);
    font-size: var(--font-size-md);
    text-transform: uppercase;
}

.hex-input:focus {
    border-color: var(--term-bright);
    box-shadow: 0 0 10px var(--term-text);
    outline: none;
}

.modal-btn-small {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-small:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: 0 0 10px var(--term-text);
}

.color-presets {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    border: 1px dashed var(--term-dim);
}

.preset-label {
    color: var(--term-bright);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-sm);
    text-align: center;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    justify-content: center;
}

.preset-btn {
    background: transparent;
    border: 1px solid var(--term-text);
    color: var(--term-text);
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-main);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    background-color: var(--term-text);
    color: var(--term-bg);
    box-shadow: 0 0 10px var(--term-text);
}

/* Old styles removed - using modern pause modal redesign styles above */

.info-text.dim {
    color: var(--term-dim);
    text-align: center;
    padding: var(--space-md);
    font-size: var(--font-size-sm);
}

/* Game Over Modal Specific */
.game-over-content {
    text-align: center;
}

.game-over-text {
    font-size: 10px;
    color: var(--term-bright);
    text-shadow: var(--term-glow);
    margin-bottom: var(--space-lg);
    line-height: 1.2;
}

.game-over-stats {
    border: 1px solid var(--term-text);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    background-color: rgba(0, 255, 0, 0.05);
}

.stat-line {
    font-size: var(--font-size-md);
    color: var(--term-dim);
    margin-bottom: var(--space-xs);
    display: flex;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
}

.stat-line span {
    color: var(--term-bright);
    text-shadow: var(--term-glow);
    font-weight: bold;
}

.game-over-message {
    font-size: var(--font-size-sm);
    color: #ff4444;
    text-shadow: 0 0 5px #ff4444;
    margin-bottom: var(--space-lg);
    padding: var(--space-md);
    border: 1px dashed #ff4444;
    background-color: rgba(255, 0, 0, 0.1);
    animation: pulse 2s ease-in-out infinite;
}

/* ================================
   RESPONSIVE DESIGN
   ================================ */

/* Tablet */
@media (max-width: 1024px) {
    .side-panel {
        width: 250px;
    }
    
    .stats-bar {
        flex-wrap: wrap;
    }
    
    .console-messages {
        height: 100px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Use custom property fallback for mobile browsers that don't support dvh */
    body {
        height: calc(var(--vh, 1vh) * 100);
    }
    
    .header-center .title-box {
        display: none;
    }
    
    .game-container {
        flex-direction: row; /* Allow horizontal layout */
        flex-wrap: wrap; /* Allow items to wrap to next line */
    }
    
    .center-panel {
        flex: unset; /* Don't take full height */
        width: 100%; /* Take full width for first row */
        order: 1; /* Canvas and log first */
        min-height: 400px; /* Ensure there's space for canvas and console on mobile */
        max-height: 60vh; /* Don't take too much vertical space */
        display: flex; /* Keep flex display */
        flex-direction: column; /* Stack canvas and console vertically */
    }
    
    /* Override width-constrained class on mobile */
    .center-panel.width-constrained {
        flex: unset !important; /* Don't let width-constrained override mobile layout */
        width: 100% !important;
        min-height: 400px;
        max-height: 60vh;
    }
    
    .center-panel.width-constrained .game-wrapper {
        flex: 1 !important; /* Ensure game-wrapper can grow on mobile */
        min-height: 300px;
    }
    
    .game-wrapper {
        flex: 1; /* Allow it to grow */
        display: flex; /* Keep flex display */
        flex-direction: column; /* Stack elements vertically */
        min-height: 300px; /* Ensure minimum height */
    }
    
    .canvas-container {
        flex: 1; /* Allow it to grow and fill available space */
        min-height: 200px; /* Ensure minimum height for canvas on mobile */
        max-height: 400px; /* Prevent canvas from being too large */
        height: auto; /* Only as tall as the canvas */
        touch-action: none; /* Prevent default touch behaviors on canvas */
    }
    
    .console-messages {
        min-height: 120px; /* Ensure minimum height for visibility */
        max-height: 170px; /* Limit system log height on mobile */
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* Show side panels side-by-side under the system log on mobile */
    .side-panel {
        display: block;
        width: 50%; /* Half width to sit side-by-side */
        order: 2; /* Side panels appear after center panel */
        max-height: calc(var(--vh, 1vh) * 40); /* Use custom property for mobile viewport */
        overflow-y: auto; /* Enable vertical scrolling */
        overflow-x: hidden; /* Prevent horizontal scroll */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        border-top: 1px solid var(--term-text);
        touch-action: pan-y; /* Allow vertical scrolling only */
    }
    
    .side-panel.left-panel {
        order: 2; /* Left panel first */
        border-left: none;
        border-right: 1px solid var(--term-text); /* Add divider between panels */
    }
    
    .side-panel.right-panel {
        order: 2; /* Same order to sit on same row */
        border-left: none;
        border-right: none;
    }
    
    /* Touch-friendly button improvements */
    .upgrade-btn,
    .modal-btn,
    .modal-btn-confirm,
    .modal-btn-cancel,
    button {
        min-height: 24px; /* Apple's recommended minimum touch target */
        padding: var(--space-sm) var(--space-md);
        touch-action: manipulation; /* Prevent double-tap zoom */
        -webkit-tap-highlight-color: rgba(0, 255, 0, 0.2); /* Visual feedback on tap */
    }
    
    /* Active state for touch feedback */
    .upgrade-btn:active:not(:disabled) {
        background-color: var(--term-text);
        color: var(--term-bg);
        transform: scale(0.98);
        box-shadow: var(--term-glow);
    }
    
    .modal-btn-confirm:active {
        background-color: var(--term-text);
        transform: scale(0.98);
        box-shadow: 0 0 20px var(--term-text);
    }
    
    .modal-btn-cancel:active {
        background-color: #ff4444;
        color: var(--term-bg);
        transform: scale(0.98);
        box-shadow: 0 0 20px #ff4444;
    }
    
    /* Improve input fields for touch */
    input[type="text"],
    input[type="number"],
    textarea {
        min-height: 44px;
        font-size: 16px; /* Prevent iOS zoom on focus */
        touch-action: manipulation;
    }
    
    /* Tab buttons touch improvements */
    .tab-btn {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 255, 0, 0.2);
    }
    
    .tab-btn:active {
        transform: scale(0.98);
    }
    
    /* Category headers touch improvements */
    .category-header {
        min-height: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 255, 0, 0.1);
    }
    
    .category-header:active {
        background-color: rgba(0, 255, 0, 0.05);
    }
    
    .stats-bar {
        gap: var(--space-xs);
        padding: var(--space-xs);
    }
    
    .stat-display {
        font-size: 10px;
    }
    
    .minimap {
        bottom: var(--space-sm);
        right: var(--space-sm);
        scale: 0.8;
    }
    
    .controls-hint {
        scale: 0.9;
        top: var(--space-sm);
        left: var(--space-sm);
    }
    
    /* Make console input area thinner on mobile to save space */
    .console-input-area {
        padding: 3px 6px !important; /* Balanced padding */
        min-height: 26px !important; /* Balanced height */
        gap: 6px; /* Balanced gap between prompt and input */
    }
    
    .console-prompt {
        line-height: 1.1 !important; /* Slightly relaxed line height */
        font-size: 13px; /* Readable font size */
    }
    
    /* Modal adjustments for mobile - account for browser chrome */
    .modal-large {
        max-height: calc(var(--vh, 1vh) * 80); /* Use custom property for mobile viewport */
        max-width: 95vw; /* Don't take full width on mobile */
    }
    
    .modal-content {
        max-height: calc(var(--vh, 1vh) * 80); /* Consistent with modal-large */
        overflow-y: auto; /* Enable scrolling for long content */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    .console-input {
        line-height: 1.2 !important; /* Slightly relaxed line height */
        min-height: 20px !important; /* Balanced input height */
        font-size: 14px !important; /* Readable but compact */
        padding: 2px 4px !important; /* Minimal but usable padding */
    }
    
    /* Make console header thinner on mobile to save space */
    .console-header {
        padding: 3px 6px !important; /* Minimal vertical padding */
        min-height: 24px; /* Compact height */
        font-size: 12px; /* Smaller font */
    }
    
    .console-clear {
        padding: 1px 4px !important; /* Smaller button padding */
        font-size: 11px; /* Smaller font */
        min-height: 20px; /* Compact button */
    }
    
    /* Halve auto-mine button size on mobile */
    .auto-mine-btn {
        width: 60px !important; /* Half of 120px */
        height: 60px !important; /* Half of 120px */
    }
    
    .auto-mine-icon {
        width: 24px !important; /* Half of 48px */
        height: 24px !important; /* Half of 48px */
    }
    
    .auto-mine-status {
        font-size: 10px; /* Smaller status text */
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .terminal-header {
        padding: 4px var(--space-xs);
    }
    
    .terminal-btn,
    .exit-btn {
        padding: 2px var(--space-xs);
        font-size: 10px;
    }
    
    .title-line,
    .title-text {
        font-size: 10px;
    }
    
    .stats-bar {
        padding: 4px;
    }
    
    .stat-display {
        font-size: 9px;
        gap: 2px;
    }
    
    .console-messages {
        height: 60px;
    }
    
    .console-header,
    .console-content {
        font-size: 10px;
    }
    
    /* Modal adjustments for small screens */
    .modal-content {
        min-width: 280px;
        max-width: 90%;
        padding: var(--space-md);
    }
    
    .modal-title {
        font-size: 12px;
    }
    
    .modal-message {
        font-size: 11px;
        padding: var(--space-sm);
    }
    
    /* Color picker mobile adjustments */
    .color-swatches-grid {
        grid-template-columns: repeat(6, 1fr); /* Reduce columns for mobile */
        gap: 6px;
    }
    
    .color-swatch {
        min-width: 38px; /* Larger touch targets */
        min-height: 38px;
    }
    
    .color-swatch-btn {
        min-width: 130px;
        font-size: 10px;
    }
    
    .swatch-preview {
        width: 25px;
        height: 25px;
    }
    
    .custom-hex-input input {
        font-size: 11px;
        padding: 6px;
    }
    
    .modal-btn {
        font-size: 11px;
        padding: var(--space-sm);
    }
    
    .game-over-text {
        font-size: 6px;
    }
    
    .stat-line {
        font-size: 10px;
        flex-direction: column;
        text-align: center;
    }
    
    .game-over-message {
        font-size: 10px;
    }
}

/* ================================
   ANIMATIONS
   ================================ */

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes glow {
    0%, 100% {
        text-shadow: var(--term-glow);
    }
    50% {
        text-shadow: 0 0 15px var(--term-bright);
    }
}

.pulsing {
    animation: pulse 2s ease-in-out infinite;
}

.glowing {
    animation: glow 2s ease-in-out infinite;
}

/* ================================
   UTILITY CLASSES
   ================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-bright {
    color: var(--term-bright);
}

.text-dim {
    color: var(--term-dim);
}

.text-accent {
    color: var(--term-accent);
}

/* ================================
   LARGE SCREEN SCALING
   (Base design: 1920x1080)
   ================================ */

/* 2K Displays (2560x1440) - Scale up 33% */
@media (min-width: 2560px) {
    :root {
        --font-size-sm: 16px;   /* was 12px */
        --font-size-md: 19px;   /* was 14px */
        --font-size-lg: 21px;   /* was 16px */
        --font-size-xl: 27px;   /* was 20px */
        
        --space-xs: 5px;        /* was 4px */
        --space-sm: 11px;       /* was 8px */
        --space-md: 21px;       /* was 16px */
        --space-lg: 32px;       /* was 24px */
    }
    
    body {
        font-size: 19px;        /* Scale base font */
    }
    
    .modal-content {
        min-width: 533px;       /* was 400px */
        max-width: 80%;
    }
    /*
    .minimap {
        width: 200px;
        height: 200px;
    }
    */
    #minimapCanvas {
        width: 160px;           /* was 120px */
        height: 160px;          /* was 120px */
    }
    
    .mobile-btn {
        width: 67px;            /* was 50px */
        height: 67px;           /* was 50px */
        font-size: 32px;        /* was 24px */
    }
    
    /* Canvas and CRT Effect Scaling */
    .canvas-container {
        border-width: 3px;      /* was 2px */
    }
    
    body.crt-mode .canvas-container::after {
        /* Scale scanline pattern */
        background: repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 1.33px,  /* was 1px */
            transparent 1.33px,
            transparent 2.66px   /* was 2px */
        );
    }
    
    body.crt-mode #gameCanvas {
        /* Scale CRT shadows */
        box-shadow: 
            inset 0 0 200px rgba(0, 0, 0, 0.6),   /* was 150px */
            inset 0 0 133px rgba(0, 0, 0, 0.5),   /* was 100px */
            inset 0 0 80px rgba(0, 0, 0, 0.4) !important;  /* was 60px */
    }
}

/* 4K Displays (3840x2160) - Scale up 100% */
@media (min-width: 3840px) {
    :root {
        --font-size-sm: 24px;   /* was 12px */
        --font-size-md: 28px;   /* was 14px */
        --font-size-lg: 32px;   /* was 16px */
        --font-size-xl: 40px;   /* was 20px */
        
        --space-xs: 8px;        /* was 4px */
        --space-sm: 16px;       /* was 8px */
        --space-md: 32px;       /* was 16px */
        --space-lg: 48px;       /* was 24px */
    }
    
    body {
        font-size: 28px;        /* Scale base font */
    }
    
    .modal-content {
        min-width: 800px;       /* was 400px */
        max-width: 80%;
    }
    
    .modal-title {
        font-size: 32px;        /* was 16px */
        padding: 16px;          /* was 8px */
    }
    
    .modal-message {
        font-size: 24px;        /* was 12px */
        padding: 32px;          /* was 16px */
    }
    
    .modal-btn {
        padding: 16px 32px;     /* was 8px 16px */
        font-size: 28px;        /* was 14px */
    }
    
    .minimap {
        width: 300px;           /* was 150px */
        height: 300px;          /* was 150px */
    }
    
    #minimapCanvas {
        width: 240px;           /* was 120px */
        height: 240px;          /* was 120px */
    }
    
    .controls-hint {
        font-size: 22px;        /* was 11px */
        padding: 16px;          /* was 8px */
    }
    
    .stat-display {
        font-size: 24px;        /* was 12px */
    }
    
    .upgrade-btn,
    .terminal-btn {
        padding: 16px 32px;     /* was 8px 16px */
        font-size: 28px;        /* was 14px */
        min-height: 88px;       /* was 44px */
    }
    
    .mobile-btn {
        width: 100px;           /* was 50px */
        height: 100px;          /* was 50px */
        font-size: 48px;        /* was 24px */
    }
    
    .color-swatch {
        min-width: 60px;        /* was 30px */
        min-height: 60px;       /* was 30px */
    }
    
    .swatch-preview {
        width: 60px;            /* was 30px */
        height: 60px;           /* was 30px */
    }
    
    /* Canvas and CRT Effect Scaling */
    .canvas-container {
        border-width: 4px;      /* was 2px */
    }
    
    body.crt-mode .canvas-container::after {
        /* Scale scanline pattern */
        background: repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 2px,     /* was 1px */
            transparent 2px,
            transparent 4px      /* was 2px */
        );
    }
    
    body.crt-mode #gameCanvas {
        /* Scale CRT shadows */
        box-shadow: 
            inset 0 0 300px rgba(0, 0, 0, 0.6),   /* was 150px */
            inset 0 0 200px rgba(0, 0, 0, 0.5),   /* was 100px */
            inset 0 0 120px rgba(0, 0, 0, 0.4) !important;  /* was 60px */
    }
}

/* Ultra-wide and 8K Displays (5120px+) - Scale up 166% */
@media (min-width: 5120px) {
    :root {
        --font-size-sm: 32px;   /* was 12px */
        --font-size-md: 37px;   /* was 14px */
        --font-size-lg: 43px;   /* was 16px */
        --font-size-xl: 53px;   /* was 20px */
        
        --space-xs: 11px;       /* was 4px */
        --space-sm: 21px;       /* was 8px */
        --space-md: 43px;       /* was 16px */
        --space-lg: 64px;       /* was 24px */
    }
    
    body {
        font-size: 37px;        /* Scale base font */
    }
    
    .modal-content {
        min-width: 1066px;      /* was 400px */
        max-width: 75%;
    }
    
    .modal-title {
        font-size: 43px;        /* was 16px */
        padding: 21px;          /* was 8px */
    }
    
    .modal-message {
        font-size: 32px;        /* was 12px */
        padding: 43px;          /* was 16px */
    }
    
    .modal-btn {
        padding: 21px 43px;     /* was 8px 16px */
        font-size: 37px;        /* was 14px */
    }
    
    .minimap {
        width: 400px;           /* was 150px */
        height: 400px;          /* was 150px */
    }
    
    #minimapCanvas {
        width: 320px;           /* was 120px */
        height: 320px;          /* was 120px */
    }
    
    .upgrade-btn,
    .terminal-btn {
        padding: 21px 43px;     /* was 8px 16px */
        font-size: 37px;        /* was 14px */
        min-height: 117px;      /* was 44px */
    }
    
    /* Canvas and CRT Effect Scaling */
    .canvas-container {
        border-width: 5px;      /* was 2px */
    }
    
    body.crt-mode .canvas-container::after {
        /* Scale scanline pattern */
        background: repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 2.66px,  /* was 1px */
            transparent 2.66px,
            transparent 5.32px   /* was 2px */
        );
    }
    
    body.crt-mode #gameCanvas {
        /* Scale CRT shadows */
        box-shadow: 
            inset 0 0 400px rgba(0, 0, 0, 0.6),   /* was 150px */
            inset 0 0 266px rgba(0, 0, 0, 0.5),   /* was 100px */
            inset 0 0 160px rgba(0, 0, 0, 0.4) !important;  /* was 60px */
    }
}

