:root {
  --zh-bg: #140f0c;
  --zh-ink: #f3e7d3;
  --zh-muted: #b9a68a;
  --zh-panel: rgba(28, 20, 14, 0.96);
  --zh-accent: #d4a05a;
  --zh-line: rgba(212, 160, 90, 0.35);
  --zh-font: "Sora", system-ui, sans-serif;
  --zh-display: "Syne", "Sora", system-ui, sans-serif;
  --zh-log-h: min(34vh, 280px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--zh-bg);
  color: var(--zh-ink);
  font-family: var(--zh-font);
  overflow: hidden;
}

body.has-ingress {
  background: #fff;
}

.zh-ingress {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  pointer-events: none;
  opacity: 1;
}

.zh-ingress.is-clear {
  pointer-events: none;
}

.app {
  display: grid;
  grid-template-rows: 1fr var(--zh-log-h);
  height: 100%;
  min-height: 0;
}

.stage-pane {
  position: relative;
  min-height: 0;
  background: #0c0907;
  overflow: hidden;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

#stage[data-armed="walk"] { cursor: default; }
#stage[data-armed="look"] { cursor: help; }
#stage[data-armed="sniff"] { cursor: cell; }
#stage[data-armed="talk"] { cursor: pointer; }
#stage[data-armed="bite"] { cursor: crosshair; }
#stage[data-armed="wag"] { cursor: grab; }
#stage[data-armed="open"] { cursor: pointer; }

.bottom-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7.5rem, 30%);
  min-height: 0;
  border-top: 1px solid var(--zh-line);
}

.bottom-band.is-bookend {
  grid-template-columns: minmax(0, 1fr) minmax(8rem, 22%);
}

.bottom-band.is-bookend .log-pane {
  border-right: 1px solid var(--zh-line);
}

.bottom-band.is-bookend .verb-pane {
  display: flex;
}

.bottom-band.is-bookend #verb-root {
  display: none;
}

.log-pane {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--zh-line);
  padding: 0.65rem 0.85rem;
}

.verb-pane {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-radius: 0;
  border: none;
  padding: 0.45rem 0.5rem;
  overflow: auto;
}

#verb-root {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#side-chrome {
  flex-shrink: 0;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#volume-root {
  flex-shrink: 0;
}

.verb-rail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
}

.verb-rail__btn {
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--zh-line);
  background: rgba(212, 160, 90, 0.1);
  color: var(--zh-ink);
  padding: 0.45rem 0.5rem;
  min-height: 2rem;
}

.verb-rail__btn:hover:not(:disabled) {
  background: rgba(212, 160, 90, 0.28);
}

.verb-rail__btn.is-armed {
  background: rgba(212, 160, 90, 0.42);
  border-color: var(--zh-accent);
  color: #fff8ec;
  box-shadow: inset 0 0 0 1px rgba(212, 160, 90, 0.55);
}

.verb-rail__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.verb-rail.is-disabled {
  opacity: 0.85;
}

.panel {
  background: var(--zh-panel);
  border: 1px solid var(--zh-line);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}

.text-toggle {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 18;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--zh-ink);
  cursor: pointer;
  background: var(--zh-panel);
  border: 1px solid var(--zh-line);
  border-radius: 10px;
  backdrop-filter: blur(8px);
}

.brand {
  margin: 0;
  font-family: var(--zh-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.15rem;
}

.room-label {
  margin: 0.2rem 0 0.55rem;
  color: var(--zh-muted);
  font-size: 0.9rem;
}

.controls-hint {
  margin-bottom: 0.65rem !important;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--zh-line);
}

/* Floating hotspot tag (over stage only) */
.tag-float {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  padding: 0.2rem 0.55rem;
  background: rgba(12, 8, 5, 0.92);
  border: 1px solid var(--zh-accent);
  border-radius: 4px;
  color: var(--zh-accent);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transform: translate(12px, 14px);
}

#text-root {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.transcript {
  flex: 1;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.45;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.transcript::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.transcript p {
  margin: 0 0 0.4rem;
}

.transcript p.meta {
  color: var(--zh-muted);
  font-size: 0.78rem;
}

.zh-who {
  font-weight: 700;
}

.zh-who--anubis {
  color: #e8a54b;
}

.zh-who--dog {
  color: #b07a45;
}

.zh-line-body {
  color: var(--zh-ink);
}

/* End-of-run report card over the throne tableau */
.zh-report {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 5, 4, 0.55);
  backdrop-filter: blur(2px);
}

.zh-report__card {
  width: min(28rem, 94%);
  max-height: min(92%, 34rem);
  overflow: auto;
  padding: 1.1rem 1.25rem 1.15rem;
  background: linear-gradient(165deg, #2a1c14 0%, #1a120e 55%, #140e0a 100%);
  border: 1px solid var(--zh-accent);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  color: var(--zh-ink);
  scrollbar-width: none;
}

.zh-report__card::-webkit-scrollbar {
  display: none;
}

.zh-report__title {
  margin: 0;
  font-family: var(--zh-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.35rem;
  color: var(--zh-accent);
}

.zh-report__sub {
  margin: 0.25rem 0 0.85rem;
  color: var(--zh-muted);
  font-size: 0.78rem;
}

.zh-report__stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 0.65rem 0;
  border-top: 1px solid var(--zh-line);
  border-bottom: 1px solid var(--zh-line);
  font-size: 0.9rem;
}

.zh-report__stats dt {
  margin: 0;
  color: var(--zh-muted);
}

.zh-report__stats dd {
  margin: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.zh-report__grade {
  margin: 0.85rem 0 1rem;
  font-weight: 600;
  color: #f0d7a8;
  font-size: 0.95rem;
}

.zh-report__exit {
  display: block;
  width: 100%;
  font: 600 0.95rem var(--zh-font);
  letter-spacing: 0.03em;
  color: var(--zh-ink);
  background: rgba(212, 160, 90, 0.18);
  border: 1px solid var(--zh-accent);
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
}

.zh-report__exit:hover {
  background: rgba(212, 160, 90, 0.32);
}

.choice-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.45rem;
  flex-shrink: 0;
  max-height: 40%;
  overflow: auto;
}

.choice-box button {
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--zh-line);
  background: rgba(212, 160, 90, 0.12);
  color: var(--zh-ink);
  padding: 0.4rem 0.55rem;
}

.choice-box button:hover {
  background: rgba(212, 160, 90, 0.28);
}

.text-drawer {
  position: absolute;
  top: 3.4rem;
  right: 0.75rem;
  width: min(320px, calc(100% - 1.5rem));
  z-index: 19;
}

.text-drawer .hint {
  margin: 0 0 0.4rem;
  color: var(--zh-muted);
  font-size: 0.78rem;
}

.text-prompt {
  display: flex;
  gap: 0.4rem;
}

.text-prompt input {
  flex: 1;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--zh-line);
  color: var(--zh-ink);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.text-prompt button {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--zh-line);
  background: rgba(212, 160, 90, 0.15);
  color: var(--zh-ink);
  padding: 0.4rem 0.65rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 700px) {
  :root {
    --zh-log-h: min(42vh, 260px);
  }

  .bottom-band {
    grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 28%);
  }

  .verb-rail__btn {
    padding: 0.35rem 0.45rem;
    font-size: 0.85rem;
  }
}

/* Bookend continue + wipe */
.zh-continue {
  position: absolute;
  right: 0.85rem;
  bottom: 0.65rem;
  z-index: 30;
  font: 600 0.95rem var(--zh-font);
  letter-spacing: 0.02em;
  color: var(--zh-ink);
  background: rgba(28, 20, 14, 0.96);
  border: 1px solid var(--zh-accent);
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.zh-continue:hover {
  background: rgba(212, 160, 90, 0.22);
}

.zh-skip {
  font: 600 0.85rem var(--zh-font);
  letter-spacing: 0.03em;
  color: var(--zh-ink);
  background: rgba(212, 160, 90, 0.1);
  border: 1px solid var(--zh-line);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  width: 100%;
}

.zh-skip:hover {
  background: rgba(212, 160, 90, 0.28);
  border-color: var(--zh-accent);
}

/* BGM volume — under verb rail / bottom of verb pane */
.zh-volume {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
}

.zh-volume__slider {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 0.35rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--zh-accent);
  background: transparent;
}

.zh-volume__mute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--zh-ink);
  background: rgba(212, 160, 90, 0.1);
  border: 1px solid var(--zh-line);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.zh-volume__mute:hover {
  background: rgba(212, 160, 90, 0.28);
}

.zh-volume.is-muted .zh-volume__mute {
  border-color: var(--zh-accent);
  color: var(--zh-accent);
}

.zh-volume__icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.zh-wipe {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: #0a0705;
  transform: scaleX(0);
  transform-origin: left center;
  opacity: 0;
}

.zh-wipe--active {
  pointer-events: auto;
  opacity: 1;
}

.zh-wipe--cover {
  transform: scaleX(1);
  transition: transform 0.3s ease-in;
}

.zh-wipe--out {
  transform-origin: right center;
  transform: scaleX(0);
  transition: transform 0.28s ease-out;
}
