/* The native look the island and the Ooga Chat app (src/ooga-chat/) share: the tokens, the cave-sign lettering, a
   panel's carved title, status chip, stone slab and amber primary button, and the Bananas panel (banana-panel.js).
   Both pages load it before their own stylesheet; scripts/build.mjs joins it ahead of style.css into the island's one
   style block. */

:root {
  color-scheme: dark;
  --bg: #0a0a0b;
  --fg: #ededea;
  --muted: #a6a6a2;
  --faint: #6f6f6c;
  --border: rgba(255, 255, 255, 0.09);
  --accent: #d8892b;
  --accent-text: #ffd9a0;
  --ok: #22c55e;
  --warn: #c9a44a;
  --danger: #e5533d;
  --paper: #f3efe4;
  --wood: #8a6236;
  --wood-dk: #5c4425;
  --plank: #a9773f;
  --wood-edge: #4a3319;
  --nail: #3a2a18;
  --stone: #3a3734;
  --stone-dk: #2d2b28;
  --stone-lt: #45413d;
  --ink: #2a1a0c;
  --ink-muted: rgba(42, 26, 12, 0.72);
  --ink-faint: rgba(42, 26, 12, 0.5);
  --planks: radial-gradient(circle at 9px 9px, var(--nail) 2.5px, transparent 3px), radial-gradient(circle at calc(100% - 9px) 9px, var(--nail) 2.5px, transparent 3px), radial-gradient(circle at 9px calc(100% - 9px), var(--nail) 2.5px, transparent 3px), radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), var(--nail) 2.5px, transparent 3px), repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 11px), repeating-linear-gradient(180deg, var(--plank) 0 34px, var(--wood-edge) 34px 36px, var(--wood) 36px 70px, var(--wood-edge) 70px 72px);
  /* The panels' dark sections, the reaction card, the banner's HUD buttons and every "tablet" box (tooltips, notes,
     fields, the games' HUDs), one near-black. */
  --slab-dark: #161412;
  --tablet: var(--slab-dark);
  --tablet-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -2px 0 rgba(0, 0, 0, 0.35), 0 2px 0 rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Code", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  /* An installed web app has no browser toolbar. --home-chrome is how far the touch cluster can drop. */
  --home-chrome: 0px;
  --stick-inset: 96px;
  --stick-size: 112px;
  --act-inset: 64px;
  /* A touch drawer's default height in percent of the screen; sheet.js reads it. */
  --drawer-share: 24;
}

* {
  box-sizing: border-box;
}

/* The microphone dialog uses the voice-handoff title, slab and actions, and the same planked frame as the chat
   dialogs. Both apps load those shared rules; this dialog needs only its sizing and input layout here. */
.microphone-dialog {
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 14px 16px 16px;
  border: 3px solid var(--wood-edge);
  border-radius: var(--radius);
  background: var(--planks);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.35);
  color: var(--paper);
  font: inherit;
}

.microphone-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.microphone-dialog p { margin: 0; overflow-wrap: anywhere; }
.microphone-dialog .voice-handoff-body { display: grid; gap: 12px; }
.microphone-dialog label { display: grid; gap: 4px; font-size: 11px; }
.microphone-dialog [role="status"] { color: rgba(243, 239, 228, 0.78); font-size: 11px; }
.microphone-dialog select {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 2px solid var(--stone-dk);
  border-radius: 6px;
  background: var(--tablet);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
}
.microphone-dialog .foot-button { min-height: 40px; padding: 0 16px; }
.microphone-dialog select:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
@media (pointer: coarse) {
  .microphone-dialog .foot-button, .microphone-picker.foot-button { min-height: 44px; }
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* A carved title stays hidden until hud.js swaps its text for lettering (and labels it), so the
   fallback font never flashes while the page's scripts load. If the scripts never run, the plain
   text shows after a few seconds rather than never. */
[data-sign]:not([aria-label]) {
  visibility: hidden;
  animation: sign-fallback 0s 4s forwards;
}

@keyframes sign-fallback {
  to {
    visibility: visible;
  }
}

.sign {
  display: inline-block;
  height: 1em;
  width: auto;
  overflow: visible;
  vertical-align: -0.2em;
}

/* The island's panels share one shape: a carved title with a status chip, one stone slab that scrolls and
   takes every extra pixel of the drawer's height, and the panel's action pinned under it. The panel itself
   scrolls only when the drawer is shorter than its fixed parts (a phone's keyboard up). */
.panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 12px 14px 10px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.35) transparent;
}

.panel > .help { flex: none; margin: 0; }

.panel-title {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}

.panel .panel-title h2 {
  margin: 0 auto 0 0;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6));
}

.panel-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px solid rgba(243, 239, 228, 0.22);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(243, 239, 228, 0.72);
  font-size: 9px;
  line-height: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.panel-chip:empty { display: none; }

.panel-chip[data-tone="live"]::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.55);
}

.panel-chip[data-tone="live"] { color: #bfeccb; border-color: rgba(34, 197, 94, 0.38); }
.panel-chip[data-tone="test"] { color: #ffd84a; border-color: rgba(255, 216, 74, 0.45); background: rgba(255, 216, 74, 0.08); }
.panel-chip[data-tone="wait"] { color: var(--accent-text); border-color: rgba(216, 137, 43, 0.42); }
.panel-chip[data-tone="closed"] { color: #ffb4a6; border-color: rgba(229, 83, 61, 0.45); }

.slab {
  background: var(--slab-dark);
  border: 2px solid var(--stone-dk);
  border-radius: 9px 7px 10px 8px;
  box-shadow: var(--tablet-shadow);
}

.panel > .slab {
  flex: 1 1 auto;
  min-height: 96px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 239, 228, 0.2) transparent;
}

.slab-head {
  margin: 0;
  color: var(--accent-text);
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6));
}

.feed-open,
.panel-primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--wood-edge);
  border-radius: 6px;
  background: linear-gradient(#e2a04a, var(--accent));
  color: var(--ink);
  font-size: 15px;
  box-shadow: 0 3px 0 var(--nail);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.panel-primary { flex: none; margin: 0; }

.feed-open .sign path,
.panel-primary .sign path {
  stroke: currentColor;
  stroke-width: 0.3;
}

.feed-open:hover,
.feed-open.virtual-hover,
.feed-open:focus-visible,
.panel-primary:hover,
.panel-primary.virtual-hover,
.panel-primary:focus-visible {
  background: linear-gradient(#f0b05a, #e2a04a);
  outline: none;
}

/* Bananas: the all-time total on top, its count and sats beneath, then the donors and the latest tips in the same
   slab. Like every panel's slab it scrolls above the panel's action, so Feed the Oogas stays at the foot as
   Contributor sign-in does; its sections never shrink, and each list scrolls inside its own window: the donors' five
   donor rows tall (`--banana-five`), the latest tips' at least as tall and taking whatever room the slab has left. The
   slab may shrink to nothing, so even a phone's short drawer keeps the action whole; only a drawer shorter than the
   title and the action scrolls the panel. */
.panel > .banana-slab {
  --banana-five: calc(5 * (17px + 12px + 1px));
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 12px 12px 10px;
}
.banana-slab > section { flex: none; }
.banana-slab > .banana-recent { flex: 1 0 auto; display: flex; flex-direction: column; }
.banana-leaders,
.banana-recent-list {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.45) transparent;
}
/* The donors' window holds five rows however few entries it has. The latest tips' is never shorter and grows into the
   slab's spare room, unless it holds nothing: then it keeps the donors' height with its note under it. */
.banana-leaders { height: var(--banana-five); }
.banana-recent-list { flex: 1 0 var(--banana-five); min-height: var(--banana-five); }
.banana-recent:has(> .banana-empty:not([hidden])) > .banana-recent-list { flex-grow: 0; }

/* The total's title over it, and the total with the banana beside it as tall as its figures, both flush left. */
.banana-hero {
  display: grid;
  row-gap: 4px;
  text-align: left;
}

.banana-hero-value {
  margin: 0;
  color: var(--accent-text);
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
  overflow-wrap: anywhere;
}

/* On the figures' baseline and a cap height tall (the em fallback is about a cap). */
.banana-hero-icon {
  width: 0.72em;
  height: 0.72em;
  width: 1cap;
  height: 1cap;
  margin-right: 0.2em;
  vertical-align: baseline;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.45));
}

.banana-hero-label,
.banana-totals dt,
.banana-board-labels {
  color: rgba(243, 239, 228, 0.58);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.banana-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0 0;
  padding-top: 10px;
  text-align: left;
}

.banana-totals,
.banana-rates,
.banana-board {
  border-top: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.banana-totals div { min-width: 0; }

.banana-totals dd {
  margin: 3px 0 0;
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* A banana's price in dollars and sats, then a bitcoin's in bananas, a line each, flush left. A stale price dims; the
   line says so on hover. */
.banana-rates {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding-top: 10px;
  text-align: left;
}

.banana-rate {
  min-width: 0;
  margin: 0;
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.banana-rate[data-tone="stale"] { color: rgba(243, 239, 228, 0.6); }
/* The bitcoin line is measured on one line (banana-panel.js `fitBtcRate`) and wraps only when even "100M sats" will not fit. */
.banana-rate[data-fit="line"] { white-space: nowrap; }

/* The banana before an amount, as a currency's sign: an em square centred on the figures after it. */
.banana-rate-icon,
.banana-amount-icon {
  width: 1em;
  height: 1em;
  margin-right: 0.15em;
  vertical-align: -0.15em;
  vertical-align: calc((1cap - 1em) / 2);
}

.panel[data-panel="bananas"][data-unit="sats"] .banana-amount-icon { display: none; }

.banana-board { margin-top: 12px; padding-top: 12px; }

.banana-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.banana-units {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.banana-units button {
  min-height: 24px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: rgba(243, 239, 228, 0.66);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.banana-units button[aria-pressed="true"] {
  background: linear-gradient(#e2a04a, var(--accent));
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.banana-units button:not([aria-pressed="true"]):hover,
.banana-units button.virtual-hover:not([aria-pressed="true"]) {
  background: rgba(255, 255, 255, 0.07);
  color: var(--paper);
}

.banana-units button:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }

.banana-board-labels,
.banana-leaders li {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr) auto;
  column-gap: 10px;
  align-items: baseline;
}

.banana-board-labels { margin-top: 10px; padding: 0 2px 5px; }
.banana-board-labels span:last-child { text-align: right; }

.banana-leaders { margin: 0; padding: 0; list-style: none; }
.banana-leaders li[hidden] { display: none; }

/* A row's 17px line, 12px of padding and 1px rule are the `--banana-five` unit. */
.banana-leaders li {
  padding: 6px 2px;
  border-top: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  font-size: 12px;
  line-height: 17px;
}

.banana-rank { color: rgba(243, 239, 228, 0.5); font-size: 10px; font-variant-numeric: tabular-nums; }
.banana-leaders li:nth-child(-n + 3) .banana-rank { color: var(--accent-text); }
/* A donor's name keeps to one line and ends in an ellipsis where it would not fit; hovering shows it whole. */
.banana-donor { min-width: 0; overflow: hidden; color: var(--paper); text-overflow: ellipsis; white-space: nowrap; }
.banana-donor[data-anon="true"] { color: rgba(243, 239, 228, 0.55); font-style: italic; }
.banana-amount { color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.banana-leaders li:first-child .banana-amount { color: var(--accent-text); }

.banana-recent { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(0, 0, 0, 0.4); }
.banana-recent-filter { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11px; color: rgba(243, 239, 228, 0.7); cursor: pointer; }
.banana-recent-filter input { margin: 0; accent-color: var(--accent); }
.banana-recent-list { margin: 10px 0 0; padding: 0; list-style: none; }
.banana-recent-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: baseline;
  padding: 8px 2px;
  border-top: 1px solid rgba(0, 0, 0, 0.35);
  font-size: 12px;
}
/* The name and its check share one line, the check centred on the name's line rather than on its x-height; a name too
   long for it ends in an ellipsis before the check, and hovering shows it whole. */
.banana-recent-name { display: flex; align-items: center; min-width: 0; color: var(--paper); }
.banana-recent-name[data-anon="true"] { color: rgba(243, 239, 228, 0.55); font-style: italic; }
.banana-recent-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The orange check is a seal with a ridged rim (banana-panel.js `seal`). */
.banana-verified {
  display: inline-flex;
  flex: none;
  width: 13px;
  height: 13px;
  margin-left: 5px;
}
.banana-verified svg { width: 100%; height: 100%; }
.banana-verified-seal { fill: var(--accent); }
.banana-verified-tick { fill: none; stroke: #211b14; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.banana-recent-message { grid-column: 1 / -1; margin: 0; color: rgba(243, 239, 228, 0.7); overflow-wrap: anywhere; line-height: 1.4; }
.banana-recent-list li[hidden], .banana-verified[hidden], .banana-recent-message[hidden] { display: none; }

.banana-empty {
  margin: 0;
  padding: 14px 0 6px;
  color: rgba(243, 239, 228, 0.62);
  font-size: 10.5px;
  text-align: center;
}

.banana-board-note {
  margin: auto 0 0;
  padding-top: 12px;
  color: rgba(243, 239, 228, 0.48);
  font-size: 9.5px;
  line-height: 1.45;
}

@media (pointer: coarse) {
  .banana-units button { min-height: 40px; padding: 0 12px; }
}

/* Ooga Chat's mark (native-icons.js `cloud`) is drawn on 11 pixels where the other tab icons use 9, so it takes 11/9 of
   their box, reaching evenly into the tab's side padding, and its pixels match theirs. */
.sheet-toggle svg.cloud-icon,
.oc-tab svg.cloud-icon {
  flex: none;
  width: calc(100% * 11 / 9);
  margin: 0 calc(100% / -9);
}
/* Its outer dots: a pixel nearer the middle on a side-docked panel's tab, where the wide ones read too spread. */
.cloud-icon .cloud-near,
.sheet:not([data-dock="bottom"]) .cloud-icon .cloud-wide { display: none; }
.sheet:not([data-dock="bottom"]) .cloud-icon .cloud-near { display: inline; }

/* The World Map page (/map, map.js), in the Hum app's palette: light is sand and cream with navy ink and one blue,
   dark is neutral greys with the same blue brightened, each token light-dark(light, dark). Which applies is
   `color-scheme` on :root: <html data-theme> when this browser chose Light or Dark (theme.js, the switch in map.js),
   else the system's. Staged after src/native.css, whose dark island tokens it sets aside here. The lands are told
   apart by shades of the one blue on their cards' edges and connectors; no font is fetched, so text is the system's
   sans. */

:root {
  color-scheme: light;
  --map-bg: light-dark(#ede5d8, #1f1f1f);
  --map-surface: light-dark(#faf6ef, #111111);
  /* Dark paints each surface with a black gradient, so cards sit as darker layers on the grey page. */
  --map-surface-image: none;
  --map-field: light-dark(#f1eadf, #2a2a2a);
  --map-line: light-dark(#ddd2c1, #3a3a3a);
  --map-line-soft: light-dark(#e8dfd1, #2e2e2e);
  --map-stroke: light-dark(#e2d8c8, #262626);
  --map-grid: light-dark(color-mix(in srgb, #ddd2c1 55%, transparent), rgba(255, 255, 255, 0.05));
  --map-ink: light-dark(#141b2d, #f2f2f0);
  --map-ink-hover: light-dark(#0a1020, #ffffff);
  --map-on-ink: light-dark(#ffffff, #111111);
  --map-muted: light-dark(#675f52, #a3a3a0);
  --map-faint: light-dark(#877e70, #6b6b6b);
  --map-accent: light-dark(#399fe3, #4fabe8);
  --map-accent-hover: light-dark(#2a8fd4, #6bbaee);
  --map-accent-soft: light-dark(#d7e9f7, #15324a);
  --map-accent-halo: light-dark(#e8f2fa, #10243a);
  --map-accent-text: light-dark(#1a5f94, #8ccbf3);
  --map-sky: light-dark(#a9d3f0, #5b9fcf);
  --map-sky-soft: light-dark(#dceefa, #1e3446);
  --map-thread: light-dark(#2480c0, #4fabe8);
  --map-live: light-dark(#1f8a4c, #2ea062);
  --map-danger: light-dark(#b42318, #e0634f);
  --map-stone: light-dark(#e5dccd, #383838);
  --map-stone-text: light-dark(#3d372d, #e2e2e0);
  /* The tooltip: navy in light, black edged in grey in dark. */
  --map-bubble: light-dark(#141b2d, #111111);
  --map-bubble-text: #f2f2f0;
  --map-bubble-stroke: light-dark(transparent, #3d3d3d);
  --map-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --map-radius: 16px;
  --map-shadow-card: 0 0 0 1px var(--map-stroke), 0 1px 2px light-dark(rgba(20, 27, 45, 0.03), rgba(0, 0, 0, 0.3)),
    0 10px 28px -18px light-dark(rgba(20, 27, 45, 0.14), rgba(0, 0, 0, 0.5));
  --map-shadow-float: 0 0 0 1px var(--map-stroke), 0 2px 4px light-dark(rgba(20, 27, 45, 0.04), rgba(0, 0, 0, 0.35)),
    0 20px 48px -16px light-dark(rgba(20, 27, 45, 0.2), rgba(0, 0, 0, 0.6));
  --map-shadow-pill: 0 0 0 1px var(--map-stroke), 0 1px 2px light-dark(rgba(20, 27, 45, 0.03), rgba(0, 0, 0, 0.3));
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --map-surface-image: linear-gradient(180deg, #181818 0%, #0a0a0a 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --map-surface-image: linear-gradient(180deg, #181818 0%, #0a0a0a 100%);
  }
}

[hidden] {
  display: none !important;
}

/* Every land in one blue, from the deep blue of the island's own to the pale sky of the worlds past ₿IFRÖST; dark
   mode lifts each shade so it still reads on black. */
.land-island { --land: light-dark(#1a5f94, #8ccbf3); }
.land-bifrost { --land: light-dark(#2480c0, #6bbaee); }
.land-dsb { --land: light-dark(#399fe3, #4fabe8); }
.land-ember { --land: light-dark(#2a8fd4, #5fb3ec); }
.land-keep { --land: light-dark(#3478b4, #7ab6e6); }
.land-external { --land: light-dark(#877e70, #6b6b6b); }
.land-factory { --land: light-dark(#1f6fae, #7cc2f0); }
.land-arcade { --land: light-dark(#2b86cc, #5aaee8); }
.land-haunt { --land: light-dark(#4a7fb0, #8fb4d6); }
.land-block { --land: light-dark(#5aaee8, #a9d3f0); }
.land-rainforest { --land: light-dark(#3a92cf, #66b4e6); }
.land-hq { --land: light-dark(#5d7790, #9aaabb); }
.land-repos { --land: light-dark(#2f7fb8, #74b8e6); }
.land-sphere { --land: light-dark(#1b74b8, #5ba7e0); }
.land-bca { --land: light-dark(#4b9bd6, #8cc4ec); }
.land-lab { --land: light-dark(#6cb5e8, #a9d3f0); }

html,
body {
  margin: 0;
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background-color: var(--map-bg);
  /* The Hum page's faint 32-pixel grid. */
  background-image: linear-gradient(var(--map-grid) 1px, transparent 1px), linear-gradient(90deg, var(--map-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--map-ink);
  font: 14px/1.45 var(--map-sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--map-accent-text);
}

:focus-visible {
  outline: 2px solid var(--map-accent);
  outline-offset: 2px;
}

.map-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "home heading tools theme" "status status status status";
  align-items: center;
  gap: 6px 20px;
  padding: calc(16px + var(--safe-top)) calc(20px + var(--safe-right)) 12px calc(20px + var(--safe-left));
  background: color-mix(in srgb, var(--map-bg) 88%, transparent);
  border-bottom: 1px solid var(--map-line-soft);
}

.map-home {
  grid-area: home;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--map-surface);
  box-shadow: var(--map-shadow-pill);
  color: var(--map-ink);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.map-home:hover {
  background: var(--map-accent-halo);
}

.map-heading {
  grid-area: heading;
  min-width: 0;
}

.map-title {
  margin: 0;
  color: var(--map-ink);
  font-size: 28px;
  line-height: 1;
}

.map-sub {
  margin: 8px 0 0;
  color: var(--map-muted);
}

.map-tools {
  grid-area: tools;
  display: flex;
  gap: 8px;
}

.map-tools button {
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--map-surface);
  box-shadow: var(--map-shadow-pill);
  color: var(--map-ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.map-tools button:hover {
  background: var(--map-accent-halo);
}

.map-tools button[data-map="fit"] {
  background: var(--map-ink);
  box-shadow: none;
  color: var(--map-on-ink);
}

.map-tools button[data-map="fit"]:hover {
  background: var(--map-ink-hover);
}

.map-status {
  grid-area: status;
  margin: 0;
  min-height: 1.45em;
  color: var(--map-muted);
  font-size: 13px;
}

.map-view {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  /* A press and drag pans the diagram (map.js), so it never selects the cards' text or drags a link away. */
  -webkit-user-select: none;
  user-select: none;
}

.map-view a {
  -webkit-user-drag: none;
}

.map-view.dragging {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.map-edges {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

.edge {
  fill: none;
  stroke: var(--land);
  stroke-opacity: 0.55;
  stroke-width: 2;
  stroke-linecap: round;
}

.edge-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--map-surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--land) 35%, var(--map-stroke));
  color: var(--map-accent-text);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.node {
  position: absolute;
  padding: 10px 12px 11px 14px;
  border-left: 4px solid var(--land);
  border-radius: var(--map-radius);
  background: var(--map-surface);
  box-shadow: var(--map-shadow-card);
  cursor: default;
}

.node:hover,
.node:focus-within {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--land) 45%, var(--map-stroke)), 0 2px 4px rgba(20, 27, 45, 0.04), 0 16px 32px -16px rgba(20, 27, 45, 0.22);
}

/* The island, root of everything: navy, as the Hum app's main pill. */
.kind-island {
  border-left-color: var(--map-accent);
  background: var(--map-ink);
  color: var(--map-on-ink);
}

.kind-island .node-name,
.kind-island a.node-name {
  color: var(--map-on-ink);
  font-size: 17px;
  text-decoration-color: var(--map-accent);
}

.kind-island a.node-name:hover {
  color: var(--map-sky);
}

.kind-island .node-meta,
.kind-island .node-objects {
  color: var(--map-sky);
}

.kind-island .chip {
  background: color-mix(in srgb, var(--map-on-ink) 12%, transparent);
  box-shadow: none;
  color: var(--map-on-ink);
}

.kind-island .node-fold {
  background: color-mix(in srgb, var(--map-on-ink) 12%, transparent);
  color: var(--map-on-ink);
}

.kind-games {
  background: var(--map-field);
}

.kind-room {
  background: color-mix(in srgb, var(--map-surface) 70%, var(--map-accent-halo));
}

.kind-external {
  background: var(--map-field);
}

.node-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.node-name {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--map-ink);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

a.node-name {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--land) 55%, transparent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a.node-name:hover {
  color: var(--map-accent-text);
}

.node-fold {
  flex: none;
  min-width: 32px;
  padding: 1px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--map-accent-soft);
  color: var(--map-accent-text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  cursor: pointer;
}

.node-fold:hover {
  background: var(--map-sky);
}

.node-meta {
  margin: 3px 0 0;
  color: var(--map-muted);
  font-size: 11.5px;
}

/* The connector says how a place is reached on the wide layout; the outline has no labels, so its cards say it. */
.node-via {
  display: none;
}

.map-narrow .node-via {
  display: inline;
}

.map-narrow .node-via + .node-where::before {
  content: " · ";
}

/* A place reached only by its connector, on the wide layout, keeps no empty line. */
.node-meta:not(:has(.node-where)) {
  display: none;
}

.map-narrow .node-meta {
  display: block;
}

.node-items {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.node-item {
  color: var(--map-muted);
}

a.node-item {
  color: var(--map-accent-text);
  font-weight: 600;
}

.node-note {
  margin-left: 4px;
  color: var(--map-danger);
  font-size: 11px;
}

.node-live {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.badge,
.chip {
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge.here {
  background: color-mix(in srgb, var(--map-live) 14%, var(--map-surface));
  color: var(--map-live);
}

.badge.here::before {
  content: "● ";
}

.badge.inside {
  background: var(--map-stone);
  color: var(--map-stone-text);
}

/* A player's name keeps to one line and ends in an ellipsis, its whole name its title. */
.chip {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
  background: var(--map-sky-soft);
  color: var(--map-accent-text);
}

.chip.more {
  background: var(--map-ink);
  color: var(--map-on-ink);
}

.node-objects {
  margin: 8px 0 0;
  padding: 7px 0 0;
  border-top: 1px dashed var(--map-line);
  list-style: none;
  color: var(--map-accent-text);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.map-tip {
  position: fixed;
  z-index: 3;
  max-width: 320px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--map-bubble);
  box-shadow: 0 0 0 1px var(--map-bubble-stroke), var(--map-shadow-float);
  color: var(--map-bubble-text);
  font-size: 13px;
  pointer-events: none;
}

.map-objects {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  z-index: 2;
  width: min(380px, calc(100vw - 32px));
  max-height: 40vh;
  overflow: auto;
  padding: 12px 16px;
  border-radius: var(--map-radius);
  background: var(--map-surface);
  box-shadow: var(--map-shadow-float);
}

.map-objects-title {
  color: var(--map-accent-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.map-objects[open] .map-objects-title {
  margin-bottom: 8px;
}

.map-objects-list {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--map-ink);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.map-objects-list li + li {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--map-line-soft);
}

/* The list a reader without scripts gets, and what a search engine reads. */
.map-list {
  padding: 16px 24px 40px;
  overflow: auto;
  height: 100%;
}

.map-list ul {
  margin: 4px 0;
  padding-left: 18px;
}

.map-list li {
  margin: 4px 0;
}

.map-list .via {
  color: var(--map-muted);
}

/* The outline, on a narrow screen: the page scrolls, nothing pans. */
.map-narrow {
  display: block;
  min-height: 0;
}

.map-narrow .map-top {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "home" "heading" "tools" "theme" "status";
  justify-items: start;
}

.map-narrow .map-heading {
  justify-self: stretch;
}

.map-narrow .map-tools {
  flex-wrap: wrap;
}

.map-narrow .map-title {
  font-size: 24px;
}

.map-narrow .map-tools button[data-map="fit"] {
  display: none;
}

.map-narrow .map-view {
  overflow: visible;
  touch-action: auto;
  cursor: auto;
  -webkit-user-select: auto;
  user-select: auto;
}

.map-narrow .map-stage {
  position: relative;
}

.map-narrow .map-objects {
  position: static;
  width: auto;
  max-height: none;
  margin: 0 16px 20px;
}

/* The appearance switch, as the Hum app's: System, Light or Dark on a sunken track, the chosen one raised. */
.map-theme {
  grid-area: theme;
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--map-field);
}

.map-theme button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--map-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.map-theme button:hover {
  color: var(--map-ink);
}

.map-theme button[aria-checked="true"] {
  background-color: var(--map-surface);
  background-image: var(--map-surface-image);
  box-shadow: var(--map-shadow-pill);
  color: var(--map-ink);
}

/* The estimated CPU a place costs its object (worker/src/cpu-model.js): a model, so it says so. */
.node-cpu {
  margin: 6px 0 0;
  color: var(--map-muted);
  font-size: 11px;
}

.node-cpu b {
  color: var(--map-accent-text);
  font-weight: 700;
}

.kind-island .node-cpu,
.kind-island .node-cpu b {
  color: var(--map-sky);
}

/* Dark paints each surface with its gradient over the colour; the cards tinted on purpose keep their tint. */
.map-home,
.map-tools button,
.edge-label,
.node,
.map-objects {
  background-image: var(--map-surface-image);
}

.kind-island,
.kind-games,
.kind-room,
.kind-external,
.map-tools button[data-map="fit"] {
  background-image: none;
}
