/* Endpapers — atlas viewer (map.html) + map label styles. Tokens come from theme.css.
 * Layers: stage 0 (canvas + labels 10) · ink-wash 15 · UI 20 · card 30 · modal 40 · toast 45 · loader 50. */

html, body { height: 100%; }
body.viewer { overflow: hidden; overscroll-behavior: none; background: var(--bg); -webkit-user-select: none; user-select: none; }
body.viewer input, body.viewer .card__scroll { -webkit-user-select: text; user-select: text; }
.ui { position: relative; z-index: var(--z-ui); }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.glass {
  background: linear-gradient(180deg, rgba(46, 33, 64, .80), rgba(24, 18, 34, .86));
  -webkit-backdrop-filter: blur(14px) saturate(1.25); backdrop-filter: blur(14px) saturate(1.25);
  border: 1px solid rgba(230, 211, 163, .16); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(230, 211, 163, .14);
}
.glass-strong {
  background: linear-gradient(180deg, rgba(38, 27, 54, .95), rgba(20, 15, 30, .96));
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  border: 1px solid rgba(230, 211, 163, .2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-2), inset 0 1px 0 rgba(230, 211, 163, .18);
}
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; transition: all var(--dur-1) var(--ease); }
.icon-btn:hover { color: var(--gold-2); border-color: var(--line-strong); background: rgba(255, 255, 255, .04); }
.btn .ico { width: 16px; height: 16px; }

/* ================================================================ stage */
.stage {
  --sky-top: #140f1e; --sky-horizon: #3a2a52;
  position: fixed; inset: 0; z-index: var(--z-map); overflow: hidden; outline: none;
  background:
    radial-gradient(ellipse 60% 48% at 50% 46%, rgba(230, 211, 163, .10), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 110%, rgba(78, 147, 132, .16), transparent 60%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-horizon) 58%, var(--sky-top) 100%);
  cursor: grab; touch-action: none; -webkit-tap-highlight-color: transparent;
}
.stage.is-grabbing { cursor: grabbing; }
.stage.is-pointing { cursor: pointer; }
.stage:focus-visible { box-shadow: inset 0 0 0 2px rgba(230, 211, 163, .45); }
.stage::before { /* festival-night sky */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease);
  background: radial-gradient(ellipse 70% 50% at 50% 45%, rgba(107, 74, 140, .35), transparent 70%), linear-gradient(180deg, #05030a 0%, #150c28 60%, #05030a 100%);
}
.is-night .stage::before { opacity: 1; }
.stage::after { /* soft vignette so the block floats on the page */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse 85% 75% at 50% 50%, transparent 60%, rgba(8, 5, 14, .5) 100%);
}
#map-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.labels { position: absolute; inset: 0; z-index: var(--z-labels); pointer-events: none; overflow: hidden; contain: strict; }
.is-transitioning .labels { opacity: 0; transition: opacity .2s; }

/* ================================================================ labels */
.lbl {
  position: absolute; left: 0; top: 0; padding: 0; margin: 0; border: 0; background: none; color: inherit; font: inherit;
  cursor: pointer; pointer-events: auto; will-change: transform; transform: translate3d(-9999px, -9999px, 0); -webkit-tap-highlight-color: transparent;
}
.lbl:focus { outline: none; }
.lbl:focus-visible .lbl__body { outline: 2px solid var(--gold-2); outline-offset: 3px; border-radius: 4px; }
.lbl.is-off { pointer-events: none; visibility: hidden; transition: visibility 0s linear .22s; }
.lbl.is-measuring { visibility: hidden !important; transition: none !important; }
.lbl__body { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; white-space: nowrap; transform: translate(-50%, -50%); transition: opacity .22s var(--ease), filter .22s var(--ease), scale .22s var(--ease); }
.lbl.is-off .lbl__body { opacity: 0; }
.lbl.is-dim .lbl__body { opacity: .3; filter: saturate(.25); }
.lbl.is-dim .lbl__leader { opacity: .3; }
.lbl__ev { display: none; width: 9px; height: 9px; margin-left: 5px; flex: none; background: var(--gold-2);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter: drop-shadow(0 0 3px rgba(230, 211, 163, .9)); }
.lbl.has-ev .lbl__ev { display: inline-block; }

/* banners — ribbon with swallowtail ends in the faction colour (after the printed map's palace banners) */
.lbl--banner .lbl__body { top: auto; bottom: 12px; transform: translateX(-50%); transform-origin: 50% 100%; }
.lbl__ribbon { position: relative; display: block; padding: 0 13px; }
.lbl__band {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 6px; height: 23px; padding: 0 11px 0 9px;
  background: linear-gradient(180deg, var(--fc-hi, #7d5aa3) 0%, var(--fc, #6b4a8c) 55%, var(--fc-lo, #3d2a5c) 100%);
  color: var(--fc-ink, #fbf6ec); font: 600 10.5px/1 var(--font-caps); letter-spacing: .15em; text-transform: uppercase;
  border-top: 1px solid rgba(246, 230, 190, .8); border-bottom: 1px solid rgba(246, 230, 190, .8);
  box-shadow: 0 3px 8px rgba(8, 4, 14, .45), inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .2);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .28);
}
.lbl__band::before, .lbl__band::after { /* folds where the band turns behind */
  content: ''; position: absolute; bottom: -6px; width: 0; height: 0; border-style: solid; z-index: -1;
}
.lbl__band::before { left: -1px; border-width: 0 7px 6px 0; border-color: transparent rgba(20, 10, 18, .75) transparent transparent; }
.lbl__band::after { right: -1px; border-width: 0 0 6px 7px; border-color: transparent transparent transparent rgba(20, 10, 18, .75); }
.lbl__tail { position: absolute; z-index: 1; top: 6px; width: 24px; height: 23px; background: linear-gradient(180deg, var(--fc, #6b4a8c), var(--fc-lo, #3d2a5c));
  border-top: 1px solid rgba(246, 230, 190, .55); border-bottom: 1px solid rgba(246, 230, 190, .55); }
.lbl__tail--l { left: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 36% 50%); }
.lbl__tail--r { right: 0; clip-path: polygon(0 0, 100% 0, 64% 50%, 100% 100%, 0 100%); }
.lbl__emblem { width: 14px; height: 14px; margin: 0 1px 0 -2px; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .25)); }
.lbl--banner .lbl__ev { margin-left: 2px; }
.lbl__leader { position: absolute; left: -.5px; top: -12px; width: 1px; height: 12px; pointer-events: none;
  background: linear-gradient(180deg, rgba(246, 230, 190, .95), rgba(39, 32, 28, .75)); box-shadow: 0 0 1px rgba(0, 0, 0, .4); }
.lbl__leader::after { content: ''; position: absolute; left: -2.5px; bottom: -3.5px; width: 6px; height: 6px; transform: rotate(45deg);
  background: var(--fc, #6b4a8c); border: 1px solid rgba(246, 230, 190, .95); box-shadow: 0 0 0 1px rgba(20, 12, 20, .35); }
.lbl--banner.is-hover .lbl__band { filter: brightness(1.12); }
.lbl--banner.is-selected .lbl__body { scale: 1.1; }
.lbl--banner.is-selected .lbl__band, .lbl--banner.is-faction .lbl__band {
  box-shadow: 0 0 0 1px rgba(246, 230, 190, .9), 0 0 22px rgba(230, 211, 163, .55), 0 3px 8px rgba(8, 4, 14, .45), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.lbl--banner .lbl__band { overflow: hidden; }
.lbl--banner .lbl__text { position: relative; }
.lbl--banner.is-hover .lbl__band > .lbl__text::after, .lbl--banner.is-selected .lbl__band > .lbl__text::after { /* mirror-tile shimmer */
  content: ''; position: absolute; inset: -6px -40px; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
  animation: shimmer 1.6s var(--ease) 1; pointer-events: none;
}
@keyframes shimmer { from { transform: translateX(-70%); } to { transform: translateX(70%); } }

/* engraved regions, italic waters, pins */
.lbl__text { display: block; }
.lbl--region .lbl__text { font: 400 15px/1.05 var(--font-engraved); letter-spacing: .34em; text-transform: uppercase; color: rgba(49, 36, 27, .86); padding-left: .34em;
  text-shadow: 0 0 2px rgba(240, 233, 214, .95), 0 0 6px rgba(240, 233, 214, .8), 0 0 14px rgba(240, 233, 214, .45); }
.lbl--region.lbl--sea .lbl__text { color: rgba(242, 236, 220, .92); text-shadow: 0 1px 1px rgba(14, 38, 44, .9), 0 0 8px rgba(14, 38, 44, .65), 0 0 18px rgba(14, 38, 44, .35); }
.lbl--region.lbl--sea.is-hover .lbl__text { color: #fff; }
.lbl--water .lbl__text { font: italic 500 16px/1.05 var(--font-label); letter-spacing: .16em; color: #eef8f4;
  text-shadow: 0 1px 1px rgba(14, 38, 44, .9), 0 0 8px rgba(14, 38, 44, .65), 0 0 18px rgba(14, 38, 44, .35); }
.lbl--pin .lbl__body { transform: translate(-6px, -50%); }
.lbl__dot { width: 10px; height: 10px; margin-right: 6px; flex: none; border-radius: 50%; background: var(--fc, #27201c);
  border: 2px solid #f7efd9; box-shadow: 0 0 0 1px rgba(39, 32, 28, .7), 0 1px 3px rgba(0, 0, 0, .45); }
.lbl--pin .lbl__text { font: 600 13.5px/1 var(--font-label); letter-spacing: .05em; color: #261c14;
  text-shadow: 1px 0 0 #f6f0e0, -1px 0 0 #f6f0e0, 0 1px 0 #f6f0e0, 0 -1px 0 #f6f0e0, 0 0 3px rgba(246, 240, 224, 1), 0 0 7px rgba(246, 240, 224, .9), 0 0 12px rgba(246, 240, 224, .5); }
.lbl--small .lbl__text { font: 600 11.5px/1 var(--font-label); letter-spacing: .1em; font-variant: small-caps; color: #261c14;
  text-shadow: 1px 0 0 #f6f0e0, -1px 0 0 #f6f0e0, 0 1px 0 #f6f0e0, 0 -1px 0 #f6f0e0, 0 0 3px rgba(246, 240, 224, 1), 0 0 7px rgba(246, 240, 224, .8); }
.lbl--pin.is-selected .lbl__dot, .lbl--small.is-selected .lbl__text { box-shadow: 0 0 0 2px var(--gold-2), 0 0 14px rgba(230, 211, 163, .9); }
.lbl--pin.is-selected .lbl__text, .lbl--pin.is-hover .lbl__text { padding: 4px 8px 4px 7px; margin-left: -3px; border-radius: 6px; background: rgba(250, 245, 232, .94); box-shadow: 0 0 0 1px var(--gold), 0 3px 10px rgba(8, 4, 14, .35); text-shadow: none; }
.lbl--region.is-selected .lbl__text, .lbl--water.is-selected .lbl__text { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.lbl--pin.is-hover .lbl__text, .lbl--small.is-hover .lbl__text, .lbl--region.is-hover .lbl__text { color: #000; }
.lbl--water.is-hover .lbl__text { color: #fff; }
.lbl--room .lbl__body { padding: 4px 9px; border-radius: 3px; background: rgba(250, 246, 236, .94); border: 1px solid var(--gold);
  box-shadow: 0 2px 8px rgba(8, 4, 14, .35); }
.lbl--room .lbl__text { font: 600 9.5px/1 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: #2a2018; }
.lbl--room.is-selected .lbl__body { background: var(--gold-2); }
.lbl--portal .lbl__body { flex-direction: column; gap: 8px; transform: translate(-50%, -24px); }
.lbl__ring { width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--gold-2);
  box-shadow: 0 0 0 5px rgba(230, 211, 163, .14), 0 0 26px rgba(230, 211, 163, .55), inset 0 0 16px rgba(230, 211, 163, .35);
  animation: portal 2.4s ease-in-out infinite; }
.lbl__hint { padding: 6px 11px; border-radius: var(--r-pill); background: rgba(20, 15, 30, .88); border: 1px solid rgba(230, 211, 163, .35);
  color: var(--ink-2); font: 500 11.5px/1 var(--font-ui); box-shadow: var(--shadow-1); }
.lbl__hint b { color: var(--gold-2); font-weight: 600; }
.lbl__hint .lbl__text { display: inline; font-family: var(--font-caps); letter-spacing: .06em; color: var(--ink); }
@keyframes portal { 0%, 100% { transform: scale(.92); opacity: .75; } 50% { transform: scale(1.08); opacity: 1; } }
.labels.is-interior .lbl--banner .lbl__leader { display: none; }

/* ================================================================ top bar */
.topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 10px 0 14px; z-index: 26; } /* above crumbs/controls/drawer so its dropdowns win */
.brand { display: flex; align-items: center; gap: 9px; color: var(--gold-2); flex: none; }
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; fill: none; stroke: var(--gold); stroke-width: 1.3; stroke-linejoin: round; }
.brand__mark path:first-child { fill: rgba(186, 150, 88, .1); }
.brand__name { font: 500 11px/1 var(--font-mono); letter-spacing: .3em; text-transform: uppercase; color: var(--ink-2); }
.book { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding-left: 14px; border-left: 1px solid var(--line); }
.book__title { font: 700 16px/1.1 var(--font-display); letter-spacing: .02em; color: var(--gold-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book__author { font: italic 500 13px/1.1 var(--font-label); color: var(--muted); white-space: nowrap; }
.tabs { display: flex; gap: 3px; padding: 4px; margin-left: 6px; border-radius: var(--r-pill); background: rgba(8, 5, 14, .38); border: 1px solid var(--line); flex: none; }
.tab { padding: 9px 14px; border: 0; border-radius: var(--r-pill); background: none; color: var(--muted); cursor: pointer; white-space: nowrap;
  font: 600 10.5px/1 var(--font-caps); letter-spacing: .12em; text-transform: uppercase; transition: all var(--dur-1) var(--ease); }
.tab:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.tab.is-active { color: var(--gold-2); background: linear-gradient(180deg, rgba(230, 211, 163, .2), rgba(186, 150, 88, .08)); box-shadow: inset 0 0 0 1px rgba(230, 211, 163, .38); }
.tb-spacer { flex: 1; }
.search { position: relative; width: 250px; flex: 0 1 250px; min-width: 170px; }
@media (min-width: 1181px) { .book { flex-shrink: 0; } }
.search__ico { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 34px 0 37px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: rgba(8, 5, 14, .5);
  color: var(--ink); font: 400 14px/1 var(--font-ui); outline: none; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(186, 150, 88, .18); }
.search input::-webkit-search-cancel-button { display: none; }
.search__kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); min-width: 20px; padding: 2px 5px; border-radius: 5px; border: 1px solid var(--line-strong);
  color: var(--faint); font: 500 11px/1 var(--font-mono); text-align: center; pointer-events: none; }
.search input:focus ~ .search__kbd { opacity: 0; }
.search__list { position: absolute; top: calc(100% + 8px); left: 0; right: 0; min-width: 300px; margin: 0; padding: 6px; list-style: none; max-height: 60vh; overflow: auto; z-index: 5; }
.search__list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; }
.search__list li[aria-selected="true"] { background: rgba(230, 211, 163, .12); box-shadow: inset 0 0 0 1px rgba(230, 211, 163, .25); }
.sr__em { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--fc, #4e3463); color: var(--fc-ink, #fbf6ec); }
.sr__em--plain { background: rgba(255, 255, 255, .06); color: var(--muted); }
.sr__em--plain .ico { width: 14px; height: 14px; }
.sr__name { flex: 1; min-width: 0; font: 500 16px/1.2 var(--font-body); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr__meta { font: 500 10px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }
.sr__none { color: var(--muted); font: italic 500 15px var(--font-label); cursor: default !important; }
.tb-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: rgba(8, 5, 14, .35);
  color: var(--muted); cursor: pointer; transition: all var(--dur-1) var(--ease); }
.tb-btn:hover { color: var(--gold-2); border-color: var(--gold); }
.tb-btn[aria-pressed="true"] { color: #1a1206; background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; box-shadow: var(--glow-gold); }
.tb-search-open, .tb-more { display: none; }
.spoil { display: flex; align-items: center; height: 38px; padding: 3px; gap: 2px; flex: none; border-radius: var(--r-pill); border: 1px solid var(--line); background: rgba(8, 5, 14, .35); }
.spoil__ico { display: grid; place-items: center; width: 32px; color: var(--faint); }
.spoil__ico .claws { width: 22px; height: 14px; }
.spoil button { height: 30px; padding: 0 11px; border: 0; border-radius: var(--r-pill); background: none; color: var(--muted); cursor: pointer; font: 500 12px/1 var(--font-ui); white-space: nowrap; }
.spoil button:hover { color: var(--ink); }
.spoil button[aria-checked="true"] { color: #1a1206; background: linear-gradient(180deg, var(--gold-2), var(--gold)); font-weight: 600; }
.spoil[data-level="minor"] .spoil__ico { color: var(--apricot); }
.spoil[data-level="major"] .spoil__ico { color: #e2574c; }
.spoil[data-level="major"] button[aria-checked="true"] { color: #fff; background: linear-gradient(180deg, #cf3b31, var(--crimson)); }
.claws { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* ================================================================ breadcrumbs */
.crumbs { position: fixed; top: 82px; left: 358px; z-index: var(--z-ui); max-width: calc(100vw - 780px); transition: left .3s var(--ease); }
.drawer-closed .crumbs { left: 140px; }   /* clear of the Places button */
.crumbs ol { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; gap: 2px; margin: 0; padding: 6px 12px; list-style: none; border-radius: var(--r-pill);
  background: rgba(20, 15, 30, .62); border: 1px solid var(--line); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.crumbs li { display: flex; align-items: center; min-width: 0; white-space: nowrap; font: 500 10.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-2); }
.crumbs li + li::before { content: '\203A'; margin: 0 7px; color: var(--faint); font-size: 13px; }
.crumbs li > span, .crumbs button { overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.crumbs li:last-child { flex-shrink: 0; }
.crumbs button { padding: 3px 2px; border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.crumbs button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ================================================================ drawer */
.drawer { position: fixed; left: 12px; top: 82px; bottom: 12px; width: 334px; z-index: var(--z-ui); display: flex; flex-direction: column; overflow: hidden; }
.drawer__grab { display: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.drawer__title { font: 600 13px/1.2 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); }
.drawer__body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 16px 18px; overscroll-behavior: contain; }
.drawer-open { position: fixed; left: 12px; top: 82px; z-index: var(--z-ui); display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px 0 12px; border-radius: var(--r-pill) !important;
  color: var(--gold-2); cursor: pointer; font: 600 11px/1 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; font: 600 10.5px/1 var(--font-caps); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.sec-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.fchips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 4px; }
.fchip { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 0 5px; border: 0; border-radius: 12px; background: none; cursor: pointer; color: var(--ink-2); transition: all var(--dur-2) var(--ease); }
.fchip__medal { display: grid; place-items: center; width: 42px; height: 42px; color: var(--fc-ink, #fff);
  background: radial-gradient(circle at 35% 30%, var(--fc-hi), var(--fc) 55%, var(--fc-lo));
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%);
  box-shadow: inset 0 0 0 1px rgba(246, 230, 190, .5); transition: transform var(--dur-2) var(--ease), filter var(--dur-2); }
.fchip__name { font: 600 9.5px/1 var(--font-caps); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.fchip:hover .fchip__medal { transform: translateY(-2px); filter: brightness(1.12); }
.fchip:hover .fchip__name { color: var(--ink); }
.fchips.has-active .fchip[aria-pressed="false"] { opacity: .42; filter: saturate(.4); }
.fchip[aria-pressed="true"] { background: rgba(230, 211, 163, .08); box-shadow: inset 0 0 0 1px rgba(230, 211, 163, .35); }
.fchip[aria-pressed="true"] .fchip__name { color: var(--gold-2); }
.fchip[aria-pressed="true"] .fchip__medal { filter: drop-shadow(0 0 8px rgba(230, 211, 163, .6)); }
.plist { display: flex; flex-direction: column; gap: 2px; }
.pgroup summary { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 6px; cursor: pointer; list-style: none;
  font: 600 10px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.pgroup summary::-webkit-details-marker { display: none; }
.pgroup summary::before { content: ''; width: 6px; height: 6px; margin-right: 8px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--dur-1); }
.pgroup:not([open]) summary::before { transform: rotate(-45deg); }
.pgroup summary span:first-child { flex: 1; }
.pgroup__n { padding: 2px 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .05); }
.pl { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 5px 8px 5px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); text-align: left; cursor: pointer; transition: background var(--dur-1), opacity var(--dur-2); }
.pl:hover { background: rgba(255, 255, 255, .05); color: var(--ink); }
.pl.is-active { background: rgba(230, 211, 163, .1); color: var(--gold-2); }
.pl.is-active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--gold-2); }
.pl.is-dim { opacity: .35; }
.pl__em { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; color: var(--fc-ink, #fff); background: var(--fc); box-shadow: inset 0 0 0 1px rgba(246, 230, 190, .35); }
.pl__dot { width: 22px; height: 22px; flex: none; display: grid; place-items: center; }
.pl__dot::after { content: ''; width: 7px; height: 7px; transform: rotate(45deg); border: 1.5px solid var(--gold); }
.pl__name { flex: 1; min-width: 0; font: 500 15.5px/1.2 var(--font-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl__ev { width: 8px; height: 8px; flex: none; background: var(--gold-2); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.pl__canon { width: 7px; height: 7px; flex: none; border-radius: 50%; }
.pl__canon--book { background: var(--gold-2); }
.pl__canon--map { border: 1.5px solid var(--slate-2); }
.pl__canon--interpretation { border: 1.5px dashed var(--violet-2); }
.legend__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.legend__list li { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; color: var(--muted); font: 400 13px/1.35 var(--font-ui); }
.legend__list .canon { justify-self: start; }
.ad-wrap { display: grid; place-items: center; margin: 22px 0 10px; }
.ad-wrap .ad-slot { max-width: 100%; }
.credits { margin-top: 12px; color: var(--faint); font: italic 500 13px/1.4 var(--font-label); text-align: center; }

/* canon badges */
.canon { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px 5px 8px; border-radius: var(--r-pill); white-space: nowrap;
  font: 600 9.5px/1 var(--font-caps); letter-spacing: .12em; text-transform: uppercase; }
.canon::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.canon--book { color: #f3e3b8; background: rgba(186, 150, 88, .18); border: 1px solid rgba(230, 211, 163, .45); }
.canon--book::before { background: var(--gold-2); box-shadow: 0 0 6px rgba(230, 211, 163, .8); }
.canon--map { color: #d3ece5; background: rgba(78, 147, 132, .2); border: 1px solid rgba(140, 197, 183, .45); }
.canon--map::before { border: 1.5px solid var(--slate-2); }
.canon--interpretation { color: #e6d9f1; background: rgba(165, 139, 196, .14); border: 1px dashed rgba(205, 182, 216, .55); }
.canon--interpretation::before { border: 1.5px dashed var(--violet-2); }

/* ================================================================ info card */
.card { position: fixed; right: 12px; top: 82px; width: 388px; max-height: calc(100% - 94px); z-index: var(--z-card); display: flex; flex-direction: column; overflow: hidden;
  animation: cardIn .32s var(--ease); }
@keyframes cardIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.card__grab { display: none; }
.card__close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(8, 5, 14, .35); }
.card__scroll { overflow-y: auto; padding: 22px 22px 20px; overscroll-behavior: contain; }
.card__head { display: flex; align-items: center; gap: 14px; padding-right: 34px; }
.card__medal { display: grid; place-items: center; width: 58px; height: 58px; flex: none; color: var(--fc-ink, #fff);
  background: radial-gradient(circle at 35% 30%, var(--fc-hi, #7d5aa3), var(--fc, #6b4a8c) 55%, var(--fc-lo, #3d2a5c));
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%); box-shadow: inset 0 0 0 1.5px rgba(246, 230, 190, .6); }
.card__medal--plain { background: linear-gradient(180deg, #3a2a52, #231a33); color: var(--gold-2); }
.card__medal--plain .ico { width: 26px; height: 26px; }
.card__kind { margin-bottom: 5px; font: 500 10px/1.2 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.card__name { font: 600 23px/1.12 var(--font-caps); letter-spacing: .03em; color: var(--gold-2); }
.card__aka { margin-top: 4px; font: italic 500 14px/1.2 var(--font-label); color: var(--muted); }
.card__badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); position: relative; }
.card__badges::after { content: '\221E'; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); padding: 0 10px; background: #1d1529; color: var(--gold); font: 400 16px/1 var(--font-body); }
.fbadge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid rgba(246, 230, 190, .35); background: linear-gradient(180deg, var(--fc-hi), var(--fc)); color: var(--fc-ink); font: 600 9.5px/1 var(--font-caps); letter-spacing: .12em; text-transform: uppercase; }
.fbadge .emblem { width: 15px; height: 15px; }
.card__summary { margin: 18px 0 10px; font: italic 500 19px/1.38 var(--font-label); color: var(--ink); }
.card__desc, .card__sec p { font: 400 16px/1.6 var(--font-body); color: var(--ink-2); }
.card__sec { margin-top: 16px; }
.card__h { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font: 600 10.5px/1 var(--font-caps); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.card__h::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.feats { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; }
.feats li { position: relative; padding-left: 20px; font: 400 15.5px/1.45 var(--font-body); color: var(--ink-2); }
.feats li::before { content: ''; position: absolute; left: 3px; top: .5em; width: 9px; height: 9px; background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.events { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.ev { padding: 9px 12px; border-radius: 10px; border-left: 2px solid var(--gold); background: rgba(255, 255, 255, .03); font: 400 15px/1.5 var(--font-body); color: var(--ink-2); }
.ev__t { display: block; margin-bottom: 2px; font: 600 14px/1.3 var(--font-caps); letter-spacing: .03em; color: var(--ink); }
.ev__lv { display: inline-block; margin-top: 6px; font: 600 9px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--apricot); }
.ev--major { border-left-color: var(--crimson); }
.ev--major .ev__lv { color: #e2574c; }
.ev--gated { padding: 0; border: 0; background: none; }
.gate { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 10px; cursor: pointer; text-align: left;
  border: 1px dashed rgba(179, 38, 30, .55); color: var(--ink-2);
  background: repeating-linear-gradient(135deg, rgba(179, 38, 30, .08) 0 8px, rgba(179, 38, 30, .02) 8px 16px), rgba(20, 15, 30, .6); transition: all var(--dur-2) var(--ease); }
.gate .claws { width: 40px; height: 24px; flex: none; color: #d0463b; transition: transform var(--dur-2) var(--ease); }
.gate--minor { border-color: rgba(239, 180, 138, .5); background: repeating-linear-gradient(135deg, rgba(239, 180, 138, .07) 0 8px, transparent 8px 16px), rgba(20, 15, 30, .6); }
.gate--minor .claws { color: var(--apricot); }
.gate span { display: flex; flex-direction: column; gap: 3px; }
.gate b { font: 600 11px/1 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.gate em { font: italic 500 14px/1.2 var(--font-label); color: var(--muted); }
.gate:hover { border-style: solid; }
.gate:hover .claws { transform: translateX(3px) rotate(-4deg); }
.card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.card__actions .btn { min-height: 38px; padding: 0 14px; }
.card__src { margin-top: 16px; color: var(--faint); font: 400 12.5px/1.5 var(--font-ui); }
.card__src summary { cursor: pointer; font: 500 10px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.card__src ul { margin: 8px 0 0; padding-left: 18px; }
.card__src a { color: var(--muted); }
.rooms { display: flex; flex-wrap: wrap; gap: 6px; }
.room { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 8px; border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .03);
  color: var(--ink-2); cursor: pointer; font: 500 13px/1 var(--font-ui); }
.room i { width: 10px; height: 10px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.room.is-active, .room:hover { border-color: var(--gold); color: var(--gold-2); }
.room-card { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(236, 229, 210, .06); border: 1px solid var(--line); }
.room-card h4 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; font: 600 15px/1.2 var(--font-caps); color: var(--ink); }

/* ================================================================ controls */
.controls { position: fixed; right: 14px; bottom: 14px; z-index: var(--z-ui); display: flex; flex-direction: column; align-items: center; gap: 8px; transition: right .32s var(--ease), opacity .2s; }
.card-open .controls { right: 414px; }
.compass { width: 66px; height: 66px; padding: 0; border: 0 !important; background: none !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  cursor: pointer; filter: drop-shadow(0 6px 14px rgba(5, 2, 14, .55)); transition: transform var(--dur-2) var(--ease); }
.compass:hover { transform: scale(1.05); }
.compass svg { width: 100%; height: 100%; overflow: visible; }
.compass__oct { fill: rgba(22, 16, 32, .9); stroke: var(--gold); stroke-width: 1.2; }
.compass__oct2 { fill: none; stroke: rgba(230, 211, 163, .28); stroke-width: .8; }
.compass__minor { fill: rgba(230, 211, 163, .22); }
.compass__ew { fill: rgba(230, 211, 163, .5); }
.compass__s { fill: rgba(205, 182, 216, .55); }
.compass__n { fill: var(--gold-2); }
.compass__pin { fill: #1a1206; stroke: var(--gold-2); stroke-width: 1; }
.compass__t { font: 600 7.5px/1 var(--font-caps); fill: var(--muted); text-anchor: middle; }
.compass__t--n { fill: var(--gold-2); font-size: 8.5px; }
.zoom { display: flex; flex-direction: column; align-items: center; width: 46px; padding: 3px 0; border-radius: 23px !important; }
.zoom__btn, .ctl { display: grid; place-items: center; color: var(--ink-2); cursor: pointer; transition: color var(--dur-1), filter var(--dur-1); }
.zoom__btn { width: 40px; height: 38px; border: 0; border-radius: 19px; background: none; }
.zoom__btn:hover { color: var(--gold-2); background: rgba(255, 255, 255, .05); }
.ctl:hover { color: var(--gold-2); filter: brightness(1.2); }
.zoom__rail { position: relative; width: 40px; height: 92px; margin: 2px 0; cursor: ns-resize; touch-action: none; }
.zoom__rail::before { content: ''; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 1px; background: linear-gradient(180deg, var(--gold), rgba(186, 150, 88, .15)); }
.zoom__notch { position: absolute; left: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; background: rgba(230, 211, 163, .35);
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%); }
.zoom__notch:first-child { margin-top: 0; } .zoom__notch:nth-child(5) { margin-top: -7px; }
.zoom__thumb { position: absolute; left: 50%; top: 100%; width: 16px; height: 16px; margin: -8px 0 0 -8px; background: linear-gradient(180deg, var(--gold-2), var(--gold));
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%); filter: drop-shadow(0 0 4px rgba(230, 211, 163, .8)); pointer-events: none; }
.zoom__rail:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; border-radius: 10px; }
.ctl { width: 46px; height: 42px; border-radius: 14px !important; }
.ctl[aria-pressed="true"] { color: var(--gold-2); box-shadow: inset 0 0 0 1px var(--gold), var(--shadow-2); }
.ctl__txt { font: 600 11.5px/1 var(--font-caps); letter-spacing: .08em; }

/* ================================================================ hints, coach, toast */
.hint { position: fixed; left: 50%; bottom: 26px; z-index: var(--z-ui); display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 10px; border-radius: var(--r-pill) !important;
  transform: translateX(-50%); color: var(--ink-2); font: 500 13px/1.2 var(--font-ui); animation: rise .3s var(--ease); pointer-events: none; }
.hint b { color: var(--gold-2); font-family: var(--font-caps); letter-spacing: .04em; }
.hint__ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.hint__track { fill: none; stroke: rgba(230, 211, 163, .18); stroke-width: 3; }
.hint__prog { fill: none; stroke: var(--gold-2); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 94.25; transition: stroke-dashoffset .12s linear; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.coach { position: fixed; left: 50%; bottom: 26px; z-index: var(--z-ui); display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; border-radius: var(--r-pill) !important;
  transform: translate(-50%, 12px); opacity: 0; transition: opacity .4s var(--ease), transform .4s var(--ease); color: var(--ink-2); font: 400 13.5px/1 var(--font-ui); white-space: nowrap; }
.coach.is-in { opacity: 1; transform: translate(-50%, 0); }
.coach__item { display: inline-flex; align-items: center; gap: 8px; }
.coach__item .ico { width: 18px; height: 18px; color: var(--gold); }
.coach b { font-weight: 500; }
.coach__sep { color: var(--gold); }
.coach__x { width: 28px; height: 28px; }
.coach__x .ico { width: 14px; height: 14px; }
.card-open .coach, .card-open .hint { left: calc(50% - 200px); }
.toast { position: fixed; left: 50%; top: 84px; z-index: 45; padding: 9px 16px; border-radius: var(--r-pill); transform: translate(-50%, -6px); opacity: 0;
  background: rgba(20, 15, 30, .92); border: 1px solid var(--line-strong); color: var(--ink); font: 500 13px/1.2 var(--font-ui); box-shadow: var(--shadow-2); transition: all .25s var(--ease); pointer-events: none; }
.toast.is-in { opacity: 1; transform: translate(-50%, 0); }

/* ================================================================ ink-wash transition */
.xfade { position: fixed; inset: 0; z-index: 15; overflow: hidden; pointer-events: none; }
.xfade__snap { position: absolute; inset: 0; will-change: transform, opacity; }
.xfade__img { display: block; width: 100%; height: 100%; }
.xfade__ink { position: absolute; left: var(--ox, 50%); top: var(--oy, 50%); width: 300vmax; height: 300vmax; margin: -150vmax 0 0 -150vmax; opacity: 0; will-change: transform, opacity;
  border-radius: 50%; background: radial-gradient(circle, #140f1e 0%, #1b1425 30%, rgba(38, 27, 56, .97) 40%, rgba(46, 33, 64, .55) 47%, rgba(46, 33, 64, 0) 54%); }
.xfade__ink i { position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(27, 20, 37, .95) 0%, rgba(46, 33, 64, .5) 45%, transparent 70%); }
.xfade__ink i:nth-child(1) { left: 24%; top: 30%; width: 22%; height: 20%; }
.xfade__ink i:nth-child(2) { left: 56%; top: 22%; width: 18%; height: 24%; }
.xfade__ink i:nth-child(3) { left: 40%; top: 58%; width: 24%; height: 18%; }
.xfade__title { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); opacity: 0; transition: opacity .35s var(--ease) .15s;
  font: 700 clamp(22px, 3.2vw, 38px)/1.1 var(--font-display); color: var(--gold-2); letter-spacing: .04em; text-align: center; text-shadow: 0 2px 24px rgba(0, 0, 0, .6); white-space: nowrap; }
.is-transitioning .xfade__title { opacity: 1; }

/* ================================================================ loader, fallback, help */
.loader { position: fixed; inset: 0; z-index: var(--z-loader); display: grid; place-items: center; background: radial-gradient(ellipse at 50% 42%, #2e2140 0%, #1b1425 40%, #0e0a16 100%); transition: opacity .6s var(--ease); }
.loader.is-done { opacity: 0; pointer-events: none; }
.loader__inner { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px; text-align: center; }
.loader__art { width: 210px; height: 105px; overflow: visible; }
.loader__path { fill: none; stroke: rgba(186, 150, 88, .22); stroke-width: 1.2; }
.loader__ink { fill: none; stroke: var(--gold-2); stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 34 230; animation: inkrun 2.4s linear infinite; }
.loader__feather { fill: var(--ink); stroke: none; }
.loader__feather .vane { fill: rgba(246, 241, 250, .92); }
.loader__feather .shaft { fill: none; stroke: #1b1425; stroke-width: .8; }
@keyframes inkrun { from { stroke-dashoffset: 264; } to { stroke-dashoffset: 0; } }
.loader__kicker { font: 500 10px/1 var(--font-mono); letter-spacing: .32em; text-transform: uppercase; color: var(--faint); }
.loader__book { font: 700 26px/1.15 var(--font-display); color: var(--gold-2); letter-spacing: .02em; }
.loader__msg { min-height: 1.3em; font: italic 500 17px/1.3 var(--font-label); color: var(--muted); }
.loader__bar { width: 200px; height: 2px; margin-top: 6px; overflow: hidden; border-radius: 2px; background: rgba(230, 211, 163, .14); }
.loader__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transform: scaleX(.04); transform-origin: left; transition: transform .35s var(--ease); }
.fallback { position: absolute; left: 50%; top: 50%; z-index: 5; width: min(460px, calc(100% - 32px)); padding: 28px 26px; transform: translate(-50%, -50%); text-align: center; cursor: default; }
.fallback__mark { width: 56px; height: 56px; margin: 0 auto 12px; fill: none; stroke: var(--gold); stroke-width: 1.4; }
.fallback h2 { margin-bottom: 10px; font-size: 20px; color: var(--gold-2); }
.fallback p { margin-bottom: 10px; font: 400 16px/1.55 var(--font-body); color: var(--ink-2); }
.fallback .btn { margin-top: 8px; }
.fallback__err { font: 400 12px/1.4 var(--font-mono) !important; color: var(--faint) !important; }
.no-webgl .controls, .no-webgl .coach { display: none; }
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; background: rgba(8, 5, 14, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal__box { position: relative; width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 28px 30px 24px; }
.modal__x { position: absolute; top: 14px; right: 14px; }
.modal h2 { margin-bottom: 8px; font-size: 22px; color: var(--gold-2); }
.modal__lede { margin-bottom: 18px; font: italic 500 18px/1.45 var(--font-label); color: var(--ink-2); }
.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.help-grid h3 { margin-bottom: 8px; font: 600 11px/1 var(--font-caps); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.help-grid dl { margin: 0; display: grid; gap: 4px; }
.help-grid dt { font: 500 13px/1.3 var(--font-ui); color: var(--ink); }
.help-grid dd { margin: 0 0 6px; font: 400 14px/1.3 var(--font-body); color: var(--muted); }
.modal__fine { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font: 400 13px/1.6 var(--font-ui); color: var(--muted); }

/* ================================================================ mobile (< 760px) */
@media (max-width: 759px) {
  /* smaller map labels on phones so the ribbons don't bury the diorama */
  .lbl__band { height: 19px; gap: 4px; padding: 0 8px 0 7px; font-size: 9px; letter-spacing: .1em; }
  .lbl__tail { top: 5px; width: 19px; height: 19px; }
  .lbl__ribbon { padding: 0 10px; }
  .lbl__emblem { width: 12px; height: 12px; }
  .lbl--pin .lbl__text { font-size: 12.5px; }
  .lbl--region .lbl__text { font-size: 13px; letter-spacing: .28em; }
  .lbl--water .lbl__text { font-size: 14px; }
  .topbar { top: 0; left: 0; right: 0; height: 52px; gap: 6px; padding: 0 6px 0 10px; border-radius: 0 0 16px 16px; border-top: 0; }
  .brand__name, .book__author, .search__kbd { display: none; }
  .brand__mark { width: 26px; height: 26px; }
  .book { flex: 1; padding-left: 10px; }
  .book__title { font-size: 14px; }
  .tb-spacer { display: none; }
  .tabs { position: absolute; top: calc(100% + 6px); left: 8px; right: 8px; margin: 0; overflow-x: auto; scrollbar-width: none; background: rgba(20, 15, 30, .78);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 1 0 auto; padding: 9px 12px; font-size: 10px; }
  .search { display: none; }
  .search-open .search { display: block; position: absolute; left: 8px; right: 8px; top: 7px; width: auto; z-index: 3; }
  .search-open .search input { height: 38px; background: #1b1425; }
  .search__list { min-width: 0; max-height: 55vh; }
  .tb-search-open, .tb-more { display: inline-grid; }
  .tb-btn { width: 34px; height: 34px; }
  .tb-btn .ico { width: 18px; height: 18px; }
  .spoil { display: none; }
  .more-open .spoil { display: flex; position: absolute; top: calc(100% + 54px); right: 8px; background: rgba(20, 15, 30, .95); box-shadow: var(--shadow-2); }
  .crumbs { top: 104px; left: 8px; max-width: calc(100vw - 80px); }
  .crumbs ol { padding: 5px 10px; flex-wrap: nowrap; }
  .crumbs li:not(:nth-last-child(-n+2)) { display: none; }
  .crumbs li:nth-last-child(2)::before { content: '\2039'; margin: 0 6px 0 0; }
  .crumbs li:nth-last-child(2):first-child::before { display: none; }
  .crumbs li { min-width: 0; white-space: nowrap; }
  .crumbs li span, .crumbs li button { overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .crumbs li { font-size: 9.5px; }
  .drawer-closed .crumbs { left: 8px; }
  .drawer { left: 0; right: 0; top: auto; bottom: 0; width: auto; height: min(74vh, 640px); border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(calc(100% - 58px - env(safe-area-inset-bottom))); transition: transform .38s var(--ease); z-index: 25; }
  .drawer.is-open { transform: none; }
  .drawer__grab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; width: 100%; height: 58px; flex: none; border: 0; background: none; cursor: pointer; color: var(--ink-2); }
  .drawer__pill { width: 40px; height: 4px; border-radius: 4px; background: rgba(230, 211, 163, .45); }
  .drawer__peek { font: 600 10.5px/1 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: var(--gold-2); }
  .drawer__head { display: none; }
  .drawer__body { padding-top: 0; }
  .drawer-open { display: none !important; }
  .fchip__medal { width: 44px; height: 44px; }
  .card { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 56vh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: sheetIn .34s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .card.is-expanded { max-height: calc(100% - 64px); }
  .card__grab { display: flex; justify-content: center; align-items: center; height: 22px; flex: none; border: 0; background: none; cursor: pointer; }
  .card__scroll { padding: 4px 18px 18px; }
  .card__close { top: 16px; right: 12px; }
  .card__name { font-size: 20px; }
  .card__medal { width: 48px; height: 48px; }
  .card__summary { font-size: 17.5px; }
  @keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .controls { right: 10px; bottom: 70px; gap: 6px; }
  .card-open .controls { right: 10px; opacity: 0; pointer-events: none; }
  .compass { position: fixed; top: 104px; right: 10px; width: 50px; height: 50px; }
  .zoom { width: 42px; }
  .zoom__rail { display: none; }
  .zoom__btn { width: 40px; height: 40px; }
  .ctl { width: 42px; height: 40px; }
  #full-btn { display: none; }
  .hint { bottom: 72px; max-width: calc(100vw - 76px); left: calc(50% - 30px); white-space: normal; }
  .coach { bottom: 72px; left: 8px; right: 62px; transform: translateY(12px); flex-wrap: wrap; justify-content: center; gap: 6px 12px; padding: 10px 34px 10px 14px;
    border-radius: 18px !important; font-size: 12.5px; white-space: normal; }
  .coach.is-in { transform: none; }
  .coach__x { position: absolute; right: 4px; top: 50%; margin-top: -14px; }
  .coach__sep { display: none; }
  .coach__item .ico { width: 15px; height: 15px; }
  .card-open .coach, .card-open .hint { left: 50%; opacity: 0; }
  .toast { top: 108px; }
  .help-grid { grid-template-columns: 1fr; }
  .modal__box { padding: 22px 18px; }
  .fallback { top: 45%; }
}
@media (max-width: 1180px) and (min-width: 760px) {
  .brand__name { display: none; }
  .search { width: 190px; }
  .spoil button { padding: 0 8px; }
  .crumbs { max-width: calc(100vw - 760px); }
}
@media (max-width: 1000px) and (min-width: 760px) {
  .book__author { display: none; }
  .drawer { width: 300px; }
  .card { width: 340px; }
  .card-open .controls { right: 364px; }
  .crumbs { left: 324px; }
  .ad-wrap .ad-slot { transform: scale(.9); }
}
@media (prefers-reduced-motion: reduce) {
  .lbl__ring { animation: none; }
}
.xfade__title::before { display: block; margin-bottom: 10px; font: 500 11px/1 var(--font-mono); letter-spacing: .34em; text-transform: uppercase; color: var(--muted); content: 'Opening'; }
.xfade.is-portal .xfade__title::before { content: 'Entering'; }
.xfade.is-portal-out .xfade__title::before { content: 'Returning to'; }
.xfade__title::after { display: block; margin-top: 8px; font: 400 22px/1 var(--font-body); color: var(--gold); content: '\221E'; }

/* ================================================================ street mode (docs/STREET-MODE.md §8.6) */
/* Walk button: the raven-eye glyph above the compass; pressed while you are in the streets */
.walk-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 52px; color: var(--gold-2); }
.walk-btn .emblem, .walk-btn .ico { width: 22px; height: 22px; }
.walk-btn__txt { font: 600 8.5px/1 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.walk-btn[aria-pressed="true"] { color: #1a1206; background: linear-gradient(180deg, var(--gold-2), var(--gold)) !important; box-shadow: var(--glow-gold); }
.walk-btn[aria-pressed="true"] .walk-btn__txt { color: #1a1206; }
.walk-btn:focus-visible, .mapview-btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.is-descent .walk-btn:not([aria-pressed="true"]) { box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(230, 211, 163, .45), var(--shadow-2); }
.mapview-btn { display: none; flex-direction: column; gap: 2px; height: 52px; color: var(--gold-2); }
.mapview-btn .ico { width: 18px; height: 18px; }
.mapview-btn .ctl__txt { font-size: 9px; }
/* street HUD: no zoom rail, no 2D; Map view rises back to the aerial map */
.is-street .mapview-btn { display: flex; }
.is-street .zoom__rail, .is-street #tilt-btn { display: none; }
.is-street .stage { cursor: grab; }
.is-street .stage.is-grabbing { cursor: grabbing; }
.is-street .stage.is-pointing { cursor: pointer; }
.is-street .stage::after { background: radial-gradient(ellipse 95% 85% at 50% 50%, transparent 70%, rgba(8, 5, 14, .32) 100%); }
body.is-transitioning .card, body.is-transitioning .aside, body.is-transitioning .door-pill { pointer-events: none; }   /* CR-3 */

/* labels at street level: smaller ribbons standing on their buildings, no leader lines */
.labels.is-street .lbl--banner .lbl__leader { display: none; }
.labels.is-street .lbl--banner .lbl__body { bottom: 0; }
.labels.is-street .lbl__band { height: 20px; gap: 5px; padding: 0 9px 0 8px; font-size: 9.5px; }
.labels.is-street .lbl__tail { top: 5px; width: 20px; height: 20px; }
.labels.is-street .lbl__ribbon { padding: 0 11px; }
.labels.is-street .lbl--pin .lbl__text { font-size: 12.5px; }
.labels.is-street .lbl--small .lbl__text { font-size: 11px; }

/* the click-to-go ring (fallback drawn on the label layer when the renderer has no cursor pass) */
.cursor-ring { position: absolute; left: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 2px solid rgba(242, 198, 107, .95); background: radial-gradient(circle, rgba(242, 198, 107, .28) 0 38%, transparent 40%);
  box-shadow: 0 0 10px rgba(242, 198, 107, .55), inset 0 0 8px rgba(242, 198, 107, .45); transition: opacity .15s; will-change: transform; }
.cursor-ring.is-on { opacity: .9; }

/* descent hint sits above the coach line */
.hint--street { bottom: 26px; }
.hint--street .hint__prog { transition: stroke-dashoffset .08s linear; }

/* minimap: octagon-framed painted map with your position and view wedge; click to go there */
.minimap { position: fixed; left: 14px; bottom: 14px; z-index: var(--z-ui); width: 176px; height: 176px; cursor: crosshair; transition: left .32s var(--ease);
  filter: drop-shadow(0 8px 22px rgba(5, 2, 14, .55)); animation: mmIn .35s var(--ease); }
body:not(.drawer-closed) .minimap { left: 358px; }
@keyframes mmIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
.minimap__frame { position: absolute; inset: 0; overflow: hidden; background: #2b4a52;
  clip-path: polygon(29.3% 1.5%, 70.7% 1.5%, 98.5% 29.3%, 98.5% 70.7%, 70.7% 98.5%, 29.3% 98.5%, 1.5% 70.7%, 1.5% 29.3%); }
.minimap canvas { display: block; width: 100%; height: 100%; }
.minimap__oct { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: var(--gold); stroke-width: 2.2; }
.minimap__cap { position: absolute; left: 50%; bottom: -20px; transform: translateX(-50%); white-space: nowrap; opacity: 0; transition: opacity .2s;
  font: 500 9.5px/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.minimap:hover .minimap__cap { opacity: 1; }

/* the Raven's aside */
.aside { position: fixed; left: 14px; bottom: 206px; z-index: var(--z-ui); display: flex; align-items: flex-start; gap: 12px; width: min(360px, calc(100vw - 120px));
  padding: 14px 40px 12px 14px; opacity: 0; transform: translateY(8px); transition: opacity .26s var(--ease), transform .26s var(--ease), left .32s var(--ease); }
body:not(.drawer-closed) .aside { left: 358px; }
.aside.is-in { opacity: 1; transform: none; }
.aside__medal { display: grid; place-items: center; width: 38px; height: 38px; flex: none; color: #f6f1fa;
  background: radial-gradient(circle at 35% 30%, #7d5aa3, #5b3f7a 55%, #2e2140);
  clip-path: polygon(29.3% 0, 70.7% 0, 100% 29.3%, 100% 70.7%, 70.7% 100%, 29.3% 100%, 0 70.7%, 0 29.3%); }
.aside__text { margin: 0; font: italic 500 17.5px/1.36 var(--font-label); color: var(--ink); }
.aside__credit { margin: 6px 0 0; font: 600 9.5px/1.2 var(--font-caps); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); font-variant: small-caps; }
.aside__credit span { color: var(--muted); letter-spacing: .08em; }
.aside__x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; }
.aside__x .ico { width: 14px; height: 14px; }

/* Step inside pill (walkable interiors) */
.door-pill { position: fixed; left: 50%; bottom: 82px; z-index: var(--z-ui); display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 14px;
  border-radius: var(--r-pill) !important; transform: translateX(-50%); color: var(--ink); cursor: pointer; font: 500 14px/1 var(--font-ui); animation: rise .3s var(--ease); }
.door-pill .ico { width: 18px; height: 18px; color: var(--gold-2); }
.door-pill b { color: var(--gold-2); font-family: var(--font-caps); font-weight: 600; letter-spacing: .04em; }
.door-pill:hover { box-shadow: var(--glow-gold); }
.card-open .door-pill { left: calc(50% - 200px); }

/* ink veil for teleports and stepping through doors */
.veil { position: fixed; inset: 0; z-index: 16; pointer-events: none; opacity: 0; transition: opacity .25s var(--ease);
  background: radial-gradient(ellipse at 50% 50%, rgba(46, 33, 64, .92), rgba(20, 15, 30, .98)); }
.veil.is-on { opacity: 1; }

.coach--street { bottom: 26px; }
.help-grid { grid-template-columns: repeat(4, 1fr); }
.modal__box { width: min(900px, 100%); }

@media (max-width: 1180px) and (min-width: 760px) {
  .help-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 759px) {
  .walk-btn { width: 42px; height: 46px; }
  .mapview-btn { width: 42px; height: 46px; }
  .minimap { left: 8px; top: 138px; bottom: auto; width: 112px; height: 112px; }
  body:not(.drawer-closed) .minimap { left: 8px; }
  .minimap__cap { display: none; }
  .aside { left: 8px; right: 62px; bottom: 76px; width: auto; }
  body:not(.drawer-closed) .aside { left: 8px; }
  .aside__text { font-size: 16px; }
  .door-pill { bottom: 128px; }
  .coach--street, .hint--street { bottom: 72px; }
  .card-open .door-pill, .card-open .aside { opacity: 0; pointer-events: none; }
  .help-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .minimap, .door-pill { animation: none; }
  .aside, .veil { transition: none; }
}
