/* ghanaciv: a strategy-game skin in Ghana's colours.
   Gold, green and red from the flag; deep indigo-black panels; kente bands as trim. */
:root {
  color-scheme: dark;
  --bg: #12100b;
  --panel: rgba(24, 20, 14, 0.95);
  --panel-solid: #1b1710;
  --panel-2: #262017;
  --panel-3: #322a1d;
  --ink: #f4ecd8;
  --ink-2: #cdbf9d;
  --ink-3: #9b8e70;
  --gold: #e9bd3a;
  --gold-2: #f7d262;
  --gold-dim: #a8842c;
  --line: rgba(233, 189, 58, 0.26);
  --line-soft: rgba(244, 236, 216, 0.1);
  --red: #c8102e;
  --green: #1e8a48;
  --blue: #2c6fbb;
  --good: #62c46e;
  --bad: #e06a48;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.55);
  --display: 'Cinzel', 'Trajan Pro', Georgia, 'Times New Roman', serif;
  --body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --kente: repeating-linear-gradient(90deg, #f2b705 0 16px, #111 16px 19px, #0b7a3e 19px 31px, #111 31px 34px,
    #c8102e 34px 50px, #111 50px 53px, #f2b705 53px 57px, #111 57px 60px, #1b3f8b 60px 72px, #111 72px 75px);
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font: 14px/1.4 var(--body); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--gold-2); text-decoration-color: rgba(247, 210, 98, 0.4); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--gold-2); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
[role="link"] { cursor: pointer; }
.ic { flex: none; vertical-align: -3px; }
kbd { font: 600 11px var(--body); border: 1px solid var(--line-soft); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--ink-2); background: rgba(255,255,255,0.04); }

#map { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#map.pointing { cursor: pointer; }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

/* ---------- top bar ---------- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) 0 max(12px, env(safe-area-inset-left, 0px)); background: linear-gradient(#211b12, #15120c); border-bottom: 1px solid #000;
}
.kente { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0; height: 5px; z-index: 30; background: var(--kente); box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.brand { display: flex; align-items: center; gap: 9px; background: none; border: 0; padding: 4px 6px 4px 0; border-radius: 6px; }
.brand:hover .brand-text b { color: var(--gold-2); }
.brand-emblem {
  width: 34px; height: 34px; border-radius: 50%; flex: none; border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, #ffe27a, #f2b705 55%, #b98600);
  position: relative; box-shadow: 0 0 0 2px #0e0b06, 0 2px 6px rgba(0,0,0,0.6);
}
.brand-emblem::after {
  content: ''; position: absolute; inset: 5px; background: #0e0b06;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.brand-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.brand-text b { font: 700 19px var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink); }
.brand-text i { font: 600 10px var(--body); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold-dim); font-style: normal; margin-top: 3px; }
.spacer { flex: 0 0 0; }

.yields { display: flex; gap: 2px; align-items: center; min-width: 0; overflow: hidden; flex: 1 1 0; height: 40px; flex-wrap: wrap; }
.yield { display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 6px; background: none; border: 1px solid transparent; white-space: nowrap; }
.yield:hover { background: rgba(255,255,255,0.05); border-color: var(--line); }
.yield .yi { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff8e6; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25), 0 1px 3px rgba(0,0,0,0.5); }
.yield b { font: 700 14px var(--body); color: var(--ink); }
.yield b i { font: 500 11px var(--body); color: var(--ink-3); font-style: normal; }      /* the cedi figure beside the dollars */
.yield small { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); display: block; line-height: 1; }
.yield .yt { display: flex; flex-direction: column; line-height: 1.1; align-items: flex-start; }

.search { position: relative; display: flex; align-items: center; flex: 0 1 240px; min-width: 150px; }
.search input {
  width: 100%; height: 32px; padding: 0 30px 0 32px; border-radius: 16px; border: 1px solid var(--line); background: rgba(0,0,0,0.35);
  color: var(--ink); font: 14px var(--body); outline: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(233,189,58,0.15); }
.search-ic { position: absolute; left: 10px; color: var(--ink-3); display: grid; }
.search-kbd { position: absolute; right: 9px; }
.search-results { position: fixed; z-index: 40; max-height: 60vh; overflow: auto; padding: 4px; width: 340px; }
.sr-item { display: flex; gap: 10px; align-items: center; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.sr-item[aria-selected="true"], .sr-item:hover { background: rgba(233,189,58,0.14); }
.sr-item .sr-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff8e6; }
.sr-item b { font-weight: 600; }
.sr-item small { color: var(--ink-3); display: block; line-height: 1.2; }

.turn {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line);
  background: linear-gradient(#2a2216, #1a150d); white-space: nowrap;
}
.turn:hover { border-color: var(--gold); }
.turn .t-date { font: 700 12px var(--display); letter-spacing: 0.1em; color: var(--gold-2); text-transform: uppercase; }
.turn .t-stat { display: flex; flex-direction: column; line-height: 1.05; align-items: flex-start; }
.turn .t-stat small { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.turn .t-stat b { font-size: 13px; }
.up { color: var(--good); } .down { color: var(--bad); }

.tb-buttons { display: flex; gap: 6px; }
.btn {
  height: 34px; padding: 0 11px; border-radius: 6px; border: 1px solid var(--line); background: linear-gradient(#2c2418, #1c170f);
  display: inline-flex; align-items: center; gap: 7px; font: 600 12px var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
.btn:hover, .btn[aria-pressed="true"] { border-color: var(--gold); color: var(--ink); background: linear-gradient(#3a2f1c, #241d12); }
.btn-icon { width: 34px; padding: 0; justify-content: center; font-size: 15px; }
.icon-btn { background: none; border: 0; color: var(--ink-3); width: 30px; height: 30px; border-radius: 6px; font-size: 15px; }
.icon-btn:hover { background: rgba(255,255,255,0.08); color: var(--ink); }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 300px; padding: 9px 11px; border-radius: 7px;
  background: rgba(16, 13, 9, 0.96); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px;
}
.tooltip h4 { margin: 0 0 2px; font: 700 13px var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-2); }
.tooltip .tt-sub { color: var(--ink-3); font-size: 12px; margin-bottom: 5px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 16px; }
.tooltip .tt-row span { color: var(--ink-2); }
.tooltip .tt-row b { font-weight: 600; }
.tooltip .tt-row b small, .card .big small { font-size: 0.72em; font-weight: 500; color: var(--ink-3); }
.tooltip .tt-hint { margin-top: 5px; color: var(--ink-3); font-size: 11px; }
.tooltip .tt-lens { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line-soft); }

/* ---------- lens dock ---------- */
#lens-area { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 20; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: calc(100vw - 176px); pointer-events: none; }
#lens-area > * { pointer-events: auto; }
body.panel-open #lens-area { max-width: calc(100vw - 468px); }
body.dispatch-open .legend, body.dispatch-open .lens-picker, body.dispatch-open .layer-pop { margin-left: 392px; }
.lens-dock { display: flex; gap: 4px; padding: 5px; align-items: center; flex-wrap: wrap; }
.lens-btn {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 6px; border: 1px solid transparent; background: none;
  font: 600 12px var(--body); letter-spacing: 0.04em; color: var(--ink-2); white-space: nowrap;
}
.lens-btn .lb-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff8e6; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.22); }
.lens-btn:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
.lens-btn[aria-pressed="true"] { background: rgba(233,189,58,0.16); border-color: var(--gold); color: var(--ink); }
.lens-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.lens-picker { width: min(760px, calc(100vw - 24px)); max-height: min(620px, calc(100dvh - var(--topbar-h) - 96px)); overflow: auto; padding: 12px 14px 14px; }
.lens-picker h3 { margin: 10px 0 6px; font: 700 11px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.lens-picker h3:first-child { margin-top: 0; }
.lens-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px; }
.lens-grid .lens-btn { width: 100%; justify-content: flex-start; height: 32px; min-width: 0; }
.lens-grid .lens-btn .lb-t { overflow: hidden; text-overflow: ellipsis; }

.legend { padding: 10px 12px 11px; width: 300px; }
.legend h4 { margin: 0; font: 700 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); display: flex; align-items: center; gap: 7px; }
.legend h4 { cursor: pointer; }
.legend.compact p, .legend.compact .lg-top, .legend.compact .lg-src { display: none; }
.legend.compact .lg-bar, .legend.compact .lg-cats { margin-top: 7px; }
.legend p { margin: 4px 0 8px; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }
.legend .lg-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; border: 1px solid rgba(0,0,0,0.5); }
.legend .lg-bar i { flex: 1; cursor: default; }
.legend .lg-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-2); margin-top: 3px; }
.legend .lg-ticks.at { position: relative; display: block; height: 16px; margin-top: 5px; }
.legend .lg-ticks.at span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.legend .lg-ticks.at span::before { content: ''; position: absolute; left: 50%; top: -5px; height: 4px; border-left: 1px solid var(--ink-3); }
.legend .lg-ends { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); }
.lens-btn.off { opacity: 0.55; }
.legend .lg-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 12px; }
.legend .lg-cats span { display: flex; align-items: center; gap: 6px; }
.legend .lg-cats i { width: 11px; height: 11px; border-radius: 2px; flex: none; border: 1px solid rgba(0,0,0,0.4); }
.legend .lg-src { margin-top: 7px; font-size: 11px; color: var(--ink-3); }
.legend .lg-top { margin-top: 8px; font-size: 12px; display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; }
.legend .lg-top .lt-h { grid-column: 1 / -1; color: var(--ink-3); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 4px; }
.legend .lg-top a { cursor: pointer; text-decoration: none; color: var(--ink); }
.legend .lg-top a:hover { color: var(--gold-2); }
.legend .lg-top b { text-align: right; font-weight: 600; color: var(--ink-2); }

.layer-pop { padding: 10px 12px; width: 260px; }
.layer-pop h4 { margin: 0 0 6px; font: 700 12px var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); }
.layer-pop label { display: flex; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; cursor: pointer; }
.layer-pop input { accent-color: var(--gold); }
.layer-pop .note { margin: 6px 0 0; }

/* ---------- zoom and minimap ---------- */
.zoom-ctl { position: fixed; right: 12px; bottom: 132px; z-index: 20; display: flex; flex-direction: column; overflow: hidden; }
.zoom-ctl button { width: 34px; height: 32px; background: none; border: 0; font-size: 18px; color: var(--ink-2); }
.zoom-ctl button:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.zoom-ctl button + button { border-top: 1px solid var(--line-soft); }
#minimap-wrap { position: fixed; right: 12px; bottom: 12px; z-index: 20; padding: 4px; line-height: 0; }
#minimap { width: 128px; height: 108px; border-radius: 4px; cursor: pointer; }

.attrib { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 9px); z-index: 15; font-size: 10.5px; color: rgba(244,236,216,0.82); text-shadow: 0 1px 2px #000; pointer-events: none; white-space: nowrap; background: rgba(16,13,9,0.6); padding: 2px 9px; border-radius: 10px; }
.attrib .short { display: none; }
.attrib button { background: none; border: 0; padding: 0; color: var(--gold-2); font: inherit; text-decoration: underline; pointer-events: auto; }

/* ---------- guided tour ---------- */
.tour { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 45; width: min(560px, calc(100vw - 24px)); padding: 14px 16px 12px; }
.tour::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--kente); border-radius: 8px 8px 0 0; }
/* the Challenge needs the whole country clickable, so its card sits at the right edge, over the neighbours */
.tour.quest { left: auto !important; right: 16px; bottom: auto !important; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 40px); transform: none; width: min(370px, calc(100vw - 32px)); max-width: none !important; }
/* on a phone or a short window the caption sits under the top bar, clear of the dock, the legend and the city sheet */
.tour.at-top { top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 14px); bottom: auto !important; left: 50% !important; width: min(560px, calc(100vw - 16px)); padding: 10px 12px 9px; }
.tour.at-top h3 { font-size: 15px; }
.tour.at-top p { font-size: 13px; margin-bottom: 7px; }
.tour .tr-step { font: 600 10.5px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.tour h3 { margin: 2px 0 4px; font: 700 18px var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.tour p { margin: 0 0 10px; font-size: 14.5px; line-height: 1.45; }
.tour p b { color: var(--gold-2); font-weight: 600; }
.tour .tr-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.tour .tr-dots { flex: 1; display: flex; gap: 5px; }
.tour .tr-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.tour .tr-dots i.on { background: var(--gold); }
.quest-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 12px; }
.quest-choices .btn { height: 40px; justify-content: center; font-size: 13px; text-transform: none; letter-spacing: 0.02em; color: var(--ink); }
.btn.primary { background: linear-gradient(#f2c230, #c9971a); color: #1a1408; border-color: #f7d262; }
.btn.primary:hover { background: linear-gradient(#f8d050, #d9a520); color: #1a1408; }

/* ---------- side panels ---------- */
.side-panel {
  position: fixed; top: calc(var(--topbar-h) + 15px); right: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); z-index: 25;
  overflow: hidden; display: flex; flex-direction: column;
}
.side-panel.left { right: auto; left: 12px; width: min(380px, calc(100vw - 24px)); bottom: 62px; }
.sp-head { padding: 12px 44px 10px 14px; position: relative; border-bottom: 1px solid var(--line-soft); background: linear-gradient(rgba(233,189,58,0.08), transparent); overflow: hidden; }
/* Adinkrahene, the chief of the Adinkra symbols, as a watermark */
.sp-head::after { content: ''; position: absolute; right: -26px; top: -18px; width: 132px; height: 132px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23e9bd3a' stroke-width='1.3'%3E%3Ccircle cx='12' cy='12' r='10.3'/%3E%3Ccircle cx='12' cy='12' r='6.8'/%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat; opacity: 0.09; pointer-events: none; }
.sp-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--kente); opacity: 0.9; }
.sp-head .close { position: absolute; right: 8px; top: 10px; }
.sp-kicker { font: 600 10.5px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); display: flex; gap: 8px; align-items: center; }
.sp-title { margin: 2px 0 0; font: 700 24px/1.1 var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.sp-sub { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.sp-body { overflow: auto; padding: 10px 14px 18px; flex: 1; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.sp-tabs { display: flex; gap: 2px; padding: 6px 10px 0; border-bottom: 1px solid var(--line-soft); }
.sp-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 9px 7px; font: 600 11.5px var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.sp-tab:hover { color: var(--ink); }
.sp-tab[aria-selected="true"] { color: var(--gold-2); border-bottom-color: var(--gold); }

h5.sec { margin: 16px 0 7px; font: 700 11px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); display: flex; align-items: center; gap: 8px; }
h5.sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
h5.sec:first-child { margin-top: 4px; }
.lede { font-size: 14.5px; line-height: 1.45; color: var(--ink); margin: 2px 0 8px; }
.lede b { color: var(--gold-2); font-weight: 600; }
.note { color: var(--ink-3); font-size: 12px; line-height: 1.4; }

.yield-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ycard { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 7px; padding: 7px 8px; display: flex; gap: 8px; align-items: center; min-width: 0; }
.ycard .yi { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff8e6; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }
.ycard b { display: block; font: 700 15px var(--body); line-height: 1.1; }
.ycard small { display: block; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ycard .rank { display: block; font-size: 10.5px; line-height: 1.35; color: var(--ink-3); white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 12.5px; }
.chip .ci { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff8e6; }
.chip small { color: var(--ink-3); }
.district-card { display: flex; gap: 10px; padding: 8px 9px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line-soft); margin-bottom: 6px; align-items: flex-start; }
.district-card .ci { width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; flex: none; color: #fff8e6; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2); }
.district-card b { font: 700 12.5px var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
.district-card p { margin: 1px 0 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.35; }

.bars { display: grid; grid-template-columns: minmax(96px, auto) 1fr auto; gap: 4px 9px; align-items: center; font-size: 12.5px; }
.bars .bl { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bars .bt { height: 10px; background: rgba(255,255,255,0.07); border-radius: 2px; position: relative; }
.bars .bt i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--gold); }
.bars .bt u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; opacity: 0.8; }
.bars .bv { text-align: right; font-weight: 600; white-space: nowrap; }
.bars .bv small { color: var(--ink-3); font-weight: 400; }

.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; height: 74px; align-items: end; margin: 2px 0 4px; }
.months span { display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; height: 100%; }
.months em { display: flex; align-items: flex-end; width: 100%; height: 100%; }      /* the bar area: 100% here is the tallest bar */
.months i { display: block; width: 100%; background: linear-gradient(#72b5d7, #3b84c0); border-radius: 2px 2px 0 0; min-height: 1px; }
.months b { font: 600 9.5px var(--body); color: var(--ink-3); margin-top: 3px; }
.side-panel svg.line { display: block; width: 100%; height: auto; }
.stat-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.stat-table td { padding: 3px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.stat-table td:nth-child(2) { text-align: right; font-weight: 600; white-space: nowrap; padding-left: 8px; }
.stat-table td:nth-child(3) { width: 78px; padding-left: 9px; }
.stat-table td:first-child { color: var(--ink-2); }
.spark { height: 8px; background: rgba(255,255,255,0.07); border-radius: 2px; position: relative; }
.spark i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; }
.spark u { position: absolute; top: -2px; bottom: -2px; width: 2px; background: #fff; opacity: 0.75; }
.cmp { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

.news-item { padding: 8px 0; border-bottom: 1px solid var(--line-soft); display: grid; grid-template-columns: 26px 1fr; gap: 9px; }
.news-item .ni { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; margin-top: 1px; }
.news-item a.nt { color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.3; display: block; cursor: pointer; }
.news-item a.nt:hover { color: var(--gold-2); }
.news-item .nm { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.news-item .nm a { color: var(--ink-2); }
/* the Dispatch timeline: reports per week, a window slider, a play button */
.tl { margin: 2px 0 10px; padding: 8px 9px 7px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 7px; }
.tl-bars { display: flex; align-items: flex-end; gap: 2px; height: 34px; }
.tl-bars i { flex: 1; background: rgba(244, 236, 216, 0.16); border-radius: 1px 1px 0 0; }
.tl-bars i.on { background: var(--gold); }
.tl-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.tl-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--gold); }
.tl-row .btn { height: 26px; padding: 0 8px; font-size: 11px; }
.tl-play { width: 30px; justify-content: center; }
.tl-label { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; background: rgba(255,255,255,0.08); color: var(--ink-2); }
.filter-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 8px; }
.filter-row button { border: 1px solid var(--line-soft); background: none; border-radius: 12px; padding: 2px 9px; font-size: 11.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; }
.filter-row button i { width: 8px; height: 8px; border-radius: 50%; }
.filter-row button[aria-pressed="true"] { border-color: var(--gold); color: var(--ink); background: rgba(233,189,58,0.12); }

/* ---------- modal (Almanac, Advisors, Explorer, Realm) ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(6, 5, 3, 0.62); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(1180px, 100%); height: min(820px, 100%); display: grid; grid-template-columns: 220px 1fr; position: relative; overflow: hidden; }
.modal-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--kente); z-index: 2; }
.modal-card .close { position: absolute; right: 10px; top: 13px; z-index: 3; }
#modal-nav { border-right: 1px solid var(--line-soft); padding: 22px 8px 12px; overflow: auto; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23e9bd3a' stroke-width='1.3' stroke-opacity='0.13'%3E%3Ccircle cx='12' cy='12' r='10.3'/%3E%3Ccircle cx='12' cy='12' r='6.8'/%3E%3Ccircle cx='12' cy='12' r='3.2'/%3E%3C/g%3E%3C/svg%3E") right -60px bottom -60px / 220px no-repeat, rgba(0,0,0,0.2); }
#modal-nav h2 { margin: 0 8px 10px; font: 700 17px var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-2); }
#modal-nav .nav-note { margin: 0 8px 12px; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
#modal-nav button { display: flex; width: 100%; gap: 9px; align-items: center; text-align: left; background: none; border: 0; border-radius: 6px; padding: 7px 8px; color: var(--ink-2); font-size: 13.5px; }
#modal-nav button:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
#modal-nav button[aria-current="page"] { background: rgba(233,189,58,0.15); color: var(--ink); }
#modal-nav button .ni { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff8e6; }
#modal-nav button small { display: block; color: var(--ink-3); font-size: 11px; line-height: 1.1; }
#modal-body { overflow: auto; overflow-x: hidden; min-width: 0; padding: 24px 28px 30px; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
#modal-body h1 { margin: 0 0 4px; font: 700 26px var(--display); letter-spacing: 0.06em; text-transform: uppercase; }
#modal-body h2 { margin: 24px 0 8px; font: 700 13px var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
#modal-body p { max-width: 74ch; line-height: 1.55; color: var(--ink); }
#modal-body p.sub { color: var(--ink-2); margin-top: 0; font-size: 15px; }
.modal-card.wide { grid-template-columns: 1fr; }
.modal-card.wide #modal-nav { display: none; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 8px; padding: 12px 13px; }
.card h3 { margin: 0 0 2px; font: 600 11px var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.card .big { font: 700 24px var(--body); line-height: 1.15; }
.card .big small { font-size: 12px; font-weight: 600; margin-left: 6px; }
.card p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.35; }
.card svg.line { display: block; width: 100%; height: auto; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.rank-list { display: grid; grid-template-columns: 22px 1fr auto; gap: 3px 8px; font-size: 13px; align-items: baseline; }
.rank-list .rk { color: var(--ink-3); text-align: right; font-size: 11.5px; }
.rank-list a { color: var(--ink); text-decoration: none; cursor: pointer; }
.rank-list a:hover { color: var(--gold-2); }
.rank-list b { font-weight: 600; text-align: right; }
.rank-list small { color: var(--ink-3); }
.quote { border-left: 3px solid var(--gold); padding: 6px 0 6px 14px; margin: 10px 0 14px; font-size: 16px; line-height: 1.5; max-width: 70ch; }
.quote b { color: var(--gold-2); }
.src-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table-scroll { overflow-x: auto; }
.src-table th { text-align: left; font: 600 10.5px var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); }
.src-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.src-table td small { color: var(--ink-3); }

/* explorer */
.ex-controls { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: end; margin: 8px 0 12px; }
.ex-controls label { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
select, .ex-controls input {
  height: 32px; border-radius: 6px; border: 1px solid var(--line); background: #15110b; color: var(--ink); font: 13.5px var(--body); padding: 0 8px; max-width: 280px;
}
.ex-grid { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(360px, 1fr); gap: 18px; min-height: 0; }
.ex-table-wrap { overflow: auto; max-height: 560px; border: 1px solid var(--line-soft); border-radius: 8px; }
table.ex { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.ex th { position: sticky; top: 0; background: #241d13; text-align: right; padding: 6px 8px; font: 600 10.5px var(--body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); cursor: pointer; z-index: 1; max-width: 150px; vertical-align: bottom; }
table.ex th:first-child, table.ex td:first-child { text-align: left; }
table.ex th.sorted { color: var(--gold-2); }
table.ex td { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); text-align: right; white-space: nowrap; }
table.ex tr:hover td { background: rgba(233,189,58,0.1); cursor: pointer; }
table.ex td small { color: var(--ink-3); }
.ex-plot { border: 1px solid var(--line-soft); border-radius: 8px; background: #17130d; position: relative; }
.ex-plot canvas { display: block; width: 100%; height: 480px; }
.ex-plot .ex-stat { padding: 7px 10px; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line-soft); }
.dot-legend { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 11px; color: var(--ink-2); padding: 6px 10px; }
.dot-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }

.toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 70; padding: 8px 14px; border-radius: 18px; background: rgba(16,13,9,0.96); border: 1px solid var(--gold); font-size: 13px; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 18px; background: radial-gradient(circle at 50% 40%, #2a2114, #0e0b07 70%); transition: opacity 0.5s; }
#loading.done { opacity: 0; pointer-events: none; }
.loading-star { width: 74px; height: 74px; background: var(--gold); clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); animation: pulse 1.6s ease-in-out infinite; }
.loading-text { font: 700 14px var(--display); letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-2); }
@keyframes pulse { 50% { transform: scale(0.86); opacity: 0.7; } }

/* ---------- small screens ---------- */
@media (max-width: 1700px) { .btn span.bt { display: none; } .btn { padding: 0 9px; } }
@media (max-width: 1280px) { .turn .t-stat:nth-of-type(n+3) { display: none; } }
@media (max-width: 900px) {
  /* tablets: the Challenge card goes across the top, so the country keeps the full width */
  .tour.quest { left: 8px !important; right: 8px; width: auto; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 12px); }
  .yield b i { display: none; }
  .yields .yield:nth-child(n+4) { display: none; }
  .turn { display: none; }
  .modal-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #modal-nav { display: flex; gap: 4px; overflow-x: auto; padding: 14px 44px 6px 8px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  #modal-nav h2, #modal-nav .nav-note, #modal-nav button small { display: none; }
  #modal-nav button { width: auto; white-space: nowrap; }
  .two-col, .ex-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 48px; }
  .yields { display: none; }
  .brand-text { display: none; }
  #topbar { gap: 8px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .search { flex: 1 1 0; min-width: 0; }
  #btn-share, #btn-help { display: none; }
  .tb-buttons { gap: 4px; }
  #topbar .btn { padding: 0; width: 34px; justify-content: center; }
  .search-kbd { display: none; }
  #minimap-wrap, .zoom-ctl { display: none; }
  .attrib { font-size: 9.5px; top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 1px); background: none; padding: 0; z-index: 19; }
  .attrib .full { display: none; }
  .attrib .short { display: inline; }
  #lens-area { bottom: calc(15px + env(safe-area-inset-bottom, 0px)); }
  .tour { bottom: 58px; }
  .tour.quest { left: 8px !important; right: 8px; width: auto; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px) + 12px); padding: 10px 12px 9px; }
  .tour.quest h3 { font-size: 15px; }
  .tour.quest p { font-size: 13px; margin-bottom: 7px; }
  .side-panel, .side-panel.left { left: 0; right: 0; width: auto; bottom: 0; top: 38vh; border-radius: 12px 12px 0 0; }
  .lens-dock .lens-btn .lb-t { display: none; }
  #lens-area, body.panel-open #lens-area { max-width: calc(100vw - 24px); }
  body.dispatch-open .legend, body.dispatch-open .lens-picker, body.dispatch-open .layer-pop { margin-left: 0; }
  .lens-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .side-panel { z-index: 27; }
  #modal-nav { margin-right: 44px; padding-right: 8px; }
  .ex-grid > *, .two-col > * { min-width: 0; }
  .ex-plot canvas { height: 320px; }
  table.ex th:nth-child(2), table.ex td:nth-child(2) { display: none; }
  .legend { width: min(300px, calc(100vw - 24px)); }
  #modal-body { padding: 16px; }
  .modal { padding: 0; }
  .yield-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .loading-star { animation: none; } }
