* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --night: #1d1419;
  --paper: #fbf2e2;
  --tan: #efe0c9;
  --ink: #34232a;
  --muted: #725b52;
  --wine: #6d3949;
  --gold: #efd2a2;
  --edge: #be9e84;
  --shell: #492f38;
}
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  background: radial-gradient(ellipse at top,#39232d,var(--night) 70%);
  color: var(--paper);
  font: 16px/1.4 system-ui,sans-serif;
}
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid #ba6424; outline-offset: 2px; }
button:disabled { cursor: default; opacity: .42; }
h1,h2,p { margin: 0; }
.top {
  width: min(100%,1320px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-inline: auto;
  padding: 10px clamp(10px,2vw,26px);
  color: var(--gold);
  font: clamp(16px,2vw,21px)/1.2 Georgia,serif;
}
.top button {
  background: transparent;
  color: var(--gold);
  border: 1px solid #927266;
  border-radius: 6px;
  padding: 6px 10px;
  font: 13px/1.2 system-ui,sans-serif;
}
main {
  min-height: 0;
  width: min(100%,1320px);
  margin-inline: auto;
  padding: 0 clamp(8px,2vw,26px) clamp(8px,2vh,18px);
}
.book {
  display: grid;
  grid-template-rows: minmax(0,1fr);
  gap: 7px;
}
.book-spread {
  display: grid;
  grid-template-columns: minmax(0,1.65fr) minmax(260px,1fr);
  grid-template-rows: auto minmax(0,1fr);
  grid-template-areas: "reader tray" "reader map";
  gap: 5px;
  min-height: 0;
  border: 1px solid #9e7769;
  border-radius: 12px;
  background: var(--shell);
  padding: 5px;
  box-shadow: 0 10px 35px #0005;
}
.reader,.map-section,.detail-card {
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
}
.reader {
  grid-area: reader;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-radius: 7px;
  overflow: hidden;
}
.art {
  flex: none;
  height: clamp(148px,33vh,330px);
  background-color: #3c282a;
  background-size: cover;
  background-position: center 50%;
  border-bottom: 2px solid #a1775b;
}
.stage { background-image: url("media/stage-panorama.jpg"); }
.foyer { background-image: url("media/foyer.jpg"); }
.dressing { background-image: url("media/dressing-new.jpg"); }
.props { background-image: url("media/props-new.jpg"); }
.stage,.dressing,.props {
  background-color: #201612;
  background-size: contain;
  background-repeat: no-repeat;
}
.asset-nina { --asset: url("media/nina.jpg"); }
.asset-rita { --asset: url("media/rita.jpg"); }
.asset-victor { --asset: url("media/victor.jpg"); }
.asset-lev { --asset: url("media/lev.jpg"); }
.asset-key { --asset: url("media/key.jpg"); }
.asset-mirror { --asset: url("media/mirror.jpg"); }
.asset-wardrobe { --asset: url("media/stage-panorama-wardrobe.jpg"); }
.asset-microphone { --asset: url("media/microphone.jpg"); }
.asset-lamp { --asset: url("media/stage-panorama-lamp.jpg"); }
.asset-side-door { --asset: url("media/side-door.jpg"); }
.asset-script-book { --asset: url("media/script-book.jpg"); }
.asset-coat { --asset: url("media/coat.jpg"); }
.asset-chest { --asset: url("media/chest-locked.jpg"); }
.asset-chest-open { --asset: url("media/chest-open.jpg"); }
.asset-rehearsal { --asset: url("media/rehearsal.jpg"); }
.asset-bolt { --asset: url("media/bolt-closed.jpg"); }
.asset-bolt-open { --asset: url("media/bolt-open.jpg"); }
.reader-title {
  padding: 9px clamp(12px,2vw,24px) 3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}
h1 { font: 400 clamp(26px,3.4vw,48px)/1.05 Georgia,serif; }
h1:focus,.reader-paper:focus { outline: none; }
.reader-paper {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flow-root;
  padding: 8px clamp(12px,2vw,24px);
  font: clamp(16px,1.4vw,18px)/1.35 Georgia,serif;
}
.reader-paper p + p { margin-top: 7px; }
.reader-paper .intro-line { padding-inline-start: 10px; border-inline-start: 2px solid #b08355; }
.reader-paper .intro-line + p:not(.intro-line) { margin-top: 10px; }
.reader-paper .goal { font: 13px/1.4 system-ui,sans-serif; color: var(--muted); margin-top: 9px; }
.talk { display: inline-flex; align-items: center; gap: 7px; }
.talk-avatar,.dialogue-portrait { background: #775b64 var(--asset) center/cover; }
.talk-avatar { width: 25px; height: 25px; border-radius: 50%; }
.dialogue-panel {
  margin-block: 10px 4px;
  padding: 10px 12px;
  background: #f0e1e2;
  border-inline-start: 3px solid #9d646f;
  border-radius: 5px;
}
.dialogue-panel.with-portrait {
  display: grid;
  grid-template-columns: clamp(48px,9vw,104px) minmax(0,1fr);
  gap: 12px;
  align-items: start;
}
.dialogue-portrait { aspect-ratio: 1; border-radius: 5px; }
.dialogue-heading { margin-bottom: 6px; font-size: 1.06em; }
.reply-pending { visibility: hidden; }
.controls { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.action {
  border: 1px solid #8e645c;
  border-radius: 5px;
  color: #fff4e5;
  background: var(--wine);
  padding: 6px 10px;
  min-height: 34px;
  font: 600 13px/1.28 system-ui,sans-serif;
}
.action:not(:disabled):hover { filter: brightness(1.11); }
.secondary { background: #fbf1df; color: #502e39; }
.compact { padding: 4px 8px; min-height: 30px; }
.link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #763143;
  font: inherit;
  font-weight: bold;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link:hover { background: #edd4bd; }
.link.item { color: #355940; }

.map-section {
  grid-area: map;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  padding: clamp(8px,1.4vw,17px);
  background: #eddfca;
  border-radius: 7px;
}
.map-section h2 { font: 400 clamp(19px,2vw,26px)/1.15 Georgia,serif; }
.floor-plan {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 5px;
  padding: 5px;
  background: #776255;
  border-radius: 5px;
}
.floor-room {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  gap: 3px;
  padding: clamp(4px,.9vw,10px);
  background: repeating-linear-gradient(0deg,transparent 0 18px,#69443a0d 18px 19px),#e9d6ba;
}
.floor-room.current { background-color: #ecd0c7; box-shadow: inset 0 0 0 2px #955769; }
.floor-room.locked { background-color: #ded0bc; }
.floor-room.available:hover,.floor-room.available:focus-within { background-color: #f7deb5; }
.floor-room.available .room-label::after { content: " ↗"; color: #884d45; }
.room-label {
  justify-self: start;
  color: var(--ink);
  font: 600 clamp(11px,1.25vw,15px)/1.15 system-ui,sans-serif;
}
.room-travel {
  position: absolute;
  z-index: 1;
  inset: 0;
  padding: 0;
  background: transparent;
  border: 0;
}
.room-travel:focus-visible { outline-offset: -3px; }
.interior {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0,1fr) minmax(0,1fr);
  align-items: stretch;
  gap: clamp(3px,.6vw,8px);
}
.furniture {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 3px;
  border: 1px solid #9f8066;
  background: #d1b494;
  color: #4e332c;
  font: 11px/1.1 system-ui,sans-serif;
  text-align: center;
}
.furniture-name { overflow-wrap: anywhere; }
.wardrobe {
  grid-row: span 2;
  background: linear-gradient(90deg,#c6a281 49%,#98765d 49% 51%,#c6a281 51%);
  border: 2px double #8e644f;
}
.desk,.shelf,.vanity { background: #d7bd9e; border-top: 3px double #a9876d; }
.bench,.rack,.crate { background: #c2a384; }
.chair { border-radius: 50% 50% 15% 15%; }
.moon { background: #e4cf9d; border-radius: 35% 70% 70% 35%; }
.lamp { background: #f0dbac; border-radius: 50%; }
.stage-layout { grid-template-rows: minmax(0,1fr) minmax(0,1fr) auto; }
.stage-layout .room-occupants { grid-column: 1/-1; justify-content: flex-end; }
.map-portraits { display: flex; justify-content: center; align-items: center; gap: 3px; }
.room-occupants { min-width: 0; }
.floor-door { position: absolute; z-index: 1; background: #f3d8a9; pointer-events: none; }
.door-восток { top: 43%; right: -6px; width: 7px; height: 21px; }
.door-юг { left: 48%; bottom: -6px; width: 21px; height: 7px; }
.door-locked { color: #fff2e5; background: #793a49; text-align: center; font: bold 10px/7px system-ui,sans-serif; }
.map-hint { color: #5c4439; font: 12px/1.3 system-ui,sans-serif; }
.map-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.map-footer .map-hint { flex: 1 1 150px; }
.movement {
  margin-top: 8px;
  color: var(--muted);
  font: 12px/1.4 system-ui,sans-serif;
}
.book-tray {
  grid-area: tray;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(84px,auto);
  align-items: start;
  gap: 5px 14px;
  padding: 10px 13px;
  color-scheme: light;
  color: var(--ink);
  background: var(--tan);
  border: 1px solid var(--edge);
  border-radius: 7px;
}
.tray-group { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tray-group h2 { flex-basis: 100%; font-size: 15px; }
.inventory { justify-content: flex-end; text-align: right; }
.empty-inventory { color: var(--muted); font-size: 12px; }
.tray-avatar,.inventory-icon,.map-marker {
  position: relative;
  display: grid;
  place-content: center;
  border-radius: 50%;
  border: 1px solid #9a726a;
  color: #fff4e5;
  background-color: #68525c;
  background-image: var(--asset,none);
  background-size: cover;
  background-position: center;
  padding: 0;
  font: 600 12px/1 system-ui,sans-serif;
}
.tray-avatar,.inventory-icon { width: clamp(34px,3.7vw,58px); height: clamp(34px,3.7vw,58px); }
.inventory-icon { border-radius: 5px; color: #563c37; background-color: #ecd5b3; }
.map-marker { width: 24px; height: 24px; border: 2px solid #fff3dd; box-shadow: 0 0 0 1px #775754; z-index: 2; }
.player-marker { background: #234f44; color: #fff9e9; font-size: 9px; }
[class*="asset-"] .symbol { color: transparent; }
[data-tip]:hover,[data-tip]:focus-visible { z-index: 4; }
[data-tip]:is(:hover,:focus-visible)::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 4px 6px;
  border-radius: 4px;
  background: #39252e;
  color: #fff1df;
  pointer-events: none;
  font: 12px/1.2 system-ui,sans-serif;
}
.detail-card {
  width: min(550px,calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 16px;
  border: 2px solid var(--edge);
  border-radius: 8px;
}
.detail-card::backdrop { background: #241419b0; }
.posters-card { width: min(780px,calc(100% - 24px)); }
.programmes-card { width: min(690px,calc(100% - 24px)); }
.script-card { width: min(570px,calc(100% - 24px)); }
.script-paper {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  aspect-ratio: 1;
  margin: 8px 0 12px;
  padding: 11% 12% 35% 18%;
  border: 1px solid #9d7556;
  border-radius: 4px;
  background: #e7c999 url("media/script-page.jpg") center/100% 100% no-repeat;
  color: #4a2d1d;
  box-shadow: 0 2px 6px #492b2233;
}
.script-paper .script-note-title {
  margin-bottom: 4px;
  font: italic 700 clamp(19px,8cqw,33px)/1.1 Georgia,serif;
}
.script-paper .script-note-line {
  margin-top: 4px;
  font: italic 600 clamp(14px,5.2cqw,22px)/1.2 Georgia,serif;
}
.script-paper .script-signature {
  align-self: end;
  margin-top: 8px;
  font: italic 600 clamp(14px,5.4cqw,22px)/1.15 "Segoe Print", Georgia,serif;
}
.poster-gallery {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: clamp(8px,2vw,18px);
  margin-block: 10px 14px;
}
.playbill { display: grid; grid-template-rows: auto 1fr; margin: 0; min-width: 0; }
.playbill-version { margin-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 600; }
.playbill-print {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px,1.5vw,15px);
  padding: 5% 7% 7%;
  border: 3px double #966c48;
  text-align: center;
  color: #4b2924;
  background: #ebd3a7 url("media/playbill.jpg") center/100% 100%;
  box-shadow: 0 2px 6px #492b2233;
}
.poster-gallery .playbill-title {
  font: 700 clamp(13px,8cqw,29px)/1.05 Georgia,serif;
  text-transform: uppercase;
  text-wrap: balance;
}
.playbill-cast {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 7px;
}
.playbill-person:only-child { grid-column: 1/-1; width: 62%; justify-self: center; }
.playbill-portrait { aspect-ratio: 1; background: #775b64 var(--asset) center/cover; border: 2px solid #8f6240; }
.poster-gallery .playbill-name { margin-top: 5px; font: 700 clamp(10px,5.8cqw,20px)/1.1 Georgia,serif; }
.poster-gallery .playbill-note { font: italic clamp(10px,5.5cqw,20px)/1.22 "Segoe Print", cursive; color: #554c48; }
.programme-print {
  container-type: inline-size;
  aspect-ratio: 2/3;
  padding: 10% 10% 0;
  text-align: center;
  color: #422823;
  background-color: #ead3a8;
  background-position: center;
  background-size: 100% 100%;
  border: 1px solid #9d7556;
  box-shadow: 0 2px 6px #492b2233;
}
.programme-new { background-image: url("media/programme-new.jpg"); }
.programme-old { background-image: url("media/programme-old.jpg"); }
.programmes .programme-kicker {
  text-transform: uppercase;
  letter-spacing: .08em;
  font: 600 clamp(10px,4.7cqw,13px)/1.2 system-ui,sans-serif;
}
.programmes .programme-title {
  margin-top: 8%;
  text-wrap: balance;
  font: 700 clamp(17px,9cqw,28px)/1.06 Georgia,serif;
}
.programmes .programme-credit {
  margin-top: 8%;
  text-wrap: balance;
  font: 700 clamp(12px,7cqw,19px)/1.23 Georgia,serif;
}
.programmes .programme-credit + .programme-credit { margin-top: 4px; }
@media (max-width: 390px) {
  .programmes .programme-print { aspect-ratio: 4/7; padding-inline: 7%; }
  .programmes .programme-kicker { font-size: 9px; letter-spacing: 0; }
  .programmes .programme-title { font-size: 14px; }
  .programmes .programme-credit { font-size: 11px; }
}
.card-body.has-art { display: grid; grid-template-columns: clamp(66px,20vw,142px) minmax(0,1fr); gap: 12px; align-items: start; }
.card-body h2 { font: 400 25px/1.1 Georgia,serif; margin-bottom: 7px; }
.card-body p { font-size: 14px; }
.card-body p + p { margin-top: 6px; }
.card-location { color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.card-art {
  display: grid;
  place-content: center;
  aspect-ratio: 1;
  border-radius: 6px;
  background: #775b64 var(--asset,none) center/cover;
  color: var(--paper);
  font: 32px Georgia,serif;
}
.landing,.ending { display: flex; max-width: 960px; padding-bottom: min(6vh,45px); }
.landing .reader,.ending .reader { width: 100%; }
.landing .art { height: min(40vh,335px); }
.ending .art {
  height: min(56vh,520px);
  background-color: #211619;
  background-size: contain;
  background-repeat: no-repeat;
}
.final-victor { background-image: url("media/final-victor.jpg"); }
.final-lev { background-image: url("media/final-lev.jpg"); }
.final-both { background-image: url("media/final-both.jpg"); }
.landing h1,.ending h1 { padding: 12px clamp(12px,2vw,24px) 0; }
.mobile-switch { display: none; }
@media (max-height: 660px) {
  .art { height: clamp(104px,24vh,158px); }
  .landing .art { height: 25vh; }
  .ending .art { height: 48vh; }
  .reader-title { padding-top: 6px; }
}
@media (max-height: 455px) {
  .art { height: min(25vh,110px); }
  .floor-room { padding-block: 3px; }
  .map-hint { font-size: 11px; }
}
@media (max-width: 680px) {
  .book { grid-template-rows: auto minmax(0,1fr); }
  .mobile-switch { display: block; justify-self: start; }
  .book-spread { grid-template-columns: minmax(0,1fr); grid-template-areas: "tray" "reader"; }
  .book-spread.plan-open { grid-template-areas: "tray" "map"; }
  .book-spread:not(.plan-open) .map-section,.book-spread.plan-open .reader { display: none; }
  .art { height: min(28vh,230px); }
}
@media (max-width: 390px) {
  .tray-avatar,.inventory-icon { width: 35px; height: 35px; }
  .book-tray { gap: 5px; }
}
