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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1f2e;
    color: #c0c8d8;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

#gameCanvas {
    flex: 1;
    display: block;
    background: linear-gradient(135deg, #1a1f2e 0%, #252d3d 100%);
}

#end-turn-btn {
    width: 100%;
    padding: 8px;
    background: rgba(58, 74, 42, 0.6);
    border: 1px solid rgba(90, 122, 58, 0.5);
    color: #a8d888;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
}

#end-turn-btn:hover {
    background: rgba(74, 90, 58, 0.7);
    border-color: rgba(122, 154, 90, 0.6);
}

#tech-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: auto;
}

.tech-modal-content {
    background: #1a1f2e;
    border: 2px solid #5a6478;
    border-radius: 8px;
    padding: 20px;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.tech-modal-content h2 {
    color: #8fa3c8;
    margin-bottom: 20px;
    text-align: center;
}

#tech-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.tech-item {
    background: #2a3344;
    border: 2px solid #3a4454;
    border-radius: 4px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tech-item:hover {
    border-color: #5a7a8a;
    background: #3a4454;
    transform: translateY(-2px);
}

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

.tech-item.tech-disabled:hover {
    transform: none;
    background: #2a3344;
    border-color: #3a4454;
}

.tech-name {
    font-size: 14px;
    font-weight: 600;
    color: #a8b8d8;
    margin-bottom: 6px;
}

.tech-cost {
    font-size: 11px;
    color: #7a9ac8;
    margin-bottom: 8px;
}

.tech-desc {
    font-size: 10px;
    color: #8fa3c8;
    line-height: 1.4;
    margin-bottom: 8px;
}

.tech-type {
    font-size: 9px;
    color: #6a8aa8;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    background: rgba(90, 122, 138, 0.2);
    border-radius: 2px;
    display: inline-block;
}

#close-tech-modal {
    width: 100%;
    padding: 10px;
    background: #3a4a5a;
    border: 1px solid #5a6a7a;
    color: #a8b8d8;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

#close-tech-modal:hover {
    background: #4a5a6a;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

#top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(26, 31, 46, 0.92);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(58, 68, 84, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    backdrop-filter: blur(8px);
}

#top-bar h1 {
    font-size: 20px;
    color: #9fafc8;
    font-weight: 500;
    letter-spacing: 1px;
}

#settlement-panel {
    position: absolute;
    right: 240px;
    top: 0px;
    width: 400px;
    max-height: 220px;
    background: rgba(20, 25, 36, 0.98);
    border: 2px solid #4a6a8a;
    border-radius: 0px;
    padding: 15px;
    overflow-y: auto;
    pointer-events: auto;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.start-menu-content {
    text-align: center;
    animation: fadeIn 1s ease-in;
}

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

.game-title {
    font-size: 64px;
    font-weight: 900;
    background: linear-gradient(180deg, #ff8800 0%, #ff4400 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(255, 100, 0, 0.5);
}

.game-subtitle {
    font-size: 18px;
    color: #8fa3c8;
    margin-bottom: 50px;
    letter-spacing: 2px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.menu-btn {
    padding: 15px 50px;
    background: #3a4a5a;
    border: 2px solid #5a6a7a;
    color: #c0d0e8;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    min-width: 250px;
}

.menu-btn:hover {
    background: #4a5a6a;
    border-color: #7a8a9a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(90, 106, 122, 0.4);
}

@keyframes blink-red {
    0%, 100% {
        background: #aa0000;
        border-color: #ff0000;
    }
    50% {
        background: #ff4444;
        border-color: #ff6666;
    }
}

#settlement-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #3a4a5a;
    border: 1px solid #5a6a7a;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#settlement-close-btn:hover {
    background: #4a5a6a;
}

#settlement-title {
    color: #8fa3c8;
    font-size: 18px;
    margin-bottom: 15px;
    padding-right: 40px;
}

#settlement-info {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #3a4454;
}

.settlement-stat {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin: 5px 0;
    color: #a8b8d8;
}

.settlement-stat strong {
    color: #c0d0e8;
}

#settlement-food-rate {
    color: #88cc88;
    font-size: 10px;
    margin-left: 5px;
}

#settlement-buildings {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #3a4454;
}

#settlement-buildings h3,
#settlement-citizens h3 {
    color: #8fa3c8;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

#terminal-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0a0f1e 0%, #0f0a1e 100%);
    z-index: 20001;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.terminal-screen-content {
    text-align: left;
    animation: fadeIn 3s ease-in;
}

.terminal-container {
    background: #0a0f1e;
    border: 2px solid #3a5a8a;
    border-radius: 4px;
    padding: 0;
    max-width: 1700px;
    margin: 0 auto;
    box-shadow: 0 0 20px rgba(58, 90, 138, 0.3);
}

.terminal-header {
    background: #1a2a4a;
    padding: 8px 15px;
    color: #8fa3c8;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    border-bottom: 1px solid #3a5a8a;
}

.terminal-output {
    padding: 15px;
    min-height: 120px;
    max-height: 200px;
    overflow-y: hidden;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.terminal-line {
    color: #8fa3c8;
    margin: 4px 0;
    line-height: 1.6;
}

.terminal-warning {
    color: #ff8800;
}

.terminal-success {
    color: #00ff88;
}

.terminal-error {
    color: #ff4444;
}

.terminal-input-container {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-top: 1px solid #3a5a8a;
    background: #0d1420;
}

.terminal-prompt {
    color: #00ff88;
    font-family: 'Courier New', monospace;
    margin-right: 8px;
    font-size: 14px;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #c0d0e8;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    outline: none;
}

.terminal-send {
    background: #3a4a5a;
    border: 1px solid #5a6a7a;
    color: #c0d0e8;
    padding: 6px 15px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    font-family: 'Courier New', monospace;
}

.terminal-send:hover {
    background: #4a5a6a;
    border-color: #7a8a9a;
}

#resource-count {
    font-size: 10px;
    line-height: 1.3;
}

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

.ecosystem-stat {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin: 4px 0;
    color: #a8b8d8;
}

.ecosystem-stat strong {
    color: #c0d0e8;
}

#ecosystem-info {
    padding: 6px;
    background: rgba(26, 31, 46, 0.4);
    border-radius: 3px;
}

#view-toggle-container {
    position: absolute;
    bottom: 230px;
    right: 20px;
    z-index: 1000;
    pointer-events: auto;
}

#view-toggle-btn {
    padding: 12px;
    background: rgba(26, 31, 46, 0.95);
    border: 2px solid #4a6a8a;
    color: #8fa3c8;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#view-toggle-btn:hover {
    background: rgba(36, 41, 56, 0.95);
    border-color: #6a8aaa;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(106, 138, 170, 0.4);
}

#view-toggle-btn svg {
    fill: #8fa3c8;
    transition: all 0.3s ease;
}

#view-toggle-btn:hover svg {
    fill: #a8c3e8;
}

#view-icon-path {
    transition: d 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.menu-logo {
    margin: 0 auto 30px;
    animation: logoFloat 3s ease-in-out infinite;
}

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

.menu-logo svg {
    filter: drop-shadow(0 0 20px rgba(255, 100, 0, 0.6));
}

#settlement-buildings-list,
#settlement-citizens-list {
    font-size: 10px;
    color: #a8b8d8;
}

#start-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0a0f1e 0%, #1a2a3a 50%, #2a1a2a 100%);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.building-limit-item {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    padding: 3px 6px;
    background: rgba(58, 74, 90, 0.3);
    border-radius: 3px;
}

.building-limit-item.at-limit {
    background: rgba(90, 60, 60, 0.3);
}

.citizen-item {
    margin: 4px 0;
    padding: 4px 6px;
    background: rgba(58, 74, 90, 0.3);
    border-radius: 3px;
}

.citizen-name {
    font-weight: 600;
    color: #b8c8e8;
}

.citizen-details {
    font-size: 9px;
    color: #8fa3c8;
    margin-top: 2px;
}

#settlement-panel::-webkit-scrollbar {
    width: 6px;
}

#settlement-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#settlement-panel::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 3px;
}

#stats {
    display: flex;
    gap: 35px;
    font-size: 12px;
}

#stats span {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.9;
}

#stats strong {
    color: #b8c8e8;
    display: block;
    font-size: 15px;
    margin-top: 2px;
    font-weight: 500;
}

#bottom-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 25, 36, 0.95);
    border-top: 1px solid rgba(58, 68, 84, 0.3);
    height: 220px;
    pointer-events: auto;
    display: flex;
    gap: 0;
    backdrop-filter: blur(10px);
}

#console {
    flex: 1;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    height: 220px;
    overflow-y: auto;
    color: #9fafc8;
    border-right: 1px solid rgba(58, 68, 84, 0.3);
    padding: 12px;
    background: rgba(10, 12, 20, 0.4);
}

#console p {
    margin: 2px 0;
    line-height: 1.4;
}

#console::-webkit-scrollbar {
    width: 6px;
}

#console::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#console::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 3px;
}

#side-panel {
    width: 240px;
    height: 220px;
    overflow-y: auto;
    background: rgba(10, 12, 20, 0.5);
    display: flex;
    flex-direction: column;
}

#side-panel::-webkit-scrollbar {
    width: 6px;
}

#side-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#side-panel::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 3px;
}

.panel-section {
    padding: 10px;
    border-bottom: 1px solid #3a4454;
    font-size: 12px;
}

.panel-section h3 {
    font-size: 11px;
    color: #8fa3c8;
    text-transform: uppercase;
    margin-bottom: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.resource-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin: 3px 0;
    color: #a8b8d8;
}

#buildings-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.building-button {
    flex: 0 0 calc(50% - 2px);
    padding: 6px;
    background: #2a3344;
    border: 1px solid #3a4454;
    color: #a8b8d8;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    pointer-events: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.building-button:hover:not(:disabled) {
    background: #3a4454;
    border-color: #5a6478;
}

.building-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.building-button.active {
    background: #5a7a8a;
    border-color: #8fa3c8;
    box-shadow: inset 0 0 4px rgba(143, 163, 200, 0.3);
}

#research-btn {
    width: 100%;
    padding: 6px;
    background: #2a3a4a;
    border: 1px solid #3a5a6a;
    color: #8fa3c8;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    margin-bottom: 6px;
}

#research-btn:hover:not(:disabled) {
    background: #3a4a5a;
    border-color: #5a7a8a;
}

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

#galaxy-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    pointer-events: auto;
}

.galaxy-modal-content {
    background: #0a0f1e;
    border: 3px solid #3a5a8a;
    border-radius: 8px;
    padding: 30px;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(58, 90, 138, 0.5);
}

.galaxy-modal-content h2 {
    color: #8fa3c8;
    margin-bottom: 25px;
    text-align: center;
    font-size: 24px;
}

#planet-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.planet-item {
    background: linear-gradient(135deg, #1a2a4a 0%, #2a3a5a 100%);
    border: 2px solid #4a6a8a;
    border-radius: 6px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.planet-item:hover {
    border-color: #6a9aca;
    background: linear-gradient(135deg, #2a3a5a 0%, #3a4a6a 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(106, 154, 202, 0.3);
}

.planet-item.planet-conquered {
    border-color: #5a9a5a;
    background: linear-gradient(135deg, #1a3a2a 0%, #2a4a3a 100%);
}

.planet-item.planet-locked {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #3a4a5a;
}

.planet-item.planet-locked:hover {
    transform: none;
    background: linear-gradient(135deg, #1a2a4a 0%, #2a3a5a 100%);
    box-shadow: none;
}

.planet-name {
    font-size: 16px;
    font-weight: 700;
    color: #b8d8f8;
    margin-bottom: 8px;
}

.planet-type {
    font-size: 10px;
    color: #7a9ac8;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 3px 8px;
    background: rgba(90, 122, 138, 0.3);
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 8px;
}

.planet-status {
    font-size: 12px;
    color: #a8b8d8;
    margin-bottom: 8px;
}

.planet-rewards {
    font-size: 11px;
    color: #8fa3c8;
    font-style: italic;
}

#close-galaxy-modal {
    width: 100%;
    padding: 12px;
    background: #3a4a5a;
    border: 2px solid #5a6a7a;
    color: #c0d0e8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s;
}

#close-galaxy-modal:hover {
    background: #4a5a6a;
    border-color: #7a8a9a;
}

#galaxy-map-btn,
#deploy-assault-btn,
#deploy-ranger-btn,
#deploy-tank-btn,
#deploy-hacker-btn {
    width: 100%;
    padding: 6px;
    margin-bottom: 4px;
    background: #2a3a5a;
    border: 1px solid #4a6a8a;
    color: #8d8;
    font-size: 10px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

#galaxy-map-btn:hover,
#deploy-assault-btn:hover,
#deploy-ranger-btn:hover,
#deploy-tank-btn:hover,
#deploy-hacker-btn:hover {
    background: #3a4a6a;
    border-color: #6a8aaa;
}

#buildings-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 220px;
    background: rgba(10, 12, 20, 0.98);
    border-top: 1px solid #3a4454;
    z-index: 1001;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

#buildings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 0 15px 15px 15px;
    overflow-y: auto;
    flex: 1;
    pointer-events: auto;
    max-height: calc(220px - 40px);
}

#buildings-menu h2 {
    text-align: center;
    color: #8fa3c8;
    margin: 5px 0 5px 0;
    font-size: 14px;
}

#buildings-grid::-webkit-scrollbar {
    width: 6px;
}

#buildings-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#buildings-grid::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 3px;
}

.building-card {
    background: linear-gradient(135deg, #2a3344 0%, #1a2334 100%);
    border: 2px solid #3a4454;
    border-radius: 6px;
    padding: 6px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.building-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 4px;
    background: linear-gradient(135deg, #3a4a5a 0%, #2a3a4a 100%);
    border: 2px solid #4a5a6a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.building-card:hover {
    border-color: rgba(90, 122, 138, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(90, 122, 138, 0.2);
}

.building-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
}

.building-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.building-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
}

.building-name {
    font-size: 10px;
    font-weight: 600;
    color: #a8b8d8;
    margin-bottom: 2px;
}

.building-cost {
    font-size: 8px;
    color: #8fa3c8;
    margin-bottom: 3px;
}

.building-desc {
    font-size: 7px;
    color: #7a8a9a;
    line-height: 1.2;
    margin-bottom: 4px;
    min-height: 20px;
    flex: 1;
}

.building-build-btn {
    width: 100%;
    padding: 4px;
    background: #3a5a4a;
    border: 1px solid #5a7a6a;
    color: #a8d888;
    font-size: 9px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    pointer-events: auto;
    margin-top: auto;
}

.building-age-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 170, 0, 0.9);
    color: #1a1f2e;
    font-size: 6px;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 2px;
    text-transform: uppercase;
}

.building-build-btn:hover:not(:disabled) {
    background: #4a6a5a;
    border-color: #7a9a8a;
}

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

#buildings-back-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    padding: 6px 12px;
    background: #3a4a5a;
    border: 1px solid #5a6a7a;
    color: #a8b8d8;
    font-size: 10px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10;
    transition: all 0.2s;
    pointer-events: auto;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

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

#buildings-back-btn:hover {
    background: #4a5a6a;
    border-color: #7a8a9a;
}

#open-buildings-btn {
    width: 100%;
    padding: 8px;
    background: #2a4a5a;
    border: 1px solid #4a6a8a;
    color: #a8b8d8;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    margin-bottom: 6px;
}

#open-buildings-btn:hover {
    background: #3a5a6a;
    border-color: #6a8aaa;
}

#age-display {
    background: rgba(143, 163, 200, 0.15);
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(143, 163, 200, 0.3);
    font-weight: 600;
    color: #a8b8d8;
    text-shadow: none;
}

#galaxy-map-btn {
    background: #3a2a5a;
    border-color: #5a4a8a;
}

#galaxy-map-btn:hover {
    background: #4a3a6a;
    border-color: #7a6aaa;
}

#hacking-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    pointer-events: auto;
}

.hacking-modal-content {
    background: linear-gradient(135deg, #0a1a2a 0%, #1a2a3a 100%);
    border: 3px solid #00ffff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    text-align: center;
}

.hacking-modal-content h2 {
    color: #00ffff;
    margin-bottom: 10px;
    font-size: 20px;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
}

#hack-timer {
    font-size: 16px;
    font-weight: bold;
    color: #ff8800;
    margin-bottom: 10px;
}

#hacking-canvas {
    border: 2px solid #3a5a7a;
    cursor: pointer;
    background: #0a0f1e;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

#complete-hack-btn,
#cancel-hack-btn {
    padding: 10px 20px;
    margin: 5px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

#complete-hack-btn {
    background: #00aa00;
    border: 2px solid #00ff00;
    color: #ffffff;
}

#complete-hack-btn:hover:not(:disabled) {
    background: #00cc00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

#complete-hack-btn:disabled {
    background: #333333;
    border-color: #555555;
    color: #777777;
    cursor: not-allowed;
}

#cancel-hack-btn {
    background: #aa0000;
    border: 2px solid #ff0000;
    color: #ffffff;
}

#cancel-hack-btn:hover {
    background: #cc0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
}

#open-military-btn {
    width: 100%;
    padding: 8px;
    background: #3a2a2a;
    border: 1px solid #6a4a4a;
    color: #ff8888;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
    margin-bottom: 6px;
}

#open-military-btn:hover {
    background: #4a3a3a;
    border-color: #8a6a6a;
}

#military-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 220px;
    background: rgba(20, 10, 10, 0.98);
    border-top: 1px solid #4a3a3a;
    z-index: 1001;
    overflow: visible;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

#military-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 10px 15px 15px 15px;
    overflow-y: auto;
    flex: 1;
    pointer-events: auto;
    max-height: 160px;
    min-height: 160px;
}

#military-grid::-webkit-scrollbar {
    width: 6px;
}

#military-grid::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#military-grid::-webkit-scrollbar-thumb {
    background: #6a4a4a;
    border-radius: 3px;
}

.unit-card {
    background: linear-gradient(135deg, #3a2a2a 0%, #2a1a1a 100%);
    border: 2px solid #4a3a3a;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.unit-card:hover {
    border-color: rgba(122, 90, 90, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(122, 90, 90, 0.2);
}

.unit-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 6px;
    background: linear-gradient(135deg, #4a3a3a 0%, #3a2a2a 100%);
    border: 2px solid #5a4a4a;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.unit-name {
    font-size: 11px;
    font-weight: 600;
    color: #ff8888;
    margin-bottom: 3px;
}

.unit-cost {
    font-size: 9px;
    color: #ffaa66;
    margin-bottom: 4px;
}

.unit-stats {
    font-size: 8px;
    color: #aa8888;
    line-height: 1.3;
    margin-bottom: 6px;
    min-height: 30px;
    flex: 1;
}

.unit-deploy-btn {
    width: 100%;
    padding: 5px;
    background: #4a2a2a;
    border: 1px solid #6a4a4a;
    color: #ff8888;
    font-size: 9px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    pointer-events: auto;
    margin-top: auto;
}

.unit-deploy-btn:hover:not(:disabled) {
    background: #5a3a3a;
    border-color: #8a6a6a;
}

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

#military-back-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    padding: 6px 12px;
    background: #4a3a3a;
    border: 1px solid #6a5a5a;
    color: #ff8888;
    font-size: 10px;
    cursor: pointer;
    border-radius: 4px;
    z-index: 10;
    transition: all 0.2s;
    pointer-events: auto;
}

#military-back-btn:hover {
    background: #5a4a4a;
    border-color: #8a7a7a;
}

.tech-detail-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 450px;
    max-height: 80vh;
    background: linear-gradient(135deg, #1a1f2e 0%, #2a2f3e 100%);
    border: 3px solid #5a6478;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    z-index: 10001;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.tech-detail-panel.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.tech-detail-panel::-webkit-scrollbar {
    width: 8px;
}

.tech-detail-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.tech-detail-panel::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 4px;
}

.tech-detail-header {
    border-bottom: 2px solid #ff8800;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.tech-detail-title {
    font-size: 22px;
    font-weight: 700;
    color: #c0d0e8;
    margin-bottom: 5px;
}

.tech-detail-era {
    font-size: 11px;
    color: #ff8800;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.tech-detail-year {
    font-size: 10px;
    color: #8fa3c8;
    font-style: italic;
    margin-top: 3px;
}

.tech-detail-section {
    margin: 15px 0;
    padding: 12px;
    background: rgba(58, 74, 90, 0.3);
    border-left: 3px solid #5a7a8a;
    border-radius: 4px;
}

.tech-detail-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #8fa3c8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.tech-detail-section-content {
    font-size: 11px;
    line-height: 1.6;
    color: #a8b8d8;
    text-align: justify;
}

.tech-detail-inventor {
    background: rgba(90, 122, 138, 0.2);
    padding: 8px;
    border-radius: 3px;
    font-size: 11px;
    color: #b8c8e8;
    font-style: italic;
    margin: 10px 0;
}

.tech-detail-volcano {
    background: linear-gradient(135deg, rgba(255, 68, 0, 0.1) 0%, rgba(255, 136, 0, 0.1) 100%);
    border-left: 3px solid #ff8800;
}

.tech-detail-choice {
    background: linear-gradient(135deg, rgba(255, 136, 0, 0.2) 0%, rgba(255, 68, 0, 0.2) 100%);
    border: 2px solid #ff8800;
    padding: 12px;
    border-radius: 4px;
    margin-top: 15px;
}

.tech-detail-choice-title {
    font-size: 13px;
    font-weight: 700;
    color: #ff8800;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.tech-detail-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #3a4454;
}

.tech-detail-stat {
    background: rgba(90, 122, 138, 0.2);
    padding: 6px;
    border-radius: 3px;
    text-align: center;
}

.tech-detail-stat-label {
    font-size: 9px;
    color: #7a8a9a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tech-detail-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #88ff88;
    margin-top: 2px;
}

.tech-detail-stat-value.negative {
    color: #ff8888;
}

.tech-detail-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: #3a4a5a;
    border: 1px solid #5a6a7a;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tech-detail-close:hover {
    background: #4a5a6a;
    transform: scale(1.1);
}

.tech-item-enhanced {
    position: relative;
    transition: all 0.3s ease;
}

.tech-item-enhanced:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(90, 122, 138, 0.4);
}

.tech-item-enhanced::after {
    content: '📖';
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s;
}

.tech-item-enhanced:hover::after {
    opacity: 0.6;
}

#resource-display {
    position: relative;
    display: inline-block;
}

#pinned-resources {
    font-size: 10px;
    line-height: 1.3;
    cursor: pointer;
}

.resource-hover-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(20, 25, 36, 0.98);
    border: 2px solid #4a6a8a;
    border-radius: 4px;
    padding: 12px;
    min-width: 400px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 10000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-top: 8px;
}

.resource-hover-panel::-webkit-scrollbar {
    width: 6px;
}

.resource-hover-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.resource-hover-panel::-webkit-scrollbar-thumb {
    background: #5a6478;
    border-radius: 3px;
}

.resource-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.resource-item {
    background: rgba(58, 74, 90, 0.3);
    padding: 8px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.resource-item:hover {
    background: rgba(74, 90, 106, 0.5);
    border-color: #5a7a8a;
}

.resource-item.pinned {
    background: rgba(90, 122, 138, 0.4);
    border-color: #8fa3c8;
}

.resource-name {
    font-size: 9px;
    color: #8fa3c8;
    font-weight: 600;
    margin-bottom: 4px;
}

.resource-amount {
    font-size: 11px;
    color: #c0d0e8;
    font-weight: 500;
}

.resource-symbol {
    font-size: 8px;
    color: #7a8a9a;
    margin-left: 2px;
}

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

.resource-item.disabled:hover {
    background: rgba(58, 74, 90, 0.3);
    border-color: transparent;
}

#view-transition-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    animation: fadeIn 0.3s ease;
}

.view-transition-content {
    background: linear-gradient(135deg, #1a1f2e 0%, #2a2f3e 100%);
    border: 3px solid #5a6478;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-transition-content h2 {
    color: #8fa3c8;
    font-size: 28px;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.view-transition-content p {
    color: #a8b8d8;
    font-size: 14px;
    margin-bottom: 30px;
    line-height: 1.6;
}

.transition-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.transition-btn {
    padding: 12px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.transition-btn.confirm {
    background: linear-gradient(135deg, #4a6a8a 0%, #5a7a9a 100%);
    color: #ffffff;
    border-color: #6a8aaa;
}

.transition-btn.confirm:hover {
    background: linear-gradient(135deg, #5a7a9a 0%, #6a8aaa 100%);
    border-color: #7a9aba;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(90, 122, 170, 0.4);
}

.transition-btn.cancel {
    background: linear-gradient(135deg, #3a3a4a 0%, #4a4a5a 100%);
    color: #c0d0e8;
    border-color: #5a5a6a;
}

.transition-btn.cancel:hover {
    background: linear-gradient(135deg, #4a4a5a 0%, #5a5a6a 100%);
    border-color: #6a6a7a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(90, 90, 106, 0.4);
}

.shipyard-status {
    background: rgba(26, 31, 46, 0.95);
    border: 2px solid #4a6a8a;
    padding: 12px;
    margin: 8px 0;
    border-radius: 4px;
}

.ship-progress-bar {
    width: 100%;
    height: 8px;
    background: #2a3a4a;
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0;
}

.ship-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4488ff 0%, #88aaff 100%);
    transition: width 0.3s ease;
}

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

#clear-building-container {
    position: absolute;
    top: 85px;
    right: 20px;
    z-index: 1000;
    pointer-events: auto;
}

#clear-building-btn {
    padding: 12px;
    background: rgba(138, 31, 31, 0.95);
    border: 2px solid #ff4444;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

#clear-building-btn:hover {
    background: rgba(168, 51, 51, 0.95);
    border-color: #ff6666;
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(255, 68, 68, 0.4);
}