/* Cabinet of Arms — a minimal plate with a vintage hand.
   The page is the paper; the WebGL canvas prints on top of it. */

:root {
  --paper: #ece2cb;
  --paper-hi: #f6f0e2;
  --ink: #1f1913;
  --ink-2: #3a2f24;
  --muted: #6e5c48;
  --faint: #a08c74;
  --rubric: #a3301d;
  --rubric-hi: #8a2616;
  --glass: rgba(249, 244, 232, 0.74);
  --glass-strong: rgba(250, 246, 236, 0.9);
  --line: rgba(70, 52, 32, 0.14);
  --line-2: rgba(70, 52, 32, 0.24);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset, 0 14px 34px -16px rgba(60, 40, 20, 0.38), 0 2px 6px -2px rgba(60, 40, 20, 0.12);
  --display: "Bodoni Moda", "Bodoni 72", Didot, Georgia, serif;
  --ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 16px;
  --gap: 20px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  font-family: var(--ui);
  font-size: 14px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 75% 65% at 50% 45%, rgba(253, 248, 236, 0.75), rgba(253, 248, 236, 0) 70%),
    radial-gradient(ellipse 130% 120% at 50% 50%, rgba(0, 0, 0, 0) 58%, rgba(112, 82, 44, 0.24)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .23 0 0 0 0 .13 -1.1 0 0 0 .7'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004' numOctaves='5' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .33 0 0 0 0 .18 1.4 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)' opacity='.26'/%3E%3C/svg%3E");
  background-size: auto, auto, 240px 240px, cover;
  background-repeat: no-repeat, no-repeat, repeat, no-repeat;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga";
}
button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid rgba(163, 48, 29, 0.55); outline-offset: 2px; border-radius: 8px; }

#gl {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease 0.1s;
}
#gl.ready { opacity: 1; }
.still #gl, .still * { transition: none !important; animation: none !important; }

.stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  touch-action: none;
  cursor: grab;
  outline: none;
}
.stage:active { cursor: grabbing; }
.stage.pick { cursor: pointer; }

/* ---------- shared surfaces ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.over {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- brand ---------- */
.brand {
  position: fixed;
  left: 28px;
  top: 24px;
  z-index: 5;
  pointer-events: none;
}
.brand .over b { font-weight: 600; color: var(--rubric); }
/* a soft wash of the page colour behind the title, so it reads over trees, rigging or sea */
.brand::before {
  content: "";
  position: absolute;
  inset: -40px -90px -46px -60px;
  z-index: -1;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--paper) 78%, transparent) 0%, color-mix(in srgb, var(--paper) 55%, transparent) 55%, transparent 100%);
  pointer-events: none;
}
.brand .over, .brand h1, .brand .sub { text-shadow: 0 0 3px color-mix(in srgb, var(--paper) 70%, transparent); }
.brand h1 {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(34px, 3.4vw, 54px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand h1 i { font-weight: 400; font-size: 0.62em; margin-right: 0.12em; color: var(--ink-2); }
.brand .sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand .sub::before { content: ""; flex: 0 0 18px; height: 1px; background: var(--line-2); }

/* ---------- toolbar ---------- */
.toolbar {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
}
.tb {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.tb:hover { background: rgba(70, 52, 32, 0.07); }
.tb[aria-pressed="true"], .tb[aria-expanded="true"] { background: var(--ink); color: var(--paper-hi); }
.tb.only { padding: 0; width: 36px; justify-content: center; }
.toolbar .sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }

/* ---------- settings popover ---------- */
.popover {
  position: fixed;
  right: 20px;
  top: 72px;
  z-index: 9;
  width: 280px;
  padding: 14px;
  border-radius: var(--r);
  animation: pop 0.2s ease both;
}
.popover[hidden] { display: none; }
.popover .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 2px; font-size: 13px; color: var(--ink-2); }
.popover .row + .row { border-top: 1px solid var(--line); }
.popover .keys { margin: 10px 2px 0; font-size: 11.5px; line-height: 1.7; color: var(--muted); }
.popover kbd, .hint kbd {
  font-family: var(--ui);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink-2);
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

.switch {
  appearance: none;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: rgba(70, 52, 32, 0.18);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex: none;
}
.switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(15px); }

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: rgba(70, 52, 32, 0.08);
  gap: 2px;
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--paper-hi); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 20, 0.18); }

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.35);
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.btn:hover { background: rgba(255, 255, 255, 0.7); border-color: var(--muted); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.dark, .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper-hi); border-color: var(--ink); }

/* ---------- cards (right) ---------- */
.cards {
  position: fixed;
  right: 20px;
  top: 76px;
  bottom: 20px;
  z-index: 7;
  width: 384px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  pointer-events: none;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.cards::-webkit-scrollbar { display: none; }
.card {
  pointer-events: auto;
  border-radius: var(--r);
  padding: 16px 18px 18px;
  flex: none;
  animation: slide 0.32s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes slide { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.card-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.card-h h2 {
  margin: 3px 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.1;
  color: var(--ink);
}
.x {
  appearance: none;
  border: 0;
  background: rgba(70, 52, 32, 0.07);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--muted);
  flex: none;
  transition: background 0.18s, color 0.18s;
}
.x:hover { background: rgba(70, 52, 32, 0.14); color: var(--ink); }
.x .icon { width: 14px; height: 14px; }
.card p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.card p + p { margin-top: 10px; }
.card em { font-family: var(--display); font-style: italic; font-size: 1.04em; }
.rule { height: 1px; background: var(--line); margin: 14px 0; position: relative; }
.rule::after { content: ""; position: absolute; left: 50%; top: -3px; width: 6px; height: 6px; transform: translateX(-50%) rotate(45deg); background: var(--paper-hi); border: 1px solid var(--line-2); }

.specs { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.specs div { background: rgba(255, 255, 255, 0.42); padding: 9px 12px; }
.specs dt { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.specs dd { margin: 3px 0 0; font-family: var(--display); font-size: 16px; color: var(--ink); }
.notes { margin: 0; padding: 0; list-style: none; }
.notes li { position: relative; padding-left: 16px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.notes li + li { margin-top: 7px; }
.notes li::before { content: ""; position: absolute; left: 2px; top: 0.6em; width: 5px; height: 5px; transform: rotate(45deg); background: var(--rubric); opacity: 0.75; }
.source { margin-top: 12px !important; font-size: 11.5px !important; color: var(--muted) !important; line-height: 1.5 !important; }

/* charts */
.fig { margin: 0; }
.fig + .fig { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fig-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.fig-h span { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.fig-h i { font-family: var(--display); font-size: 13px; color: var(--muted); }
.fig svg { display: block; width: 100%; height: 132px; overflow: visible; }
.fig svg text { font-family: var(--ui); font-size: 9.5px; fill: var(--muted); }
.fig svg .lab { font-family: var(--display); font-style: italic; font-size: 11px; fill: var(--ink-2); }
.fig svg .ax { stroke: var(--line-2); stroke-width: 1; fill: none; }
.fig svg .grid { stroke: var(--line); stroke-width: 1; fill: none; }
.fig svg .p { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.fig svg .v { stroke: var(--rubric); stroke-width: 1.4; fill: none; stroke-dasharray: 4 3; }
.fig svg .vac { stroke: var(--faint); stroke-width: 1.1; fill: none; stroke-dasharray: 2 3; }
.fig svg .air { stroke: var(--ink); stroke-width: 1.6; fill: none; }
.fig svg .hist { fill: var(--paper-hi); stroke: var(--rubric); stroke-width: 1.2; }
.fig svg .dot { fill: var(--rubric); }
.fig svg .burst { stroke: var(--rubric); stroke-width: 1.2; fill: none; }
.fig svg .shade { fill: rgba(70, 52, 32, 0.08); }
.fig svg .bar { fill: var(--line-2); }
.fig svg .barhi { fill: var(--rubric); opacity: 0.85; }
.fig svg .tick { stroke: var(--paper-hi); stroke-width: 1; opacity: 0.7; }
.fig .note { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.fig .note b { font-weight: 600; color: var(--ink); }
.legend { display: flex; gap: 14px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 0; border-top: 1.6px solid var(--ink); }
.legend i.v { border-top: 1.4px dashed var(--rubric); }
.legend i.vac { border-top: 1.2px dotted var(--faint); }
.legend i.hist { width: 8px; height: 8px; border-radius: 50%; border: 1.2px solid var(--rubric); }

/* drawings */
.dwg { margin: 0; }
.dwg + .dwg { margin-top: 12px; }
.dwg-frame { position: relative; width: 100%; aspect-ratio: 16 / 8.6; border-radius: 10px; background: rgba(255, 255, 255, 0.38); border: 1px solid var(--line); overflow: hidden; }
.dwg-frame canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.dwg-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.dwg figcaption { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.dwg figcaption i { font-family: var(--display); letter-spacing: 0; text-transform: none; font-size: 13px; color: var(--ink-2); }
.dims .dim { stroke: var(--muted); stroke-width: 0.8; fill: none; }
.dims .ext { stroke: var(--line-2); stroke-width: 0.7; fill: none; }
.dims .cl { stroke: var(--muted); stroke-width: 0.7; stroke-dasharray: 9 3 2 3; fill: none; }
.dims .gnd { stroke: var(--muted); stroke-width: 1; fill: none; }
.dims .hatch { stroke: var(--line-2); stroke-width: 0.7; }
.dims .arc { stroke: var(--rubric); stroke-width: 1; fill: none; }
.dims .arr { fill: var(--muted); stroke: none; }
.dims .arr.r { fill: var(--rubric); }
.dims text { fill: var(--ink-2); font-family: var(--ui); font-size: 10px; paint-order: stroke; stroke: rgba(246, 240, 226, 0.95); stroke-width: 3px; stroke-linejoin: round; }
.dims text.lab { font-family: var(--display); font-style: italic; font-size: 11px; }
.dims text.r { fill: var(--rubric); }

/* ---------- bottom: view bar + dock ---------- */
.bottom {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  z-index: 8;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 16px;
  pointer-events: none;
}
.bottom > * { pointer-events: auto; }
.bottom-spacer { pointer-events: none; }
.viewbar { justify-self: start; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.viewbar .glass { border-radius: 999px; padding: 4px; display: flex; align-items: center; gap: 4px; }
.viewbar .seg { background: transparent; }
.chip {
  appearance: none;
  border: 0;
  background: transparent;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.chip:hover { color: var(--ink); background: rgba(70, 52, 32, 0.06); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper-hi); }
.chip .icon { width: 15px; height: 15px; }

.dock {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 8px 8px 8px 16px;
  border-radius: 22px;
}
.dock .grp { display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 4px 16px; }
.dock .grp + .grp { border-left: 1px solid var(--line); }
.dock .lbl { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 10.5px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.dock .lbl output { font-family: var(--display); font-size: 17px; letter-spacing: 0; text-transform: none; color: var(--ink); }
.dock .note { font-size: 11.5px; color: var(--muted); white-space: nowrap; min-height: 1.3em; }
.ammo { display: flex; gap: 4px; }
.ammo button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  width: 66px;
  padding: 5px 2px 4px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--muted);
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.ammo button svg { width: 46px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.ammo button span { font-size: 11.5px; font-weight: 500; }
.ammo button:hover { color: var(--ink); background: rgba(70, 52, 32, 0.05); }
.ammo button[aria-checked="true"] { color: var(--ink); background: var(--paper-hi); border-color: var(--line-2); box-shadow: 0 1px 3px rgba(60, 40, 20, 0.12); }
.ammo button[aria-checked="true"] span { color: var(--rubric); }

.range { -webkit-appearance: none; appearance: none; width: 200px; height: 20px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--ink) var(--p, 50%), rgba(70, 52, 32, 0.18) var(--p, 50%)); }
.range::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--ink) var(--p, 50%), rgba(70, 52, 32, 0.18) var(--p, 50%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border-radius: 50%; background: var(--paper-hi); border: 1.5px solid var(--ink); box-shadow: 0 1px 4px rgba(60, 40, 20, 0.3); }
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--paper-hi); border: 1.5px solid var(--ink); box-shadow: 0 1px 4px rgba(60, 40, 20, 0.3); }
.range:disabled { opacity: 0.35; cursor: default; }
.dock .grp { transition: opacity 0.25s, max-width 0.35s ease, padding 0.35s ease; max-width: 420px; }
.dock .grp.off { opacity: 0; max-width: 0; padding-left: 0; padding-right: 0; border-left-color: transparent !important; pointer-events: none; overflow: hidden; }
.range-grp.small .range { width: 140px; }
/* the arm's challenge: a tab above the dock (see ui.syncGoal) */
.dock { position: relative; }
.goal {
  appearance: none;
  position: absolute;
  left: 14px;
  bottom: calc(100% + 8px);
  max-width: min(560px, calc(100vw - 60px));
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px -12px rgba(40, 25, 10, 0.5);
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.goal .g-icon { flex: none; display: inline-flex; margin-top: 1px; color: var(--rubric); }
.goal .g-icon .icon { width: 18px; height: 18px; }
.goal .g-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.goal .g-top { display: flex; align-items: baseline; gap: 8px; }
.goal .g-k { flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rubric); }
.goal .g-t { font-family: var(--display); font-size: 15px; line-height: 1.25; }
.goal .g-s { font-size: 11.5px; color: var(--muted); }
.goal .g-s:empty { display: none; }
.goal .g-h { display: none; font-size: 11.5px; line-height: 1.45; color: var(--ink-2); max-width: 480px; }
.goal[aria-expanded="true"] .g-h:not(:empty) { display: block; margin-top: 3px; padding-top: 5px; border-top: 1px solid var(--line); }
.goal.tried .g-s { color: var(--ink-2); }
.goal.done { border-color: color-mix(in srgb, var(--rubric) 45%, transparent); }
.goal.done .g-k { color: var(--rubric); }
.goal.just { animation: goal-met 1.2s ease; }
@keyframes goal-met { 0% { transform: scale(1); } 18% { transform: scale(1.06); box-shadow: 0 0 0 6px color-mix(in srgb, var(--rubric) 25%, transparent); } 100% { transform: scale(1); } }
html.museum-dark .goal { background: rgba(24, 21, 18, 0.86); }
/* the marks of the challenges met, on the cards and in the list */
.pcard .pc-met { position: absolute; right: 6px; top: 6px; display: none; color: var(--rubric); background: var(--paper-hi); border-radius: 50%; line-height: 0; box-shadow: 0 1px 4px rgba(40, 25, 10, 0.25); }
.pcard .pc-met .icon { width: 20px; height: 20px; }
.pcard.met .pc-met { display: block; }
.goalsum { cursor: default; gap: 5px; color: var(--ink-2); }
.goalsum:hover { background: transparent; }
.goalsum .icon { color: var(--rubric); }
.plate-menu button.met i::before { content: "✓"; margin-right: 6px; color: var(--rubric); font-style: normal; }
#goalCount { font-style: normal; color: var(--muted); margin-left: 4px; }

/* a crowded dock, drawn tighter (see fitDock), and at last given a row of its own */
.bottom.stack { grid-template-columns: 1fr; gap: 10px; }
.bottom.stack .dock { order: -1; justify-self: end; }
.bottom.stack .bottom-spacer { display: none; }
.dock.tight .grp { padding: 4px 11px; }
.dock.tight .range { width: 160px; }
.dock.tight .range-grp.small .range { width: 116px; }
.dock.tight .ammo button { width: 56px; }
.dock.tight .ammo button svg { width: 40px; }
.dock.tight .fire { min-width: 116px; padding: 0 14px; }
.dock.tighter .grp { padding: 4px 8px; }
.dock.tighter .range { width: 128px; }
.dock.tighter .range-grp.small .range { width: 100px; }
.dock.tighter .ammo button { width: 50px; }
.dock.tighter .ammo button svg { width: 36px; }
.dock.tighter .ammo button span { font-size: 10.5px; }
.dock.tighter .lbl { letter-spacing: 0.1em; }
.dock.tighter .note { font-size: 10.5px; white-space: normal; max-width: 128px; line-height: 1.25; }
.dock.tighter .range-grp.small .note { max-width: 100px; }
.dock.tighter .fire { min-width: 100px; padding: 0 12px; }

.fire-grp { flex-direction: row !important; align-items: center !important; gap: 10px !important; padding-right: 4px !important; }
.fire {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-hi);
  height: 40px;
  min-width: 132px;
  padding: 0 18px;
  border-radius: 999px;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}
.fire:hover { background: var(--ink-2); border-color: var(--ink-2); }
.fire:active { transform: translateY(1px); }
.fire:focus-visible { outline: 2px solid var(--rubric); outline-offset: 2px; }
.fire small { font-size: 9.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.62; }
.fire small:empty { display: none; }
.fire.busy { background: transparent; color: var(--ink-2); border-color: var(--line-2); }
.fire.busy:hover { background: rgba(70, 52, 32, 0.06); }
.fire .ring { position: absolute; }
.side-btns { display: flex; flex-direction: column; gap: 6px; }

/* ---------- part tags on the model ---------- */
.leaders { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 3; pointer-events: none; overflow: visible; }
.leaders path { stroke: rgba(31, 25, 19, 0.55); stroke-width: 1; fill: none; }
.leaders circle { fill: var(--paper-hi); stroke: var(--ink); stroke-width: 1.4; }
.leaders circle.on { fill: var(--rubric); stroke: var(--paper-hi); }
.tags, .marks { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.tag {
  position: absolute;
  left: 0;
  top: 0;
  appearance: none;
  pointer-events: auto;
  border: 1px solid var(--line-2);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 4px 10px 4px 9px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px -6px rgba(60, 40, 20, 0.4);
  transition: opacity 0.25s, background 0.15s, color 0.15s, border-color 0.15s;
  will-change: transform;
}
.tag:hover { border-color: var(--rubric); color: var(--rubric); }
.tag.on { background: var(--ink); color: var(--paper-hi); border-color: var(--ink); }
.tag.hide { opacity: 0; pointer-events: none; }
.mark {
  position: absolute;
  left: 0;
  top: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(249, 244, 232, 0.8);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: opacity 0.4s;
}
.mark b { font-family: var(--display); font-weight: 500; font-size: 13px; }

/* ---------- floating part card ---------- */
.partcard {
  position: fixed;
  z-index: 9;
  width: 300px;
  border-radius: var(--r);
  padding: 14px 16px 16px;
  animation: pop 0.22s ease both;
}
.partcard[hidden] { display: none; }
.partcard h3 { margin: 4px 0 8px; font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.15; }
.partcard p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.partcard .x { position: absolute; right: 10px; top: 10px; }
.partcard .nav { display: flex; gap: 6px; margin-top: 12px; }

/* ---------- drill & tour panels ---------- */
.panel { position: fixed; z-index: 8; border-radius: var(--r); padding: 16px 18px; animation: pop 0.25s ease both; }
.panel[hidden] { display: none; }
.drillcard { left: 20px; top: 140px; width: 340px; }
.cmd { margin: 6px 0 6px; font-family: var(--display); font-style: italic; font-size: 34px; line-height: 1; color: var(--rubric); }
.step-text { margin: 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); min-height: 4.6em; text-wrap: pretty; }
.steps { display: flex; gap: 4px; margin: 12px 0 10px; }
.steps i { flex: 1; height: 3px; border-radius: 3px; background: rgba(70, 52, 32, 0.15); transition: background 0.3s; }
.steps i.done { background: var(--ink); }
.steps i.on { background: var(--rubric); }
.crew { display: block; width: 100%; height: auto; overflow: visible; margin-top: 4px; }
.crew .gun { fill: none; stroke: var(--ink-2); stroke-width: 1; }
.crew .gunfill { fill: rgba(60, 45, 30, 0.08); stroke: var(--ink-2); stroke-width: 0.8; }
.crew circle { fill: var(--paper-hi); stroke: var(--faint); stroke-width: 0.9; transition: fill 0.2s, stroke 0.2s; }
.crew text { font-family: var(--display); font-size: 8.5px; fill: var(--ink-2); text-anchor: middle; dominant-baseline: central; }
.crew g.on circle { fill: var(--rubric); stroke: var(--rubric); }
.crew g.on text { fill: var(--paper-hi); }
.crew .cap { font-family: var(--ui); font-size: 6.5px; letter-spacing: 0.16em; text-transform: uppercase; fill: var(--muted); }
.panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }

.tourcard { left: 50%; bottom: 152px; width: min(540px, calc(100vw - 40px)); transform: translateX(-50%); animation: none; }
.tourcard h3 { margin: 4px 0 6px; font-family: var(--display); font-weight: 500; font-size: 24px; line-height: 1.1; }
.tourcard p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); min-height: 3em; text-wrap: pretty; }
.tour-prog { flex: 1; height: 2px; border-radius: 2px; background: rgba(70, 52, 32, 0.15); position: relative; overflow: hidden; }
.tour-prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--rubric); }

/* ---------- small things ---------- */
.hint {
  position: fixed;
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
  z-index: 6;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.8s;
  white-space: nowrap;
}
.hint.gone { opacity: 0; }
.toast {
  position: fixed;
  left: 50%;
  top: 22px;
  transform: translateX(-50%) translateY(-8px);
  z-index: 12;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--paper-hi);
  background: rgba(31, 25, 19, 0.88);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
/* flight readout for long shots */
.hud {
  position: fixed;
  left: 50%;
  top: 86px;
  transform: translateX(-50%) translateY(-6px);
  z-index: 11;
  display: flex;
  gap: 22px;
  align-items: flex-end;
  padding: 10px 20px 14px;
  border-radius: var(--r);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
}
.hud.show { opacity: 1; transform: translateX(-50%); }
.hud .it { display: flex; flex-direction: column; gap: 1px; min-width: 62px; }
.hud .k { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.hud .v { font-family: var(--display); font-size: 21px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud .v small { font-family: var(--ui); font-size: 11px; color: var(--muted); margin-left: 2px; }
.hud .bar { position: absolute; left: 20px; right: 20px; bottom: 7px; height: 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.hud .bar i { display: block; height: 100%; background: var(--rubric); }
.hud .tag { position: absolute; left: 20px; top: -9px; font-family: var(--display); font-style: italic; font-size: 12px; color: var(--rubric); background: var(--paper-hi); padding: 0 6px; border-radius: 6px; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; pointer-events: none; transition: opacity 0.8s; }
.loading span { font-family: var(--display); font-style: italic; font-size: 20px; color: var(--muted); }
.loading.done { opacity: 0; }
.noscript, .nogl { position: fixed; inset: auto 0 45% 0; text-align: center; font-family: var(--display); font-style: italic; z-index: 30; padding: 0 24px; }

/* ---------- medium screens ---------- */
@media (max-width: 1360px) {
  .bottom { grid-template-columns: auto 1fr; }
  .bottom .dock { justify-self: end; }
  .bottom-spacer { display: none; }
  .tb .t { display: none; }
  .tb:not(.only) { padding: 0 11px; }
}
@media (max-width: 1100px) {
  .range { width: 150px; }
  .range-grp.small .range { width: 110px; }
  .ammo button { width: 56px; }
  .viewbar .seg button { padding: 0 8px; }
}

/* ---------- phones & portrait tablets ---------- */
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  body { font-size: 13px; }
  .toolbar { left: 8px; right: 8px; top: 8px; justify-content: space-between; padding: 4px; }
  .toolbar .sep { margin: 0 1px; }
  .tb { height: 34px; padding: 0 9px !important; }
  .brand { left: 16px; right: 16px; top: 60px; }
  .brand .over { display: none; }
  .brand h1 { font-size: 28px; margin-top: 0; }
  .brand .sub { font-size: 11.5px; margin-top: 4px; text-wrap: balance; }
  .popover { top: 50px; right: 8px; }
  .bottom { left: 8px; right: 8px; bottom: 8px; grid-template-columns: 1fr; gap: 6px; }
  .viewbar { justify-self: stretch; }
  .viewbar .glass { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .viewbar .seg button, .chip { font-size: 12px; padding: 0 9px; height: 28px; }
  .dock { flex-wrap: wrap; padding: 8px 10px; justify-content: space-between; border-radius: 18px; }
  .dock .grp { padding: 2px 4px; }
  .dock .grp + .grp { border-left: 0; }
  .dock .grp:first-child:not(.range-grp) .lbl { display: none; }
  .hud { top: 74px; gap: 12px; padding: 8px 12px 12px; }
  .hud .v { font-size: 16px; }
  .hud .it { min-width: 0; }
  .dock .grp.range-grp { flex: 1 1 100%; order: 4; max-width: none; }
  .dock .grp.off { display: none; }
  .fire-grp { order: 2; gap: 6px !important; }
  .goal { position: static; order: -1; flex: 1 1 100%; max-width: none; margin: 0 0 6px; padding: 6px 10px; box-shadow: none; }
  .goal .g-t { font-size: 13.5px; }
  .side-btns .btn { height: 30px; padding: 0 10px; }
  .range, .range-grp.small .range { width: 100%; }
  .fire { height: 34px; min-width: 104px; padding: 0 14px; font-size: 13px; gap: 8px; }
  .fire small { font-size: 8.5px; }
  .ammo { gap: 2px; }
  .ammo button { width: 50px; padding: 4px 0; }
  .ammo button svg { width: 38px; height: 16px; }
  .ammo button span { font-size: 10.5px; }
  .cards { left: 8px; right: 8px; width: auto; top: 50px; bottom: auto; max-height: 58vh; z-index: 11; }
  .drillcard { left: 8px; right: 8px; top: 50px; width: auto; z-index: 11; padding: 12px 14px; }
  .drillcard .crew { display: none; }
  .drillcard .step-text { min-height: 0; }
  .cmd { font-size: 26px; }
  .tourcard { top: 50px; bottom: auto; z-index: 11; }
  .tourcard h3 { font-size: 20px; }
  .hint { display: none; }
  .partcard { left: 8px !important; right: 8px; top: 50px !important; bottom: auto; width: auto; z-index: 12; }
  .tag { font-size: 11px; padding: 3px 8px; }
}

/* ---------- modes ---------- */
.is-home .plate-only, .is-home #homeBtn, .is-home .bottom, .is-home .cards, .is-home .hint { display: none !important; }
.is-plate .home, .is-plate .homenames { display: none !important; }

/* ---------- plate switcher ---------- */
.brand .plate-switch {
  pointer-events: auto;
  appearance: none;
  border: 0;
  background: none;
  padding: 3px 6px 3px 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.brand .plate-switch .icon { width: 13px; height: 13px; opacity: 0.7; }
.brand .plate-switch:hover { color: var(--ink); }
.plate-menu {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 26px;
  z-index: 12;
  width: 290px;
  padding: 6px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: pop 0.18s ease both;
}
.plate-menu[hidden] { display: none; }
.plate-menu button {
  appearance: none;
  border: 0;
  background: transparent;
  text-align: left;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: baseline;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.plate-menu button span { font-family: var(--display); font-size: 13px; color: var(--muted); }
.plate-menu button i { font-style: normal; font-size: 11.5px; color: var(--muted); }
.plate-menu button:hover { background: rgba(70, 52, 32, 0.07); }
.plate-menu button.on { background: var(--ink); color: var(--paper-hi); }
.plate-menu button.on span, .plate-menu button.on i { color: rgba(246, 240, 226, 0.7); }
.plate-menu button.all { grid-template-columns: 22px 1fr; border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; padding-top: 10px; align-items: center; }
.plate-menu button.all .icon { width: 15px; height: 15px; }

/* ---------- catalogue home ---------- */
.home { position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 8; pointer-events: none; }
.home[hidden] { display: none; }
.home-bar { pointer-events: auto; border-radius: 22px; padding: 12px 12px 12px; max-width: 1180px; margin: 0 auto; }
.home-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 4px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chipf {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.chipf .icon { width: 15px; height: 15px; }
.chipf:hover { color: var(--ink); background: rgba(70, 52, 32, 0.06); }
.chipf[aria-checked="true"], .chipf[aria-pressed="true"] { background: var(--ink); color: var(--paper-hi); }
.strip { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: thin; padding: 2px 2px 4px; scroll-snap-type: x proximity; }
.pcard {
  appearance: none;
  flex: none;
  width: 196px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
  border-radius: 14px;
  padding: 6px 6px 10px;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.pcard[hidden] { display: none; }
.pcard:hover, .pcard.on { border-color: var(--rubric); background: rgba(255, 255, 255, 0.62); }
.pcard.on { transform: translateY(-2px); }
.pcard .thumb { position: relative; height: 104px; border-radius: 10px; overflow: hidden; background: rgba(236, 226, 203, 0.7); }
.pcard .thumb canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pcard .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.pcard .ph .icon { width: 34px; height: 34px; stroke-width: 1.2; }
.pc-body { padding: 8px 6px 0; }
.pc-over { margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rubric); }
.pc-name { margin: 3px 0 0; font-family: var(--display); font-size: 17px; line-height: 1.15; color: var(--ink); }
.pc-meta { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); }
.strip-div { flex: none; display: flex; align-items: center; padding: 0 4px 0 10px; border-left: 1px solid var(--line-2); margin-left: 4px; }
.strip-div span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
/* eras: tabs in the bar, a heading in the strip, a bracket and a sign on the floor */
.home-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.chips.eras { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.chips.eras::-webkit-scrollbar { display: none; }
.chips.eras .chipf { flex: none; }
@media (max-width: 1100px) and (min-width: 821px) {
  .home-tools .t { display: none; }
}
.efilter { position: relative; }
.chipf .caret { width: 13px; height: 13px; margin-left: -2px; opacity: 0.6; }
.chipf .ef-icon:empty { display: none; }
.chipf .ef-icon { display: inline-flex; }
.emenu { position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 12; border-radius: 16px; padding: 6px; display: grid; grid-template-columns: repeat(2, auto); gap: 2px; min-width: 260px; }
.emenu[hidden] { display: none; }
.emenu .chipf { justify-content: flex-start; }
.emenu .chipf:first-child { grid-column: 1 / -1; }
.strip-div.era-div { appearance: none; background: transparent; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; cursor: pointer; scroll-snap-align: start; }
.strip-div.era-div:first-child { border-left: 0; margin-left: 0; padding-left: 2px; }
.strip-div.era-div[hidden] { display: none; }
.strip-div.era-div span { color: var(--rubric); font-weight: 600; }
.strip-div.era-div:hover span { color: var(--ink); }
.era-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.era-lines path { fill: none; stroke: var(--ink-2); stroke-opacity: 0.38; stroke-width: 1; }
.era-sign {
  position: absolute;
  left: 0;
  top: 0;
  appearance: none;
  border: 0;
  background: transparent;
  padding: 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  pointer-events: auto;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.35s;
}
.era-sign b { font-family: var(--ui); font-size: 10.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); }
.era-sign i { font-family: var(--display); font-size: 13px; color: var(--muted); }
.era-sign:hover b, .era-sign.on b { color: var(--rubric); }

.homenames { position: fixed; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.homenames[hidden] { display: none; }
.hname {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: var(--display);
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 14px -8px rgba(60, 40, 20, 0.45);
  transition: opacity 0.3s, background 0.15s, color 0.15s;
}
.hname span { font-family: var(--ui); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rubric); margin-right: 7px; }
.hname:hover, .hname.on { background: var(--ink); color: var(--paper-hi); border-color: var(--ink); }
.hname.on span, .hname:hover span { color: #e9a08e; }

.compare { position: fixed; right: 20px; top: 76px; width: 384px; z-index: 9; pointer-events: auto; }
.compare[hidden] { display: none; }
.compare svg.cmp { display: block; width: 100%; height: auto; overflow: visible; }
.compare svg text { font-family: var(--ui); font-size: 9.5px; fill: var(--muted); }
.compare svg .lab { font-family: var(--display); font-style: italic; font-size: 11.5px; fill: var(--ink); }
.compare svg .ax { stroke: var(--line-2); fill: none; }
.compare svg .grid { stroke: var(--line); fill: none; }
.compare svg .dot { fill: var(--rubric); }
.compare .note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.cmp-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; }
.cmp-list li { display: flex; justify-content: space-between; padding: 5px 0; border-top: 1px solid var(--line); }
.cmp-list b { font-weight: 500; }
.cmp-list span { color: var(--muted); }

@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  .home { left: 8px; right: 8px; bottom: 8px; }
  .home-bar { padding: 8px; border-radius: 18px; }
  .home-head { flex-direction: column; align-items: stretch; }
  .chips { flex-wrap: nowrap; overflow-x: auto; }
  .chips .chipf { flex: none; }
  .home-tools { justify-content: flex-end; }
  .emenu { right: auto; left: 0; }
  .era-sign b { font-size: 9.5px; letter-spacing: 0.12em; }
  .era-sign i { font-size: 11.5px; }
  .pcard { width: 156px; }
  .pcard .thumb { height: 84px; }
  .compare { left: 8px; right: 8px; width: auto; top: 50px; }
  .hname { font-size: 12px; padding: 4px 9px; }
}

/* ---------------------------------------------------------------- the intro */
.intro { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.intro[hidden] { display: none; }
.intro .lb { position: absolute; z-index: 2; left: 0; right: 0; height: 0; background: #17120d; transition: height 1.2s cubic-bezier(.65, 0, .35, 1); }
.intro .lb.top { top: 0; }
.intro .lb.bot { bottom: 0; }
.intro.title .lb, .intro.film .lb { height: 11vh; }
.intro.out .lb { height: 0; }
.intro .dip { position: absolute; inset: 0; background: var(--paper); opacity: 0; }
.intro .ititle { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; background: radial-gradient(ellipse at center, rgba(236, 226, 203, 0.86) 0%, rgba(236, 226, 203, 0.55) 55%, rgba(236, 226, 203, 0) 100%); opacity: 0; transition: opacity 0.8s ease; pointer-events: none; }
.intro.title .ititle { opacity: 1; pointer-events: auto; }
.intro .ititle .over { font: 600 11px/1 var(--ui); letter-spacing: 0.24em; text-transform: uppercase; color: var(--rubric, #9b2d1c); margin: 0 0 18px; }
.intro .ititle h1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 7vw, 92px); line-height: 1; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
.intro .ititle h1 i { font-size: 0.5em; margin-right: 0.18em; }
.intro .ititle .sub { font-family: var(--display); font-style: italic; font-size: clamp(15px, 1.6vw, 20px); color: rgba(31, 25, 19, 0.72); margin: 14px 0 34px; }
.intro .ibtns { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.intro .ibegin { font: 500 16px/1 var(--display); color: var(--paper-hi); background: var(--ink); border: 0; border-radius: 999px; padding: 15px 28px; cursor: pointer; display: inline-flex; flex-direction: column; gap: 5px; align-items: center; box-shadow: 0 10px 30px rgba(31, 25, 19, 0.25); transition: transform 0.2s ease; }
.intro .ibegin:hover { transform: translateY(-1px); }
.intro .ibegin span { font: 500 10px/1 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.7; }
.intro .iskip, .intro .iskipbtn { font: 500 12px/1 var(--ui); letter-spacing: 0.06em; color: rgba(31, 25, 19, 0.78); background: rgba(246, 240, 226, 0.6); border: 1px solid rgba(31, 25, 19, 0.18); border-radius: 999px; padding: 11px 18px; cursor: pointer; }
.intro .iskipbtn { position: absolute; z-index: 3; right: 22px; bottom: calc(11vh + 16px); opacity: 0; pointer-events: none; transition: opacity 0.6s ease 1s; color: rgba(246, 240, 226, 0.85); background: rgba(23, 18, 13, 0.35); border-color: rgba(246, 240, 226, 0.25); }
.intro.film { pointer-events: auto; cursor: pointer; }
.intro.film .iskipbtn { opacity: 1; pointer-events: auto; }
.intro .icap { position: absolute; z-index: 3; left: 50%; bottom: 0; height: 11vh; width: min(880px, 86vw); transform: translateX(-50%); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; opacity: 0; transition: opacity 0.7s ease; }
.intro .icap.on { opacity: 1; }
.intro .itag { margin: 0 0 6px; font: 600 10px/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: #c9a46a; }
.intro .iline { margin: 0; font-family: var(--display); font-size: clamp(14px, 1.45vw, 19px); line-height: 1.38; color: #f1e8d4; }
/* the film in the dark hall */
html.museum-dark .intro .lb { background: #060504; }
html.museum-dark .intro .ititle { background: radial-gradient(ellipse at center, rgba(8, 7, 6, 0.78) 0%, rgba(8, 7, 6, 0.5) 50%, rgba(8, 7, 6, 0) 100%); }
html.museum-dark .intro .ititle .sub { color: var(--muted); }
html.museum-dark .intro .ititle .over { color: #c9a46a; }
html.museum-dark .intro .ibegin { box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(240, 225, 200, 0.2); }
html.museum-dark .intro .iskip { color: rgba(240, 230, 212, 0.82); background: rgba(240, 225, 200, 0.06); border-color: rgba(240, 225, 200, 0.2); }
html.intro-on #home, html.intro-on #homeNames, html.intro-on #brand, html.intro-on #toolbar, html.intro-on #hint { opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
#home, #homeNames, #brand, #toolbar { transition: opacity 0.8s ease; }
@media (max-width: 720px) {
  .intro.title .lb, .intro.film .lb { height: 14vh; }
  .intro .icap { height: 14vh; }
  .intro .iskipbtn { bottom: calc(14vh + 12px); right: 12px; }
}

/* ------------------------------------------------- condition and museum label */
.viewbar .cond .cl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0 6px 0 10px; }
.mlabel { position: fixed; z-index: 7; left: 20px; top: 132px; width: 286px; padding: 16px 18px 15px; border-radius: 12px; opacity: 0; transform: translateY(6px); transition: opacity 0.6s ease, transform 0.6s ease; pointer-events: none; }
.mlabel.on { opacity: 1; transform: none; pointer-events: auto; }
.mlabel[hidden] { display: none; }
.mlabel .mo { margin: 0 0 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--rubric); }
.mlabel h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 19px; line-height: 1.2; color: var(--ink); }
.mlabel .mp { margin: 3px 0 10px; font-family: var(--display); font-style: italic; font-size: 13px; color: var(--muted); }
.mlabel .mm { margin: 0 0 8px; font-size: 12px; line-height: 1.45; color: var(--ink-2); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.mlabel .ms { margin: 0 0 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.mlabel .mf { margin: 0; font-size: 11px; color: var(--faint); }
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  /* on a phone the label is one line above the controls, and opens on a tap */
  .mlabel { top: auto; bottom: var(--mlabel-b, 168px); left: 8px; right: 8px; width: auto; padding: 9px 36px 9px 14px; cursor: pointer; }
  .mlabel::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-135deg); transition: transform 0.25s ease; }
  .mlabel.open::after { top: 22px; transform: rotate(45deg); }
  .mlabel .mo { margin-bottom: 2px; }
  .mlabel h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mlabel.open h3 { white-space: normal; }
  .mlabel:not(.open) .mp, .mlabel:not(.open) .mm, .mlabel:not(.open) .ms, .mlabel:not(.open) .mf { display: none; }
}
.hcond { position: fixed; z-index: 6; left: 24px; top: 128px; border-radius: 999px; padding: 4px; display: flex; align-items: center; gap: 4px; }
.hcond[hidden] { display: none; }
.hcond .cl { font-size: 10.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 0 6px 0 10px; }
html.intro-on .hcond { opacity: 0; pointer-events: none; }
@media (max-width: 820px) { .hcond { top: 114px; left: 12px; } .hcond .cl { display: none; } }

/* ---------- previous / next plate ---------- */
.pager { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.pg { position: absolute; top: var(--pg-y, 46%); width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); cursor: pointer; pointer-events: auto; padding: 0; transition: opacity 0.35s, color 0.2s, background 0.2s, right 0.35s ease, top 0.35s ease; }
.pg.prev { left: 18px; }
.pg.next { right: var(--pg-r, 16px); }
.pg .icon { width: 20px; height: 20px; stroke-width: 1.5; }
.pg:hover, .pg:focus-visible { color: var(--ink); background: var(--glass-strong); }
.pg .pgl { position: absolute; top: 50%; transform: translateY(-50%); white-space: nowrap; display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 10px; background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.pg.prev .pgl { left: 52px; text-align: left; }
.pg.next .pgl { right: 52px; text-align: right; }
.pg:hover .pgl, .pg:focus-visible .pgl { opacity: 1; }
.pg .pgl small { font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.pg .pgl b { font-family: var(--display); font-weight: 400; font-size: 15px; color: var(--ink); }
.pager.off .pg { opacity: 0; pointer-events: none; }
body:not(.is-plate) .pager, html.intro-on .pager { display: none; }
@media (max-width: 820px), (max-aspect-ratio: 4/5) {
  .pg { width: 36px; height: 36px; margin-top: -18px; }
  .pg.prev { left: 6px; }
  .pg.next { right: 6px; }
  .pg .pgl { display: none; }
}

/* ------------------------------------------- the museum's dark room (colour) */
.darkroom {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.1s ease;
  background:
    radial-gradient(ellipse 60% 52% at 50% 46%, rgba(70, 58, 44, 0.42), rgba(70, 58, 44, 0) 72%),
    radial-gradient(ellipse 120% 110% at 50% 50%, #14110e 30%, #090807 78%, #050404 100%);
}
.darkroom::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .95 0 0 0 0 .85 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
html.museum-dark .darkroom { opacity: 1; }
html.museum-dark {
  --paper: #0e0c0a;
  --paper-hi: #1d1a16;
  --ink: #efe6d4;
  --ink-2: #d8ccb4;
  --muted: #a99a82;
  --faint: #7d7060;
  --rubric: #d98a5a;
  --rubric-hi: #e79a68;
  --glass: rgba(26, 23, 20, 0.66);
  --glass-strong: rgba(30, 27, 23, 0.86);
  --line: rgba(240, 225, 200, 0.12);
  --line-2: rgba(240, 225, 200, 0.22);
  --shadow: 0 1px 0 rgba(255, 240, 215, 0.06) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.7), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
html.museum-dark body { color: var(--ink); }
html.museum-dark .chip:hover, html.museum-dark .chipf:hover, html.museum-dark .tb:hover { background: rgba(240, 225, 200, 0.08); }
html.museum-dark .seg button[aria-checked="true"] { background: var(--ink); color: #15120f; }
html.museum-dark .tag { background: rgba(24, 21, 18, 0.82); color: var(--ink); border-color: rgba(240, 225, 200, 0.18); }
html.museum-dark .tag.on { background: var(--ink); color: #15120f; }
html.museum-dark .leaders path { stroke: rgba(240, 225, 200, 0.45); }
html.museum-dark .leaders circle { fill: #efe6d4; stroke: rgba(0, 0, 0, 0.6); }
html.museum-dark .mlabel { background: rgba(18, 16, 14, 0.78); border: 1px solid rgba(240, 225, 200, 0.1); }
html.museum-dark .mlabel h3 { color: #f3ead8; }
html.museum-dark .hname { background: rgba(24, 21, 18, 0.82); color: var(--ink); }
html.museum-dark .pcard { background: rgba(26, 23, 20, 0.8); }
html.museum-dark .btn { background: rgba(240, 225, 200, 0.06); }
html.museum-dark .specs div, html.museum-dark .dwg-frame { background: rgba(240, 225, 200, 0.04); }
html.museum-dark .pcard:hover, html.museum-dark .pcard.on { background: rgba(40, 35, 30, 0.9); }
html.museum-dark .btn:hover { background: rgba(240, 225, 200, 0.12); }
html.museum-dark .btn.dark, html.museum-dark .btn[aria-pressed="true"] { background: var(--ink); color: #15120f; }
html.museum-dark .fire { color: #15120f; }
html.museum-dark .fire.busy { color: var(--ink-2); }
html.museum-dark .fire.busy:hover { background: rgba(240, 225, 200, 0.08); }
html.museum-dark .pcard .thumb { background: radial-gradient(ellipse 80% 90% at 50% 75%, #2b241c, #0c0a08 80%); }
