/* The world atlas. A night-table atlas: the stitched tile map fills the stage, and a ledger
   panel on the right (below on phones) reads out the selected region. Single dark look on
   purpose: the game's tile colours are made for a dark terminal. */

@font-face { font-family: "IM Fell English SC"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/im-fell-english-sc-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "IM Fell English"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/im-fell-english-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/alegreya-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Alegreya Sans"; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/alegreya-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2"); }

:root {
  --ink: #0b0d10;        /* page ground, the terminal's */
  --slate: #14181d;      /* panel ground */
  --raise: #1c2229;      /* hover */
  --rule: #2a313a;       /* hairlines */
  --parch: #e9e1cf;      /* text */
  --muted: #9aa3ad;      /* secondary text */
  --gilt: #d9b45a;       /* accent */
  --danger: #e2685b;
  --sky: #7cc4f0;
  --f-display: "IM Fell English SC", Georgia, "Times New Roman", serif;
  --f-italic: "IM Fell English", Georgia, serif;
  --f-body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--ink); color: var(--parch); font-family: var(--f-body); font-size: 15px; line-height: 1.5; overflow: hidden; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gilt); outline-offset: 2px; }

.app { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
header.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--rule); background: var(--slate);
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand h1 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 26px; letter-spacing: .02em; color: var(--gilt); white-space: nowrap; }
.brand span { font-family: var(--f-italic); font-style: italic; color: var(--muted); font-size: 15px; white-space: nowrap; }
.search { position: relative; flex: 1 1 220px; max-width: 360px; min-width: 0; }
.search input { width: 100%; background: var(--ink); border: 1px solid var(--rule); border-radius: 4px; padding: 6px 10px; }
.search input::placeholder { color: var(--muted); }
.results { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; background: var(--slate); border: 1px solid var(--rule); border-radius: 4px; max-height: 50vh; overflow: auto; }
.results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--rule); }
.results button:hover, .results button.on { background: var(--raise); }
.results small { color: var(--muted); font-family: var(--f-mono); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layers { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--rule); background: var(--ink); border-radius: 999px; padding: 3px 11px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip:hover { border-color: var(--gilt); }
.chip[aria-pressed="true"] { color: var(--ink); background: var(--gilt); border-color: var(--gilt); }

main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #123c5e; cursor: grab; touch-action: none; }
.stage.drag { cursor: grabbing; }
canvas#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: rgba(11,13,16,.92); border: 1px solid var(--rule); border-radius: 4px; padding: 5px 9px; font-size: 13px; max-width: 280px; }
.tip b { font-family: var(--f-display); font-weight: 400; font-size: 15px; color: var(--gilt); }
.tip em { display: block; font-style: normal; color: var(--muted); font-family: var(--f-mono); font-size: 11px; }
.zoom { position: absolute; z-index: 4; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 4px; }
.zoom button { width: 34px; height: 34px; border-radius: 4px; border: 1px solid var(--rule); background: rgba(20,24,29,.92); cursor: pointer; font-family: var(--f-mono); font-size: 16px; }
.zoom button:hover { border-color: var(--gilt); }
.scale { position: absolute; z-index: 4; left: calc(12px + env(safe-area-inset-left, 0px)); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); font-family: var(--f-mono); font-size: 11px; background: rgba(11,13,16,.8); padding: 4px 8px; border-radius: 3px; border: 1px solid var(--rule); }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-italic); font-style: italic; font-size: 18px; text-align: center; padding: 16px; }

aside.ledger { min-width: 0; overflow-y: auto; border-left: 1px solid var(--rule); background: var(--slate); padding-block: 18px 28px; padding-left: 20px; padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.ledger h2 { font-family: var(--f-display); font-weight: 400; font-size: 28px; line-height: 1.1; margin: 0 0 4px; color: var(--gilt); text-wrap: balance; }
.ledger h3 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; font-weight: 700; }
.ledger p { margin: 0 0 10px; max-width: 65ch; }
.eyebrow { font-family: var(--f-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 10px; }
.desc { font-family: var(--f-italic); font-style: italic; font-size: 16.5px; line-height: 1.45; color: #d8d0bd; }
.back { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 13px; margin-bottom: 12px; }
.back:hover { color: var(--gilt); }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.lvl i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.row > span { min-width: 0; }
.glyph { font-family: var(--f-mono); text-align: center; font-weight: 600; }
.row small { display: block; color: var(--muted); font-size: 13px; }
.row small.inline { display: inline; }
.tag { display: inline-block; font-size: 11px; font-family: var(--f-mono); border: 1px solid var(--rule); border-radius: 3px; padding: 0 5px; margin-left: 6px; color: var(--muted); vertical-align: 1px; }
.link { background: none; border: 0; padding: 0; color: var(--parch); cursor: pointer; text-align: left; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.link:hover { color: var(--gilt); text-decoration-color: var(--gilt); }
.route { display: grid; gap: 2px; }
.route button { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: none; border: 0; border-bottom: 1px solid var(--rule); padding: 6px 2px; cursor: pointer; text-align: left; }
.route button:hover { background: var(--raise); }
.route .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route .k { font-family: var(--f-mono); font-size: 10px; color: var(--muted); text-transform: uppercase; }
.lvbar { width: 70px; height: 6px; border-radius: 3px; background: var(--rule); position: relative; }
.lvbar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; font-size: 13px; }
.legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ramp { height: 10px; border-radius: 2px; margin: 14px 0 2px; }
.ramp-labels { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.stones { display: grid; gap: 6px; }
.stones button { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: center; background: none; border: 1px solid var(--rule); border-radius: 4px; padding: 6px 8px; cursor: pointer; text-align: left; }
.stones button:hover { border-color: var(--gilt); }
.stones .num { font-family: var(--f-display); color: var(--gilt); font-size: 18px; text-align: center; }
.stones small { display: block; color: var(--muted); font-size: 12.5px; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.stats b { color: var(--parch); font-weight: 600; }
.mons { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 3px 10px; font-size: 14px; }
.mons span:nth-child(3n+1) { font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.mons span:nth-child(3n) { font-size: 12px; color: var(--muted); }
.hint { margin-top: 14px; color: var(--muted); font-size: 13px; }

@media (max-width: 860px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100%; }
  main { grid-template-columns: minmax(0, 1fr); }
  .stage { height: 64vh; min-height: 340px; }
  aside.ledger { border-left: 0; border-top: 1px solid var(--rule); overflow: visible; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
