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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
    color: #00ff00;
    min-height: 100vh;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.game-container {
    max-width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== Start Screen ========== */
.start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a2e 100%);
}

.start-content {
    text-align: center;
    padding: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #00ff00;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
}

.title-large {
    font-size: 4em;
    text-shadow: 0 0 20px #00ff00;
    letter-spacing: 10px;
    margin-bottom: 10px;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 20px #00ff00, 0 0 30px #00ff00; }
    50% { text-shadow: 0 0 30px #00ff00, 0 0 50px #00ff00, 0 0 70px #00ff00; }
}

.subtitle-large {
    font-size: 1.5em;
    color: #00aaff;
    margin-bottom: 40px;
}

.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 300px;
}

.btn-large {
    font-size: 1.2em;
    padding: 15px 30px;
}

/* ========== 2-Column Game Layout ========== */
.main-game {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
    padding: 10px;
    height: 100vh;
    overflow: hidden;
}

.battlefield-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    min-height: 0;
}

/* ========== Panels ========== */
.panel {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ff00;
    border-radius: 5px;
    padding: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel h2 {
    color: #00aaff;
    margin: 0 0 6px 0;
    font-size: 1em;
    text-align: center;
    border-bottom: 1px solid #00ff00;
    padding-bottom: 5px;
    flex-shrink: 0;
}

/* Collapsible headers */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.collapsible-header:hover {
    color: #00ff00;
    text-shadow: 0 0 5px #00ff00;
}

.collapsible-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsible-content.collapsed {
    max-height: 0 !important;
    overflow: hidden;
}

/* ========== Battlefield Panel ========== */
.battlefield-panel {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.battlefield {
    display: grid;
    gap: 1px;
    background: #000;
    padding: 3px;
    border: 1px solid #00ff00;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.cell {
    background: #0a0e27;
    border: 1px solid #003300;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.cell:hover {
    background: #1a1e37;
    border-color: #00ff00;
}

.cell.player {
    background: rgba(0, 100, 255, 0.3);
    border-color: #0066ff;
}

.cell.enemy {
    background: rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
}

.cell.selected {
    background: rgba(0, 255, 0, 0.3);
    border: 2px solid #00ff00;
    box-shadow: 0 0 10px #00ff00;
}

.cell.valid-placement {
    background: rgba(255, 255, 0, 0.2);
    border: 1px dashed #ffff00;
    cursor: crosshair;
}

.cell.valid-placement:hover {
    background: rgba(255, 255, 0, 0.4);
    border: 2px solid #ffff00;
    box-shadow: 0 0 5px #ffff00;
}

.cell.valid-deployment {
    background: rgba(0, 255, 100, 0.2);
    border: 1px dashed #00ff66;
    cursor: crosshair;
}

.cell.valid-deployment:hover {
    background: rgba(0, 255, 100, 0.4);
    border: 2px solid #00ff66;
    box-shadow: 0 0 5px #00ff66;
}

.cell-content {
    font-size: 1em;
    text-align: center;
    line-height: 1;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

.cell-hp {
    font-size: 0.35em;
    position: absolute;
    bottom: 0px;
    right: 0px;
    color: #ff6600;
    background: rgba(0, 0, 0, 0.8);
    padding: 0px 1px;
    border-radius: 1px;
    line-height: 1;
}

/* ========== Resources Panel ========== */
.resources-panel {
    flex-shrink: 0;
}

.resources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 3px;
}

.resource-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 2px;
    background: rgba(0, 100, 100, 0.2);
    border: 1px solid #00aaff;
    border-radius: 3px;
}

.resource-icon {
    font-size: 1.3em;
    margin-bottom: 2px;
    line-height: 1;
}

.resource-value {
    font-weight: bold;
    color: #00ff00;
    font-size: 0.75em;
    line-height: 1;
}

/* ========== Controls Panel ========== */
.controls-panel {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: center;
    align-items: center;
    padding: 8px;
    flex-shrink: 0;
}

.controls-panel .btn {
    padding: 5px 8px;
    font-size: 0.75em;
    margin: 0;
    white-space: nowrap;
}

.btn-control {
    flex: 1;
    min-width: 0;
}

/* ========== Info Panel ========== */
.info-panel {
    min-height: 150px;
    max-height: 250px;
    display: flex;
    flex-direction: column;
}

.info-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 6px;
    flex-shrink: 0;
}

.info-tab {
    flex: 1;
    padding: 4px 6px;
    background: rgba(0, 100, 100, 0.2);
    border: 1px solid #00aaff;
    color: #00aaff;
    font-family: 'Courier New', monospace;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px 3px 0 0;
}

.info-tab:hover {
    background: rgba(0, 150, 150, 0.3);
}

.info-tab.active {
    background: rgba(0, 170, 255, 0.3);
    border-color: #00ff00;
    color: #00ff00;
    font-weight: bold;
}

.info-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.info-tab-content.active {
    display: flex;
    flex-direction: column;
}

.info-display {
    overflow-y: auto;
    flex: 1;
}

.info-display p {
    margin: 6px 0;
    line-height: 1.4;
    font-size: 0.9em;
}

.hint {
    color: #ffaa00;
    font-size: 0.9em;
}

.buildings-list {
    overflow-y: auto;
    flex: 1;
    margin-bottom: 5px;
}

.building-item {
    background: rgba(100, 50, 0, 0.3);
    border: 1px solid #ff9900;
    padding: 8px;
    margin: 5px 0;
    font-size: 0.9em;
}

.building-name {
    font-weight: bold;
    color: #ffaa00;
}

.building-hp {
    color: #ff6600;
    font-size: 0.8em;
}

.units-list {
    overflow-y: auto;
    flex: 1;
}

/* ========== Tech Tree Panel ========== */
.tech-panel {
    max-height: 300px;
}

.tech-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.tech-item {
    background: rgba(0, 50, 100, 0.3);
    border: 1px solid #00aaff;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.tech-item:hover {
    background: rgba(0, 100, 200, 0.3);
    border-color: #00ff00;
}

.tech-item.researched {
    background: rgba(0, 150, 0, 0.3);
    border-color: #00ff00;
}

.tech-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.tech-name {
    font-weight: bold;
    color: #00aaff;
}

.tech-cost {
    font-size: 0.9em;
    color: #ffaa00;
    margin-top: 5px;
}

.tech-requires {
    font-size: 0.8em;
    color: #888;
    margin-top: 5px;
}

/* ========== Cards Panel ========== */
.cards-panel {
    max-height: 300px;
}

.card-hand {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 5px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.card {
    background: linear-gradient(135deg, #1a1a2e 0%, #2a2a4e 100%);
    border: 2px solid #00aaff;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.card-discard-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border: 1px solid #ff0000;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
    z-index: 10;
}

.card-discard-btn:hover {
    background: rgba(255, 0, 0, 1);
    transform: scale(1.2);
    box-shadow: 0 0 5px #ff0000;
}

.card:hover {
    border-color: #00ff00;
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
    transform: translateX(-5px);
}

.card.selected {
    border-color: #00ff00;
    background: linear-gradient(135deg, #2a2a4e 0%, #3a3a6e 100%);
}

.card-title {
    font-weight: bold;
    color: #00aaff;
    margin-bottom: 5px;
}

.card-type {
    font-size: 0.8em;
    color: #ffaa00;
    margin-bottom: 5px;
}

.card-description {
    font-size: 0.85em;
    color: #aaa;
    margin-bottom: 5px;
}

.card-cost {
    font-size: 0.9em;
    color: #ff6600;
}

/* ========== Build Version ========== */
.build-version {
    padding: 6px 0;
    font-size: 0.75em;
    color: #666;
    text-align: center;
    flex-shrink: 0;
}

.build-version span {
    color: #00aaff;
    font-weight: bold;
}

/* ========== Buttons ========== */
.btn {
    padding: 10px 20px;
    border: 2px solid #00ff00;
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 5px;
}

.btn:hover {
    background: rgba(0, 255, 0, 0.3);
    box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

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

.btn-primary {
    border-color: #00aaff;
    color: #00aaff;
    background: rgba(0, 170, 255, 0.1);
}

.btn-primary:hover {
    background: rgba(0, 170, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.5);
}

.btn-secondary {
    border-color: #ffaa00;
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 170, 0, 0.3);
}

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

/* ========== Modals ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a2e;
    border: 3px solid #00ff00;
    padding: 30px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 5px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    color: #00ff00;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    z-index: 1001;
}

.modal-close:hover {
    color: #ff0000;
    transform: scale(1.2);
    text-shadow: 0 0 10px #ff0000;
}

.modal-content h2 {
    color: #00aaff;
    margin-bottom: 20px;
    text-align: center;
    padding-right: 30px;
}

#buildOptions, #techDetails {
    margin-bottom: 20px;
}

.build-option {
    background: rgba(100, 50, 0, 0.3);
    border: 2px solid #ff9900;
    padding: 15px;
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.2s;
}

.build-option:hover {
    border-color: #00ff00;
    background: rgba(100, 100, 0, 0.3);
}

.build-option.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========== Settings Form ========== */
.settings-form {
    margin: 20px 0;
}

.setting-group {
    margin-bottom: 25px;
    text-align: left;
}

.setting-group label {
    display: block;
    color: #00aaff;
    font-weight: bold;
    margin-bottom: 10px;
}

.setting-group label span {
    color: #00ff00;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #0a0e27;
    outline: none;
    border: 1px solid #00ff00;
}

.slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00ff00;
    cursor: pointer;
    box-shadow: 0 0 10px #00ff00;
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00ff00;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px #00ff00;
}

.setting-hint {
    font-size: 0.85em;
    color: #888;
    margin-top: 5px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    padding: 10px;
    background: rgba(0, 100, 100, 0.2);
    border: 1px solid #00aaff;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-label:hover {
    background: rgba(0, 150, 150, 0.3);
    border-color: #00ff00;
}

.radio-label input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.radio-label span {
    color: #00ff00;
    font-weight: bold;
    margin-right: 5px;
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0e27;
}

::-webkit-scrollbar-thumb {
    background: #00ff00;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00aaff;
}

/* ========== Mobile Responsive ========== */
@media (max-width: 768px) {
    .main-game {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        height: 100vh;
    }

    .battlefield-column {
        min-height: 50vh;
    }

    .sidebar-column {
        max-height: 45vh;
        overflow-y: auto;
    }

    .controls-panel .btn {
        font-size: 0.7em;
        padding: 4px 6px;
    }

    .resources-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 2px;
    }

    .resource-icon {
        font-size: 1em;
    }

    .resource-value {
        font-size: 0.7em;
    }

    .info-panel {
        min-height: 100px;
        max-height: 180px;
    }

    .tech-panel,
    .cards-panel {
        max-height: 200px;
    }

    .title-large {
        font-size: 2.5em;
        letter-spacing: 5px;
    }

    .subtitle-large {
        font-size: 1em;
    }

    .start-content {
        padding: 20px;
        margin: 10px;
    }

    .start-buttons {
        min-width: unset;
        width: 100%;
    }
}