:root {
  --ink: #1f2427; --muted: #5f6a71; --faint: #8e989e; --line: #d9dfe2; --panel: #ffffff; --panel2: #f5f7f8;
  --accent: #28627b; --chip: #eef2f4; --shadow: 0 1px 2px rgba(0,0,0,.08), 0 6px 18px rgba(0,0,0,.10);
  --water: #dbe7ee; --land: #f2eee6; --coast: #c9d6dd;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif;
  --pos: #28627b; --neg: #ac6538; --hi: #ffd400;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7ebee; --muted: #a7b1b8; --faint: #7f8a91; --line: #33393e; --panel: #1b1f22; --panel2: #23282c;
    --accent: #7fb8d0; --chip: #2a3035; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.45);
    --water: #16222b; --land: #262a2c; --coast: #2f3d46; --pos: #7fb8d0; --neg: #e0955f;
  }
}
:root[data-theme="dark"] {
  --ink: #e7ebee; --muted: #a7b1b8; --faint: #7f8a91; --line: #33393e; --panel: #1b1f22; --panel2: #23282c;
  --accent: #7fb8d0; --chip: #2a3035; --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.45);
  --water: #16222b; --land: #262a2c; --coast: #2f3d46; --pos: #7fb8d0; --neg: #e0955f;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--water); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
#app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#map.drag { cursor: grabbing; }
#map.pointer { cursor: pointer; }

/* header */
#bar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 10px; align-items: flex-start; pointer-events: none; flex-wrap: wrap; z-index: 5; }
#bar > * { pointer-events: auto; }
.brand { background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; height: 40px; padding: 4px 12px; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; white-space: nowrap; }
.brand .t { font-weight: 600; font-size: 15px; }
.brand .s { font-size: 11.5px; color: var(--muted); }
.search { position: relative; flex: 1 1 220px; max-width: 340px; }
#q { width: 100%; height: 40px; border: 0; border-radius: 8px; padding: 0 12px; background: var(--panel); box-shadow: var(--shadow); font-size: 15px; outline: none; }
#q:focus { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
#results { position: absolute; top: 44px; left: 0; width: max-content; min-width: max(100%, 380px); max-width: min(560px, calc(100vw - 24px)); z-index: 6; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); max-height: min(60vh, 440px); overflow: auto; padding: 4px 0; }
#results .r { display: flex; gap: 10px; align-items: center; padding: 6px 12px; cursor: pointer; font-size: 13px; }
#results .r.on, #results .r:hover { background: var(--panel2); }
#results .r .v { flex: 1; min-width: 0; }
#results .r .v .tt { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#results .r .v small { color: var(--muted); display: block; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .r .k { font-size: 11px; color: var(--faint); flex: none; text-transform: uppercase; letter-spacing: .04em; }
#results .r .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#results .empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
#crumbs { display: flex; align-items: center; gap: 2px; background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; height: 40px; padding: 0 6px; font-size: 13px; min-width: 0; max-width: min(520px, 42vw); }
#crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 5px; cursor: pointer; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#crumbs button:hover { color: var(--accent); background: var(--panel2); }
#crumbs button.cur { color: var(--ink); font-weight: 600; cursor: default; background: none; flex: 0 1 auto; }
#crumbs .sep { color: var(--faint); flex: none; }
#crumbs button.back { flex: none; font-size: 18px; line-height: 1; color: var(--accent); padding: 2px 8px; }
.tools { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.seg { display: flex; background: var(--panel2); box-shadow: var(--shadow); border-radius: 8px; overflow: hidden; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 0 10px; height: 34px; border-radius: 6px; font-size: 13px; cursor: pointer; color: var(--muted); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.link { border: 0; background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; height: 40px; padding: 0 12px; font-size: 13px; cursor: pointer; color: var(--accent); white-space: nowrap; }

#zoomctl { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; z-index: 4; }
#zoomctl button { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }
#zoomctl button + button { border-top: 1px solid var(--line); }
#app.panel-open #zoomctl { right: 404px; }

#legend { position: absolute; left: 12px; bottom: 12px; background: var(--panel); border-radius: 8px; box-shadow: var(--shadow); max-width: 320px; font-size: 12px; z-index: 4; }
#legend .lhead { border: 0; background: none; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink); }
#legendBody { padding: 0 12px 10px; max-height: 55vh; overflow: auto; color: var(--muted); line-height: 1.45; }
#legendBody .row { display: flex; align-items: center; gap: 8px; margin: 5px 0; }
#legendBody svg { flex: none; }
#legendBody b { color: var(--ink); font-weight: 600; }
#legendBody .lg-pill { flex: none; width: 36px; text-align: center; font-weight: 600; font-size: 11px; line-height: 16px; color: var(--pos); }   /* (drawn as on the map: plain text with a halo, no box) */
#legendBody .lg-pill.weak { color: var(--muted); font-weight: 500; }
#legendBtn .kh { display: none; margin-left: 8px; font-weight: 500; color: var(--muted); }
#legendBtn.hint .kh { display: inline; }
#legendBtn .kh svg { vertical-align: -3px; margin-right: 3px; }

#hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 13px; color: var(--muted); background: color-mix(in srgb, var(--panel) 88%, transparent); padding: 4px 12px; border-radius: 14px; pointer-events: none; white-space: nowrap; z-index: 3; transition: opacity .3s; }
#app.panel-open #hint { left: calc((100% - 392px) / 2); }
#hint:empty { display: none; }

/* hover card */
#tip { position: absolute; z-index: 7; pointer-events: none; background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; max-width: 320px; color: var(--ink); }
#tip .t { font-weight: 600; font-size: 13.5px; }
#tip .s { color: var(--muted); }
#tip .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
#tip .th { width: 52px; height: 52px; border-radius: 4px; flex: none; background-color: var(--chip); background-repeat: no-repeat; }
#tip .n { font-variant-numeric: tabular-nums; }

/* panel */
#panel { position: absolute; top: 60px; right: 12px; bottom: 12px; width: 380px; z-index: 4; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .25s ease, opacity .25s ease; }
#app:not(.panel-open) #panel { transform: translateX(calc(100% + 24px)); opacity: 0; pointer-events: none; }
#pclose { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--chip); color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; z-index: 2; }
#pclose:hover { color: var(--ink); }
#popen { position: absolute; top: 60px; right: 12px; z-index: 4; border: 0; background: var(--panel); box-shadow: var(--shadow); border-radius: 8px; height: 34px; padding: 0 12px; font-size: 13px; cursor: pointer; color: var(--accent); }
#pbody { overflow: auto; padding: 16px 18px 20px; font-size: 13px; line-height: 1.45; flex: 1; overscroll-behavior: contain; }
#pbody h2 { font-size: 17px; line-height: 1.25; margin: 0 34px 4px 0; font-weight: 650; }
#pbody h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: 18px 0 6px; font-weight: 600; }
#pbody p { margin: 6px 0; color: var(--muted); }
#pbody .lede { color: var(--ink); font-size: 13.5px; }
#pbody .lede .ar { color: var(--faint); }
#pbody .kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 8px 0; font-size: 12.5px; }
#pbody .kv span:nth-child(odd) { color: var(--muted); }
#pbody .kv span:nth-child(even) { font-variant-numeric: tabular-nums; }
#pbody .items { display: flex; flex-direction: column; gap: 2px; margin: 4px -8px; }
#pbody .it { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 6px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
#pbody .it:hover, #pbody .it.hov { background: var(--panel2); }
#pbody .it .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }
#pbody .it .tx { flex: 1; min-width: 0; }
#pbody .it .tx b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pbody .it .tx small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pbody .it .bar { width: 46px; height: 5px; border-radius: 3px; background: var(--chip); flex: none; overflow: hidden; }
#pbody .it .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
#pbody .stg { font-size: 11.5px; color: var(--faint); margin: 12px 0 2px; display: flex; gap: 8px; align-items: center; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
#pbody .stg .weak { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--neg); background: color-mix(in srgb, var(--neg) 10%, transparent); border-radius: 8px; padding: 0 6px; }
#pbody .it .ct { color: var(--faint); font-size: 11.5px; flex: none; font-variant-numeric: tabular-nums; }
#pbody .nd .tx b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pbody .nd .tx small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pbody .val details { margin-top: 4px; }
#pbody .nd { display: flex; gap: 10px; padding: 5px 8px; margin: 0 -8px; border-radius: 6px; cursor: pointer; align-items: center; }
#pbody .nd:hover, #pbody .nd.hov { background: var(--panel2); }
#pbody .nd .pics { display: flex; gap: 3px; flex: none; }
#pbody .nd .th { width: 40px; height: 40px; border-radius: 4px; background-color: var(--chip); background-repeat: no-repeat; flex: none; position: relative; }
#pbody .nd .th.hatch { background-image: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--muted) 25%, transparent) 0 1px, transparent 1px 5.5px); }
#pbody .nd .tx { flex: 1; min-width: 0; }
#pbody .nd .tx b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; }
#pbody .nd .tx small { display: block; color: var(--muted); font-size: 11.5px; line-height: 1.35; }
#pbody .nd .tx a { color: var(--accent); text-decoration: none; }
#pbody .nd .tx a:hover { text-decoration: underline; }
#pbody .neg { color: var(--neg); }
#pbody .pos { color: var(--pos); }
#pbody .val { background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 12.5px; }
#pbody .val b { font-variant-numeric: tabular-nums; }
#pbody .val .bars { display: grid; grid-template-columns: 110px 1fr 54px; gap: 4px 8px; align-items: center; margin-top: 6px; }
#pbody .val .bars .b { height: 8px; border-radius: 4px; background: var(--chip); position: relative; overflow: hidden; }
#pbody .val .bars .b i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
#pbody .val .bars span:nth-child(3n) { text-align: right; font-variant-numeric: tabular-nums; }
#pbody table { border-collapse: collapse; width: 100%; font-size: 12px; font-variant-numeric: tabular-nums; }
#pbody td, #pbody th { padding: 3px 4px; border-bottom: 1px solid var(--line); text-align: left; }
#pbody th { color: var(--faint); font-weight: 600; font-size: 11px; }
#pbody td.r, #pbody th.r { text-align: right; }
#pbody details { margin-top: 8px; }
#pbody summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
#pbody .mini { font-size: 11.5px; color: var(--faint); }
#pbody a.ms { color: var(--accent); }
#pbody .btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
#pbody .btnrow button { border: 0; background: var(--chip); border-radius: 12px; padding: 3px 10px; font-size: 12.5px; cursor: pointer; }
#pbody .btnrow button:hover { color: var(--accent); }

#loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; background: var(--water); z-index: 9; }
#loading[hidden] { display: none; }

dialog#about { border: 0; border-radius: 12px; box-shadow: var(--shadow); max-width: 640px; width: calc(100vw - 32px); padding: 22px 26px; background: var(--panel); color: var(--ink); font-size: 14px; line-height: 1.55; max-height: calc(100vh - 40px); }
dialog#about::backdrop { background: rgba(10, 20, 26, .35); }
dialog#about h2 { font-size: 18px; margin: 0 0 8px; }
dialog#about h3 { font-size: 14px; margin: 16px 0 4px; }
dialog#about p, dialog#about li { color: var(--muted); }
dialog#about b { color: var(--ink); }
dialog#about a { color: var(--accent); }
dialog#about .x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }

/* the tour */
#tourbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(600px, calc(100% - 32px)); z-index: 6; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px 10px 16px; }
#app.panel-open #tourbar { left: calc((100% - 392px) / 2); width: min(600px, calc(100% - 392px - 32px)); }
#tourbar[hidden] { display: none; }
#tourbar .tb-cap { margin: 0 0 10px; font-size: 15px; line-height: 1.42; color: var(--ink); min-height: 42px; text-wrap: pretty; }
#tourbar .tb-ctl { display: flex; align-items: center; gap: 6px; }
#tourbar .tb-ctl button { border: 0; background: var(--chip); color: var(--ink); height: 30px; min-width: 34px; border-radius: 15px; cursor: pointer; font-size: 15px; flex: none; }
#tourbar .tb-ctl button:disabled { opacity: .35; cursor: default; }
#tourbar .tb-ctl .tb-play { min-width: 44px; background: var(--accent); color: var(--panel); font-size: 13px; }
#tourbar .tb-ctl .tb-x { margin-left: auto; background: none; color: var(--muted); min-width: 30px; font-size: 18px; }
#tourbar .tb-dots { display: flex; gap: 4px; margin-left: 8px; flex: 1 1 auto; max-width: 200px; min-width: 60px; }
#tourbar .tb-dots i { flex: 1; height: 5px; border-radius: 3px; background: var(--chip); overflow: hidden; cursor: pointer; }
#tourbar .tb-dots b { display: block; height: 100%; width: 0; background: var(--accent); }
#tourbar .tb-step { font-size: 12px; color: var(--faint); margin-left: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
#tourbar .tb-note { font-size: 12px; color: var(--muted); margin-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#app.touring #hint, #app.touring #legend, #app.touring #popen { display: none; }
#tourCard { position: absolute; z-index: 5; background: var(--panel); border-radius: 10px; box-shadow: 0 0 0 2px var(--accent), var(--shadow); padding: 10px 12px; width: max-content; max-width: 340px; }
#tourCard[hidden] { display: none; }
#tourCard .tc-h b { display: block; font-size: 14px; }
#tourCard .tc-h small { display: block; color: var(--muted); font-size: 11.5px; contain: inline-size; }   /* (wraps to the pictures' width, never widens the card) */
#tourCard .tc-row { display: flex; gap: 8px; margin: 8px 0 6px; align-items: flex-start; }
#tourCard .tc-g { display: grid; column-gap: 8px; row-gap: 3px; align-items: end; margin: 8px 0 6px; }
#tourCard .tc-l { font-size: 10.5px; line-height: 1.2; color: var(--muted); contain: inline-size; }
#tourCard .tc-fv { width: 115px; height: 115px; border-radius: 6px; flex: none; background-repeat: no-repeat; background-color: var(--chip); }
#tourCard .tc-grid { display: grid; grid-template-columns: repeat(3, 56px); gap: 3px; }
#tourCard .tc-im { display: block; border-radius: 3px; background-repeat: no-repeat; background-color: var(--chip); }
#tourCard .tc-f { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; font-size: 12px; }
#tourCard .tc-id { color: var(--muted); font-size: 11px; margin-right: auto; }
#tourCard .tc-f a { color: var(--accent); white-space: nowrap; font-weight: 600; text-decoration: none; }
#pbody .btnrow button.tourgo { background: var(--accent); color: var(--panel); padding: 5px 12px; font-weight: 600; }
.short { display: none; }
@media (max-width: 1360px) and (min-width: 761px) { .brand { display: none; } .search { max-width: 280px; } }
@media (max-width: 760px) {
  .short { display: inline; } .long { display: none; }
  #bar { top: 8px; left: 8px; right: 8px; gap: 6px; }
  .brand { display: none; }
  .search { flex: 1 1 100%; max-width: none; order: 1; }
  #crumbs { order: 2; max-width: none; flex: 1 1 0; min-width: 0; height: 34px; }
  .tools { order: 3; margin-left: 0; flex: none; }
  .seg button { height: 28px; padding: 0 8px; font-size: 12px; }
  .link { height: 34px; font-size: 12px; padding: 0 9px; }
  #panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 46vh; }
  #app.panel-open #zoomctl { right: 12px; bottom: calc(46vh + 16px); }
  #popen { top: auto; bottom: 60px; right: 12px; }
  #app.panel-open #hint { display: none; }
  #legend { display: none; }
  #zoomctl { bottom: 60px; }
  #hint { bottom: 10px; font-size: 12px; }
  #tourbar, #app.panel-open #tourbar { left: 8px; right: 8px; width: auto; transform: none; bottom: 8px; padding: 10px 12px; }
  #tourbar .tb-cap { font-size: 14px; min-height: 0; margin-bottom: 8px; }
  #tourbar .tb-note { display: none; }
  #tourCard { max-width: 280px; padding: 8px; }
  #tourCard .tc-grid { grid-template-columns: repeat(3, 43px); }
  #app.touring #zoomctl { display: none; }
}
/* the narrowest phones: the tour and help buttons shrink to their symbols, so the breadcrumb keeps its room */
@media (max-width: 420px) { .tl, .hw { display: none; } #tourBtn, #aboutBtn { padding: 0 12px; } }
@media (prefers-reduced-motion: reduce) { #panel { transition: none; } }

/* ---------------- the essay embed (index.html?embed=1) ---------------- */
/* Set like the essay's other figures: nothing sits over the map. Above it, a quiet row of small grey text (where you
   are, the key, search, the pictures, details, zoom); below it, the step's caption, small arrows and dots with the
   step's name, and two text links. The map itself is a flat rectangle; the page's own white shows around it. */
#stepbar[hidden], #ehint:empty { display: none; }
html.embed { --e-cap: #3d4b52; --e-mut: #717a80; --e-fnt: #9aa4aa; --e-dot: #cfd6da; --e-ul: #c9d4d9; --e-bg: #fff;
  --e-pop: 0 10px 30px rgba(25, 51, 67, .11); --e-card: rgba(31, 36, 39, .12); }
@media (prefers-color-scheme: dark) {
  html.embed:not([data-theme="light"]) { --e-cap: #cfd6db; --e-mut: #a7b1b8; --e-fnt: #7f8a91; --e-dot: #4d575d; --e-ul: #4d575d; --e-bg: #1b1f22;
    --e-pop: 0 10px 30px rgba(0, 0, 0, .5); --e-card: rgba(255, 255, 255, .1); }
}
html.embed[data-theme="dark"] { --e-cap: #cfd6db; --e-mut: #a7b1b8; --e-fnt: #7f8a91; --e-dot: #4d575d; --e-ul: #4d575d; --e-bg: #1b1f22;
  --e-pop: 0 10px 30px rgba(0, 0, 0, .5); --e-card: rgba(255, 255, 255, .1); }
html.embed, html.embed body { overscroll-behavior: auto; background: var(--e-bg); }
html.embed.framed, html.embed.framed body { background: transparent; }   /* inside the essay: the page's own background */
/* (a dark frame declares its scheme, so a dark page's frame stays see-through instead of getting a white backdrop) */
html.embed[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { html.embed:not([data-theme="light"]) { color-scheme: dark; } }
html.embed #map { touch-action: pan-y; }
html.embed #loading { background: transparent; font-size: 13px; color: var(--e-mut); }
html.embed .brand, html.embed #tourBtn, html.embed #aboutBtn, html.embed #hint, html.embed #tourbar { display: none !important; }
html.embed button:focus-visible, html.embed a:focus-visible { outline: 2px solid #3585ab; outline-offset: 2px; border-radius: 2px; }

/* the row above the map */
html.embed #bar { top: 0; left: 0; right: 0; height: 34px; padding: 0 0 9px; gap: 18px; flex-wrap: nowrap; align-items: center; pointer-events: auto;
  font-size: 13px; line-height: 20px; color: var(--e-mut); }
html.embed #crumbs { order: 0; flex: 0 1 auto; min-width: 0; max-width: none; height: auto; margin-right: auto; padding: 0; gap: 0;
  background: none; box-shadow: none; border-radius: 0; font-size: 13px; }
html.embed #crumbs button { padding: 0; border-radius: 0; color: var(--e-mut); background: none; }
html.embed #crumbs button:hover { color: var(--accent); background: none; }
html.embed #crumbs button.cur, html.embed #crumbs button.cur:hover { color: var(--ink); font-weight: 400; }
html.embed #crumbs .sep { color: var(--e-fnt); padding: 0 7px; }
html.embed #crumbs button.back { font-size: 15px; line-height: 20px; color: var(--e-mut); padding: 0 7px 0 0; }
html.embed #legend { order: 5; position: relative; left: auto; bottom: auto; flex: none; display: block; max-width: none; z-index: 8;
  background: none; box-shadow: none; border-radius: 0; font-size: 13px; }
html.embed #legend .lhead { padding: 0; font-size: 13px; font-weight: 400; line-height: 20px; color: var(--e-mut); }
html.embed #legend .lhead:hover, html.embed #legend .lhead[aria-expanded="true"] { color: var(--ink); }
html.embed #keynote { order: 1; flex: 0 1 auto; min-width: 0; display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--e-fnt); white-space: nowrap; overflow: hidden; }
html.embed #keynote[hidden] { display: none; }
html.embed #keynote svg { flex: none; }
html.embed .search { order: 2; flex: 0 1 180px; min-width: 110px; max-width: 180px; }
html.embed #q { height: 22px; padding: 0 0 1px 19px; border: 0; border-bottom: 1px solid var(--e-ul); border-radius: 0; box-shadow: none; font-size: 13px; color: var(--ink);
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%239aa4aa' stroke-width='1.4' stroke-linecap='round'%3E%3Ccircle cx='5' cy='5' r='3.7'/%3E%3Cpath d='M7.8 7.8 11 11'/%3E%3C/svg%3E") 1px 50% / 12px 12px no-repeat; }
html.embed #q::placeholder { color: var(--e-fnt); }
html.embed #q:focus { box-shadow: 0 1px 0 var(--accent); border-bottom-color: var(--accent); }
html.embed #results { top: calc(100% + 8px); left: auto; right: 0; min-width: min(360px, calc(100vw - 16px)); max-height: 300px; padding: 4px 0;
  border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--e-pop); }
html.embed #results .r.on, html.embed #results .r:hover { background: var(--panel2); }
html.embed .tools { order: 3; margin-left: 0; flex: none; }
html.embed .seg { padding: 0; gap: 0; background: none; box-shadow: none; border-radius: 0; overflow: visible; }
html.embed .seg button { height: auto; padding: 0; border-radius: 0; font-size: 13px; line-height: 20px; font-weight: 400; color: var(--e-mut); background: none; box-shadow: none; }
html.embed .seg button + button::before { content: '·'; display: inline-block; padding: 0 7px; color: var(--e-fnt); }
html.embed .seg button:hover { color: var(--ink); }
html.embed .seg button.on { color: var(--ink); font-weight: 400; background: none; box-shadow: none; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
html.embed #popen { order: 4; position: static; flex: none; height: auto; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none;
  font-size: 13px; line-height: 20px; color: var(--e-mut); white-space: nowrap; }
html.embed #popen .ar { display: none; }
html.embed #popen:hover { color: var(--ink); }
html.embed #popen.on { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
html.embed #zoomctl { order: 6; position: static; flex: none; flex-direction: row; gap: 0; margin: 0 0 0 -6px; background: none; border-radius: 0; box-shadow: none; overflow: visible; }
html.embed #zoomctl button { width: 22px; height: 22px; padding: 0; border: 0; font-size: 15px; line-height: 22px; color: var(--e-mut); background: none; }
html.embed #zoomctl button + button { border-top: 0; }
html.embed #zoomctl #zhome { width: 16px; font-size: 13px; text-align: right; }
html.embed #zoomctl button:hover { color: var(--ink); }
/* the key opens quietly under its link, like the essay's contents menu */
html.embed #legendBody { position: absolute; top: calc(100% + 8px); left: auto; right: 0; width: 320px; max-width: calc(100vw - 16px); max-height: calc(100vh - var(--sbh, 96px) - 56px);
  overflow: auto; padding: 8px 12px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--e-pop);
  font-size: 12px; line-height: 1.45; color: var(--e-mut); }
html.embed #legendBody .row { margin: 6px 0; }
html.embed #legendBody .lg-pill, html.embed #legendBody .lg-pill.lg-it { background: none; box-shadow: none; }

/* the details: a column beside the map, opened by the Details link (on a phone it takes the map's place) */
html.embed #panel { top: var(--hdr, 34px); bottom: var(--sbh, 96px); right: 0; left: auto; width: min(300px, 38vw); height: auto; z-index: 4;
  background: transparent; border-radius: 0; box-shadow: none; transition: opacity .2s ease; }
html.embed #app:not(.panel-open) #panel { transform: none; opacity: 0; }
html.embed #pclose { top: 0; right: 0; width: 22px; height: 22px; border-radius: 0; background: none; color: var(--e-mut); font-size: 15px; }
html.embed #pclose:hover { color: var(--ink); }
html.embed #pbody { padding: 0 2px 12px 0; font-size: 12.5px; line-height: 1.5; }
html.embed #pbody h2 { font-size: 15px; font-weight: 600; margin: 0 28px 4px 0; letter-spacing: -.005em; }
html.embed #pbody h3 { font-size: 11px; font-weight: 500; letter-spacing: .075em; color: var(--e-mut); margin: 16px 0 4px; }
html.embed #pbody p { color: var(--e-mut); }
html.embed #pbody .lede { color: var(--e-cap); font-size: 13px; }
html.embed #pbody .it, html.embed #pbody .nd { border-radius: 2px; }
html.embed #pbody .val { background: none; border-radius: 0; border-left: 2px solid var(--line); padding: 2px 0 2px 10px; }
html.embed #pbody .val .bars .b, html.embed #pbody .val .bars .b i, html.embed #pbody .it .bar, html.embed #pbody .it .bar i { border-radius: 0; }
html.embed #pbody .stg .weak { background: none; padding: 0; border-radius: 0; color: var(--neg); }
html.embed #pbody .btnrow { margin: 6px 0; gap: 14px; }
html.embed #pbody .btnrow button, html.embed #pbody .btnrow button.tourgo { padding: 0; border-radius: 0; background: none; color: var(--accent); font-size: 12.5px; font-weight: 400; }
html.embed #pbody .btnrow button:hover { text-decoration: underline; text-underline-offset: 3px; }
html.embed #pbody .nd .th, html.embed #pbody .it .th { border-radius: 2px; }

/* the steps, under the map */
html.embed #stepbar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; padding: 12px 0 2px; background: none; border-radius: 0; box-shadow: none;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "cap side" "links side"; column-gap: 36px; row-gap: 5px; align-items: start; }
html.embed .sb-cap { grid-area: cap; margin: 0; font-size: 14px; line-height: 1.5; color: var(--e-cap); text-wrap: pretty; }
html.embed .sb-side { grid-area: side; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; margin-top: -2px; }
html.embed .sb-nav { display: flex; align-items: center; gap: 2px; }
html.embed .sb-nav > button { width: 30px; height: 30px; display: inline-grid; place-items: center; flex: none; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer; transition: border-color .15s, opacity .15s; }
html.embed .sb-nav > button svg { display: block; width: 12px; height: 12px; }
html.embed .sb-nav > button:hover:not(:disabled) { border-color: var(--ink); }
html.embed .sb-nav > button:disabled { opacity: .35; cursor: default; }
html.embed .sb-rail { display: flex; align-items: center; margin: 0 3px; }
html.embed .sb-rail button { width: 16px; height: 22px; display: grid; place-items: center; flex: none; padding: 0; border: 0; background: none; cursor: pointer; }
html.embed .sb-rail button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--e-dot); transition: background .2s, transform .2s; }
html.embed .sb-rail button:hover::before { background: #9aa6ad; }
html.embed .sb-rail button.on::before { background: var(--accent); transform: scale(1.15); }
html.embed .sb-rail button:focus-visible { outline-offset: -2px; border-radius: 4px; }
html.embed .sb-name { min-height: 19px; padding-right: 36px; font-size: 12.5px; line-height: 19px; color: var(--e-mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
html.embed .sb-name b { font-weight: 400; color: var(--e-fnt); margin-right: 6px; font-variant-numeric: tabular-nums; }
html.embed .sb-name.peek { color: var(--ink); }
html.embed .sb-links { grid-area: links; display: flex; align-items: baseline; gap: 18px; min-width: 0; }
html.embed .sb-links button { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 13px; line-height: 20px; color: var(--e-mut); white-space: nowrap; }
html.embed .sb-links button svg { width: 9px; height: 9px; flex: none; }
html.embed .sb-links button:hover:not(:disabled) { color: var(--accent); }
html.embed .sb-links .sb-free:disabled { color: var(--e-fnt); cursor: default; }
html.embed #stepbar.last .sb-free:not(:disabled) { color: var(--accent); }   /* the last step: the way on is to explore */
html.embed #ehint { position: static; transform: none; flex: 0 1 auto; min-width: 0; margin-left: auto; padding: 0; background: none; border-radius: 0; box-shadow: none;
  font-size: 12px; line-height: 20px; color: var(--e-fnt); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .25s; }
html.embed #ehint.show { opacity: 1; }
html.embed #ehint.strong { opacity: 1; color: var(--e-mut); box-shadow: none; }

/* the hover card and the neuron card: flat, a hairline and a soft shadow */
html.embed #tip { border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--e-pop); }
html.embed #tourCard { width: max-content; max-width: min(340px, calc(100vw - 24px)); padding: 9px 11px 8px; border: 1px solid var(--line); border-radius: 3px; box-shadow: var(--e-pop); }
html.embed #tourCard .tc-h b { font-weight: 600; }
html.embed #tourCard .tc-fv, html.embed #tourCard .tc-im { border-radius: 2px; }
html.embed #tourCard .tc-f a { font-weight: 400; }

/* the essay column (660 px): the row keeps "Feature vis" whole; the search is shorter and the Key's note steps aside */
@media (max-width: 820px) { html.embed #keynote { display: none !important; } html.embed .search { flex: 0 1 130px; min-width: 90px; } }
@media (max-width: 760px) and (min-width: 601px) { html.embed .seg .long { display: inline; } html.embed .seg .short { display: none; } }
/* narrower than the essay column: the caption takes the whole width, the arrows and dots go under it, then the links */
@media (max-width: 600px) {
  html.embed #bar { gap: 14px; }
  html.embed .search { flex: 0 1 120px; min-width: 90px; }
  html.embed #zoomctl, html.embed #keynote { display: none !important; }
  html.embed #legend { position: static; }
  html.embed #legendBody { position: absolute; top: 34px; left: 0; right: 0; width: auto; max-width: none; }
  html.embed #panel { left: 0; width: auto; background: var(--e-bg); }
  html.embed #stepbar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "cap" "side" "links"; row-gap: 6px; padding-top: 10px; }
  html.embed .sb-cap { font-size: 13.5px; line-height: 1.45; }
  html.embed .sb-side { flex-direction: row; align-items: center; gap: 8px; margin: 0 0 0 -1px; }
  html.embed .sb-name { padding-right: 0; flex: 1 1 auto; min-width: 0; }
  html.embed .sb-links { gap: 16px; min-height: 30px; align-items: center; }
  /* (the touch hint wraps to two short lines beside the links; the row keeps its height whether it shows or not) */
  html.embed #ehint { flex: 1 1 0; white-space: normal; text-align: right; font-size: 11.5px; line-height: 14px; max-height: 28px;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; text-overflow: clip; }
  html.embed #tourCard { padding: 8px; }
  html.embed #tourCard .tc-row { gap: 6px; }
}
@media (max-width: 370px) { html.embed .sb-cap { font-size: 13px; } html.embed .sb-rail button { width: 15px; } }
/* phones: the search is a magnifier that opens over the row, so the trail ("‹ killer whale") keeps its room */
@media (max-width: 460px) {
  html.embed .search { flex: 0 0 16px; min-width: 16px; max-width: 16px; }
  html.embed #q { padding: 0; text-indent: -9999px; cursor: pointer; border-bottom-color: transparent; background-position: 50% 50%; }
  html.embed #q::placeholder { color: transparent; }
  html.embed .search:focus-within { position: absolute; left: 0; right: 0; top: 0; height: 25px; max-width: none; z-index: 9; background: var(--e-bg); }
  html.embed .search:focus-within #q { text-indent: 0; padding: 0 0 1px 19px; background-position: 1px 50%; border-bottom-color: var(--accent); cursor: text; }
  html.embed .search:focus-within #q::placeholder { color: var(--e-fnt); }
  html.embed #results { left: 0; right: 0; min-width: 0; }
  html.embed #crumbs button.back { padding: 0 6px 0 0; }
}
/* round 4: mixed neurons (the map's "mixed:" labels) in italics, with a muted tag in the panel */
#pbody .nd .tx b.mx { font-style: italic; font-weight: 500; }
#pbody .mx { color: var(--faint); }
#legendBody .lg-pill.lg-it { font-style: italic; font-weight: 500; color: var(--ink); }
/* round 4: on a phone (the embed's or the full page's tour) the neuron card is as wide as its pictures */
@media (max-width: 600px) { #tourCard { width: max-content; max-width: calc(100vw - 24px); padding: 8px; } #tourCard .tc-row { gap: 6px; } }
/* round 4: the neuron card fades in once the camera has landed (it doesn't ride along with the flight) */
#tourCard { transition: opacity .25s ease; }
#tourCard.settling { opacity: 0; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { #tourCard { transition: none; } }
