:root {
    --primary: #00ff41;
    --danger: #ff3e3e;
    --warning: #ffcc00;
    --bg: #0a0a0c;
    --panel-bg: rgba(10, 10, 12, 0.85);
    --border: #333;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg);
    color: var(--primary);
    font-family: 'Courier New', Courier, monospace;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#map-container {
    width: 100%;
    height: 100%;
    touch-action: pan-x pan-y pinch-zoom;
}

canvas#missile-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

#ui-overlay .menu-overlay {
    pointer-events: auto;
}

#ui-overlay .menu-overlay * {
    pointer-events: auto;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0,0,0,0.8);
    border-bottom: 1px solid var(--primary);
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-box .label {
    font-size: 10px;
    opacity: 0.7;
}

.stat-box .value {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary);
}

#timer-bar-container {
    width: 150px;
    height: 12px;
    background: #222;
    position: relative;
    overflow: hidden;
    border: 1px solid #444;
}

#timer-bar {
    width: 100%;
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear, background-color 0.3s;
}

#timer-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 8px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px black;
    pointer-events: none;
}

#timer-bar.warning-orange { background-color: #ff9900; }
#timer-bar.warning-red { background-color: #ff3e3e; animation: flash 0.5s infinite; }

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

#turn-display {
    text-align: center;
}

#turn-label {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

#actions-container {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-pip {
    width: 12px;
    height: 12px;
    border: 1px solid var(--primary);
    border-radius: 50%;
}

.action-pip.active {
    background: var(--primary);
    box-shadow: 0 0 5px var(--primary);
}

.country-hp-bar {
    pointer-events: none;
    position: absolute;
    width: 40px;
    height: 4px;
    background: #440000;
    border: 0.5px solid #000;
}

.country-hp-fill {
    height: 100%;
    background: #00ff41;
}

.country-hp-text {
    position: absolute;
    font-size: 8px;
    color: white;
    top: -10px;
    width: 100%;
    text-align: center;
    pointer-events: none;
}

#controls-panel {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 150px;
    pointer-events: auto;
}

#controls-panel .action-btn {
    pointer-events: auto;
    cursor: pointer;
}

#btn-end-turn {
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid var(--primary);
    font-size: 16px;
    letter-spacing: 1px;
    pointer-events: auto;
}

#merchant-panel {
    position: absolute;
    bottom: 250px;
    right: 20px;
    width: 150px;
    padding: 8px;
    background: rgba(5,5,6,0.95);
    border: 1px solid var(--primary);
    box-shadow: 0 0 12px rgba(0,255,65,0.08);
    z-index: 30;
    pointer-events: auto;
    font-size: 11px;
    max-height: 300px;
    overflow-y: auto;
}
#merchant-panel h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding-bottom: 4px;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

#merchant-panel.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

#merchant-panel.collapsed {
    max-height: 32px;
    overflow: hidden;
}

#merchant-panel.collapsed #merchant-content {
    display: none;
}

#merchant-content {
    transition: all 0.3s ease;
}
.merchant-item {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed rgba(255,255,255,0.02);
}
.mi-title { font-weight: bold; color: #fff; margin-bottom: 3px; font-size: 10px; }
.mi-desc { font-size: 9px; color: #cfcfcf; margin-bottom: 4px; line-height: 1.2; }
.mi-cost { font-size: 10px; color: var(--primary); margin-bottom: 4px; }
.mi-level { font-size: 10px; color: #cfcfcf; margin-bottom: 4px; }

.merchant-item .action-btn {
    width: 100%;
    padding: 6px;
    margin-top: 4px;
    font-size: 10px;
}

#selection-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 250px;
    padding: 15px;
    background: var(--panel-bg);
    border: 1px solid var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    transition: transform 0.3s ease;
}

#selection-panel.hidden {
    transform: translateX(-300px);
}

#selection-panel h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    border-bottom: 1px solid var(--primary);
    padding-bottom: 5px;
}

.country-stats {
    font-size: 14px;
    margin-bottom: 15px;
}

.action-btn {
    width: 100%;
    padding: 10px;
    margin-top: 5px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
    background: var(--primary);
    color: black;
}

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

#btn-launch {
    border-color: var(--danger);
    color: var(--danger);
}

#btn-launch:hover:not(:disabled) {
    background: var(--danger);
    color: white;
}

#launch-timer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    z-index: 20;
}

#launch-timer-overlay.hidden {
    display: none;
}

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

.warning-text {
    color: var(--danger);
    font-size: 24px;
    margin-bottom: 10px;
    letter-spacing: 5px;
    animation: blink 0.5s infinite;
}

#countdown-number {
    font-size: 80px;
    color: white;
    font-weight: bold;
}

#notifications {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    pointer-events: none;
}

.notif {
    background: rgba(0,0,0,0.8);
    padding: 8px 12px;
    border-right: 3px solid var(--primary);
    font-size: 12px;
    animation: slideIn 0.3s forwards, fadeOut 0.5s 4.5s forwards;
}

.notif.danger { border-color: var(--danger); }
.notif.success { border-color: #f1c40f; color: #f1c40f; }

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

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

@keyframes statusFlash {
    0%, 100% { 
        color: var(--warning);
        text-shadow: 0 0 5px var(--warning);
    }
    50% { 
        color: #ffdd00;
        text-shadow: 0 0 15px #ffdd00, 0 0 25px var(--warning);
    }
}

.hidden { display: none !important; }

#combo-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: none;
    text-align: center;
    text-shadow: 0 0 20px #f1c40f;
}

.combo-text {
    font-size: 60px;
    font-weight: 900;
    color: #f1c40f;
    animation: comboPulse 0.5s ease-out;
}

.combo-bonus {
    font-size: 40px;
    color: white;
    margin-top: -10px;
    animation: comboPulse 0.5s 0.1s ease-out backwards;
}

@keyframes comboPulse {
    0% { transform: scale(0.5); opacity: 0; filter: brightness(3); }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

.shake {
    animation: screenShake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes screenShake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-8px, 0, 0); }
    40%, 60% { transform: translate3d(8px, 0, 0); }
}

/* Pause Overlay */
#pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#pause-overlay.hidden {
    display: none;
}

.pause-content {
    text-align: center;
    padding: 40px;
    background: var(--panel-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
}

.pause-content h1 {
    font-size: 48px;
    margin: 0 0 30px 0;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
    letter-spacing: 5px;
}

.large-btn {
    padding: 15px 40px;
    font-size: 18px;
    margin: 10px;
    min-width: 200px;
}

/* Settings Overlay */
#settings-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 210;
}

#settings-overlay.hidden {
    display: none;
}

.settings-content {
    text-align: center;
    padding: 40px;
    background: var(--panel-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    min-width: 400px;
}

.settings-content h1 {
    font-size: 36px;
    margin: 0 0 30px 0;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
    letter-spacing: 3px;
}

.settings-grid {
    display: grid;
    gap: 25px;
    margin-bottom: 30px;
    text-align: left;
}

.setting-item {
    display: grid;
    grid-template-columns: 150px 1fr auto;
    align-items: center;
    gap: 15px;
}

.setting-item label {
    font-size: 14px;
    color: var(--primary);
    font-weight: bold;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 5px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--primary);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--primary);
}

.setting-select {
    width: 100%;
    padding: 8px;
    background: #1a1a1a;
    border: 1px solid var(--primary);
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}

.setting-select option {
    background: #1a1a1a;
    color: var(--primary);
}

.setting-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
}

.setting-value {
    font-size: 14px;
    color: white;
    min-width: 60px;
    text-align: right;
}

/* Main Menu */
.menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 20, 10, 0.98), rgba(10, 0, 0, 0.98));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
    animation: fadeIn 0.5s;
    pointer-events: auto;
}

.menu-overlay.hidden {
    display: none;
}

.menu-content {
    text-align: center;
    padding: 50px;
    background: rgba(10, 10, 12, 0.95);
    border: 3px solid var(--primary);
    box-shadow: 0 0 50px rgba(0, 255, 65, 0.6);
    max-width: 600px;
    animation: slideDown 0.8s ease-out;
    pointer-events: auto;
}

.game-title {
    font-size: 56px;
    margin: 0;
    color: var(--primary);
    text-shadow: 0 0 30px var(--primary);
    letter-spacing: 8px;
    animation: titlePulse 2s ease-in-out infinite;
}

.game-subtitle {
    font-size: 24px;
    margin: 10px 0 15px 0;
    color: #888;
    letter-spacing: 4px;
    font-weight: normal;
}

.game-credits {
    font-size: 14px;
    margin: 0 0 30px 0;
    color: #666;
    letter-spacing: 1px;
    font-style: italic;
    opacity: 0.8;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 30px var(--primary); }
    50% { text-shadow: 0 0 50px var(--primary), 0 0 20px white; }
}

.menu-section {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 65, 0.2);
}

.menu-label {
    display: block;
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 15px;
    letter-spacing: 2px;
    font-weight: bold;
}

.difficulty-buttons,
.mode-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.difficulty-btn,
.mode-btn {
    flex: 1;
    padding: 12px 20px;
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid rgba(0, 255, 65, 0.3);
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 1px;
    pointer-events: auto;
}

.difficulty-btn:hover,
.mode-btn:hover {
    background: rgba(0, 255, 65, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.difficulty-btn.selected,
.mode-btn.selected {
    background: var(--primary);
    color: black;
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary);
}

.difficulty-description,
.mode-description {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
    margin-top: 8px;
    min-height: 20px;
}

.menu-btn {
    width: 100%;
    padding: 18px;
    margin: 10px 0;
    font-size: 20px;
    font-family: inherit;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid var(--primary);
    pointer-events: auto;
}

.menu-btn.primary {
    background: var(--primary);
    color: black;
    box-shadow: 0 0 20px var(--primary);
}

.menu-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--primary);
}

.menu-btn.secondary {
    background: transparent;
    color: var(--primary);
}

.menu-btn.secondary:hover {
    background: rgba(0, 255, 65, 0.1);
}

/* Tutorial Overlay */
#tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 310;
    overflow-y: auto;
}

#tutorial-overlay.hidden {
    display: none;
}

.tutorial-content {
    text-align: left;
    padding: 40px;
    background: var(--panel-bg);
    border: 2px solid var(--primary);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.5);
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

.tutorial-content h1 {
    text-align: center;
    font-size: 36px;
    margin: 0 0 30px 0;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
    letter-spacing: 3px;
}

.tutorial-sections {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.tutorial-section {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-left: 3px solid var(--primary);
}

.tutorial-section h3 {
    color: var(--primary);
    margin: 0 0 10px 0;
    font-size: 18px;
}

.tutorial-section p {
    color: #ccc;
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
}

.tutorial-section strong {
    color: var(--primary);
}

/* Game Over Overlay */
#gameover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
    animation: fadeIn 1s;
}

#gameover-overlay.hidden {
    display: none;
}

.gameover-content {
    text-align: center;
    padding: 50px;
    background: var(--panel-bg);
    border: 3px solid var(--primary);
    box-shadow: 0 0 40px rgba(0, 255, 65, 0.6);
    animation: slideDown 0.8s ease-out;
}

.gameover-content h1 {
    font-size: 60px;
    margin: 0 0 30px 0;
    text-shadow: 0 0 25px currentColor;
    letter-spacing: 8px;
}

#gameover-stats {
    font-size: 20px;
    margin: 30px 0;
    line-height: 2;
}

#gameover-stats span {
    color: var(--primary);
    font-weight: bold;
}

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

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

/* Map styling */
.country {
    stroke: #1a1a1a;
    stroke-width: 0.5;
    transition: fill 0.3s;
    cursor: pointer;
}

.country.player { fill: #00441b; }
.country.enemy { fill: #440000; }
.country.neutral { fill: #111; }
.country.selected { 
    stroke: white; 
    stroke-width: 1.5;
    filter: drop-shadow(0 0 8px var(--primary));
    animation: borderGlow 1.5s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { 
        stroke: var(--primary); 
        filter: drop-shadow(0 0 8px var(--primary));
    }
    50% { 
        stroke: white; 
        filter: drop-shadow(0 0 15px var(--primary));
    }
}

.country.capturing {
    animation: captureAnimation 1s ease-out;
}

.country.half-price {
    animation: halfPriceFlash 1.5s ease-in-out infinite;
}

@keyframes halfPriceFlash {
    0%, 100% {
        filter: brightness(1);
        stroke: var(--warning);
        stroke-width: 1.5;
    }
    50% {
        filter: brightness(2) saturate(1.5);
        stroke: #ffdd00;
        stroke-width: 2;
    }
}

@keyframes captureAnimation {
    0% { 
        filter: brightness(1); 
        transform: scale(1);
    }
    50% { 
        filter: brightness(3) saturate(2); 
        transform: scale(1.02);
    }
    100% { 
        filter: brightness(1); 
        transform: scale(1);
    }
}

.country:hover {
    filter: brightness(1.5);
}

/* Floating Damage Numbers */
.damage-number {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ff3e3e;
    text-shadow: 0 0 10px #ff3e3e, 2px 2px 4px black;
    pointer-events: none;
    z-index: 100;
    animation: floatUp 1.5s ease-out forwards;
}

.damage-number.heal {
    color: #00ff41;
    text-shadow: 0 0 10px #00ff41, 2px 2px 4px black;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-30px) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.8);
    }
}

/* Mobile & Touch Optimizations */
@media (max-width: 768px) {
    #top-bar {
        flex-wrap: wrap;
        padding: 8px 10px;
        gap: 5px;
    }

    .stat-box {
        min-width: 60px;
    }

    .stat-box .label {
        font-size: 8px;
    }

    .stat-box .value {
        font-size: 14px;
    }

    #turn-display {
        order: -1;
        width: 100%;
        margin-bottom: 5px;
    }

    #timer-bar-container {
        width: 100%;
        order: 10;
        margin-top: 5px;
    }

    /* Merchant Panel - Collapsible on mobile */
    #merchant-panel {
        bottom: 220px;
        right: 10px;
        left: auto;
        width: 140px;
        max-height: 250px;
        overflow-y: auto;
        font-size: 10px;
        padding: 6px;
    }

    #merchant-panel.collapsed {
        max-height: 28px;
        overflow: hidden;
    }

    #merchant-panel h3 {
        font-size: 11px;
        cursor: pointer;
        user-select: none;
        margin-bottom: 3px;
    }

    #merchant-panel .action-btn {
        padding: 6px;
        font-size: 9px;
        margin-top: 3px;
    }

    .merchant-item {
        margin-bottom: 8px;
    }

    .mi-title {
        font-size: 11px;
    }

    .mi-desc {
        font-size: 10px;
    }

    /* Selection Panel - Bottom sheet style */
    #selection-panel {
        bottom: 10px;
        left: 10px;
        right: 120px;
        width: auto;
        padding: 10px;
        max-height: 200px;
        overflow-y: auto;
    }

    #selection-panel h2 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .country-stats {
        font-size: 11px;
        margin-bottom: 10px;
    }

    #selection-panel .actions {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    #selection-panel .action-btn {
        width: 100%;
        padding: 10px 8px;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Controls Panel - Larger touch targets */
    #controls-panel {
        bottom: 10px;
        right: 10px;
        width: 100px;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    #controls-panel .action-btn {
        padding: 10px 5px;
        font-size: 11px;
        margin: 0;
    }

    #btn-end-turn {
        font-size: 12px;
    }

    #btn-settings,
    #btn-pause {
        font-size: 16px;
        padding: 8px;
    }

    /* Notifications - Smaller on mobile */
    #notifications {
        top: auto;
        bottom: 60px;
        right: 10px;
        left: 10px;
        width: auto;
    }

    .notif {
        font-size: 11px;
        padding: 6px 10px;
    }

    /* HP Bars - Larger for visibility */
    .country-hp-bar {
        width: 50px;
        height: 5px;
    }

    .country-hp-text {
        font-size: 10px;
        font-weight: bold;
        text-shadow: 1px 1px 2px black;
    }

    /* Combo Overlay - Smaller */
    .combo-text {
        font-size: 40px;
    }

    .combo-bonus {
        font-size: 28px;
    }

    /* Game Over - Responsive */
    .gameover-content {
        padding: 30px 20px;
        width: 90%;
        max-width: 400px;
    }

    .gameover-content h1 {
        font-size: 40px;
    }

    #gameover-stats {
        font-size: 16px;
    }

    .large-btn {
        padding: 12px 30px;
        font-size: 16px;
        min-width: 150px;
    }

    /* Pause Overlay - Responsive */
    .pause-content {
        padding: 30px 20px;
        width: 90%;
        max-width: 400px;
    }

    .pause-content h1 {
        font-size: 36px;
    }

    /* Settings - Responsive */
    .settings-content {
        padding: 25px 15px;
        min-width: auto;
        width: 90%;
        max-width: 400px;
    }

    .settings-content h1 {
        font-size: 28px;
    }

    .setting-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .setting-item label {
        grid-column: 1;
    }

    .slider {
        grid-column: 1;
    }

    .setting-value {
        text-align: left;
        grid-column: 1;
    }

    /* Main Menu - Mobile */
    .menu-content {
        padding: 30px 20px;
        width: 90%;
        max-width: 500px;
    }

    .game-title {
        font-size: 36px;
        letter-spacing: 4px;
    }

    .game-subtitle {
        font-size: 18px;
        letter-spacing: 2px;
    }

    .menu-section {
        padding: 15px;
    }

    .difficulty-buttons,
    .mode-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .menu-btn {
        font-size: 16px;
        padding: 15px;
    }

    /* Tutorial - Mobile */
    .tutorial-content {
        padding: 25px 20px;
        margin: 10px;
    }

    .tutorial-content h1 {
        font-size: 28px;
    }

    .tutorial-section h3 {
        font-size: 16px;
    }

    .tutorial-section p {
        font-size: 13px;
    }

    /* Launch Countdown - Smaller */
    .warning-text {
        font-size: 18px;
        letter-spacing: 3px;
    }

    #countdown-number {
        font-size: 60px;
    }
}

@media (max-width: 480px) {
    .stat-box .value {
        font-size: 12px;
    }

    #merchant-panel {
        font-size: 10px;
        padding: 6px;
    }

    #selection-panel {
        padding: 10px;
    }

    #controls-panel {
        width: 100px;
    }

    .action-btn {
        padding: 10px;
        font-size: 12px;
    }

    .gameover-content h1 {
        font-size: 32px;
        letter-spacing: 4px;
    }

    #gameover-stats {
        font-size: 14px;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .country {
        cursor: default;
    }

    .country:active {
        filter: brightness(1.8);
    }

    .action-btn {
        min-height: 44px; /* iOS recommended touch target */
    }

    /* Remove hover effects on touch devices */
    .country:hover {
        filter: none;
    }

    .action-btn:hover:not(:disabled) {
        background: transparent;
        color: var(--primary);
    }

    .action-btn:active:not(:disabled) {
        background: var(--primary);
        color: black;
    }
}

/* Landscape mobile optimization */
@media (max-width: 900px) and (orientation: landscape) {
    #top-bar {
        padding: 5px 10px;
    }

    .stat-box .value {
        font-size: 12px;
    }

    #merchant-panel {
        max-height: 50vh;
        font-size: 10px;
    }

    #selection-panel {
        max-width: 300px;
    }

    .gameover-content,
    .pause-content {
        padding: 20px;
    }

    .gameover-content h1,
    .pause-content h1 {
        font-size: 32px;
        margin-bottom: 15px;
    }

    #gameover-stats {
        font-size: 14px;
        line-height: 1.5;
        margin: 15px 0;
    }

    .large-btn {
        padding: 10px 25px;
        font-size: 14px;
        margin: 5px;
    }
}