:root {
    --color-selected: green;
    --color-allies: blue;
    --color-neutral: gray;
    --color-war: red;
    --color-subject: cyan;
    --color-truce: yellow;
    --color-nap: purple;
    --color-ultimatum: orange;
    --color-overlord: cyan;
    --color-guarantee: pink;
    --color-guaranteed: pink;
    --color-confederated: lightgreen;
    --color-internally_allied: darkcyan;
    --color-internal_war: indianred;
    --color-internal_truce: darkkhaki;
    --color-internal_nap: plum;
    --color-internal_ultimatum: coral;

    overflow: hidden;
}

body {
    margin: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

#sidebar {
    width: 200px;
    min-width: 200px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 20px 16px;
    box-sizing: border-box;
    z-index: 2000;
}

#sidebar-title {
    font-family: Arial, sans-serif;
    font-size: 18px;
    font-weight: bold;
    color: #111;
    padding-bottom: 12px;
    border-bottom: 1px solid #ddd;
}

#world-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#world-selector button {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ccc;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    text-align: left;
}

#world-selector button.active {
    border-color: #333;
    background: #333;
    color: white;
}

#timeline-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto; /* push to bottom of sidebar */
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

#timeline-slider {
    width: 100%;
    cursor: pointer;
}

#timeline-label {
    font-family: Arial, sans-serif;
    font-size: 13px;
    color: #333;
}

#current-date {
    font-weight: bold;
    color: #1a1a1a;
}

#main-area {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map-container {
    position: absolute;
    aspect-ratio: 1;
    width: 100vmin;
}

#base-map {
    width: 100%;
    height: auto;
    display: block;
    image-rendering: crisp-edges;
}

#svg-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#external-world-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: none;
}

/* all the ::before tooltip-key rules stay exactly the same */
.allies::before { content: "■ "; color: var(--color-allies); }
.neutral::before { content: "■ "; color: var(--color-neutral); }
.war::before { content: "■ "; color: var(--color-war); }
.subject::before { content: "■ "; color: var(--color-subject); }
.truce::before { content: "■ "; color: var(--color-truce); }
.nap::before { content: "■ "; color: var(--color-nap); }
.ultimatum::before { content: "■ "; color: var(--color-ultimatum); }
.overlord::before { content: "■ "; color: var(--color-overlord); }
.guarantee::before { content: "■ "; color: var(--color-guarantee); }
.guaranteed::before { content: "■ "; color: var(--color-guaranteed); }
.confederated::before { content: "■ "; color: var(--color-confederated); }
.internally_allied::before { content: "■ "; color: var(--color-internally_allied); }
.internal_war::before { content: "■ "; color: var(--color-internal_war); }
.internal_truce::before { content: "■ "; color: var(--color-internal_truce); }
.internal_nap::before { content: "■ "; color: var(--color-internal_nap); }
.internal_ultimatum::before { content: "■ "; color: var(--color-internal_ultimatum); }

#tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    pointer-events: none;
    z-index: 3000;
    max-width: 200px;
}

#tooltip-name {
    margin: 0 0 5px 0;
    font-size: 16px;
    text-transform: capitalize;
    font-weight: bold;
}

.tooltip-key {
    font-weight: bold;
}

#sidebar-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
}

#country-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    overflow-y: auto;
}

#country-panel-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#country-name-header {
    font-size: 17px;
    font-weight: bold;
    color: #111;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
    text-transform: capitalize;
}

.country-stat {
    font-size: 13px;
    color: #333;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.country-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.country-stat-value {
    font-weight: bold;
    color: #111;
}

#country-notes {
    font-size: 12px;
    color: #555;
    font-style: italic;
    border-top: 1px solid #eee;
    padding-top: 8px;
    line-height: 1.5;
}

.country-diplomacy-section .country-stat {
    padding: 6px 0;
    border-bottom: 0.5px solid var(--color-border-tertiary);
}

.country-diplomacy-section-title {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.country-relation-entry {
    font-size: 12px;
    color: #222;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: capitalize;
}

.country-relation-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
