:root {
  --bg: #0b0b0d;
  --panel: rgba(18, 18, 21, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --ink: #efe9dd;
  --dim: rgba(239, 233, 221, 0.62);
  --accent: #d9b97c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}
#stage.dragging { cursor: grabbing; }
#stage.pointing { cursor: pointer; }

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
}

#fade {
  position: fixed;
  inset: 0;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
#fade.on { opacity: 1; }

.hud { user-select: none; -webkit-user-select: none; }
body.pre .hud { visibility: hidden; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand-kicker {
  font-size: 10.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Top bar */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-t)) 16px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; min-width: 0; pointer-events: none !important; }
.brand-title {
  font: 20px/1.2 var(--serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#topbar nav { display: flex; gap: 6px; flex-shrink: 0; }
#topbar nav button {
  height: 34px;
  min-width: 34px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
#topbar nav button { white-space: nowrap; }
#topbar nav button:hover { border-color: rgba(255, 255, 255, 0.3); }
#topbar nav button[aria-pressed="true"] { color: var(--accent); border-color: rgba(217, 185, 124, 0.55); }
#b-help, #b-full { padding: 0 !important; }

/* Gallery drawer */
#drawer {
  position: fixed;
  top: calc(60px + var(--safe-t));
  right: 16px;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}
#drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px 16px; }
.drawer-head h2, #help h2 { margin: 0; font: 18px var(--serif); font-weight: 400; }
.drawer-head button, #c-close { width: 30px; height: 30px; font-size: 20px; line-height: 1; color: var(--dim); border-radius: 50%; }
.drawer-head button:hover, #c-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
#d-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; }
#d-list button {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 9px;
  text-align: left;
}
#d-list button:hover, #d-list button.here { background: rgba(255, 255, 255, 0.07); }
#d-list img, #d-list .swatch { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; display: block; background: #222; }
#d-list .name { font: 15px/1.25 var(--serif); }
#d-list .num { font-size: 10.5px; letter-spacing: 0.18em; color: var(--accent); }
#d-list .count { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

/* Caption for the photo you are standing at */
#caption {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(640px, calc(100vw - 24px));
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#caption[hidden] { display: none; }
#c-prev, #c-next {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  padding-bottom: 3px;
}
#c-prev:hover, #c-next:hover { background: rgba(255, 255, 255, 0.1); }
.caption-body { min-width: 150px; padding: 0 10px; text-align: center; overflow: hidden; }
#c-title { font: 16px/1.25 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#c-text { font-size: 12.5px; color: var(--dim); max-height: 2.9em; overflow: hidden; }
#c-title:empty, #c-text:empty { display: none; }
#c-meta { font-size: 11px; letter-spacing: 0.08em; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
#c-meta b { color: var(--accent); font-weight: 500; }

/* Floor plan */
#minimap {
  position: fixed;
  right: 16px;
  bottom: calc(16px + var(--safe-b));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
}
#minimap[hidden] { display: none; }

/* Touch stick */
#joystick {
  position: fixed;
  left: 22px;
  bottom: calc(26px + var(--safe-b));
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  touch-action: none;
}
#joystick[hidden] { display: none; }
#joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: rgba(239, 233, 221, 0.4);
  pointer-events: none;
}

/* Help */
#help {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, calc(100vw - 32px));
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 18, 21, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#help[hidden] { display: none; }
.keys { list-style: none; margin: 14px 0 18px; padding: 0; display: grid; gap: 8px; color: var(--dim); }
.keys b { color: var(--ink); font-weight: 500; margin-right: 6px; }
body.touch .keys .desk, body:not(.touch) .keys .touch { display: none; }
#h-close, #l-enter {
  height: 40px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #17130b;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#h-close:hover, #l-enter:hover { filter: brightness(1.08); }

/* Loading / welcome */
#loader {
  position: fixed;
  inset: 0;
  display: flex; /* with margin:auto on the card: centred, but scrollable when it does not fit */
  overflow: hidden auto;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, #18171a, #08080a);
  transition: opacity 0.6s ease;
}
#loader.out { opacity: 0; pointer-events: none; }
/* Album mode: the couple's cover, blurred and dimmed, behind the welcome text. */
#loader.album::before {
  content: "";
  position: fixed; /* fixed, so its blurred overhang never adds scrollbars */
  inset: -40px;
  background: var(--cover) center / cover no-repeat;
  filter: blur(26px) brightness(0.34) saturate(1.1);
  z-index: -1;
}
#loader.album { background: #08080a; isolation: isolate; }
#loader.album .loader-card { text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6); }
#topbar nav button[hidden] { display: none; }

/* Choice of museum on the welcome screen */
#l-museums {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin: 4px 0 22px;
}
#l-museums[hidden] { display: none; }
.loader-card:has(#l-museums:not([hidden])) { width: min(720px, 100%); }
.museum-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(14, 14, 17, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.museum-card:hover { border-color: rgba(255, 255, 255, 0.32); transform: translateY(-2px); }
.museum-card[aria-checked="true"] { border-color: var(--accent); background: rgba(34, 28, 16, 0.72); }
.museum-name { padding: 6px 6px 0; font: 18px/1.2 var(--serif); }
.museum-card[aria-checked="true"] .museum-name { color: var(--accent); }
.museum-blurb { padding: 0 6px; font-size: 12px; line-height: 1.4; color: var(--dim); }

/* Small painted previews, one per museum, built from gradients (no image files). */
.swatch-art { display: block; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; }
.swatch-midnight {
  background:
    radial-gradient(circle at 20% 16%, #ffe2b0 0 1.4%, transparent 2.4%),
    radial-gradient(circle at 36% 11%, #ffe2b0 0 1.2%, transparent 2.2%),
    radial-gradient(circle at 52% 9%, #ffe2b0 0 1.4%, transparent 2.4%),
    radial-gradient(circle at 68% 11%, #ffe2b0 0 1.2%, transparent 2.2%),
    radial-gradient(circle at 84% 16%, #ffe2b0 0 1.4%, transparent 2.4%),
    linear-gradient(#f3e9d6, #f3e9d6) 12% 46% / 24% 26% no-repeat,
    linear-gradient(#e9dcc4, #e9dcc4) 50% 46% / 20% 22% no-repeat,
    linear-gradient(#f3e9d6, #f3e9d6) 88% 46% / 24% 26% no-repeat,
    radial-gradient(ellipse at 50% 46%, rgba(255, 226, 176, 0.28), transparent 62%),
    linear-gradient(#0c0c0f 0 20%, #3a3a40 20% 70%, #17171a 70% 100%);
}
.swatch-palace {
  background:
    radial-gradient(circle at 50% 18%, #fff3d0 0 3%, rgba(255, 231, 184, 0.5) 5%, transparent 12%),
    linear-gradient(#2a3f6b, #2a3f6b) 16.5% 40% / 20% 22% no-repeat,
    linear-gradient(#c7a04a, #c7a04a) 15% 40% / 26% 30% no-repeat,
    linear-gradient(#e6d9bd, #e6d9bd) 83.5% 40% / 20% 22% no-repeat,
    linear-gradient(#c7a04a, #c7a04a) 85% 40% / 26% 30% no-repeat,
    radial-gradient(ellipse 13% 34% at 50% 62%, #1d4a3d 0 99%, transparent 100%),
    linear-gradient(#d8ccb4 0 9%, #b9954a 9% 11%, #6a1c24 11% 66%, #b9954a 66% 68%, #d9cfb9 68% 80%, #8a5a2c 80% 100%);
}
body:not(.album) .album-only { display: none; }
.loader-card { width: min(520px, 100%); margin: auto; text-align: center; }
#l-title { margin: 14px 0 6px; font: 400 clamp(32px, 7vw, 54px)/1.1 var(--serif); text-wrap: balance; }
#l-sub { margin: 0 0 26px; color: var(--dim); font-size: 15px; min-height: 1em; }
#l-bar { width: 160px; height: 2px; margin: 0 auto 14px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
#l-bar i { display: block; width: 40%; height: 100%; background: var(--accent); animation: slide 1.2s ease-in-out infinite; }
#l-bar.done { visibility: hidden; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
#l-status { margin: 0 0 20px; color: var(--dim); font-size: 13px; white-space: pre-line; }
#l-status.error { color: #e8a08c; }
#l-hint { margin: 16px 0 0; color: var(--dim); font-size: 12px; letter-spacing: 0.04em; }
#l-enter[hidden], #l-hint[hidden] { display: none; }

/* Not enough width for the caption and the floor plan side by side:
   the plan steps aside while you are looking at a photo. */
@media (max-width: 1150px) {
  body.focused #minimap { display: none; }
}

@media (max-width: 640px) {
  /* Museum choices become compact rows so all of them and Enter fit on a phone. */
  #l-museums { grid-template-columns: 1fr; gap: 8px; }
  .museum-card { display: grid; grid-template-columns: 96px 1fr; column-gap: 10px; align-items: center; padding: 7px; }
  .swatch-art { grid-row: span 2; }
  .museum-name { padding: 0; font-size: 16px; align-self: end; }
  .museum-blurb { padding: 0; font-size: 11.5px; align-self: start; }
  #l-title { margin-top: 8px; }
  #l-sub { margin-bottom: 14px; }
  #l-status { margin-bottom: 12px; }
  .brand-title { font-size: 17px; }
  .brand-kicker { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #topbar { flex-direction: column; gap: 8px; --edge: 12px; }
  .brand { max-width: 100%; }
  #topbar nav { gap: 5px; }
  #topbar nav button { padding: 0 10px; font-size: 12.5px; }
  #minimap { right: 12px; bottom: auto; top: calc(62px + var(--safe-t)); }
  #drawer { right: 12px; left: 12px; width: auto; top: calc(60px + var(--safe-t)); max-height: calc(100vh - 230px); }
  #caption { bottom: calc(116px + var(--safe-b)); }
  body:not(.touch) #caption { bottom: calc(68px + var(--safe-b)); }
}

.swatch-haveli {
  background:
    radial-gradient(circle at 78% 16%, #fff3d6 0 3.2%, rgba(255, 240, 200, 0.35) 5%, transparent 11%),
    radial-gradient(circle at 14% 12%, #fff 0 0.7%, transparent 1.4%),
    radial-gradient(circle at 33% 22%, #fff 0 0.6%, transparent 1.3%),
    radial-gradient(circle at 52% 9%, #fff 0 0.7%, transparent 1.4%),
    radial-gradient(circle at 64% 27%, #fff 0 0.5%, transparent 1.2%),
    radial-gradient(circle at 24% 55%, #ffc978 0 1.6%, transparent 3%),
    radial-gradient(circle at 50% 55%, #ffc978 0 1.6%, transparent 3%),
    radial-gradient(circle at 76% 55%, #ffc978 0 1.6%, transparent 3%),
    radial-gradient(ellipse 11% 22% at 24% 78%, #2a1a16 0 99%, transparent 100%),
    radial-gradient(ellipse 11% 22% at 50% 78%, #2a1a16 0 99%, transparent 100%),
    radial-gradient(ellipse 11% 22% at 76% 78%, #2a1a16 0 99%, transparent 100%),
    linear-gradient(#0a1026 0 20%, #2a2548 42%, #e6cfa8 42% 47%, #c58f6c 47% 88%, #7d6a60 88% 100%);
}

.swatch-daylight {
  background:
    linear-gradient(#3a3d40, #3a3d40) 50% 30% / 1.2% 46% no-repeat,
    linear-gradient(#8fbfe9, #eaf3f9 70%, #93b383 70% 100%) 50% 30% / 22% 46% no-repeat,
    linear-gradient(#141414, #141414) 14% 44% / 20% 26% no-repeat,
    linear-gradient(#c96f4a, #e6b98a) 14% 44% / 18% 22% no-repeat,
    linear-gradient(#141414, #141414) 86% 44% / 20% 26% no-repeat,
    linear-gradient(#4a6f8f, #a8c3d6) 86% 44% / 18% 22% no-repeat,
    linear-gradient(#ffffff 0 8%, #e9ecee 8% 10%, #f3f2ee 10% 72%, #c9c9c5 72% 100%);
}

.swatch-sky {
  background:
    radial-gradient(circle at 80% 44%, #fff6dc 0 5%, rgba(255, 240, 200, 0.4) 8%, transparent 17%),
    radial-gradient(circle at 12% 14%, #fff 0 0.7%, transparent 1.4%),
    radial-gradient(circle at 30% 26%, #fff 0 0.6%, transparent 1.3%),
    radial-gradient(circle at 48% 10%, #fff 0 0.7%, transparent 1.4%),
    radial-gradient(circle at 66% 20%, #fff 0 0.5%, transparent 1.2%),
    radial-gradient(circle at 22% 40%, #ffb56a 0 1.5%, transparent 3.4%),
    radial-gradient(circle at 60% 34%, #ffb56a 0 1.2%, transparent 3%),
    radial-gradient(circle at 90% 18%, #ffb56a 0 1.3%, transparent 3.2%),
    linear-gradient(#e6c478, #e6c478) 20% 66% / 24% 24% no-repeat,
    linear-gradient(#b8603f, #e9b08a) 20% 66% / 22% 20% no-repeat,
    linear-gradient(#e6c478, #e6c478) 56% 66% / 24% 24% no-repeat,
    linear-gradient(#3f5f8a, #9db8d2) 56% 66% / 22% 20% no-repeat,
    linear-gradient(#060920 0, #4b2f72 38%, #f2a27c 58%, #4b2f72 78%, #14122c 100%);
}

/* Small message that fades in and out (e.g. "rotate your phone"). */
#toast {
  position: fixed;
  left: 50%;
  top: calc(118px + var(--safe-t));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#toast.on { opacity: 1; }

/* Phones have a notch or rounded corners on the short sides when held sideways. */
#topbar { padding-left: max(var(--edge, 16px), env(safe-area-inset-left)); padding-right: max(var(--edge, 16px), env(safe-area-inset-right)); }
#joystick { left: calc(22px + env(safe-area-inset-left)); }
#minimap { right: max(16px, env(safe-area-inset-right)); }
body.touch #topbar nav { flex-wrap: wrap; }

/* Short screens: a phone held sideways. Height is precious, so everything
   shrinks, and while you are looking at a picture the top bar steps aside. */
@media (max-height: 520px) {
  /* The bar steps aside for the picture; Ideas, down in the corner, stays. */
  body.focused #topbar { visibility: hidden; }
  body.focused #b-ideas { visibility: visible; }
  #topbar { padding-top: calc(8px + var(--safe-t)); padding-bottom: 14px; }
  #topbar nav button { height: 30px; min-width: 30px; padding: 0 11px; font-size: 12.5px; }
  .brand-title { font-size: 16px; }
  #caption { bottom: calc(8px + var(--safe-b)); padding: 3px; }
  #c-prev, #c-next { width: 34px; height: 34px; }
  #joystick { width: 92px; height: 92px; bottom: calc(14px + var(--safe-b)); }
  #toast { top: calc(52px + var(--safe-t)); }
  #help { max-height: calc(100vh - 16px); overflow-y: auto; padding: 14px 18px; }
  .keys { margin: 8px 0 12px; gap: 5px; }

  /* Welcome screen: everything, including Enter, visible without scrolling. */
  #loader { padding: 10px 16px; }
  .loader-card, .loader-card:has(#l-museums:not([hidden])) { width: min(720px, 100%); }
  #l-title { margin: 2px 0 0; font-size: clamp(24px, 5vw, 34px); }
  #l-sub { margin: 0 0 6px; font-size: 13px; }
  #l-status { margin: 0 0 8px; font-size: 12px; }
  #l-bar { margin-bottom: 8px; }
  #l-museums { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 7px; margin: 0 0 10px; }
  .museum-card { display: grid; grid-template-columns: 54px 1fr; column-gap: 8px; align-items: center; padding: 6px; border-radius: 11px; }
  .museum-card:hover { transform: none; }
  .swatch-art { grid-row: auto; border-radius: 6px; }
  .museum-name { padding: 0; font-size: 15px; align-self: center; }
  .museum-blurb { display: none; }
  #h-close, #l-enter { height: 36px; }
  #l-hint { margin-top: 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  #fade, #loader { transition-duration: 0.01s; }
  #l-bar i { animation: none; width: 100%; }
}

/* ---- Samples of new ideas (src/ideas.js) -------------------------------- */

.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow: hidden auto;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(18, 18, 21, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 6;
}
.panel[hidden] { display: none; }
.panel h2 { margin: 0; font: 20px/1.2 var(--serif); }
.panel-note { margin: 6px 0 14px; font-size: 12.5px; color: var(--dim); }
.panel-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #17130b;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  font-size: 13.5px;
}
.panel-main[hidden] { display: none; }
.panel-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.panel-row > button:not(.panel-main) { height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); }

#i-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; }
#i-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.idea { display: flex; align-items: flex-start; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.idea input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  margin-top: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #efe9dd;
  transition: transform 0.2s;
}
.idea input:checked + .switch { background: var(--accent); }
.idea input:checked + .switch::after { transform: translateX(16px); background: #17130b; }
.idea input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.idea-text { display: grid; gap: 2px; min-width: 0; }
.idea-text b { font-weight: 500; font-size: 14px; }
.idea-text span { font-size: 12px; line-height: 1.35; color: var(--dim); }
.idea-run {
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(217, 185, 124, 0.5);
  color: var(--accent);
  font-size: 12px;
  white-space: nowrap;
}

/* Heart, most loved, postcard: beside the picture you are standing at */
#actions {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 10px;
}
#actions[hidden] { display: none; }
#actions button {
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  padding: 6px 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#actions button[hidden] { display: none; }
#a-count { font-size: 11px; font-variant-numeric: tabular-nums; margin-top: 1px; color: var(--dim); }
#a-heart[aria-pressed="true"] { color: #ff5d73; border-color: rgba(255, 93, 115, 0.6); }
#a-heart[aria-pressed="true"] svg path { fill: currentColor; }
#a-heart[aria-pressed="true"] svg { animation: heart-pop 0.35s ease; }
@keyframes heart-pop { 40% { transform: scale(1.4); } }
.float-heart {
  position: fixed;
  z-index: 8;
  color: #ff5d73;
  pointer-events: none;
  animation: heart-rise 1.5s ease-out both;
}
@keyframes heart-rise {
  from { opacity: 0.95; transform: translate(-50%, 0) scale(0.6); }
  to { opacity: 0; transform: translate(calc(-50% + var(--dx)), -170px) scale(1.25); }
}

#lv-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#lv-list button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
#lv-list img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#lv-list img:not([src]) { visibility: hidden; }
.lv-name, .lv-count {
  position: absolute;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.72);
  font-size: 11px;
}
.lv-name { left: 6px; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lv-count { right: 6px; color: #ff8a9a; }
#lv-list .empty { grid-column: 1 / -1; color: var(--dim); font-size: 13px; }

#postcard { width: min(520px, calc(100vw - 28px)); }
#p-img { display: block; width: 100%; max-height: 58vh; object-fit: contain; margin-top: 12px; border-radius: 10px; }

/* Ribbon cutting: the museum is quiet until the ribbon is cut */
#ribbon-hint {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(13% + var(--safe-b));
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}
#ribbon-hint[hidden] { display: none; }
#ribbon-hint span {
  padding: 11px 22px;
  border: 1px solid rgba(217, 185, 124, 0.55);
  border-radius: 999px;
  background: rgba(12, 12, 14, 0.72);
  color: var(--accent);
  font: 15px/1 var(--serif);
  letter-spacing: 0.06em;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: hint-breathe 2.2s ease-in-out infinite;
}
@keyframes hint-breathe { 50% { transform: scale(1.05); border-color: rgba(217, 185, 124, 0.95); } }
body.ceremony .hud { visibility: hidden; }
body.ceremony #stage { cursor: pointer; }

@media (max-height: 520px) {
  .panel { padding: 14px 16px; }
  #p-img { max-height: 46vh; }
}

/* ---- Phones (body.compact: any touch device, or a narrow window) ----------
   The view is what matters, so the top bar is one slim row: the names, the
   guided tour, music, and a menu for the rest. Everything else lives in the
   bottom corners, within reach of a thumb. */

#more { display: contents; }
#b-museums { order: -1; }
#b-menu { display: none !important; }
#topbar nav .long { display: none; }

body.compact #topbar {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  --edge: 12px;
  padding-top: calc(10px + var(--safe-t));
  padding-bottom: 18px;
}
body.compact .brand { flex: 1; max-width: none; }
body.compact .brand-title { font-size: 17px; }
body.compact #topbar nav { position: relative; flex-wrap: nowrap; gap: 6px; }
body.compact #b-menu { display: inline-flex !important; width: 36px; padding: 0; }
body.compact #b-tour { padding: 0 12px; }
/* Music is just its disc on a phone: turning while it plays, struck through when off. */
body.compact #b-music { position: relative; width: 36px; padding: 0; }
body.compact #b-music .label { display: none; }
body.compact #b-music .disc { width: 22px; height: 22px; }
body.compact #b-music[aria-pressed="false"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  opacity: 0.7;
  transform: rotate(-45deg);
}

body.compact #more {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 7;
  flex-direction: column;
  gap: 2px;
  min-width: 176px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 18, 21, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body.compact #more.open { display: flex; }
body.compact #more button {
  order: 0;
  width: 100%;
  height: 42px;
  justify-content: flex-start;
  padding: 0 14px !important;
  border: 0;
  border-radius: 10px;
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  font-size: 14px;
}
body.compact #more button:active { background: rgba(255, 255, 255, 0.08); }
body.compact #more .short { display: none; }
body.compact #more .long { display: inline; }
body.compact #b-map::after { content: "off"; margin-left: auto; font-size: 12px; color: var(--dim); }
body.compact #b-map[aria-pressed="true"]::after { content: "on"; color: var(--accent); }

body.compact #toast { top: calc(66px + var(--safe-t)); }
body.compact.touch #joystick { width: 96px; height: 96px; bottom: calc(14px + var(--safe-b)); }

/* Bottom right corner: heart, most loved, postcard, then Ideas. */
body.compact #topbar nav #b-ideas {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(18px + var(--safe-b));
  width: 62px;
  height: 40px;
  padding: 0;
  color: var(--accent);
  border-color: rgba(217, 185, 124, 0.5);
}
body.compact #actions {
  top: auto;
  transform: none;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  right: calc(max(12px, env(safe-area-inset-right)) + 70px);
  bottom: calc(18px + var(--safe-b));
}
body.compact #actions button { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 20px; }
body.compact #actions #a-heart { width: auto; padding: 0 11px; grid-auto-flow: column; gap: 5px; }
body.compact #a-count { margin: 0; font-size: 12px; }

@media (max-height: 520px) {
  /* Sideways: the caption shares the bottom edge with the corner buttons, so it sits a little left. */
  body.compact #caption { left: calc(50% - 50px); }
  body.compact.touch #joystick { width: 92px; height: 92px; }
  body.compact #more button { height: 36px; }
}

/* ---- Music: a small disc that turns while the music plays, and a volume panel */

#topbar nav { position: relative; }
#b-music { gap: 7px; }
#b-music .disc {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
/* Two arcs of a ring, so the turning can be seen. */
#b-music .disc::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-left-color: transparent;
  border-right-color: transparent;
  opacity: 0.6;
}
#b-music .disc svg { width: 58%; height: 58%; }
#b-music[aria-pressed="true"] .disc { animation: disc-turn 3.4s linear infinite; }
#b-music[aria-pressed="false"] .disc { opacity: 0.55; }
@keyframes disc-turn { to { transform: rotate(360deg); } }

#vol {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 7;
  display: grid;
  gap: 10px;
  width: 232px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 18, 21, 0.95);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
#vol[hidden] { display: none; }
#topbar nav #v-toggle { width: 100%; height: 36px; padding: 0 12px; background: none; font-size: 13px; }
.vol-row { display: flex; align-items: center; gap: 10px; color: var(--dim); }
.vol-row svg { flex-shrink: 0; }
#v-range { flex: 1; min-width: 0; height: 30px; margin: 0; accent-color: var(--accent); cursor: pointer; touch-action: pan-y; }
#v-num { width: 24px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  #b-music[aria-pressed="true"] .disc { animation: none; }
}

/* ---- Guided tour: the speed button in the caption (Slow / Normal / Fast / Fastest) */

#c-speed {
  flex-shrink: 0;
  height: 30px;
  min-width: 58px;
  padding: 0 10px;
  margin-left: 2px;
  border: 1px solid rgba(217, 185, 124, 0.5);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.02em;
}
#c-speed[hidden] { display: none; }
#c-speed:hover { background: rgba(217, 185, 124, 0.1); }
/* Make room for it on a narrow phone. */
body.touring .caption-body { min-width: 112px; padding: 0 6px; }

/* ---- Layering ----------------------------------------------------------
   The top bar's drop-downs (menu, music volume) must open in front of the
   floor plan and everything else on screen; only the full-screen covers
   (panels, the fade between places, the welcome screen) sit above the bar. */
#topbar { z-index: 4; }
#help { z-index: 6; }
#fade { z-index: 20; }
#loader { z-index: 30; }
