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

body {
    background-color: #000000;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Boot Sequence */
.boot-sequence {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.boot-sequence.fade-out {
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        pointer-events: none;
    }
}

.boot-content {
    width: 90%;
    max-width: 800px;
    padding: 20px;
}

.boot-text {
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.boot-text .cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: #00ff00;
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

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

.boot-text .error {
    color: #ff0000;
}

.boot-text .success {
    color: #00ff00;
}

.boot-text .warning {
    color: #ffff00;
}

.boot-text .info {
    color: #00ffff;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Title */
.title-banner {
    background-color: #000000;
    border: 3px ridge #00ff00;
    padding: 5px 10px;
    margin-bottom: 10px;
}

.title-banner pre {
    color: #00ff00;
    font-weight: bold;
    font-size: 11px;
    text-align: center;
    margin: 0;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

/* Left Panel */
.left-panel {
    flex: 1;
    background-color: #000000;
    border: 2px ridge #00ff00;
    padding: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.status-header {
    color: #00ffff;
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 5px;
}

.stats-frame {
    background-color: #0a0a0a;
    border: 2px sunken #00ffff;
    padding: 10px 5px;
    margin-bottom: 10px;
}

.stats-frame div {
    font-size: 10px;
    padding: 2px 0;
}

#metal-stat { color: #00ff00; font-weight: bold; font-size: 12px; }
#mps-stat, #mpc-stat { color: #00ffff; }
#clicks-stat { color: #aaaaaa; }
#defense-stat { color: #ff00ff; }

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.tab-button {
    flex: 1;
    background-color: #003300;
    color: #00ff00;
    border: none;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 9px;
    cursor: pointer;
}

.tab-button:hover {
    background-color: #004400;
}

.tab-button.active {
    background-color: #005500;
}

.tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.tab-content.active {
    display: block;
}

.scrollable-content {
    height: 100%;
    overflow-y: auto;
    padding: 5px;
}

/* Custom Scrollbar */
.scrollable-content::-webkit-scrollbar {
    width: 12px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background: #330033;
    border: 1px solid #550055;
}

.scrollable-content::-webkit-scrollbar-thumb:hover {
    background: #550055;
}

/* Upgrade/Ship Items */
.upgrade-item, .ship-item {
    background-color: #001a00;
    border: 2px ridge #00ff00;
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ship-item {
    background-color: #001a1a;
}

.item-info {
    flex: 1;
}

.item-name {
    color: #00ff00;
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 3px;
}

.ship-item .item-name {
    color: #00ffff;
    font-size: 12px;
}

.item-type {
    color: #00ffff;
    font-size: 8px;
}

.item-bonus {
    color: #ffff00;
    font-size: 8px;
}

.item-count {
    color: #aaaaaa;
    font-size: 8px;
}

.item-buttons {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.buy-button, .build-button, .deploy-button, .recall-button {
    padding: 5px 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 8px;
    border: none;
    cursor: pointer;
    min-width: 100px;
}

.buy-button {
    background-color: #00aa00;
    color: #000000;
}

.buy-button:disabled {
    background-color: #003300;
    color: #006600;
    cursor: not-allowed;
}

.build-button {
    background-color: #0088aa;
    color: #000000;
}

.build-button:disabled {
    background-color: #003333;
    color: #006666;
    cursor: not-allowed;
}

.deploy-button {
    background-color: #00aa00;
    color: #000000;
}

.deploy-button:disabled {
    background-color: #003300;
    color: #006600;
    cursor: not-allowed;
}

.recall-button {
    background-color: #aa6600;
    color: #000000;
}

.recall-button:disabled {
    background-color: #332200;
    color: #664400;
    cursor: not-allowed;
}

/* Right Panel */
.right-panel {
    width: 350px;
    background-color: #000000;
    border: 2px ridge #00ff00;
    padding: 10px;
    overflow-y: auto;
    overflow-x: hidden;
}

.right-panel::-webkit-scrollbar {
    width: 12px;
}

.right-panel::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.right-panel::-webkit-scrollbar-thumb {
    background: #330033;
    border: 1px solid #550055;
}

.right-panel::-webkit-scrollbar-thumb:hover {
    background: #550055;
}

/* Combat Log */
.log-header {
    color: #ff00ff;
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.toggle-btn {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #330033;
    color: #ff00ff;
    border: 2px solid #550055;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    outline: none;
    box-shadow: none;
}

.toggle-btn:hover {
    background-color: #550055;
}

.toggle-btn:active {
    background-color: #770077;
}

.toggle-btn:focus {
    outline: 1px solid #ff00ff;
    outline-offset: 2px;
}

.log-display {
    background-color: #0a0a0a;
    border: 2px sunken #ff00ff;
    padding: 5px;
    margin-bottom: 5px;
    height: 100px;
    overflow-y: auto;
    font-size: 8px;
    color: #00ff00;
    white-space: pre-wrap;
}

.log-display.collapsed {
    display: none;
}

.separator {
    color: #330033;
    font-size: 8px;
    text-align: center;
    margin: 10px 0;
}

/* Salvage Interface */
.salvage-header {
    color: #ff00ff;
    font-weight: bold;
    font-size: 10px;
    text-align: center;
    margin: 10px 0;
}

.salvage-header pre {
    margin: 0;
}

.salvage-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.ascii-art {
    color: #00ff00;
    font-size: 10px;
}

.ascii-art pre {
    margin: 0;
}

.mine-button {
    background-color: #00aa00;
    color: #000000;
    border: 3px raised #00ff00;
    padding: 15px 30px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    min-width: 200px;
}

.mine-button:hover {
    background-color: #00ff00;
}

.mine-button:active {
    border-style: sunken;
}

.status-text {
    color: #00ff00;
    font-size: 9px;
}

.debug-button {
    background-color: #440044;
    color: #ff00ff;
    border: 1px solid #ff00ff;
    padding: 5px 15px;
    font-family: 'Courier New', monospace;
    font-size: 8px;
    cursor: pointer;
}

.debug-button:hover {
    background-color: #660066;
}

.connection-status {
    color: #00aa00;
    font-size: 8px;
    text-align: center;
    margin-top: 10px;
}

.connection-status.compromised {
    color: #ff0000;
}

.connection-status.secure {
    color: #00ff00;
}

/* Warning Overlay */
.warning-overlay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    pointer-events: none;
}

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

.warning-content {
    background-color: #000000;
    border: 5px ridge #ff0000;
    padding: 20px 40px;
    text-align: center;
    animation: warningPulse 0.5s infinite;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
}

@keyframes warningPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 50px rgba(255, 0, 0, 1);
    }
}

.warning-title {
    color: #ff0000;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 10px;
}

.warning-text {
    color: #ff4400;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}

.warning-countdown {
    color: #ff0000;
    font-weight: bold;
    font-size: 24px;
}

/* Attack Overlay */
.attack-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

.attack-content {
    background-color: #000000;
    border: 5px ridge #ff0000;
    padding: 30px;
    text-align: center;
}

.attack-title {
    color: #ff0000;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 10px;
}

.attack-warning {
    color: #ff4400;
    font-size: 10px;
    margin-bottom: 10px;
}

.attack-progress {
    color: #ffff00;
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 10px;
}

.attack-timer {
    color: #ff0000;
    font-size: 10px;
    margin-bottom: 15px;
}

.defend-button {
    background-color: #ff0000;
    color: #000000;
    border: 3px raised #ff4400;
    padding: 20px 40px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}

.defend-button:hover {
    background-color: #ff4400;
}

.defend-button:active {
    border-style: sunken;
}

.risk-label {
    color: #ff0000;
    font-size: 8px;
    margin-top: 10px;
}

/* Mobile Responsive Styles */
@media screen and (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .container {
        padding: 5px;
        height: auto;
        max-width: 100%;
    }

    .title-banner {
        padding: 5px;
    }

    .title-banner pre {
        font-size: 8px;
    }

    .main-content {
        flex-direction: column;
        overflow: visible;
    }

    .left-panel {
        width: 100%;
        margin-bottom: 10px;
        max-height: none;
    }

    .right-panel {
        width: 100%;
        max-height: none;
        padding-bottom: 120px; /* Space for sticky button */
    }

    .scrollable-content {
        max-height: 300px;
    }

    /* Sticky extract button on mobile */
    .salvage-content {
        position: relative;
    }

    .mine-button {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        font-size: 16px;
        padding: 20px 40px;
        min-width: 250px;
        box-shadow: 0 4px 15px rgba(0, 255, 0, 0.5);
    }

    .defend-button {
        font-size: 16px;
        padding: 25px 50px;
    }

    .tab-button {
        font-size: 10px;
        padding: 10px;
    }

    /* Compact horizontal layout for items on mobile */
    .upgrade-item, .ship-item {
        padding: 5px;
        flex-direction: row;
        align-items: center;
    }

    .item-info {
        flex: 1;
        min-width: 0;
    }

    .item-name {
        font-size: 9px;
    }

    .ship-item .item-name {
        font-size: 10px;
    }

    .item-type, .item-bonus, .item-count {
        font-size: 7px;
    }

    .item-buttons {
        flex-direction: column;
        gap: 2px;
        flex-shrink: 0;
    }

    .buy-button, .build-button, .deploy-button, .recall-button {
        min-width: 65px;
        max-width: 65px;
        font-size: 7px;
        padding: 4px 3px;
        white-space: nowrap;
    }

    /* Very small screens */
    @media screen and (max-width: 480px) {
        .title-banner pre {
            font-size: 6px;
        }

        .stats-frame div {
            font-size: 8px;
        }

        .log-display {
            font-size: 7px;
        }

        .item-name {
            font-size: 8px;
        }
    }

    /* Warning overlay mobile */
    .warning-content {
        padding: 15px 25px;
        max-width: 90%;
    }

    .warning-title {
        font-size: 10px;
    }

    .warning-text {
        font-size: 12px;
    }

    .warning-countdown {
        font-size: 20px;
    }

    /* Attack overlay mobile */
    .attack-content {
        padding: 20px;
        max-width: 90%;
    }

    .attack-title {
        font-size: 10px;
    }

    .attack-warning, .attack-progress, .attack-timer {
        font-size: 9px;
    }
}

/* Landscape mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .main-content {
        flex-direction: row;
    }

    .left-panel, .right-panel {
        width: 50%;
    }

    .scrollable-content {
        max-height: 200px;
    }
}
