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

body {
    background: #000;
    font-family: 'Courier New', Courier, monospace;
    color: #c0d8f0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

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

#game-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000510;
}

/* ---- SCREENS ---- */
.screen {
    display: none;
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10;
}
.screen.active { display: flex; align-items: center; justify-content: center; }

/* Main Menu */
#screen-menu {
    background: radial-gradient(ellipse at center, #050e1f 0%, #000105 100%);
}
.menu-content { text-align: center; }
.game-title {
    font-size: 3.5rem;
    letter-spacing: 0.3em;
    color: #00aaff;
    text-shadow: 0 0 30px #00aaff, 0 0 60px #0055aa;
    margin-bottom: 0.4em;
}
.game-subtitle {
    font-size: 1rem;
    color: #5a8aaa;
    letter-spacing: 0.15em;
    margin-bottom: 2.5em;
}
.menu-buttons { display: flex; gap: 1.2em; justify-content: center; }

/* Modal boxes */
.modal-box {
    background: rgba(0, 10, 28, 0.97);
    border: 1px solid #1a4a7a;
    border-radius: 6px;
    padding: 2em 2.5em;
    max-width: 620px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 100, 200, 0.25);
}
.modal-wide { max-width: 960px; }

.modal-box h2 {
    color: #00aaff;
    font-size: 1.4rem;
    letter-spacing: 0.15em;
    margin-bottom: 1em;
    border-bottom: 1px solid #1a4a7a;
    padding-bottom: 0.5em;
}

.howto-content h3 { color: #44ccff; margin: 1em 0 0.3em; font-size: 0.95rem; }
.howto-content p, .howto-content li { font-size: 0.85rem; color: #99b8cc; line-height: 1.6; }
.howto-content ul { padding-left: 1.2em; margin-bottom: 0.5em; }
.howto-content strong { color: #c0d8f0; }

/* ---- BUTTONS ---- */
.btn {
    padding: 0.65em 1.6em;
    border: 1px solid #1a6aaa;
    background: rgba(0, 60, 120, 0.5);
    color: #88ccff;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
    background: rgba(0, 100, 200, 0.6);
    border-color: #44aaff;
    color: #fff;
}
.btn:active { background: rgba(0, 60, 120, 0.8); }
.btn-primary {
    border-color: #007aff;
    background: rgba(0, 80, 180, 0.55);
    color: #aaddff;
}
.btn-primary:hover { background: rgba(0, 120, 255, 0.55); color: #fff; }
.btn-secondary { border-color: #334466; color: #6699aa; }
.btn-secondary:hover { border-color: #4477aa; color: #aaccdd; }
.btn-small { padding: 0.3em 0.8em; font-size: 0.78rem; }
.btn-order {
    width: 100%;
    margin-bottom: 0.3em;
    text-align: left;
    padding: 0.35em 0.7em;
}
.btn-order.active {
    background: rgba(0, 200, 100, 0.3);
    border-color: #00ff88;
    color: #00ff88;
}
.btn:disabled { opacity: 0.35; cursor: default; }

/* ---- DEPLOY SCREEN ---- */
#screen-deploy {
    background: transparent;
    align-items: flex-start;
    justify-content: flex-start;
    pointer-events: none;
}
#deploy-sidebar {
    pointer-events: all;
    width: 260px;
    height: 100%;
    background: rgba(0, 8, 22, 0.93);
    border-right: 1px solid #1a3a5a;
    padding: 1.2em 1em;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.7em;
}
#deploy-sidebar h2 { color: #00aaff; font-size: 1rem; letter-spacing: 0.1em; }
#deploy-sidebar h3 { color: #44aacc; font-size: 0.8rem; letter-spacing: 0.08em; margin-top: 0.5em; }
#deploy-objective-text { font-size: 0.78rem; color: #7a9aaa; line-height: 1.5; }
#deploy-resources-display { font-size: 0.85rem; color: #ffd700; }
.deploy-hint {
    pointer-events: none;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: #4a6a7a;
    background: rgba(0,0,0,0.5);
    padding: 0.3em 0.8em;
    border-radius: 3px;
}

.shop-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4em 0.5em;
    border: 1px solid #1a3a5a;
    border-radius: 3px;
    margin-bottom: 0.3em;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}
.shop-item:hover { background: rgba(0,60,120,0.4); }
.shop-item.selected { background: rgba(0,100,200,0.3); border-color: #0088ff; }
.shop-item .cost { color: #ffd700; font-size: 0.75rem; }

.placed-item {
    font-size: 0.76rem;
    color: #6a8a9a;
    padding: 0.15em 0;
}

/* ---- HUD ---- */
#hud { pointer-events: none; }
#hud.hidden { display: none; }

#hud-top {
    pointer-events: all;
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 42px;
    background: rgba(0, 8, 22, 0.88);
    border-bottom: 1px solid #1a3a5a;
    display: flex;
    align-items: center;
    gap: 1.2em;
    padding: 0 1em;
    font-size: 0.78rem;
    z-index: 5;
}
#hud-top > div { color: #88aacc; white-space: nowrap; }
#hud-level { color: #00aaff; font-weight: bold; }
#hud-turn { color: #aaccee; }
#hud-objective { flex: 1; color: #88aacc; overflow: hidden; text-overflow: ellipsis; }
#hud-resources { color: #ffd700; }

#hud-bottom {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: rgba(0, 8, 22, 0.85);
    border-top: 1px solid #1a3a5a;
    padding: 0.4em 1em;
    overflow: hidden;
    z-index: 5;
}
#msg-log {
    font-size: 0.74rem;
    color: #5a8aaa;
    line-height: 1.5;
    display: flex;
    flex-direction: column-reverse;
    height: 100%;
    overflow: hidden;
}
.msg-entry { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-combat { color: #ff8844; }
.msg-info { color: #44aacc; }
.msg-warn { color: #ffaa00; }
.msg-good { color: #44ff88; }

/* ---- UNIT PANEL ---- */
#unit-panel {
    pointer-events: all;
    position: absolute;
    top: 52px;
    left: 10px;
    width: 220px;
    background: rgba(0, 8, 22, 0.93);
    border: 1px solid #1a3a5a;
    border-radius: 4px;
    padding: 0.8em;
    z-index: 5;
}
#unit-panel.hidden { display: none; }
#unit-panel-name {
    color: #00ff88;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.6em;
    letter-spacing: 0.05em;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin-bottom: 0.35em;
    font-size: 0.74rem;
}
.stat-label { width: 52px; color: #5a7a8a; flex-shrink: 0; }
.stat-value { color: #aaccee; }
.bar-bg {
    flex: 1;
    height: 7px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}
.bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.2s;
}
.bar-hull { background: #cc4444; }
.bar-shields { background: #4488ff; }
.bar-energy { background: #44cc88; }
#val-hull, #val-shields, #val-energy { width: 34px; text-align: right; font-size: 0.7rem; color: #6a8a9a; }

#unit-panel-header {
    margin-bottom: 0.5em;
}
#unit-panel-class {
    font-size: 0.72rem;
    color: #4a8a9a;
    letter-spacing: 0.08em;
    margin-bottom: 0.4em;
}
#unit-image-wrap {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin-bottom: 0.5em;
}
#unit-thumb {
    width: 72px;
    height: 72px;
    border: 1px solid #1a4a6a;
    border-radius: 3px;
    object-fit: cover;
}
#btn-expand-image {
    background: rgba(0,40,80,0.7);
    border: 1px solid #1a4a6a;
    color: #4a8aaa;
    font-size: 1rem;
    padding: 0.2em 0.35em;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
}
#btn-expand-image:hover { border-color: #00aaff; color: #00aaff; }

#order-buttons { margin-top: 0.7em; }
#pending-orders-list { margin-top: 0.4em; font-size: 0.72rem; color: #6a9aaa; }
.pending-order { padding: 0.15em 0; border-bottom: 1px solid #0d2a3a; }

/* ---- ENEMY PANEL ---- */
#enemy-panel {
    pointer-events: all;
    position: absolute;
    top: 52px;
    right: 10px;
    width: 200px;
    background: rgba(0, 8, 22, 0.93);
    border: 1px solid #3a1a1a;
    border-radius: 4px;
    padding: 0.8em;
    z-index: 5;
}
#enemy-panel.hidden { display: none; }
#enemy-panel-name {
    color: #ff6644;
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    margin-bottom: 0.15em;
}
#enemy-panel-class {
    font-size: 0.72rem;
    color: #7a4a3a;
    letter-spacing: 0.08em;
    margin-bottom: 0.4em;
}
#enemy-image-wrap {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin-bottom: 0.5em;
}
#enemy-thumb {
    width: 64px;
    height: 64px;
    border: 1px solid #3a1a1a;
    border-radius: 3px;
    object-fit: cover;
}
#btn-expand-enemy-image {
    background: rgba(40,10,10,0.7);
    border: 1px solid #3a1a1a;
    color: #7a4a4a;
    font-size: 1rem;
    padding: 0.2em 0.35em;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
}
#btn-expand-enemy-image:hover { border-color: #ff4444; color: #ff4444; }
#enemy-condition-section { margin-top: 0.3em; }
#enemy-hull-bar-wrap,
#enemy-shield-bar-wrap {
    height: 7px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.2em;
}

/* ---- TECH TREE ---- */
#tech-resources-display { font-size: 0.85rem; color: #ffd700; float: right; }
#tech-tree-grid {
    display: flex;
    gap: 1em;
    margin-bottom: 1em;
}
.tech-branch {
    flex: 1;
    min-width: 0;
}
.tech-branch-title {
    font-size: 0.82rem;
    font-weight: bold;
    text-align: center;
    padding: 0.4em;
    border-radius: 3px;
    margin-bottom: 0.5em;
    letter-spacing: 0.08em;
}
.tech-branch-offense .tech-branch-title { color: #ff8866; border: 1px solid #aa3300; background: rgba(100,20,0,0.3); }
.tech-branch-defense .tech-branch-title { color: #6699ff; border: 1px solid #0033aa; background: rgba(0,20,100,0.3); }
.tech-branch-utility .tech-branch-title { color: #44ff99; border: 1px solid #007a33; background: rgba(0,60,20,0.3); }

.tech-tier {
    border: 1px solid #1a3a5a;
    border-radius: 3px;
    padding: 0.5em;
    margin-bottom: 0.4em;
    font-size: 0.76rem;
    transition: background 0.15s;
    cursor: pointer;
}
.tech-tier:hover:not(.owned):not(.locked) { background: rgba(0,60,120,0.35); }
.tech-tier.owned {
    border-color: #007a33;
    background: rgba(0,40,15,0.4);
    cursor: default;
}
.tech-tier.locked { opacity: 0.45; cursor: default; }
.tech-tier.locked:hover { background: transparent; }
.tech-tier-name { color: #c0d8f0; font-weight: bold; margin-bottom: 0.2em; }
.tech-tier-desc { color: #6a8a9a; line-height: 1.4; margin-bottom: 0.3em; }
.tech-tier-cost { color: #ffd700; }
.tech-tier-owned-badge { color: #44ff88; font-size: 0.7rem; }

/* ---- LEVEL COMPLETE / GAMEOVER ---- */
#lc-rewards { margin: 0.8em 0; font-size: 0.85rem; color: #ffd700; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: #1a4a7a; border-radius: 3px; }
