:root {
    --bg-color: #0a0b1e;
    --panel-bg: rgba(255, 255, 255, 0.1);
    --accent-cyan: #00f2ff;
    --accent-purple: #bf00ff;
    --accent-yellow: #fff200;
    --accent-pink: #ff00ea;
    --accent-green: #39ff14;
    --text-main: #ffffff;
    --text-dim: #a0a0c0;
    
    --hull-color: #e0e0f0;
    --engine-color: rgba(0, 242, 255, 0.4);
    --xenon-cyan: #00ffff;
    --ion-glow: 0 0 20px rgba(0, 255, 255, 0.6);
    --living-color: rgba(255, 242, 0, 0.2);
    --industrial-color: rgba(57, 255, 20, 0.2);
    --control-color: rgba(191, 0, 255, 0.2);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at center, #16183a 0%, #0a0b1e 100%);
}

/* Status Bar */
#status-bar {
    height: 80px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 40px;
    gap: 40px;
    z-index: 10;
}

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

.label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.net-value {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-left: 5px;
    text-shadow: 0 0 8px currentColor;
}

.net-value.surplus { color: var(--accent-green); }
.net-value.drain { color: #ff6666; }
.net-value.stable { color: rgba(255, 255, 255, 0.4); }

#view-history-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    line-height: 1;
    filter: drop-shadow(0 0 5px var(--accent-cyan));
    transition: transform 0.2s ease;
}

#view-history-btn:hover {
    transform: scale(1.2);
}

.value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

#deaths-value {
    color: #ff4444;
    text-shadow: 0 0 10px rgba(255, 68, 68, 0.5);
}

.sub-label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
}

.progress-bar-container {
    width: 120px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 5px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    box-shadow: 0 0 10px var(--accent-cyan);
    transition: width 0.5s ease, background 0.5s ease;
}

.progress-bar.morale {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow));
    box-shadow: 0 0 10px var(--accent-green);
}

.progress-bar-container.morale-container,
.progress-bar-container.food-container,
.progress-bar-container.power-container {
    height: 16px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.morale-text-overlay,
.progress-text-overlay {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 4px #000000, 0 0 4px #000000;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 0.5px;
}

.stat-item.morale-stat-item,
.stat-item.food-stat-item,
.stat-item.power-stat-item {
    position: relative;
}

.stat-item.morale-stat-item:hover .custom-tooltip,
.stat-item.food-stat-item:hover .custom-tooltip,
.stat-item.power-stat-item:hover .custom-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.progress-bar.food {
    background: linear-gradient(90deg, #ffd700, #ff9900);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.progress-bar.power {
    background: linear-gradient(90deg, #bf00ff, #7f00ff);
    box-shadow: 0 0 10px rgba(191, 0, 255, 0.5);
}

.custom-tooltip {
    position: absolute;
    top: 55px; /* Positioned below the stat item, which is inside #status-bar */
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: rgba(10, 11, 30, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 8px;
    padding: 10px 12px;
    width: 240px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 10px rgba(0, 242, 255, 0.15);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    line-height: 1.4;
}

.tooltip-header {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-cyan);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
    margin-bottom: 6px;
    letter-spacing: 1px;
}

.tooltip-factor {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.tooltip-factor.positive {
    color: var(--accent-green);
}

.tooltip-factor.negative {
    color: #ff4444;
}

.tooltip-factor.neutral {
    color: var(--text-dim);
}

.tooltip-factor-val {
    font-weight: 700;
}

.progress-bar.xenon {
    background: linear-gradient(90deg, #0088ff, var(--xenon-cyan));
    box-shadow: 0 0 15px var(--xenon-cyan);
    animation: xenon-pulse 2s infinite ease-in-out;
}

@keyframes xenon-pulse {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.8; filter: brightness(1.3); }
}

@keyframes ion-engine-pulse {
    0% { fill: rgba(0, 242, 255, 0.3); stroke: rgba(0, 255, 255, 0.2); }
    50% { fill: rgba(0, 242, 255, 0.6); stroke: rgba(0, 255, 255, 0.8); }
    100% { fill: rgba(0, 242, 255, 0.3); stroke: rgba(0, 255, 255, 0.2); }
}

/* Ship Area */
#ship-area {
    flex: 1;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 20px;
}

#stars-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(1px 1px at 20px 30px, white, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 40px 70px, white, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 50px 160px, white, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 90px 40px, white, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 130px 80px, white, rgba(0,0,0,0));
    background-repeat: repeat;
    background-size: 200px 200px;
    animation: starsMove 100s linear infinite;
}

@keyframes starsMove {
    from { background-position: 0 0; }
    to { background-position: -1000px 0; }
}

#ship-container {
    position: relative;
    width: 90%;
    max-width: 1200px;
    aspect-ratio: 1000 / 400;
    display: flex;
    justify-content: center;
    align-items: center;
}

#ship-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 30px rgba(0, 242, 255, 0.2));
    z-index: 1;
}

#crew-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.ship-hull {
    fill: none;
    stroke: var(--hull-color);
    stroke-width: 3;
    stroke-linejoin: round;
}

.sector {
    transition: fill 0.3s ease;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
}

.engine-room { 
    fill: var(--engine-color); 
    animation: ion-engine-pulse 3s infinite ease-in-out;
    filter: drop-shadow(var(--ion-glow));
}
.fuel-storage { fill: rgba(0, 242, 255, 0.1); }
.power-reactor { 
    fill: rgba(255, 120, 0, 0.2); 
    stroke: rgba(255, 120, 0, 0.4);
}
.living-quarters { fill: var(--living-color); }
.industrial-zone { fill: var(--industrial-color); }
.research-labs { fill: rgba(0, 255, 255, 0.05); }
.education-module { fill: rgba(0, 120, 255, 0.2); stroke: rgba(0, 120, 255, 0.4); }
.bio-dome { 
    fill: rgba(57, 255, 20, 0.3); 
    stroke: rgba(57, 255, 20, 0.5);
    animation: biodome-pulse 4s infinite ease-in-out;
}
.control-center { fill: var(--control-color); }

@keyframes biodome-pulse {
    0%, 100% { fill: rgba(57, 255, 20, 0.3); }
    50% { fill: rgba(57, 255, 20, 0.45); }
}

.sector:hover {
    fill: rgba(255, 255, 255, 0.3);
}

.sector-label {
    fill: var(--text-dim);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    pointer-events: none;
    font-family: 'Orbitron', sans-serif;
}

/* UI Overlay */
#ui-overlay {
    flex: 0 0 350px; 
    width: 100%;
    padding: 10px 15px;
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 0.8fr 1.1fr; /* 5 columns now */
    gap: 10px;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    overflow: hidden;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.directives-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.directive-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.directive-group label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.option-row {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 6px;
}

.opt-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 6px 2px;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.opt-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.opt-btn.active {
    background: var(--accent-cyan);
    color: var(--bg-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}

#run-year-btn {
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 2px;
    transition: transform 0.1s active, box-shadow 0.2s ease;
    width: 100%;
    margin-bottom: 0;
}

#run-year-btn:hover {
    box-shadow: 0 0 20px rgba(191, 0, 255, 0.5);
    filter: brightness(1.1);
}

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

@keyframes can-boost-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 242, 255, 0.2); border: 1px solid rgba(0, 242, 255, 0.3); }
    50% { box-shadow: 0 0 15px rgba(0, 242, 255, 0.6); border: 1px solid rgba(0, 242, 255, 0.8); }
}

.opt-btn.can-boost {
    animation: can-boost-pulse 1.5s infinite ease-in-out;
    color: var(--accent-cyan);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.blocked-shake {
    animation: shake 0.1s 4;
    border: 1px solid #ff4444 !important;
    color: #ff4444 !important;
}

.danger-btn {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.4);
    border-radius: 8px;
    padding: 12px 15px;
    color: #ff4444;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    width: 100%;
}

.danger-btn.small {
    padding: 6px 10px;
    font-size: 0.55rem;
}

.danger-btn:hover {
    background: rgba(255, 0, 0, 0.25);
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

.run-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}

.auto-run-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 10px;
}

.delay-control {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.delay-label {
    font-size: 0.55rem;
    color: var(--text-dim);
}

.auto-label {
    font-size: 0.6rem;
    font-weight: 700;
}

#log-panel {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#log-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    padding-right: 5px;
}

.log-entry {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-entry.system { color: var(--accent-cyan); font-weight: 700; }
.glass-panel.accent-gold {
    border-color: rgba(255, 215, 0, 0.4);
    background: rgba(40, 35, 10, 0.4);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

.glass-panel.accent-gold h3 {
    color: #ffd700;
}

#advisor-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

#advisor-content::-webkit-scrollbar {
    width: 4px;
}
#advisor-content::-webkit-scrollbar-track {
    background: transparent;
}
#advisor-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.advice-text {
    font-size: 0.8rem;
    line-height: 1.5;
    color: #e0e0f0;
}

.advice-item {
    margin-bottom: 12px;
    padding-left: 15px;
    position: relative;
}

.advice-item::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: #ffd700;
    font-size: 0.6rem;
    top: 4px;
}

.advice-warning {
    color: #ff4444;
    font-weight: bold;
}

.advice-danger {
    color: #ff3333;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255, 51, 51, 0.4);
}

.advisor-divider {
    margin: 12px 0 8px 0;
    border-top: 1px dashed rgba(255, 215, 0, 0.25);
    padding-top: 8px;
}

.advisor-disaster-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: #ffd700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.advice-success {
    color: #00ff41;
}
.log-entry.month { color: var(--text-dim); }
.log-entry.event { color: var(--accent-yellow); }
.log-entry.danger { color: var(--accent-pink); }

/* Age Pyramid */
#age-pyramid {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pyramid-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.6rem;
    color: var(--text-dim);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 700;
}

#pyramid-container {
    flex: 1;
    display: flex;
    flex-direction: column-reverse; /* youngest at bottom */
    gap: 1px;
    overflow-y: auto;
    padding-right: 5px;
}

.pyramid-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    height: 10px; /* slightly taller for better visibility */
}

.pyramid-bar-wrapper {
    flex: 1;
    display: flex;
    height: 100%;
}

.pyramid-bar-wrapper.male {
    justify-content: flex-end;
}

.pyramid-bar-wrapper.female {
    justify-content: flex-start;
}

.pyramid-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    position: relative;
    min-width: 1px;
}

.bar-count {
    font-size: 0.55rem;
    color: var(--bg-color); /* Dark text on bright bars for contrast */
    position: absolute;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    font-weight: 800;
    pointer-events: none;
    left: 0;
}

.pyramid-bar.male {
    background: var(--accent-cyan);
}

.pyramid-bar.female {
    background: var(--accent-pink);
}

.pyramid-age-label {
    width: 60px;
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-dim);
    flex-shrink: 0;
    font-family: 'Orbitron', sans-serif;
}
.crew-dot {
    position: absolute;
    width: 5px;
    height: 5px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-cyan);
    transition: all 2s ease-in-out;
    transform: translate(-50%, -50%); /* Center the dot on its coordinates */
}

/* Scrollbar for logs and pyramid */
#log-content::-webkit-scrollbar,
#pyramid-container::-webkit-scrollbar {
    width: 4px;
}
#log-content::-webkit-scrollbar-track,
#pyramid-container::-webkit-scrollbar-track {
    background: transparent;
}
#log-content::-webkit-scrollbar-thumb,
#pyramid-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.hidden {
    display: none !important;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 80%;
    max-width: 900px;
    height: 500px;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#close-history-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
}

#close-history-btn:hover {
    color: var(--accent-pink);
}

/* Chart */
#chart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    position: relative;
}

#history-svg {
    flex: 1;
    width: 100%;
    overflow: visible;
}

.grid-line {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
    stroke-dasharray: 5,5;
}

.grid-label {
    fill: var(--text-dim);
    font-size: 12px;
}

.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: d 0.3s ease;
}

.chart-line.crew { stroke: var(--accent-cyan); stroke-width: 4; filter: drop-shadow(0 0 5px var(--accent-cyan)); }
.chart-line.food { stroke: var(--accent-yellow); opacity: 0.8; }
.chart-line.power { stroke: var(--accent-purple); opacity: 0.8; }
.chart-line.morale { stroke: var(--accent-green); opacity: 0.8; }
.chart-line.integrity-engines { stroke: #ff4d00; opacity: 0.6; stroke-dasharray: 4,2; }
.chart-line.integrity-power { stroke: #0062ff; opacity: 0.6; stroke-dasharray: 4,2; }
.chart-line.integrity-lifeSupport { stroke: #00ff88; opacity: 0.6; stroke-dasharray: 4,2; }

.chart-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 700;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.crew { background: var(--accent-cyan); box-shadow: 0 0 5px var(--accent-cyan); }
.dot.food { background: var(--accent-yellow); }
.dot.power { background: var(--accent-purple); }
.dot.morale { background: var(--accent-green); }
.dot.integrity-engines { background: #ff4d00; }
.dot.integrity-power { background: #0062ff; }
.dot.integrity-lifeSupport { background: #00ff88; }

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 700;
}

/* Engine Animations */
.thruster-nozzle {
    animation: engine-flicker 0.2s infinite alternate;
}

@keyframes engine-flicker {
    from { opacity: 0.6; filter: drop-shadow(0 0 5px #00f3ff); }
    to { opacity: 1; filter: drop-shadow(0 0 15px #00f3ff); }
}

.ship-hull {
    stroke-width: 2px;
}

/* Biometric Cohorts */
.biometric-cohorts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 8px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cohort-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.cohort-label {
    font-size: 0.55rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    margin-bottom: 1px;
}

.cohort-value {
    font-family: var(--font-accent);
    font-size: 1rem;
    color: var(--cyan);
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

.pyramid-row {
    height: 9px;
}


.hydroponics-bay {
    fill: rgba(46, 204, 113, 0.2);
    stroke: rgba(46, 204, 113, 0.5);
}


/* Pyramid Details Box */
.details-box {
    position: absolute;
    bottom: 40px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid var(--cyan);
    padding: 10px;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.2s;
}

.details-box.hidden {
    display: none;
}

.details-header {
    font-size: 0.7rem;
    color: var(--cyan);
    font-weight: bold;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0, 243, 255, 0.3);
    padding-bottom: 4px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.pyramid-row:hover {
    background: rgba(0, 243, 255, 0.1);
    transform: scaleX(1.02);
    cursor: crosshair;
}

#jhi-brand-footer {
    width: 100%;
    height: 30px;
    background: #000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    color: var(--text-dim);
    letter-spacing: 1px;
    flex-shrink: 0;
}

.version-tag {
    color: var(--accent-cyan);
    font-weight: bold;
}

/* Pause Control & Slider */
#autorun-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pause-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-left: 10px;
    min-width: 120px;
}

.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

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

/* Toggle Switch Styles */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-purple);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Mission Report Modal */
.report-content {
    max-width: 1000px;
    height: auto;
    max-height: 90vh;
    padding: 40px;
}

.report-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    color: var(--accent-cyan);
    letter-spacing: 4px;
    text-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}

.report-body {
    display: flex;
    flex-direction: column;
    gap: 30px;
    overflow-y: auto;
    padding-right: 10px;
}

.mission-status {
    text-align: center;
}

.status-badge {
    display: inline-block;
    padding: 10px 30px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 2px;
    margin-bottom: 15px;
}

.status-badge.success {
    background: rgba(57, 255, 20, 0.2);
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
}

.status-badge.failed {
    background: rgba(255, 0, 0, 0.2);
    color: #ff4444;
    border: 2px solid #ff4444;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.box-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    font-weight: 700;
    letter-spacing: 1px;
}

.box-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    color: var(--accent-cyan);
}

.danger-box {
    border-color: rgba(255, 68, 68, 0.3);
    background: rgba(255, 0, 0, 0.05);
}

.danger-box .box-value {
    color: #ff4444;
    text-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
}

.report-chart-container {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.report-chart-container h3 {
    margin-bottom: 20px;
    text-align: center;
}

#report-chart-box {
    height: 300px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
}

/* Battery Visuals */
.battery-segment {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 0.5;
    transition: all 0.3s ease;
}

.battery-segment.active {
    fill: var(--accent-cyan);
    filter: drop-shadow(0 0 5px var(--accent-cyan));
    stroke: var(--accent-cyan);
}

.battery-segment.danger {
    fill: #ff4444;
    filter: drop-shadow(0 0 8px #ff4444);
    stroke: #ff4444;
    animation: battery-danger-pulse 1s infinite alternate;
}

@keyframes battery-danger-pulse {
    from { opacity: 0.4; }
    to { opacity: 1; }
}

/* Food Reserve Visuals */
.food-segment {
    fill: rgba(255, 255, 255, 0.05);
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 0.5;
    transition: all 0.3s ease;
}

.food-segment.active {
    fill: #2ecc71; /* Emerald Green */
    filter: drop-shadow(0 0 5px #2ecc71);
    stroke: #2ecc71;
}

.food-segment.danger {
    fill: #e67e22; /* Carrot Orange */
    filter: drop-shadow(0 0 8px #e67e22);
    stroke: #e67e22;
    animation: battery-danger-pulse 1s infinite alternate;
}

/* =============================================
   XENON FUEL VISUAL (in ship fuel sector)
   ============================================= */
.xenon-segment {
    fill: rgba(0, 243, 255, 0.06);
    stroke: rgba(0, 243, 255, 0.15);
    stroke-width: 0.5;
    transition: all 0.4s ease;
}

.xenon-segment.active {
    fill: rgba(0, 220, 255, 0.55);
    filter: drop-shadow(0 0 4px rgba(0, 243, 255, 0.8));
    stroke: rgba(0, 243, 255, 0.9);
    animation: xenon-pulse 2s infinite ease-in-out;
}

.xenon-segment.danger {
    fill: rgba(255, 80, 80, 0.7);
    filter: drop-shadow(0 0 6px #ff4444);
    stroke: #ff4444;
    animation: battery-danger-pulse 1s infinite alternate;
}

/* =============================================
   PLANET ORBIT CONTAINERS
   ============================================= */
.planet-container {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    width: 320px;
    height: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 2.5s ease-in;
    z-index: 5;
    pointer-events: none;
}

/* Earth departure animation — slides left as ship launches */
#earth-container.earth-departing {
    transform: translateY(-50%) translateX(-120vw);
    opacity: 0 !important;
    transition: transform 3s cubic-bezier(0.2, 0, 0.8, 1), opacity 2s ease-in !important;
}

/* The dashed orbit ring */
#earth-orbit-ring,
#alphacentauri-orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

#earth-orbit-ring {
    width: 260px;
    height: 260px;
}

#alphacentauri-orbit-ring {
    width: 110px;
    height: 110px;
}

/* Earth planet */
#earth-planet {
    position: absolute;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #7ec8ff, #1a5fa8 55%, #0a2040 100%);
    box-shadow: 0 0 50px rgba(80, 160, 255, 0.5), 0 0 20px rgba(80, 160, 255, 0.3), inset 0 0 20px rgba(0, 0, 0, 0.5);
    will-change: transform;
}

.earth-surface {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse 42% 20% at 58% 38%, rgba(57, 180, 80, 0.95), transparent),
        radial-gradient(ellipse 28% 16% at 28% 58%, rgba(57, 180, 80, 0.85), transparent),
        radial-gradient(ellipse 18% 14% at 72% 65%, rgba(57, 180, 80, 0.7), transparent),
        radial-gradient(ellipse 12% 10% at 45% 72%, rgba(57, 170, 70, 0.6), transparent),
        radial-gradient(ellipse 30% 10% at 50% 20%, rgba(200, 240, 255, 0.3), transparent);
    border-radius: 50%;
}

/* Alpha Centauri planet */
#alphacentauri-planet {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f9a855, #d4601a 55%, #5c1e05 100%);
    box-shadow: 0 0 22px rgba(255, 140, 50, 0.7), inset 0 0 10px rgba(0, 0, 0, 0.5);
    will-change: transform;
}

.ac-surface {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse 60% 8% at 50% 35%, rgba(255, 255, 180, 0.3), transparent),
        radial-gradient(ellipse 70% 8% at 50% 55%, rgba(180, 80, 20, 0.4), transparent);
}

/* =============================================
   CHART TABS
   ============================================= */
.chart-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 16px;
    color: var(--text-dim);
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.chart-tab:hover {
    color: var(--text-main);
    border-color: rgba(0, 242, 255, 0.4);
}

.chart-tab.active {
    background: rgba(0, 242, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

#chart-lines-view,
#chart-bars-view {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#bars-scroll-container {
    flex: 1;
    overflow-x: auto;
    min-height: 280px;
}

#births-deaths-svg {
    width: 100%;
    height: 100%;
    min-height: 260px;
}

.dot.births-dot { background: rgba(57, 255, 100, 0.9); box-shadow: 0 0 5px rgba(57, 255, 100, 0.7); }
.dot.deaths-dot { background: rgba(255, 68, 68, 0.9); box-shadow: 0 0 5px rgba(255, 68, 68, 0.7); }

/* Morale net display (same styling as food/power net) */
#morale-net {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0;
    margin-left: 5px;
    text-shadow: 0 0 8px currentColor;
}

#countdown-overlay {
    margin-top: 10px;
    padding: 8px;
    background: rgba(0, 242, 255, 0.1);
    border: 1px solid rgba(0, 242, 255, 0.3);
    border-radius: 8px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    color: var(--accent-cyan);
    text-align: center;
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
    box-shadow: inset 0 0 10px rgba(0, 242, 255, 0.1);
    animation: countdown-pulse 1.5s infinite alternate;
}

@keyframes countdown-pulse {
    from { opacity: 0.8; }
    to { opacity: 1; }
}

/* ==========================================
   JUPITER HEAVY SPACE SPLASH SCREEN
   ========================================== */
body.jhs-splash-active #game-container {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#game-container {
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.jhs-splash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #080705;
  background: radial-gradient(circle at center, rgba(235, 175, 55, 0.12) 0%, rgba(8, 7, 5, 0.98) 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 1;
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  user-select: none;
  font-family: 'Orbitron', 'Share Tech Mono', 'Outfit', monospace, sans-serif;
}

.jhs-splash-overlay.jhs-fade-out {
  opacity: 0;
  pointer-events: none;
}

.jhs-splash-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  animation: jhsSplashPulse 2.5s ease-in-out infinite alternate;
}

.jhs-splash-logo-box {
  width: 210px;
  height: 210px;
  background: #040403;
  border: 1px solid rgba(235, 175, 55, 0.65);
  box-shadow: 0 0 35px rgba(235, 175, 55, 0.35), inset 0 0 25px rgba(235, 175, 55, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  border-radius: 4px;
  overflow: hidden;
  padding: 12px;
  box-sizing: border-box;
}

.jhs-splash-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(235, 175, 55, 0.6));
}

.jhs-splash-title {
  font-family: 'Orbitron', monospace, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #ebaf37;
  letter-spacing: 6px;
  margin-bottom: 8px;
  text-shadow: 0 0 14px rgba(235, 175, 55, 0.55);
  text-transform: uppercase;
}

.jhs-splash-subtitle {
  font-family: 'Share Tech Mono', 'Orbitron', monospace, sans-serif;
  font-size: 11px;
  font-weight: 400;
  color: #a89050;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(235, 175, 55, 0.3);
}

.jhs-splash-skip-hint {
  margin-top: 32px;
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(235, 175, 55, 0.4);
  text-transform: uppercase;
  animation: jhsBlink 1.5s infinite;
}

@keyframes jhsSplashPulse {
  0% { transform: scale(0.98); opacity: 0.95; }
  100% { transform: scale(1.02); opacity: 1; }
}

@keyframes jhsBlink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.65; }
}


