/* The game's palette (FantasyWorld.Client.Palette): ground, card, ink, body, muted. */
:root {
    --ground: #ecebe7;
    --card: #f7f6f3;
    --ink: #1a1a18;
    --body: #4a4842;
    --muted: #66645d;
    --line: #d9d6cf;
    --conflict: #d2382d;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: var(--ground);
    color: var(--body);
    font: 14px/1.45 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

.label {
    position: absolute;
    transform: translate(-50%, -100%);
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--card);
    color: var(--ink);
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
    pointer-events: auto;
    cursor: pointer;
}

.label.realm {
    background: var(--ink);
    color: var(--card);
    padding: 3px 10px 3px 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    letter-spacing: .06em;
}

.label.realm i { width: 6px; height: 18px; border-radius: 2px; display: block; }
.label.realm small { display: block; font-size: 10px; letter-spacing: 0; opacity: .75; text-transform: lowercase; }
.label.army { background: var(--ink); color: var(--card); font-size: 11px; }
.label.news::before { content: "●"; color: var(--conflict); margin-right: 4px; }

#bar {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
    flex-wrap: wrap;
}

.kicker { font: 11px/1.2 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
h1 { margin: 2px 0 0; font-size: 20px; color: var(--ink); font-weight: normal; }
h2 { margin: 4px 0 6px; font-size: 22px; color: var(--ink); font-weight: normal; }
h3 { margin: 16px 0 6px; font: 11px/1.2 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }

.toggle { display: flex; gap: 6px; align-items: center; font: 13px system-ui, sans-serif; color: var(--body); cursor: pointer; }
.toggle input { accent-color: var(--ink); }
.year { display: flex; gap: 10px; align-items: center; font: 13px system-ui, sans-serif; flex: 1 1 220px; max-width: 520px; }
.year input { flex: 1; accent-color: var(--ink); }

#panel {
    position: fixed;
    top: 92px;
    right: 12px;
    bottom: 12px;
    width: min(400px, calc(100% - 24px));
    overflow-y: auto;
    padding: 18px 20px;
    background: var(--card);
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, .16);
}

#close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: none;
    font-size: 24px;
    color: var(--muted);
    cursor: pointer;
}

#panel a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; cursor: pointer; }
#panel a:hover { text-decoration-color: var(--ink); }
#panel ul { list-style: none; margin: 0; padding: 0; }
#panel li { padding: 5px 0; border-bottom: 1px solid var(--line); }
#panel .muted { color: var(--muted); font-size: 13px; }
#panel .tags span { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 999px; background: var(--ground); font-size: 12px; }
#panel .bars div { display: grid; grid-template-columns: 96px 1fr 28px; gap: 8px; align-items: center; font-size: 12px; margin: 3px 0; }
#panel .bars b { height: 6px; border-radius: 3px; background: var(--ink); display: block; }

#loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-content: center;
    text-align: center;
    background: var(--ground);
    transition: opacity .4s;
}

#loading p { font-size: 18px; color: var(--ink); }
#loading.done { opacity: 0; pointer-events: none; }

@media (max-width: 640px) {
    #panel { top: auto; height: 55%; }
    h1 { font-size: 17px; }
}
