:root {
  --text: #f4f0e6;
  --muted: #c6c1b6;
  --gold: #e3b35a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", ui-sans-serif, system-ui, sans-serif;
}

.parchment-home {
  background: linear-gradient(135deg, #e8dcc8 0%, #f0ebe0 50%, #e6dcc2 100%);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%; height: 100dvh; margin: 0; overflow: hidden;
  background: #0a0b0d; color: var(--text); font-family: var(--sans);
}
.stage { position: relative; height: 100%; width: 100%; overflow: hidden; }
#art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  z-index: 0;
}
.empty-art {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-style: italic; font-size: 1.1rem;
}
.veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.12) 35%, rgba(0,0,0,0.18) 70%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 1;
}
.verse-text-viewport {
  position: absolute;
  left: auto;
  right: 28px;
  bottom: 88px;
  width: clamp(380px, 52vw, 680px);
  height: clamp(320px, 38vh, 480px);
  z-index: 2;
  pointer-events: auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: rgba(10, 11, 13, 0.82);
  border-radius: 14px;
  border: 1px solid rgba(244, 240, 230, 0.12);
}
.verse-text-scroller {
  padding: 18px 22px 24px;
}
.verse-text-scroller p {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(0.95rem, 2vw, 1.25rem);
  line-height: 1.5;
  color: var(--text);
  text-align: center;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 0 0 24px rgba(0,0,0,0.6);
  word-wrap: break-word;
  overflow-wrap: break-word;
}
@media (max-width: 900px) {
  .verse-text-viewport {
    width: clamp(320px, 48vw, 520px);
    height: clamp(280px, 34vh, 420px);
  }
  .verse-text-scroller p {
    font-size: clamp(0.85rem, 1.8vw, 1.1rem);
  }
}
@media (max-width: 700px) {
  .verse-text-viewport {
    left: 14px;
    right: 14px;
    top: calc(env(safe-area-inset-top, 0px) + 86px);
    bottom: calc(var(--dock-h, 236px) + 44px + var(--cap-h, 0px) + 12px);
    width: auto;
    height: auto;
    min-height: 120px;
  }
  .verse-text-scroller {
    padding: 14px 16px 18px;
  }
  .verse-text-scroller p {
    font-size: clamp(0.8rem, 1.7vw, 1rem);
    margin: 0 0 9px;
    line-height: 1.45;
  }
}
.bar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 22px 88px 0 28px;
  z-index: 3;
  pointer-events: none;
}
.kicker {
  margin: 0 0 4px; letter-spacing: 0.18em; text-transform: uppercase;
  font-size: 0.72rem; color: var(--gold);
}
h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.02em;
}
.sub { margin: 6px 0 0; color: var(--muted); }
.dock {
  position: absolute; left: 0; right: auto; bottom: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px 22px;
  max-width: calc(100% - 14rem);
}
.art-interpret {
  position: absolute;
  right: 28px;
  bottom: 22px;
  z-index: 4;
  max-width: min(15.5rem, 44vw);
  white-space: normal;
  line-height: 1.25;
  text-align: center;
  letter-spacing: 0.08em;
}
.play {
  appearance: none; border: 1px solid #e3b35a;
  background: rgba(227,179,90,0.12); color: var(--gold);
  font: inherit; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 10px 22px; border-radius: 999px; cursor: pointer;
}
.play:hover { background: rgba(227,179,90,0.22); }
.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }

.caption {
  position: absolute;
  left: 28px;
  right: auto;
  max-width: clamp(220px, 40vw, 480px);
  bottom: 88px;
  pointer-events: none;
}
.cap-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2.4vw, 1.85rem);
  font-weight: 600;
  text-shadow: 0 2px 16px rgba(0,0,0,0.7);
}
.cap-place {
  margin: 4px 0 0;
  color: var(--gold);
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

.cap-artist {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.95rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}

.play.interpret-yes {
  border-color: #7dcea0;
  color: #7dcea0;
  background: rgba(125, 206, 160, 0.12);
}
.play.interpret-yes:hover { background: rgba(125, 206, 160, 0.22); }
.play.interpret-no {
  border-color: #e06a5c;
  color: #e06a5c;
  background: rgba(224, 106, 92, 0.12);
}
.play.interpret-no:hover { background: rgba(224, 106, 92, 0.22); }

.interpret-bubble {
  position: absolute;
  left: auto;
  right: 28px;
  top: auto;
  bottom: 88px;
  width: min(26.25rem, 57.5vw);
  height: min(42vh, 22rem);
  margin: 0;
  background: rgba(10, 11, 13, 0.82);
  border: 1px solid rgba(244, 240, 230, 0.18);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 3;
  overflow: hidden;
}
.interpret-scroll {
  height: 100%;
  overflow: auto;
  padding: 14px 16px 18px;
}
.interpret-sources {
  margin: 0 0 16px;
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1.45;
}
.interpret-sources p { margin: 0 0 6px; }
.interpret-body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.55;
}
.interpret-body p { margin: 0 0 1em; }
.interpret-cites {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(244, 240, 230, 0.16);
  font-size: 0.9rem;
  color: var(--muted);
}
.interpret-cites a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.interpret-cites p { margin: 0 0 8px; }
.interpret-empty {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 700px) {
  html, body { height: 100dvh; }
  .bar { padding: calc(18px + env(safe-area-inset-top)) 78px 0 18px; }
  h1 { font-size: 2.2rem; }
  .caption {
    left: 18px;
    right: auto;
    max-width: clamp(180px, 42vw, 360px);
    /* house3: sit above the wrapped dock (height measured live into --dock-h) */
    bottom: calc(var(--dock-h, 236px) + 44px);
  }
  .dock {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    max-width: calc(100% - 13.5rem);
  }
  .art-interpret {
    right: 14px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .play {
    padding: 12px 18px;
    font-size: 0.86rem;
  }
  .hint { display: none; }
  .interpret-bubble {
    left: 14px;
    right: 14px;
    top: calc(env(safe-area-inset-top, 0px) + 86px);
    bottom: calc(var(--dock-h, 236px) + 44px + var(--cap-h, 0px) + 12px);
    width: auto;
    height: auto;
    min-height: 120px;
  }
}

#art-empty.empty-art { z-index: 0; }
.caption { z-index: 2; }
.dock { z-index: 3; }
.ur-btn {
  appearance: none;
  position: absolute;
  top: max(14px, env(safe-area-inset-top, 0px));
  right: 14px;
  width: 52px;
  height: 52px;
  margin: 0;
  border: 2px solid #e3b35a;
  border-radius: 10px;
  background: rgba(10,11,13,0.78);
  color: #e3b35a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  box-shadow: 0 4px 18px rgba(0,0,0,0.55);
}
.ur-btn[aria-expanded="true"] { background: rgba(227,179,90,0.28); }
.ur-lines, .ur-lines:before, .ur-lines:after {
  display: block; width: 22px; height: 2.5px;
  background: #e3b35a; border-radius: 2px;
  position: relative;
}
.ur-lines:before, .ur-lines:after {
  content: ""; position: absolute; left: 0;
}
.ur-lines:before { top: -7px; }
.ur-lines:after { top: 7px; }
.ur-menu, .ur-panel {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px) + 60px);
  right: 14px;
  min-width: 13.5rem;
  background: rgba(10, 11, 13, 0.92);
  border: 1px solid rgba(244, 240, 230, 0.18);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 21;
  padding: 6px;
}
.ur-menu button, .ur-panel button {
  appearance: none; display: block; width: 100%;
  text-align: left; border: 0; background: transparent;
  color: var(--text); font: inherit;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.ur-menu button:hover, .ur-panel button:hover { background: rgba(227,179,90,0.14); }
.ur-panel { max-height: min(58vh, 26rem); overflow: auto; }
.ur-live { color: #6fd89a; }
.ur-panel button.ur-live,
.ur-menu button.ur-live {
  color: #6fd89a;
  font-weight: 600;
}
.ur-dead {
  color: #e06a5c;
  cursor: default;
  pointer-events: none;
}
.ur-off {
  color: var(--muted);
}
.ur-back { color: var(--gold); }

.ur-head {
  margin: 4px 8px 6px;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.ur-book { color: var(--text); }
.ur-panel button.ur-book.ur-live,
.ur-menu button.ur-book.ur-live {
  color: #6fd89a;
  font-weight: 600;
}
.ur-book-off {
  color: var(--muted);
  cursor: default;
  pointer-events: none;
}
.ur-wait { color: #e06a5c; }
.ur-panel button.ur-wait,
.ur-menu button.ur-wait {
  color: #e06a5c;
}

.ur-vol {
  padding: 8px 12px 12px;
}
.ur-vol input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(227,179,90,0.35);
  border-radius: 999px;
  outline: none;
}
.ur-vol input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e3b35a;
  border: 0;
  cursor: pointer;
}
.ur-vol input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e3b35a;
  border: 0;
  cursor: pointer;
}
