body {
    background-color: black;
}

#planet {
    position: absolute;
    left: 50%;
    top: 200px;
    width: 306px;
    height: 210px;
    overflow: hidden;
    transform: translateX(-50%);
}

#outline {
    position: absolute;
    left: 53px; /* center 200px disc in 306px frame */
    top: 5px;
    text-align: center;
    font-size: 26px;
    color: #000;
    border-radius: 50%;
    border: 1px solid white;
    width: 200px;
    height: 200px;
    overflow: hidden;

    /* axial tilt on the globe disc */
    transform: rotate(-23.5deg);
    transform-origin: center center;
}

/* attempts shading to give a sphere effect */
/* #outline::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 50%;
	pointer-events: none;
	z-index: 5;
	background:
		radial-gradient(circle at 34% 30%,
			rgba(255, 255, 255, 0.06) 0%,
			rgba(255, 255, 255, 0.03) 18%,
			rgba(255, 255, 255, 0.00) 38%),
		radial-gradient(circle at 58% 54%,
			rgba(20, 24, 30, 0.00) 0%,
			rgba(18, 22, 28, 0.06) 42%,
			rgba(12, 15, 20, 0.24) 72%,
			rgba(8, 10, 14, 0.32) 100%),
		radial-gradient(circle at 46% 48%,
			rgba(255, 255, 255, 0.00) 60%,
			rgba(170, 190, 210, 0.06) 78%,
			rgba(190, 210, 230, 0.12) 94%,
			rgba(255, 255, 255, 0.00) 100%);
	box-shadow:
		inset -0.65rem -0.45rem 1.4rem rgba(0, 0, 0, 0.38),
		inset 0.25rem 0.2rem 0.6rem rgba(255, 255, 255, 0.10),
		0 0 0.8rem rgba(170, 195, 220, 0.08);
} */

/* 306×200 equirectangular map: equator is at 50% height (y = 100px).
   Vertical position uses `top`, not transform, so scroll animation stays horizontal. */
#earthCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
}

.left-column {
    position: absolute;
    top: 100px;
    left: 10px;
    width: min(560px, calc(50vw - 190px));
    height: 400px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#pauseIndicator {
    position: absolute;
    left: 7%;
    top: -43px;
    width: 28px;
    height: 32px;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
}

#pauseIndicator.pause-indicator-paused {
    opacity: 0.9;
}

#pauseIndicator.pause-indicator-paused::before,
#pauseIndicator.pause-indicator-paused::after {
    content: "";
    position: absolute;
    top: 0;
    width: 9px;
    height: 100%;
    background: rgba(255, 255, 255, 0.88);
}

#pauseIndicator.pause-indicator-paused::before {
    left: 2px;
}

#pauseIndicator.pause-indicator-paused::after {
    right: 2px;
}

#pauseIndicator.pause-indicator-playing {
    width: 28px;
    height: 32px;
    animation: play-fade 0.75s ease-out forwards;
}

#pauseIndicator.pause-indicator-playing::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 0;
    width: 0;
    height: 0;
    border-top: 16px solid transparent;
    border-bottom: 16px solid transparent;
    border-left: 24px solid rgba(255, 255, 255, 0.88);
}

@keyframes play-fade {
    0% {
        opacity: 0.9;
        transform: translateX(-50%) scale(0.96);
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) scale(1.08);
    }
}

#resources,
#tech {
    flex: 1;
    min-height: 0;
    padding: 5px;
    border: solid 1px white;
    color: white;
    box-sizing: border-box;
}

#resources {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#resources .ledger {
    flex: 1;
}

.resource-modifiers {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid white;
    background: transparent;
    flex: 0 0 33%;
    overflow: visible;
}

.resource-mod-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.resource-mod-item {
    font-family: monospace;
    font-size: 12px;
    white-space: nowrap;
}

.resource-mod-factor {
    position: relative;
    cursor: help;
    text-decoration: underline dotted rgba(255, 255, 255, 0.65);
    text-underline-offset: 2px;
}

.resource-mod-tooltip {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    width: max-content;
    max-width: 260px;
    padding: 0.45rem 0.6rem;
    border: 1px solid white;
    border-radius: 4px;
    background: black;
    color: white;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease 0.35s;
    z-index: 10;
}

.resource-mod-factor:hover .resource-mod-tooltip {
    opacity: 1;
}

.tooltip-food-eaten {
    color: #ffd84d;
}

.tooltip-food-decay {
    color: #ff6464;
}

.resource-mod-separator {
    opacity: 0.7;
}

.disaster-status {
    min-height: 1.2em;
    margin: 0.25rem 0 0.4rem;
    font-family: monospace;
    font-size: 12px;
    color: #d58a4a;
}

#resources .ledger .value.housing-strained {
    color: #d6bf69;
}

#resources .ledger .value.housing-severe {
    color: #d58a4a;
}

#resources .ledger .value.overcrowded {
    color: #ff5555;
}

#tech {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 26px;
}

.innovation-bar {
    flex-shrink: 0;
    height: 22px;
    border: 1px solid white;
    border-radius: 4px;
    background: black;
    overflow: hidden;
}

.innovation-fill {
    height: 100%;
    width: 0%;
    background: white;
    transition: width 0.08s linear;
}

.panel-title {
    flex-shrink: 0;
    min-height: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.2;
    text-align: center;
    color: white;
    opacity: 0.95;
}

.tech-panel-header {
    flex-shrink: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
}

.name-style-toggle {
    padding: 2px 6px;
    border: 1px solid white;
    border-radius: 3px;
    background: black;
    color: white;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.2;
    cursor: pointer;
}

.name-style-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.tech-buttons {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
}

.tech-buttons-hidden {
    display: none;
}

.researched-tech-archive {
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 5px;
    font-family: monospace;
    font-size: 0.72rem;
    overflow: visible;
}

.researched-tech-toggle {
    all: unset;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.52);
    font-size: 0.72rem;
    letter-spacing: 0.03em;
}

.researched-tech-toggle:hover {
    color: rgba(255, 255, 255, 0.75);
}

.researched-tech-groups {
    position: absolute;
    left: 0;
    top: calc(100% + 0.25rem + 3px);
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.researched-tech-group {
    color: rgba(255, 255, 255, 0.34);
    line-height: 1.25;
}

.researched-tech-group-label {
    color: rgba(255, 255, 255, 0.45);
}

.researched-tech-chip {
    position: relative;
    color: rgba(255, 255, 255, 0.30);
    cursor: help;
}

.researched-tech-chip:hover {
    color: rgba(255, 255, 255, 0.78);
}

.researched-tech-chip:hover .tech-btn-tooltip {
    opacity: 1;
}

.researched-tech-tooltip {
    color: white;
}

.researched-tech-separator {
    color: rgba(255, 255, 255, 0.22);
}

.tech-btn {
    position: relative;
    overflow: visible;
    min-height: 3rem;
    padding: 0.45rem 0.75rem 1.15rem;
    background: black;
    color: white;
    border: 1px solid white;
}

.tech-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--propagation, 0%);
    background: white;
    z-index: 0;
    pointer-events: none;
}

.tech-btn-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.75rem;
    pointer-events: none;
    white-space: nowrap;
    font-family: monospace;
    font-size: 12px;
}

.tech-btn-label-empty {
    color: white;
    z-index: 1;
}

.tech-btn-header {
    position: absolute;
    left: 0;
    right: 0;
    top: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    pointer-events: none;
    white-space: nowrap;
    font-family: monospace;
    font-size: 10px;
    text-transform: uppercase;
    opacity: 0.85;
    z-index: 1;
}

.tech-btn-header.tech-btn-label-filled {
    color: black;
    z-index: 2;
    clip-path: inset(0 calc(100% - var(--propagation, 0%)) 0 0);
}

.tech-btn-tooltip {
    position: absolute;
    left: 0;
    top: calc(100% + 0.4rem);
    width: max-content;
    max-width: 260px;
    padding: 0.45rem 0.6rem;
    border: 1px solid white;
    border-radius: 4px;
    background: black;
    color: white;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.3;
    white-space: pre-line;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease 0.35s;
    z-index: 10;
}

.tech-btn:hover .tech-btn-tooltip {
    opacity: 1;
}

.tech-btn-label-filled {
    color: black;
    z-index: 2;
    clip-path: inset(0 calc(100% - var(--propagation, 0%)) 0 0);
}

.tech-btn-finish {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
}

.tech-btn-finish.tech-btn-label-filled {
    color: rgba(0, 0, 0, 0.85);
    z-index: 2;
}
.tech-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
}

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

.tech-btn-active {
    border-color: #64c8ff;
    box-shadow: 0 0 8px rgba(100, 200, 255, 0.5);
}

.tech-btn-paused {
    border-color: #ff6464;
    box-shadow: 0 0 8px rgba(255, 100, 100, 0.5);
}

.sota-choices {
    display: none;
    flex: 1;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-content: start;
}

.sota-choices-visible {
    display: grid;
}

.sota-choice {
    position: relative;
    min-height: 6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 2px solid var(--civic-border);
    background: var(--civic-fill);
    color: var(--civic-text);
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease;
}

.sota-choice:hover {
    background: var(--civic-hover);
    border-color: var(--civic-border);
    transform: none;
    box-shadow: none;
}

.sota-choice:hover .tech-btn-tooltip {
    opacity: 1;
}

.sota-choice-title {
    font-family: monospace;
    font-size: 1.25rem;
    letter-spacing: 0.04em;
}

.sota-choice.mare-nostrum {
    --civic-fill: #5a1715;
    --civic-border: #d2a94a;
    --civic-text: #f3dfac;
    --civic-hover: #6f201c;
}

.sota-choice.tianxia {
    --civic-fill: #090807;
    --civic-border: #a83224;
    --civic-text: #f0d8b0;
    --civic-hover: #120d0b;
}

.sota-selected {
    min-height: 1.2em;
    margin-top: 8px;
    font-family: monospace;
    font-size: 12px;
    color: #9acd32;
    text-align: center;
    opacity: 0.95;
}

#buildings {
    position: absolute;
    padding: 5px;
    top: 100px;
    right: 5px;
    height: 400px;
    width: 300px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: solid 1px white;
    color: white;
}

.alloc-wrap {
    width: calc(100% - 40px);
    margin: 8px 20px;
}

#allocBar {
    color: white;
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    border: 1px solid white;
    border-radius: 6px;
    background: black;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

#allocLabels {
    display: flex;
    width: 100%;
    margin-top: 4px;
    color: white;
    font-family: monospace;
    font-size: 11px;
    opacity: 0.85;
    pointer-events: none;
}

.alloc-label {
    text-align: center;
    flex: 1;
}

.alloc-section {
    position: relative;
    background: var(--alloc-color);
    height: 100%;
    transition: background-color 120ms ease, filter 120ms ease;
}

.alloc-section:hover {
    background: var(--alloc-hover-color);
}

.alloc-tooltip {
    position: absolute;
    left: 0;
    bottom: calc(100% + 6px);
    width: max-content;
    max-width: 260px;
    padding: 0.45rem 0.6rem;
    border: 1px solid white;
    border-radius: 4px;
    background: black;
    color: white;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.3;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease 0.35s;
    z-index: 10;
}

.alloc-section:hover .alloc-tooltip {
    opacity: 1;
}

.divider {
    /* wider hitbox for easier dragging; visible line is centered via ::after */
    width: 10px;
    background: transparent;
    cursor: ew-resize;
    height: 100%;
    position: relative;
}

.divider::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 1px;
    background: white;
    transform: translateX(-50%);
}

.divider.divider-key-selected::after {
    width: 3px;
    background: #228b22;
}
 
#allocBar, #allocBar * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#buildings .build-summary {
    text-align: center;
    font-family: monospace;
    font-size: 12px;
    color: white;
    opacity: 0.9;
    margin-bottom: 8px;
}

#resources .ledger,
#buildings .ledger {
    display: grid;
    column-gap: 12px;
    row-gap: 6px;
    align-items: center;
    font-family: monospace;
    font-size: 12px;
}

#resources .ledger {
    grid-template-columns: 1fr auto auto;
}

#buildings .ledger {
    grid-template-columns: 40px 1fr auto auto;
    background:
        linear-gradient(
            to right,
            rgba(255, 255, 255, 0.1) 0,
            rgba(255, 255, 255, 0.1) 40px,
            rgba(255, 255, 255, 0.3) 40px,
            rgba(255, 255, 255, 0.3) 41px,
            transparent 41px
        );
}

#resources .ledger .label,
#buildings .ledger .label {
    color: white;
    opacity: 0.9;
}

#resources .ledger .value,
#buildings .ledger .value {
    color: white;
    text-align: right;
}

#resources .ledger .rate,
#buildings .ledger .rate {
    color: #9acd32; /* light green for rates */
    text-align: right;
}

#buildings .building-mult {
    color: #9acd32;
    font-weight: normal;
}

#buildings .building-locked {
    display: none;
}

#buildings .sidebar-input {
    width: 100%;
    padding: 4px;
    background: transparent;
    border: none;
    color: white;
    font-family: monospace;
    font-size: 12px;
    text-align: center;
    box-sizing: border-box;
}

#buildings .sidebar-input:focus {
    outline: none;
    background: rgba(154, 205, 50, 0.1);
}

#buildings .sidebar-input::-webkit-outer-spin-button,
#buildings .sidebar-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#buildings .sidebar-input[type=number] {
    -moz-appearance: textfield;
}
