/* Scapewatch Atlas: shared look. Palette from the game's own "Modern" theme (Theme.js: slate panels, blue
   accent), so the site reads like the game it documents; Chakra Petch is the game's UI typeface. */
:root {
  --bg: #141418; --bg2: #1a1a1e; --panel: #222228; --cell: #2a2a32; --hover: #363640;
  --border: #3a3a48; --border2: #52526a;
  --ink: #e8e8ec; --text: #cccccc; --dim: #9a9aa4; --faint: #6e6e7a;
  --accent: #8ab4f8; --accent2: #6d9ce8; --on-accent: #0e1420;
  --good: #3aa890; --bad: #e0656d; --warn: #e0b050;
  /* Map groups: game theme's progress teal and damage red, plus an amber and a violet */
  --g-tasks: #e0b050; --g-actions: #3aa890; --g-combat: #e0656d; --g-items: #a98bf0; --g-other: #9a9aa4;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --radius: 4px;
  --font-ui: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #e6e6ec; --bg2: #eeeef3; --panel: #f7f7fa; --cell: #ffffff; --hover: #e8e8f0;
  --border: #c9c9d6; --border2: #a0a0b0;
  --ink: #16161c; --text: #2a2a32; --dim: #55555f; --faint: #7a7a88;
  --accent: #2f5fb0; --accent2: #4070c0; --on-accent: #ffffff;
  --good: #1f7a66; --bad: #b8323c; --warn: #8a6100;
  --g-tasks: #8a6100; --g-actions: #1f7a66; --g-combat: #b8323c; --g-items: #6a45b0; --g-other: #5f5f6a;
  --shadow: 0 1px 2px rgba(20,20,40,.06), 0 6px 18px rgba(20,20,40,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #e6e6ec; --bg2: #eeeef3; --panel: #f7f7fa; --cell: #ffffff; --hover: #e8e8f0;
    --border: #c9c9d6; --border2: #a0a0b0;
    --ink: #16161c; --text: #2a2a32; --dim: #55555f; --faint: #7a7a88;
    --accent: #2f5fb0; --accent2: #4070c0; --on-accent: #ffffff;
    --good: #1f7a66; --bad: #b8323c; --warn: #8a6100;
    --g-tasks: #8a6100; --g-actions: #1f7a66; --g-combat: #b8323c; --g-items: #6a45b0; --g-other: #5f5f6a;
    --shadow: 0 1px 2px rgba(20,20,40,.06), 0 6px 18px rgba(20,20,40,.06);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3, h4, .ui { font-family: var(--font-ui); color: var(--ink); letter-spacing: .01em; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.1; margin: 0 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.02rem; margin: 1.2em 0 .4em; }
p { margin: .5em 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
code, .mono { font-family: var(--font-mono); font-size: .9em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Top bar ── */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 4px 18px; padding: 8px 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font: 700 1.05rem var(--font-ui); letter-spacing: .02em; padding: 4px 0; }
.brand svg { width: 26px; height: 26px; }
.brand small { font-weight: 500; color: var(--dim); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; gap: 2px; margin-right: auto; }
.nav > a, .menu-btn { font: 600 .92rem var(--font-ui); color: var(--dim); text-decoration: none; padding: 8px 12px; border-radius: 3px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer; }
.nav > a:hover, .menu-btn:hover, .menu-btn[aria-expanded="true"] { color: var(--ink); background: var(--hover); }
.nav > a[aria-current="page"], .menu-btn[aria-current="page"] { color: var(--ink); }
.menu-btn .caret { width: 12px; height: 12px; transition: transform .15s; }
.menu-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.ext { width: 12px; height: 12px; opacity: .7; vertical-align: -1px; margin-left: 4px; }
.menu { position: relative; }
.menu-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; display: flex; flex-wrap: wrap; width: max-content; max-width: calc(100vw - 32px); gap: 8px; padding: 14px; background: var(--panel); border: 1px solid var(--border2); border-radius: 4px; box-shadow: 0 12px 32px rgb(0 0 0 / .28); }
.menu-panel[hidden] { display: none; }
/* Bridges the gap under the button so hover doesn't drop on the way down */
.menu-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }
.menu-col { display: grid; align-content: start; width: 320px; }
.menu-head:empty { min-height: 1.15em; }
.menu-head { margin: 0 10px 6px; font: 600 .74rem var(--font-ui); color: var(--faint); }
.menu-panel a, .menu-item { display: grid; grid-template-columns: 18px 1fr; column-gap: 10px; row-gap: 1px; align-content: center; height: 54px; padding: 0 10px; border-radius: 3px; text-decoration: none; color: var(--text); background: none; border: 0; text-align: left; font: inherit; cursor: pointer; }
.menu-panel a:hover, .menu-item:hover { background: var(--hover); }
.menu-panel b { font: 600 .9rem var(--font-ui); color: var(--ink); grid-column: 2; }
.menu-panel a > span, .menu-item > span { grid-column: 2; }
.mi { grid-row: 1 / span 2; width: 18px; height: 18px; margin-top: 1px; fill: none; stroke: var(--dim); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.menu-panel a:hover .mi, .menu-item:hover .mi { stroke: var(--ink); }
.menu-panel span { font-size: .8rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .menu-panel { left: auto; right: 0; }
.menu-small .menu-col { width: 240px; }
.menu-panel .link-head { margin-top: 10px; }
.menu-panel .link-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 10px; }
.menu-panel .link-row b { flex: 1; }
.menu-panel .link-row span { flex: none; }
.link-row button, .link-mail button { min-height: 30px; padding: 0 12px; border: 1px solid var(--border2); border-radius: 3px; background: var(--cell); color: var(--ink); font: 600 .8rem var(--font-ui); cursor: pointer; }
.link-row button:hover, .link-mail button:hover { border-color: var(--accent); }
.link-row button:disabled, .link-mail button:disabled { opacity: .6; cursor: default; }
.link-mail { display: flex; gap: 6px; padding: 4px 10px 0; }
.link-mail[hidden] { display: none; }
.link-mail input { flex: 1; min-width: 0; min-height: 30px; padding: 4px 8px; font-size: .84rem; }
.menu-panel .link-note, .menu-panel .link-msg { margin: 0; padding: 4px 10px 6px; font-size: .8rem; color: var(--dim); }
.menu-panel .link-msg:empty { display: none; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 3px; min-width: 40px; min-height: 40px; color: var(--dim); cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle svg { width: 20px; height: 20px; }
.theme-btn { background: transparent; border: 1px solid var(--border); border-radius: 3px; min-width: 40px; min-height: 40px; cursor: pointer; color: var(--dim); display: inline-flex; align-items: center; justify-content: center; }
.theme-btn:hover { color: var(--ink); border-color: var(--border2); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn.theme-row { display: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.wide { width: 100%; }
@media (max-width: 760px) {
  .topbar .in { gap: 6px; padding: 8px 12px; flex-wrap: wrap; }
  .brand { gap: 7px; font-size: .98rem; }
  .account .btn { padding: 6px 10px; }
  .nav-toggle { display: inline-flex; order: -1; }
  .brand { margin-right: auto; }
  .nav { display: none; order: 5; width: 100%; flex-direction: column; margin: 0; padding: 6px 0 4px; }
  .topbar.open .nav { display: flex; max-height: calc(100dvh - 64px); overflow-y: auto; }
  /* On phones the menus are always open, one list under the bar */
  .nav .menu-btn { display: none; }
  .nav .menu-head:empty { display: none; }
  .nav > .nav-link { padding: 8px 10px; }
  .nav .menu-panel, .nav .menu-panel[hidden] { display: grid; position: static; box-shadow: none; border: 0; padding: 0; background: none; }
  .nav .menu-col { width: auto; padding: 4px 0; }
  .account { margin-left: 0; }
  .topbar .in > .theme-btn { display: none; }
  .nav .theme-btn.theme-row { display: flex; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 3px; font: 600 .9rem var(--font-ui); }
}
@media (max-width: 400px) {
  .brand { font-size: .9rem; }
  .brand svg { width: 24px; height: 24px; }
}

/* ── Search: the box in the top bar, its results, and the /search/ page ── */
.search { position: relative; display: flex; align-items: center; }
.search-box { display: flex; align-items: center; gap: 8px; width: 210px; min-height: 40px; margin: 0; padding: 0 10px; background: var(--bg2); border: 1px solid var(--faint); border-radius: 3px; }
.search-box:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.search-box .mi { flex: none; margin: 0; }
.search .search-box input { flex: 1; min-width: 0; width: auto; min-height: 38px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ink); outline: 0; -webkit-appearance: none; appearance: none; }
.search-box input::placeholder { color: var(--dim); opacity: 1; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-key { flex: none; padding: 0 6px; font: 600 .72rem/1.6 var(--font-ui); color: var(--dim); border: 1px solid var(--border2); border-radius: 3px; }
.search-box:focus-within .search-key { display: none; }
@media (hover: none) { .search-key { display: none; } }
.search-btn, .search-close { display: none; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; background: transparent; border: 1px solid var(--border); border-radius: 3px; color: var(--dim); cursor: pointer; }
.search-btn:hover, .search-close:hover { color: var(--ink); border-color: var(--border2); }
.search-close { align-self: stretch; margin-left: auto; border: 0; border-left: 1px solid var(--border); border-radius: 0 3px 3px 0; }
.search-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; width: min(560px, calc(100vw - 32px)); max-height: min(72vh, 600px); overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--border2); border-radius: 4px; box-shadow: 0 12px 32px rgb(0 0 0 / .28); }
.search-panel[hidden], .sr-note[hidden] { display: none; }
.sr-head { margin: 8px 10px 2px; font: 600 .74rem var(--font-ui); color: var(--dim); }
h2.sr-head { margin: 24px 0 8px; font-size: 1.05rem; color: var(--ink); }
h2.sr-head span { color: var(--dim); font-weight: 500; }
.sr-note { margin: 0; padding: 12px 10px; font-size: .9rem; color: var(--dim); }
.search-panel [role="option"], .sr-list a { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; column-gap: 10px; row-gap: 1px; align-content: center; min-height: 52px; padding: 6px 10px; border-radius: 3px; text-decoration: none; color: var(--text); }
.search-panel [role="option"] b, .sr-list a b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 .9rem var(--font-ui); color: var(--ink); }
.search-panel [role="option"] i, .sr-list a i { align-self: center; font: 500 .74rem var(--font-ui); color: var(--dim); }
.search-panel [role="option"] span, .sr-list a span { grid-column: 2 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; color: var(--dim); }
.search-panel [role="option"]:hover, .sr-list a:hover { background: var(--hover); }
.search-panel [role="option"]:hover .mi, .sr-list a:hover .mi { stroke: var(--ink); }
.search-panel [role="option"]:hover i, .search-panel [role="option"]:hover span, .search-panel [role="option"][aria-selected="true"] i, .search-panel [role="option"][aria-selected="true"] span, .sr-list a:hover i, .sr-list a:hover span { color: var(--text); }
.search-panel [role="option"][aria-selected="true"] { background: var(--hover); outline: 2px solid var(--accent); outline-offset: -2px; }
.search-panel .sr-all { grid-template-columns: 1fr; min-height: 44px; }
.sr-list { padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; }
.sp-form { display: grid; gap: 6px; max-width: 640px; }
.sp-row { display: flex; gap: 8px; }
.sp-row input { flex: 1; min-width: 0; }
@media (max-width: 1199px) {
  .search-btn { display: inline-flex; }
  .search-key { display: none; }
  .search:not(.open) .search-box { display: none; }
  .search.open { flex: 1 0 100%; order: 4; }
  .search.open .search-btn { display: none; }
  .search.open .search-box { width: 100%; min-height: 46px; padding-right: 0; }
  .search.open .search-close { display: inline-flex; }
  .search-panel { left: 0; right: 0; width: auto; }
}

/* ── Page frame ── */
.page { max-width: 1280px; width: 100%; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.page.narrow { max-width: 960px; }
.lede { color: var(--dim); font-size: 1.02rem; max-width: 70ch; }
.footer { border-top: 1px solid var(--border); color: var(--faint); font-size: .82rem; }
.footer .in { max-width: 1280px; margin: 0 auto; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; }
.footer a { color: var(--dim); }

/* ── Building blocks ── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 3px; border: 1px solid var(--border2); background: var(--cell); color: var(--ink); font: 600 .9rem var(--font-ui); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border-radius: 3px; border: 1px solid var(--border); background: var(--cell); color: var(--text); font: 600 .84rem var(--font-ui); cursor: pointer; }
.chip:hover { border-color: var(--border2); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--on-accent); background: var(--accent); }
.chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.seg { display: inline-flex; border: 1px solid var(--border2); border-radius: 3px; overflow: hidden; }
.seg button { border: 0; background: var(--cell); color: var(--dim); padding: 7px 14px; min-height: 38px; cursor: pointer; font: 600 .86rem var(--font-ui); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
label.field { display: grid; align-content: start; gap: 4px; font: 600 .82rem var(--font-ui); color: var(--dim); text-transform: uppercase; letter-spacing: .04em; }
input[type=number], input[type=text], input[type=search], input[type=email], select { background: var(--bg2); border: 1px solid var(--border2); border-radius: 3px; padding: 8px 10px; min-height: 40px; color: var(--ink); width: 100%; font-family: var(--font-body); text-transform: none; letter-spacing: 0; font-weight: 400; font-size: .95rem; }
input:focus, select:focus { border-color: var(--accent); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--cell) var(--fill, 50%)); border: 1px solid var(--border); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--cell); border: 1px solid var(--border); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); border: 3px solid var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stats:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }
.stats:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .stats:has(> :nth-child(6):last-child) { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--cell); border: 1px solid var(--border); border-radius: 3px; padding: 10px 12px; }
.stat b { display: block; font: 700 1.45rem/1.15 var(--font-ui); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { color: var(--dim); font-size: .82rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.data th { text-align: left; font: 600 .76rem var(--font-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 8px 10px; border-bottom: 1px solid var(--border2); position: sticky; top: 0; background: var(--panel); }
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
table.data td.n, table.data th.n { text-align: right; }
table.data tr:hover td { background: var(--hover); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 3px; }
.badge { display: inline-block; font: 700 .72rem var(--font-ui); border-radius: 3px; padding: 1px 7px; border: 1px solid currentColor; letter-spacing: .03em; }
/* Evidence statuses read by weight, not hue: the four group colours and the blue accent already mean something on the map */
.b-confirmed, .b-observed { color: var(--ink); } .b-comment, .b-inferred, .b-unknown { color: var(--dim); }
.badge.b-confirmed { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.badge.b-comment { border-style: dashed; } .badge.b-inferred { border-style: dotted; } .badge.b-unknown { font-style: italic; }
.dim { color: var(--dim); } .faint { color: var(--faint); } .small { font-size: .84rem; }
.note { color: var(--dim); font-size: .86rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.state { padding: 24px; color: var(--dim); }
.state.err { color: var(--bad); }

/* Home: every system as a plain link list (also what crawlers follow to the system pages) */
.atlas-list { columns: 260px; column-gap: 24px; }
.atlas-list section { break-inside: avoid; margin-bottom: 14px; }
.atlas-list h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 4px; }
.atlas-list a { display: block; padding: 2px 0; color: var(--ink); text-decoration: none; }
.atlas-list a:hover { color: var(--accent); }
