/* Settlers III Wiki: classic encyclopedia layout, white theme. */
:root {
  --bg: #ffffff;
  --chrome: #f6f6f6;
  --text: #202122;
  --muted: #54595d;
  --line: #a2a9b1;
  --line-soft: #c8ccd1;
  --head: #eaecf0;
  --link: #0645ad;
  --link-visited: #0b0080;
  --accent: #2f6446;
  --serif: "Linux Libertine", "Georgia", "Times", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 12px); }
body { margin: 0; background: var(--chrome); color: var(--text); font: 15px/1.6 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: #fff; padding: 8px 12px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--chrome); border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand span { font: 22px/1 var(--serif); letter-spacing: .01em; }
.brand b { font-weight: normal; }
.brand small { font: 12px/1 var(--sans); color: var(--muted); letter-spacing: .04em; }
.search { position: relative; margin-left: 24px; width: min(420px, 44vw); }
.search input {
  width: 100%; height: 34px; padding: 0 10px 0 32px; font: inherit; font-size: 14px; color: var(--text);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2372777d' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E") 10px 50% no-repeat;
  border: 1px solid var(--line); border-radius: 2px; outline: none;
}
.search input:focus { border-color: #36c; box-shadow: inset 0 0 0 1px #36c; }
.results {
  position: absolute; top: 38px; left: 0; width: min(520px, 92vw); max-height: 70vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.results a { display: block; padding: 8px 12px; color: var(--text); border-bottom: 1px solid #eaecf0; }
.results a:hover, .results a.sel { background: #eaf3ff; text-decoration: none; }
.results .r-t { font-weight: 600; color: var(--link); }
.results .r-g { font-size: 12px; color: var(--muted); margin-left: 6px; }
.results .r-x { display: block; font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 2px; }
.results mark { background: #fef6e7; color: inherit; font-weight: 600; }
.results .empty { padding: 12px; color: var(--muted); font-size: 14px; }
.menu-btn {
  display: none; place-items: center; width: 36px; height: 36px; flex: none; margin-left: -8px;
  background: none; border: 1px solid transparent; border-radius: 2px; color: var(--muted); cursor: pointer;
}
.menu-btn:hover { border-color: var(--line-soft); }
.theme-btn { display: none; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); max-width: 1320px; margin: 0 auto; }
.sidebar { padding: 18px 10px 40px 20px; font-size: 13.5px; }
.nav-group { margin-bottom: 16px; }
.nav-heading { font-size: 12px; color: var(--muted); padding: 0 0 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 0; }
.sidebar a { display: block; padding: 2px 0; line-height: 1.4; }
.sidebar a.active { color: var(--text); font-weight: 600; }

.content {
  min-width: 0; background: var(--bg); border: 1px solid var(--line-soft); border-right: 0;
  margin-top: -1px; padding: 22px 32px 40px;
}
article { max-width: 960px; }
.toc { display: none; }

/* ---------- article ---------- */
.page-head { margin-bottom: 14px; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
h1, h2 { font-family: var(--serif); font-weight: normal; line-height: 1.25; }
h1 { font-size: 30px; margin: 0 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
h2 { font-size: 23px; margin: 26px 0 8px; padding-bottom: 3px; border-bottom: 1px solid var(--line); }
h3 { font-size: 16.5px; font-weight: 700; margin: 20px 0 4px; }
p, ul, ol { margin: 0 0 12px; }
ul, ol { padding-left: 26px; }
li { margin-bottom: 3px; }
.lede { font-size: 15px; color: var(--text); margin: 10px 0 0; }
.tagline { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
code, kbd {
  font: 13.5px/1.4 ui-monospace, Menlo, Consolas, monospace;
  background: #f8f9fa; border: 1px solid #eaecf0; border-radius: 2px; padding: 1px 4px;
}
hr { border: 0; border-top: 1px solid var(--line-soft); margin: 24px 0; }

.status { display: inline-block; font-size: 12px; padding: 1px 7px; border: 1px solid; border-radius: 2px; vertical-align: middle; margin: 6px 0 0; }
.status-live { color: #14866d; border-color: #14866d; background: #d5fdf4; }
.status-partial { color: #ac6600; border-color: #fc3; background: #fef6e7; }
.status-planned { color: #36c; border-color: #a3bbff; background: #eaf3ff; }

/* contents box */
.contents { display: inline-block; min-width: 220px; background: #f8f9fa; border: 1px solid var(--line); padding: 8px 14px 10px; margin: 6px 0 16px; font-size: 13.5px; }
.contents .c-h { text-align: center; font-weight: 700; margin-bottom: 4px; }
.contents ol { margin: 0; padding-left: 20px; }
.contents li { margin: 1px 0; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; background: #f8f9fa; border: 1px solid var(--line); font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
th { background: var(--head); font-weight: 700; }
td.n, th.n { text-align: right; }

/* message boxes */
.note, .tip, .warn { background: #f8f9fa; border: 1px solid var(--line); border-left: 8px solid #36c; padding: 8px 12px; margin: 0 0 16px; font-size: 14px; }
.tip { border-left-color: #14866d; }
.warn { border-left-color: #d33; background: #fee7e6; }
.note > :last-child, .tip > :last-child, .warn > :last-child { margin-bottom: 0; }
.note b:first-child, .tip b:first-child, .warn b:first-child { margin-right: 4px; }
.note b:first-child::after, .tip b:first-child::after, .warn b:first-child::after { content: "."; }

/* region list boxes */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 0 0 16px; }
.card { display: block; padding: 8px 12px; background: #f8f9fa; border: 1px solid var(--line-soft); color: var(--text); }
a.card:hover { text-decoration: none; border-color: var(--line); background: #eaf3ff; }
.card h3 { margin: 0 0 2px; font-size: 15px; color: var(--link); }
.card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.card .swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; border: 1px solid rgba(0,0,0,.2); }

/* land sections with infobox-style facts */
.land { margin: 0 0 8px; }
.land h2 { border-bottom-color: var(--line); }
.land h2::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; background: var(--land); border: 1px solid rgba(0,0,0,.2); vertical-align: 2px; }
.land dl { display: grid; grid-template-columns: 90px 1fr; margin: 0 0 12px; border: 1px solid var(--line); background: #f8f9fa; font-size: 14px; }
.land dt, .land dd { margin: 0; padding: 5px 9px; border-bottom: 1px solid var(--line-soft); }
.land dt { font-weight: 700; background: var(--head); }
.land dt:last-of-type, .land dd:last-of-type { border-bottom: 0; }

/* meters */
.meter { display: flex; align-items: center; gap: 10px; font-size: 13.5px; margin: 3px 0; max-width: 420px; }
.meter span:first-child { width: 100px; color: var(--muted); }
.bar { flex: 1; height: 9px; background: #eaecf0; border: 1px solid var(--line-soft); }
.bar i { display: block; height: 100%; background: #14866d; }

/* ---------- main page ---------- */
.welcome { border: 1px solid var(--line-soft); background: #f8f9fa; padding: 16px 20px; margin: 0 0 14px; text-align: center; }
.welcome h1 { border: 0; font-size: 28px; margin: 0 0 4px; }
.welcome p { margin: 0; color: var(--muted); font-size: 14px; }
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mp-box { border: 1px solid var(--line-soft); background: #fff; }
.mp-box h2 { margin: 0; padding: 4px 10px; font: 700 15px/1.5 var(--sans); border: 0; border-bottom: 1px solid var(--line-soft); }
.mp-box > div { padding: 8px 12px 4px; font-size: 14px; }
.mp-green { background: #f5fffa; } .mp-green h2 { background: #cef2e0; border-color: #a3bfb1; }
.mp-blue { background: #f5faff; } .mp-blue h2 { background: #cedff2; border-color: #a3b0bf; }
.mp-gold { background: #fffcf5; } .mp-gold h2 { background: #f2e6ce; border-color: #bfb4a3; }
.mp-grey h2 { background: var(--head); }
.mp-box ul { padding-left: 20px; }
.mp-full { grid-column: 1 / -1; }
.quote { font: italic 16px/1.5 var(--serif); border-left: 3px solid var(--line-soft); padding: 2px 0 2px 14px; margin: 4px 0 12px; }

.foot { max-width: 960px; margin-top: 36px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .menu-btn { display: grid; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: var(--top); left: 0; bottom: 0; width: min(270px, 84vw); overflow-y: auto; z-index: 30;
    background: var(--chrome); border-right: 1px solid var(--line-soft); transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: var(--top) 0 0 0; background: rgba(0,0,0,.3); z-index: 25; }
  .content { border-left: 0; padding: 16px 16px 32px; }
  .topbar { padding: 0 16px; gap: 8px; }
  .brand small { display: none; }
  .search { width: auto; flex: 1; margin-left: 4px; }
  .results { position: fixed; top: calc(var(--top) - 4px); left: 8px; right: 8px; width: auto; }
  .mp-grid { grid-template-columns: 1fr; }
  .land dl { grid-template-columns: 1fr; }
  .land dt { border-bottom: 0; }
  .contents { display: block; }
}
@media (max-width: 420px) {
  .brand span { font-size: 19px; }
  .brand img { display: none; }
}

/* ---------- maps ---------- */
.map { margin: 0 0 18px; }
.map-view {
  position: relative; overflow: hidden; height: min(78vh, 900px); min-height: 380px;
  background: #77a8d0; border: 1px solid var(--line); touch-action: none; cursor: grab; user-select: none;
}
.map-view.dragging { cursor: grabbing; }
.map-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.map-base, .map-overlay, .map-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.map-overlay { opacity: .9; }
.map-svg { overflow: visible; }
.map-label {
  font: 700 15px var(--sans); fill: #202122; paint-order: stroke; stroke: rgba(255,255,255,.9); stroke-width: 3.5px;
  stroke-linejoin: round; letter-spacing: .02em;
}
.map-label.hell { fill: #7a1a10; }
.map-icon-bg { fill: rgba(255,255,255,.88); stroke: rgba(0,0,0,.25); stroke-width: .8; }
.map-ctl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-ctl button {
  width: 32px; height: 32px; font: 700 18px/1 var(--sans); color: #202122; background: #fff;
  border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
}
.map-ctl button:hover { background: #eaf3ff; }
.map-coords {
  position: absolute; left: 8px; bottom: 8px; font: 12px/1 ui-monospace, Menlo, monospace; white-space: pre;
  background: rgba(255,255,255,.88); border: 1px solid var(--line-soft); padding: 5px 7px; pointer-events: none;
}
.map-legend, .map-layers { border: 1px solid var(--line); border-top: 0; background: #f8f9fa; padding: 8px 12px; font-size: 13px; }
.lg-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin: 3px 0; }
.lg-row b { width: 76px; }
.lg-row span, .ml-list label { display: inline-flex; align-items: center; gap: 5px; }
.lg-row svg { flex: none; }
.sw { display: inline-block; width: 12px; height: 12px; border: 1px solid rgba(0,0,0,.25); flex: none; }
.ml-group + .ml-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.ml-h { font-weight: 700; }
.ml-h a { font-weight: normal; font-size: 12px; }
.ml-about { color: var(--muted); font-size: 12.5px; margin: 1px 0 5px; }
.ml-list { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.ml-list label { cursor: pointer; }
.map-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 0 0 16px; }
.map-thumbs a { display: block; border: 1px solid var(--line-soft); background: #f8f9fa; font-size: 13.5px; }
.map-thumbs a:hover { border-color: var(--line); background: #eaf3ff; text-decoration: none; }
.map-thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-bottom: 1px solid var(--line-soft); }
.map-thumbs span { display: block; padding: 5px 8px; }
@media (max-width: 860px) {
  .map-view { height: 70vh; margin: 0 -16px; border-left: 0; border-right: 0; }
  .map-legend, .map-layers { margin: 0 -16px; border-left: 0; border-right: 0; }
  .lg-row b { width: 100%; }
}

/* map fixes: visible world edge, gate, hint, full screen */
.map-view { background: #e4e2dc repeating-linear-gradient(45deg, transparent 0 10px, rgba(0,0,0,.035) 10px 20px); touch-action: pan-y; }
.map-view.active { touch-action: none; }
.map-stage { box-shadow: 0 0 0 1px #54595d, 0 0 0 4px rgba(84,89,93,.18); }
.map-gate {
  position: absolute; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 3;
  font: 600 14px var(--sans); color: #fff; background: rgba(32,33,34,.82); border: 0; border-radius: 18px; padding: 9px 16px;
}
.map-gate[hidden] { display: none; }
.map-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 3; pointer-events: none;
  font: 600 14px var(--sans); color: #fff; background: rgba(32,33,34,.8); padding: 10px 16px; border-radius: 4px;
  opacity: 0; transition: opacity .2s; text-align: center; max-width: 80%;
}
.map-hint.on { opacity: 1; }
.map-wrap.map-full { position: fixed; inset: 0; z-index: 100; background: #fff; display: flex; flex-direction: column; }
.map-wrap.map-full .map-view { flex: 1; height: auto !important; margin: 0; border: 0; }
.map-wrap.map-full .map-legend, .map-wrap.map-full .map-layers { margin: 0; max-height: 34vh; overflow: auto; border-left: 0; border-right: 0; }
body.map-open { overflow: hidden; }
@media (max-width: 860px) {
  .mp-box .map-view, .mp-box .map-legend { margin: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  .mp-box > .map { padding: 0; }
}

.map-compare { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0 0 16px; }
.map-compare figure { margin: 0; border: 1px solid var(--line-soft); background: #f8f9fa; }
.map-compare img { display: block; width: 100%; aspect-ratio: 26 / 33; object-fit: contain; background: #dbe9f1; border-bottom: 1px solid var(--line-soft); }
.map-compare figcaption { font-size: 13px; color: var(--muted); padding: 6px 8px; }
@media (max-width: 860px) { .map-compare { grid-template-columns: 1fr; } }

figure.diagram { margin: 4px 0 18px; border: 1px solid var(--line-soft); background: #f7fbfd; max-width: 640px; }
figure.diagram img { display: block; width: 100%; height: auto; }
figure.diagram figcaption { font-size: 13px; color: var(--muted); padding: 6px 10px; border-top: 1px solid var(--line-soft); background: #f8f9fa; }
