/* Populace: the drawing fills the window, with a small atlas and observations
   laid over it like paper. Keep styles scoped so mounted pages cleanly leave. */

html:has(.world-page), html:has(.world-page) body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); }
html:has(.world-page) body::before { display: none; }
.world-page #c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; touch-action: none; cursor: grab; }
.world-page #c:active { cursor: grabbing; }
.world-page #err { position: fixed; inset: 16px; font: 13px/1.4 ui-monospace, monospace; color: #700; white-space: pre-wrap; pointer-events: none; }
.world-page.render #ui { display: none; }

/* ---------------------------------------------------------------- the index */
.world-page #index {
  position: fixed; left: 0; top: 0; bottom: 0; width: 18rem; box-sizing: border-box;
  padding: 1.1rem 1.2rem 1rem 1.4rem; overflow: hidden; display: flex; flex-direction: column;
  background: linear-gradient(90deg, rgba(244, 240, 231, 0.94) 0%, rgba(244, 240, 231, 0.9) 80%, rgba(244, 240, 231, 0) 100%);
  transition: transform 0.5s ease, opacity 0.5s ease;
  font-feature-settings: "lnum" 1, "kern" 1;
}
.world-page #index.folded { transform: translateX(-16.4rem); }
.world-page #index.folded #groups, .world-page #index.folded header { opacity: 0; pointer-events: none; }
.world-page #index header { flex: none; display: flex; flex-direction: column; gap: 0.05rem; margin-bottom: 0.5rem; padding-right: 1.6rem; transition: opacity 0.4s ease; }
.world-page #index .study-title { all: unset; display: block; cursor: pointer; font-size: 1.65rem; letter-spacing: 0.03em; line-height: 1.15; font-weight: 400; }
.world-page #index .study-title:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 3px; }
.world-page #index header .sub { font-style: italic; color: var(--ink-soft); font-size: 0.8rem; }
.world-page #groups { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; transition: opacity 0.4s ease; }
.world-page .study-about { margin: 0.65rem 0 0.85rem; }
.world-page .study-about summary { cursor: pointer; font-size: 0.7rem; color: var(--ink-soft); }
.world-page .study-intro { margin: 0.85rem 0 1.25rem; max-width: 15rem; font-size: 0.78rem; line-height: 1.42; color: var(--ink-soft); }
.world-page .study-credit { margin: 1.5rem 0 0.25rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); max-width: 15rem; font-size: 0.66rem; line-height: 1.4; color: var(--ink-soft); }
.world-page .study-source { margin: 0.6rem 0 1rem; max-width: 15rem; font-size: 0.7rem; line-height: 1.4; color: var(--ink-soft); }
.world-page .study-source a { text-decoration-color: var(--rule); text-underline-offset: 0.15em; }
/* All patterns remain indexed, but each locale opens only when requested. */
.world-page #index h2 {
  display: flex; align-items: center; gap: 0.65rem; font-size: 0.68rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-soft); margin: 1.15rem 0 0.3rem;
}
.world-page #index h2::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.world-page #index ol { list-style: none; margin: 0; padding: 0; }
.world-page #index li { position: relative; }
.world-page #index li button {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: block;
  padding: 0.2rem 0.25rem 0.2rem 0; border-radius: 2px; font-size: 0.87rem; line-height: 1.3; color: var(--ink);
}
.world-page #index li button:hover { color: #8d6025; }
.world-page #index li button:focus-visible { outline: 1px solid var(--rule); }
.world-page #index .locale { margin: 0.55rem 0 0.8rem; }
.world-page #index .locale > summary { cursor: pointer; padding: 0.18rem 0; font-size: 0.87rem; line-height: 1.3; color: var(--ink); }
.world-page #index .locale > summary::marker { font-size: 0.6em; color: var(--ink-faint); }
.world-page #index .locale > summary:focus-visible { outline: 1px solid var(--rule); outline-offset: 3px; }
.world-page #index .locale.here > summary { color: #754e21; }
.world-page #index .locale ol { margin: 0.35rem 0 0.6rem 0.5rem; padding-left: 0.5rem; border-left: 1px solid var(--rule); }
.world-page #index .pattern-link { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: 0.35rem; align-items: baseline; padding: 0.22rem 0.2rem 0.22rem 0; font-size: 0.8rem; line-height: 1.28; }
.world-page #index .reference-n { font-size: 0.68rem; font-variant-numeric: lining-nums tabular-nums; color: var(--ink-faint); }
.world-page #index .pattern-link[aria-current] { color: #754e21; }
.world-page #index .pattern-link[aria-current] .reference-n { color: #8d6025; }
/* A warm dot marks the current place without turning it into another badge. */
.world-page #index li.here::before, .world-page #index li.going::before {
  content: ""; position: absolute; left: -0.6rem; top: 0.65em; width: 0.4em; height: 0.4em; border-radius: 50%;
  background: radial-gradient(circle, #f6c469 0 35%, rgba(246, 196, 105, 0) 72%);
}
.world-page #index li.going::before { animation: world-breathe 1.1s ease-in-out infinite alternate; }
.world-page #index li.here .pattern-link { font-weight: 500; }
@keyframes world-breathe { from { opacity: 0.35; } to { opacity: 1; } }

.world-page #fold {
  all: unset; position: absolute; right: 0.5rem; top: 0.95rem; width: 1.4rem; height: 1.4rem; text-align: center; line-height: 1.3rem;
  cursor: pointer; color: var(--ink-soft); font-size: 1.1rem; border-radius: 50%;
}
.world-page #fold:hover { color: var(--ink); background: rgba(0, 0, 0, 0.04); }
.world-page #fold:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 3px; }
.world-page #index.folded #fold { right: 0.15rem; transform: rotate(180deg); }

/* ---------------------------------------------------------------- the caption card */
.world-page #card {
  position: fixed; left: 19.3rem; bottom: 1.4rem; max-width: 27rem; box-sizing: border-box;
  width: min(30rem, calc(100vw - 21rem)); padding: 0.45rem 0.65rem 0.55rem; max-height: 38vh; overflow-y: auto; scrollbar-width: thin;
  background: rgba(244, 240, 231, 0.95); border: 1px solid var(--rule);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 6px 22px rgba(60, 50, 30, 0.08);
  transition: opacity 0.7s ease, transform 0.7s ease, left 0.5s ease; opacity: 0; transform: translateY(6px);
}
.world-page #card.shown { opacity: 1; transform: none; }
.world-page #card.leaving { opacity: 0.75; }
.world-page.folded #card { left: 3rem; width: min(30rem, calc(100vw - 5rem)); }
.world-page .place-path { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 0.35rem; }
.world-page .district-link { all: unset; cursor: pointer; border-bottom: 1px solid var(--rule); }
.world-page .district-link:hover { color: var(--ink); }
.world-page .district-link:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 3px; }
.world-page #card .place-title { margin: 0; min-width: 0; font-size: 1.2rem; line-height: 1.1; font-weight: 400; letter-spacing: 0.01em; }
.world-page #card .place-note { margin: 0.5rem 0 0.65rem; font-size: 0.94rem; line-height: 1.43; color: var(--ink); }
/* These are the existing scene's actions, shared with its view in the town. */
.world-page #card .controls { display: flex; padding: 0.1rem 0.35rem 0; gap: 0.3rem; flex-wrap: wrap; align-items: center; }
.world-page #card .controls[hidden] { display: none; }
.world-page #card .controls button {
  font: inherit; font-size: 0.66rem; letter-spacing: 0.045em; text-transform: uppercase; color: var(--ink);
  background: rgba(244, 240, 231, 0.6); border: 1px solid var(--rule); border-radius: 999px;
  padding: 0.28rem 0.65rem; cursor: pointer; transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, opacity 0.4s ease;
}
.world-page #card .controls button:hover { border-color: var(--ink-soft); }
.world-page #card .controls button:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 2px; }
.world-page #card .controls button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.world-page #card .controls button:disabled { opacity: 0.45; cursor: default; }
.world-page .shared-place { margin-top: 0.7rem; padding-top: 0.5rem; border-top: 1px solid var(--rule); }
.world-page .shared-place[hidden] { display: none; }
.world-page .shared-place summary { cursor: pointer; font-size: 0.7rem; line-height: 1.4; color: var(--ink-soft); }
.world-page .reference-source { font-variant-caps: all-small-caps; letter-spacing: 0.09em; }
.world-page .reference-source::after { content: '·'; margin: 0 0.35rem; }
.world-page .reference-active { font-variant-numeric: lining-nums; }
.world-page .reference-intro { margin: 0.55rem 0 0.15rem; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.world-page .shared-patterns { display: grid; gap: 0.1rem; max-height: 9rem; overflow: auto; margin-top: 0.25rem; }
.world-page .shared-patterns button { display: flex; align-items: baseline; gap: 0.65rem; text-align: left; padding: 0.25rem 0.1rem; background: transparent; border: 0; color: var(--ink-soft); font: inherit; font-size: 0.79rem; cursor: pointer; }
.world-page .shared-patterns .other-n { min-width: 1.5rem; color: var(--ink-soft); font-variant-numeric: lining-nums; }
.world-page .shared-patterns button:hover { color: #8d6025; }
.world-page .shared-patterns button[aria-current] { color: var(--ink); }
.world-page .shared-patterns button[aria-current] .other-n { color: #8d6025; }
.world-page .shared-patterns button:focus-visible { outline: 1px solid var(--rule); outline-offset: -1px; }

/* ---------------------------------------------------------------- hover label, hint */
.world-page #tip {
  position: fixed; pointer-events: none; padding: 0.18rem 0.55rem; font-size: 0.8rem;
  background: rgba(244, 240, 231, 0.96); border: 1px solid var(--rule); border-radius: 2px; opacity: 0; transition: opacity 0.25s ease;
  max-width: min(19rem, calc(100vw - 2rem));
}
.world-page #tip.shown { opacity: 1; }
.world-page #hint {
  position: fixed; right: 1.3rem; top: 2.7rem; font-size: 0.7rem; line-height: 1.7; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
  opacity: 0.85; transition: opacity 1.5s ease; pointer-events: none; text-align: right;
}
.world-page #hint span { display: block; }
.world-page #hint.gone { opacity: 0; }

/* ---------------------------------------------------------------- the corner: the hand, and the sound (a ring, lit when on) */
.world-page #corner { position: fixed; right: 1.1rem; top: 0.95rem; display: flex; align-items: center; gap: 1.1rem; }
.world-page .material-flag { appearance: none; border: 0; border-bottom: 1px solid transparent; background: transparent; padding: 0.3rem 0.05rem; color: var(--ink-soft); font: inherit; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.world-page .material-flag[aria-pressed="true"] { color: var(--ink); border-bottom-color: #c79b57; }
.world-page .material-flag:hover { color: var(--ink); }
.world-page .material-flag:focus-visible { outline: 1px solid var(--rule); outline-offset: 3px; }
.world-page .hand-note { margin: 0; padding: 0; max-width: none; font-size: 0.88rem; font-style: italic; color: var(--ink-soft); text-align: right; }
.world-page .hand-note em { font-style: normal; font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--ink); }
.world-page .hand-note button {
  all: unset; cursor: pointer; font-style: normal; font-variant-caps: all-small-caps; letter-spacing: 0.12em; font-size: 1.05em;
  color: var(--ink-soft); border-bottom: 1px solid var(--warm); line-height: 1.1;
}
.world-page .hand-note button:hover { color: var(--ink); }
.world-page .hand-note button:focus-visible { outline: 1px solid var(--rule); }
.world-page #sound {
  all: unset; display: flex; align-items: center; gap: 0.45em; cursor: pointer;
  padding: 0.1rem 0.25rem; border-radius: 2px; font-size: 0.95rem; font-variant-caps: all-small-caps; letter-spacing: 0.12em;
  color: var(--ink-soft); transition: color 0.4s ease;
}
.world-page #sound::before {
  content: ""; width: 0.42em; height: 0.42em; border-radius: 50%; box-sizing: border-box; border: 1px solid var(--ink-faint);
  transition: border-color 0.6s ease, background-color 0.6s ease, box-shadow 0.6s ease;
}
.world-page #sound:hover { color: var(--ink); }
.world-page #sound:focus-visible { outline: 1px solid var(--rule); }
.world-page #sound[aria-pressed="true"] { color: var(--ink); }
.world-page #sound[aria-pressed="true"]::before { border-color: #e3ad4f; background-color: #f6c469; box-shadow: 0 0 0.35em 0.1em rgba(246, 196, 105, 0.7); }

@media (max-width: 760px) {
  /* One paper panel at a time leaves the drawing present on a small screen.
     Only the atlas scrolls, so its close button never disappears among the places. */
  .world-page #index {
    left: 0.75rem; right: 0.75rem; top: 0.75rem; bottom: auto; width: auto;
    height: 64vh; height: 64dvh; padding: 0.85rem; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 0.7rem; overflow: hidden;
    background: #f4f0e7; border: 1px solid var(--rule); z-index: 3;
    box-shadow: 0 6px 22px rgba(60, 50, 30, 0.08); transform: none; transition: none;
  }
  .world-page #index header { flex: none; margin: 0; padding-right: 4.5rem; }
  .world-page #index .study-title { font-size: 1.3rem; }
  .world-page #index header .sub { font-size: 0.76rem; }
  .world-page #index li button { min-height: 44px; padding: 0.4rem 0.25rem 0.4rem 0; font-size: 0.95rem; }
  .world-page #index .pattern-link { min-height: 44px; font-size: 0.9rem; padding: 0.4rem 0.2rem 0.4rem 0; }
  .world-page #index .locale > summary { min-height: 44px; display: list-item; padding: 0.6rem 0; font-size: 0.95rem; }
  .world-page #index li.here::before, .world-page #index li.going::before { top: 1em; }
  .world-page #index h2 { font-size: 0.72rem; margin: 0.85rem 0 0.25rem; }
  .world-page .study-intro { margin: 0 0 1rem; max-width: none; }
  .world-page #index #groups { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .world-page #index.folded { right: auto; height: auto; padding: 0; overflow: visible; border: 0; background: transparent; box-shadow: none; transform: none; }
  .world-page #index.folded #groups, .world-page #index.folded header { display: none; }
  .world-page #fold {
    top: 0.45rem; right: 0.45rem; width: auto; height: auto; min-height: 44px; padding: 0 0.7rem;
    box-sizing: border-box; font: inherit; font-size: 0.76rem; line-height: 1.2;
    letter-spacing: 0.08em; font-variant-caps: all-small-caps; border: 1px solid var(--rule); border-radius: 2px; background: #f4f0e7; color: var(--ink);
  }
  .world-page #index.folded #fold { position: static; transform: none; }
  .world-page #card, .world-page.folded #card {
    left: 0.75rem; right: 0.75rem; bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); max-width: none;
    width: auto; max-height: 34vh; max-height: 34dvh; padding: 0.35rem 0.4rem 0.5rem; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; background: #f4f0e7;
  }
  .world-page #card .place-title { font-size: 1.08rem; }
  .world-page #card .place-note { font-size: 0.9rem; }
  .world-page #card .controls button { min-height: 40px; padding: 0.3rem 0.8rem; font-size: 0.66rem; }
  .world-page .shared-patterns { max-height: 7rem; overscroll-behavior: contain; }
  .world-page .shared-patterns button { min-height: 40px; }
  .world-page.index-open #card, .world-page.index-open #corner { visibility: hidden; opacity: 0; pointer-events: none; }
  .world-page #hint { display: none; }
  .world-page #corner { top: 0.75rem; right: 0.75rem; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.6rem; max-width: calc(100vw - 8.8rem); padding: 0.25rem 0.45rem; background: #f4f0e7; border: 1px solid var(--rule); }
  .world-page #corner button { min-height: 34px; }
  .world-page .hand-note { font-size: 0.78rem; }
}
@media (prefers-reduced-motion: reduce) {
  .world-page #index, .world-page #card, .world-page #tip, .world-page #hint, .world-page #sound, .world-page #sound::before { transition: none; }
}

/* A small view card leaves the drawing open; reading and studies live beside it. */
.world-page { --detail-width: min(26rem, 36vw); }
.world-page .compact-heading { display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) 2.2rem; align-items: center; gap: 0.2rem; }
.world-page .view-step, .world-page .pattern-open { border: 0; background: transparent; color: var(--ink); font: inherit; cursor: pointer; }
.world-page .view-step { min-height: 44px; min-width: 44px; font-size: 1.8rem; line-height: 1; }
.world-page .view-step:disabled { color: var(--rule); cursor: default; }
.world-page .pattern-open { width: 100%; padding: 0.25rem 0; min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 0.5rem; text-align: center; line-height: 1.2; }
.world-page .expand-symbol { flex: none; font-size: 0.85rem; color: var(--ink-soft); }
.world-page .view-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: .15rem .5rem; }
.world-page .pattern-reference { font-size: .7rem; line-height: 1.3; color: var(--ink-soft); font-weight: 400; }
.world-page .detail-reference { margin: -.2rem 0 .8rem; color: var(--ink-soft); font-size: .85rem; line-height: 1.35; }
.world-page #index .pattern-link { display: block; }
.world-page .selected-reference { display: none; margin: .05rem 0 .45rem .55rem; padding-left: .55rem; border-left: 1px solid var(--rule); font-size: .73rem; line-height: 1.35; color: var(--ink-soft); }
.world-page li.here > .selected-reference { display: block; }
.world-page #tip small { display: block; color: var(--ink-soft); margin-top: .15rem; font-size: .75rem; }
.world-page .view-step:focus-visible, .world-page .pattern-open:focus-visible, .world-page .detail-close:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 1px; }
.world-page #pattern-detail { position: fixed; z-index: 4; top: 0; bottom: 0; right: 0; width: var(--detail-width); padding: 0.75rem 1.15rem 1.5rem; overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-left: 1px solid var(--rule); scrollbar-width: thin; }
.world-page #pattern-detail[hidden] { display: none; }
.world-page .detail-header { position: sticky; top: -0.75rem; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.4rem 0; margin-bottom: 0.8rem; background: var(--paper); }
.world-page .detail-number { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-soft); }
.world-page .detail-close { font: inherit; font-size: 0.76rem; color: var(--ink-soft); background: transparent; border: 1px solid var(--rule); padding: 0.25rem 0.55rem; min-height: 44px; cursor: pointer; }
.world-page #detail-title { margin: 0 0 0.6rem; font-size: 1.65rem; line-height: 1.15; font-weight: 400; }
.world-page #pattern-detail .place-note { margin: 1rem 0 1.3rem; font-size: 0.94rem; line-height: 1.5; }
.world-page .pattern-credit { margin: 1.1rem 0 0.6rem; font-size: 0.68rem; line-height: 1.45; color: var(--ink-soft); }
.world-page #pattern-detail .shared-patterns { max-height: none; }
.world-page.detail-open #card { width: min(27rem, calc(100vw - 21rem - var(--detail-width))); }
.world-page.detail-open.folded #card { width: min(27rem, calc(100vw - 5rem - var(--detail-width))); }
.world-page.detail-open #corner { right: calc(var(--detail-width) + 1rem); }
.world-page.detail-open #hint { display: none; }
@media (max-width: 760px) {
  .world-page #pattern-detail { inset: 0; width: 100%; height: 100dvh; border: 0; padding: max(0.8rem, env(safe-area-inset-top)) 1.1rem max(1.3rem, env(safe-area-inset-bottom)); }
  .world-page .detail-header { top: -0.8rem; }
  .world-page.detail-open #card, .world-page.detail-open #index, .world-page.detail-open #corner { visibility: hidden; pointer-events: none; }
  .world-page.detail-open #card, .world-page.detail-open.folded #card { width: auto; }
  .world-page .compact-heading { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 0; }
  .world-page .view-heading { display: block; }
  .world-page .pattern-reference { display: block; margin-top: .15rem; }
}

/* Posters bridge each on-demand living drawing while its renderer loads. */
.detail-illustration{margin:1.15rem 0 1.35rem;min-width:0}
.illustration-open{display:block;position:relative;width:100%;padding:0;border:0;background:#f4f0e7;color:inherit;cursor:zoom-in;text-align:left}
.illustration-open img{display:block;width:100%;height:auto;border-radius:2px}
.illustration-enlarge{position:absolute;right:.45rem;bottom:.4rem;background:#f4f0e7e8;padding:.18rem .4rem;font-size:.75rem;letter-spacing:.025em}
.illustration-nav{display:flex;align-items:center;justify-content:space-between;gap:.6rem;margin:.3rem 0;color:#69665d;font-size:.82rem}
.illustration-nav button{min-width:40px;min-height:40px;border:0;background:transparent;color:inherit;font:1.5rem Georgia,serif;cursor:pointer}
.illustration-nav button:disabled{opacity:.25;cursor:default}
.illustration-nav button[hidden]{display:none}
.detail-illustration figcaption{font-size:.82rem;line-height:1.45;color:#69665d}
.illustration-dialog{width:min(1160px,calc(100vw - 2rem));max-width:none;max-height:calc(100dvh - 2rem);padding:1rem;background:#f4f0e7;color:#363b3e;border:1px solid #a5b0b5;overflow:auto}
.illustration-dialog::backdrop{background:#222b33aa}
.illustration-dialog-controls{display:flex;align-items:center;gap:.75rem;margin-bottom:.6rem;position:sticky;top:0;background:#f4f0e7;z-index:1}
.illustration-dialog-controls span{margin-right:auto}
.illustration-dialog-controls button{min-height:40px;padding:.3rem .6rem;border:1px solid #aaa294;background:transparent;color:inherit;font:inherit;cursor:pointer}
.illustration-scroll{overflow:auto;max-height:calc(100dvh - 11rem)}
.illustration-scroll img{display:block;width:100%;height:auto}
.illustration-scroll.zoomed img{width:max(100%,1100px);max-width:none}
.illustration-dialog p{font-size:.9rem;line-height:1.45;margin:.7rem 0 0}
@media(max-width:760px){.illustration-dialog{width:calc(100vw - 1rem);max-height:calc(100dvh - 1rem);padding:.7rem}.illustration-dialog-controls{gap:.4rem}.illustration-dialog-controls button{padding:.25rem .45rem}}

/* Living detail art shares the original renderer. Only the selected drawing
   runs, and the town rests behind it while the reader studies the picture. */
.illustration-stage{position:relative;width:100%;min-width:0;background:#f4f0e7;overflow:hidden}
.illustration-stage>.illustration-poster{display:block;width:100%;height:100%;object-fit:contain}
.illustration-stage>.illustration-canvas{position:absolute;inset:0;width:100%;height:100%;display:block;opacity:0;touch-action:pan-y}
.illustration-stage.illustration-live>.illustration-canvas{opacity:1}
.illustration-stage .illustration-open{position:absolute;right:.45rem;bottom:.4rem;z-index:2;width:auto;padding:.2rem .45rem;background:#f4f0e7e8;font:inherit;font-size:.78rem;min-height:36px;cursor:zoom-in}
.illustration-controls{display:flex;align-items:center;flex-wrap:wrap;gap:.4rem .6rem;margin:.55rem 0;font-size:.78rem}
.illustration-controls:empty{display:none}
.illustration-controls button{min-height:36px;border:1px solid #aaa294;background:transparent;color:inherit;font:inherit;padding:.3rem .5rem;cursor:pointer}
.illustration-status,.illustration-hint{color:#69665d}
.illustration-hint{flex-basis:100%;line-height:1.4}
.illustration-range{display:block;flex-basis:100%;margin:.35rem 0;font-size:.9rem}
.illustration-range input{display:block;width:100%;min-height:36px;accent-color:#54768b}
.illustration-range-ends{display:flex;justify-content:space-between;font-size:.75rem;color:#69665d}
.illustration-scroll .illustration-stage{width:100%}
.illustration-scroll.zoomed .illustration-stage{width:max(100%,1100px)}
.illustration-dialog .illustration-open{display:none}

/* A Town view borrows the existing canvas instead of building another town. */
.world-page #c.borrowed-town{position:absolute;inset:0;width:100%;height:100%;touch-action:pan-y}
.world-page .town-detail-backdrop{position:fixed;inset:0;width:100vw;height:100vh;pointer-events:none}
.illustration-controls .controls{display:contents}
.illustration-controls .controls[hidden]{display:none}
.illustration-controls button[aria-pressed="true"]{background:#363b3e;color:#f4f0e7}
.illustration-scroll.zoomed .illustration-poster{width:100%}

/* Quiet visual controls; transparent padding retains a usable touch target. */
button.icon-button,.world-page #card .controls button.icon-button,.world-page .detail-close.icon-button,
.illustration-controls button.icon-button,.illustration-dialog-controls button.icon-button,
.illustration-stage .illustration-open.icon-button,.world-page #sound.icon-button{
 display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;
 width:30px;height:30px;min-width:30px;min-height:30px;padding:6px;border:0;border-radius:50%;
 background:transparent;color:#73746e;cursor:pointer;line-height:1;opacity:.82;
}
button.icon-button svg{display:block;width:17px;height:17px;pointer-events:none}
button.icon-button:hover,.world-page #sound.icon-button:hover{background:#7f807310;color:#363b3e;opacity:1}
button.icon-button:focus-visible{outline:1px solid #777e7d;outline-offset:1px}
.illustration-controls button.icon-button[aria-pressed="true"]{background:transparent;color:#363b3e}
.world-page #sound::before{display:none}
.world-page #corner{gap:.3rem;background:none;border:0;padding:0}
.illustration-stage .illustration-open.icon-button{background:#f4f0e7b8}
.illustration-controls{gap:.2rem .35rem;margin:.35rem 0}
.illustration-status{font-size:.7rem;opacity:.7;margin-right:.3rem}
.illustration-dialog-controls{gap:.25rem}
@media(pointer:coarse){button.icon-button,.world-page #card .controls button.icon-button,.world-page .detail-close.icon-button,
 .illustration-controls button.icon-button,.illustration-dialog-controls button.icon-button,
 .illustration-stage .illustration-open.icon-button,.world-page #sound.icon-button{width:44px;height:44px;min-width:44px;min-height:44px;padding:13px}}

.illustration-dialog .illustration-stage .illustration-open.icon-button{display:none}
