@font-face {
  font-family: 'Neucha';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/neucha-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Neucha';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/neucha-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'PT Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-italic-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'PT Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-italic-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'PT Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/pt-serif-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/pt-serif-700-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/pt-serif-700-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/pt-serif-700-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'PT Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/pt-serif-700-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #E9DFC7;
  --paper-hi: #F2EADA;
  --paper-deep: #DCCFB2;
  --ink: #221C15;
  --ink-soft: #3A3126;
  --ink-line: rgba(34, 28, 21, 0.38);
  --sepia: #A9885C;
  --ochre: #C9A063;
  --rust: #8C5433;
  --teal-deep: #3F5B58;
  --teal-mid: #6E8A82;
  --danger: #A3402F;
  --lamp: #F2C879;

  --fs-body: 17px;
  --fs-lead: 19px;
  --fs-h3: 22px;
  --fs-h2: 26px;
  --fs-h1: clamp(30px, 8vw, 38px);
  --fs-caption: 16px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  --tap-min: 44px;
  --tap-primary: 56px;
  --tap-gap: 10px;

  --r-1: 2px;
  --r-2: 4px;
  --r-3: 8px;

  --t-fast: 120ms;
  --t-base: 180ms;
  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);

  --font-title: "Neucha", "Georgia", serif;
  --font-body: "PT Serif", "Georgia", serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /*
   * Бумажная рамка paper-frame-9x16.webp нарисована с полями ~5,6% по ширине
   * и ~3,2% по высоте. Поля экранов считаем от рамки, а не в пикселях:
   * иначе на широком телефоне текст выходит за линию.
   */
  --frame-inline: clamp(26px, 7.6%, 72px);
  --frame-top: max(4dvh, calc(var(--safe-top) + 16px));
  --frame-bottom: max(6dvh, calc(var(--safe-bottom) + 26px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: clip;
}

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("assets/art/ui/paper-tile-512.webp");
  background-size: 512px 512px;
  background-repeat: repeat;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

p,
ul,
ol,
figure {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.app {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: 100dvh;
  width: 100%;
  padding:
    max(10px, var(--safe-top))
    max(14px, var(--safe-right))
    max(18px, var(--safe-bottom))
    max(14px, var(--safe-left));
}

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

.app-bar {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: var(--tap-min);
}

.app-bar__day {
  min-width: 0;
  font-family: var(--font-title);
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar__tools {
  display: flex;
  flex: none;
  gap: 6px;
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  line-height: 1.1;
  color: var(--ink);
  cursor: pointer;
}

.tool__sound-off {
  display: none;
}

.tool--sound[aria-pressed="false"] .tool__sound-on {
  display: none;
}

.tool--sound[aria-pressed="false"] .tool__sound-off {
  display: block;
}

.tool img {
  width: 22px;
  height: 22px;
  flex: none;
}

.tool:disabled {
  opacity: 0.42;
  cursor: default;
}

.resources {
  position: relative;
  z-index: 25;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  list-style: none;
}

.resource {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 46px;
  padding: 6px 8px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.resource__icon {
  width: 24px;
  height: 24px;
  flex: none;
}

.resource__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.resource__value {
  font-family: var(--font-title);
  font-size: 21px;
  font-variant-numeric: tabular-nums;
}

.resource__label {
  font-size: 16px;
  line-height: 1.15;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource.is-low {
  border-color: var(--rust);
}

.resource.is-low .resource__value {
  color: var(--rust);
}

.resource.is-empty {
  opacity: 0.55;
}

.resource.is-empty .resource__value {
  text-decoration: line-through;
}

.resource.is-changed {
  border-color: var(--ink);
}

.resource__slash {
  position: absolute;
  left: 4px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  opacity: 0.85;
}

.scene {
  position: relative;
  width: 100%;
  height: clamp(184px, 32dvh, 360px);
  aspect-ratio: 9 / 16;
  flex: none;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-1);
  background: var(--paper-deep);
}

.scene__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.scene--logo .scene__image {
  object-fit: contain;
  padding: var(--sp-6);
}

.app[data-screen="summary"],
.app[data-screen="part"],
.app[data-screen="ending"],
.app[data-screen="turn"] {
  gap: 0;
  padding: 0;
}

.app[data-screen="summary"] .app-bar {
  padding: 14px 20px 6px;
}

.app[data-screen="part"] .app-bar,
.app[data-screen="ending"] .app-bar,
.app[data-screen="turn"] .app-bar,
.app[data-screen="summary"] .resources,
.app[data-screen="part"] .resources,
.app[data-screen="ending"] .resources,
.app[data-screen="turn"] .resources,
.app[data-screen="summary"] .scene,
.app[data-screen="part"] .scene,
.app[data-screen="ending"] .scene,
.app[data-screen="turn"] .scene {
  display: none;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
  padding-bottom: var(--sp-2);
}

.panel__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
}

.panel.is-busy {
  cursor: progress;
}

.panel.is-busy .actions,
.panel.is-busy .mechanic {
  opacity: 0.6;
  pointer-events: none;
}

.panel__text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  font-size: var(--fs-lead);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.panel__text p {
  max-width: 34ch;
}

.dialog {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--ink-line);
  background: var(--paper-hi);
  border-radius: var(--r-1);
}

.dialog__line {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dialog__who {
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.dialog__text {
  font-size: var(--fs-body);
  font-style: italic;
  line-height: 1.45;
}

.note {
  padding: var(--sp-2) var(--sp-3);
  border: 1px dashed var(--ink-line);
  border-radius: var(--r-1);
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.note--ok {
  border-style: solid;
  border-color: var(--teal, #3b6b63);
  border-left-width: 4px;
  background: rgba(59, 107, 99, 0.1);
  color: var(--ink);
}

.note--fail {
  border-style: solid;
  border-color: var(--rust);
  border-left-width: 4px;
  background: rgba(154, 62, 42, 0.1);
  color: var(--ink);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: var(--tap-gap);
}

.actions[hidden] {
  display: none;
}

.page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.page[hidden] {
  display: none;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.pager[hidden] {
  display: none;
}

.pager__count {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.pager__next {
  width: auto;
  min-width: 148px;
  min-height: 48px;
  padding: 10px 18px;
  font-size: var(--fs-body);
}

.task {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.task__speaker {
  font-family: var(--font-display);
  font-size: var(--fs-body);
  font-weight: 700;
}

.task__frame {
  margin: 0;
  padding-left: var(--sp-3);
  border-left: 3px solid var(--sepia);
  font-size: var(--fs-body);
  font-style: italic;
  line-height: 1.5;
}

.task__label {
  margin-top: var(--sp-1);
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.task__legend,
.task__steps {
  margin: 0;
  padding-left: 22px;
  font-size: var(--fs-caption);
  line-height: 1.45;
}

.task__legend li,
.task__steps li {
  margin-bottom: var(--sp-1);
}

.task__step-name {
  display: block;
  font-size: var(--fs-caption);
}

.task__step-known {
  display: block;
  color: var(--ink-soft);
}

.task__cost {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-1);
  background: var(--paper-deep);
  font-size: var(--fs-caption);
  line-height: 1.4;
}

.task__how {
  margin-top: var(--sp-1);
  border-top: 1px dashed var(--ink-line);
}

.task__how-summary {
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  cursor: pointer;
}

.task__how[open] .task__how-summary {
  color: var(--ink);
}

.task__how[open] .task__how-summary::after {
  content: "свернуть";
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.task__how:not([open]) .task__how-summary::after {
  content: "развернуть";
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.task__how .task__label:first-of-type {
  margin-top: 0;
}

.act-result {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--ink);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.act-result__verdict {
  font-size: var(--fs-body);
  line-height: 1.45;
}

.act-result__line {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--sp-2);
  align-items: baseline;
}

.act-result__who {
  font-size: var(--fs-caption);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.act-result__text,
.act-result__heard,
.act-result__tape {
  font-size: var(--fs-caption);
  line-height: 1.45;
}

.act-result__heard,
.act-result__tape {
  color: var(--ink-soft);
}

.mask {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: var(--sp-3);
  border: 1px solid rgba(32, 34, 30, 0.22);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.18), 0 6px 14px rgba(10, 12, 10, 0.14);
  font-family: var(--font-body);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.mask:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.18), 0 2px 6px rgba(10, 12, 10, 0.1);
}

.mask.is-picked {
  border: 2px solid var(--ink);
  background: var(--paper);
}

.mask__name {
  font-size: var(--fs-body);
  font-weight: 700;
}

.mask__manner,
.mask__hear {
  font-size: var(--fs-caption);
  line-height: 1.4;
}

.mask__hear {
  color: var(--ink-soft);
}

.toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--sp-3);
  width: 100%;
  min-height: 64px;
  padding: var(--sp-3);
  border: 1px solid rgba(32, 34, 30, 0.28);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.18), 0 6px 14px rgba(10, 12, 10, 0.12);
  font-family: var(--font-body);
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.toggle:active:not([disabled]) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.18), 0 2px 6px rgba(10, 12, 10, 0.1);
}

.toggle.is-on {
  border: 2px solid var(--ink);
  background: var(--paper);
}

.toggle__label {
  font-size: var(--fs-body);
  font-weight: 700;
}

.toggle__state {
  grid-column: 1 / -1;
  font-size: var(--fs-caption);
  line-height: 1.4;
  color: var(--ink-soft);
}

.power__budget,
.power__tape {
  font-size: var(--fs-caption);
  line-height: 1.45;
}

.power__budget.is-over {
  color: var(--danger);
  font-weight: 700;
}

.power__zero,
.power__warn {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--sepia);
  background: var(--paper);
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
}

.power__warn {
  border-left-color: var(--rust);
  color: var(--ink);
}

.mechanic__hint--cost {
  border-left-color: var(--rust);
  background: var(--paper-deep);
  font-size: var(--fs-caption);
}

.mechanic__hint--free {
  border-left-color: var(--sepia);
  background: var(--paper);
  font-size: var(--fs-caption);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  min-height: var(--tap-primary);
  padding: 12px 18px;
  border: 1px solid rgba(32, 34, 30, 0.28);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.2), 0 6px 16px rgba(10, 12, 10, 0.15);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:active:not([disabled]) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.2), 0 2px 6px rgba(10, 12, 10, 0.12);
}

.btn--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(10, 12, 10, 0.48), 0 8px 18px rgba(10, 12, 10, 0.24);
}

.btn--primary:active:not([disabled]) {
  box-shadow: 0 1px 0 rgba(10, 12, 10, 0.48), 0 3px 8px rgba(10, 12, 10, 0.18);
}

.btn--small {
  width: auto;
  min-height: var(--tap-min);
  padding: 8px 14px;
  font-size: var(--fs-caption);
  border-radius: var(--r-2);
}

.btn--ghost {
  width: 100%;
  margin-top: 10px;
  border-color: rgba(32, 34, 30, 0.28);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.2), 0 6px 16px rgba(10, 12, 10, 0.15);
  font-weight: 700;
}

.btn[disabled] {
  opacity: 0.45;
  box-shadow: none;
  cursor: not-allowed;
}

.btn img {
  width: 20px;
  height: 20px;
  flex: none;
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-height: 64px;
  padding: 13px 16px;
  border: 1px solid rgba(32, 34, 30, 0.22);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.18), 0 6px 16px rgba(10, 12, 10, 0.15);
  text-align: left;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.choice:active:not([disabled]) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.18), 0 2px 6px rgba(10, 12, 10, 0.12);
}

.choice__label {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.choice__meta {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.failure {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--danger);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.failure__text {
  font-size: var(--fs-caption);
  color: var(--danger);
}

.mechanic {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  container-type: inline-size;
  container-name: mechanic;
}

.mechanic__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stamp {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mechanic__prompt {
  font-size: var(--fs-lead);
  font-weight: 700;
  line-height: 1.35;
  max-width: 30ch;
}

.mechanic__question {
  font-size: var(--fs-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.docs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.doc {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 104px;
  padding: 10px 10px 8px;
  border: 1px solid var(--ink-line);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 21px,
    rgba(34, 28, 21, 0.16) 21px,
    rgba(34, 28, 21, 0.16) 22px
  );
  border-radius: var(--r-1);
}

.doc__title {
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.2;
}

.doc__note {
  font-size: 14px;
  line-height: 1.25;
  color: var(--ink-soft);
}

.methods {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.method {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper);
  text-align: left;
  font-size: var(--fs-body);
  line-height: 1.35;
  cursor: pointer;
}

.method[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.method__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid var(--ink-line);
  border-radius: 50%;
  font-family: var(--font-title);
  font-size: 17px;
  line-height: 1;
}

.mechanic__hint {
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.attempts {
  align-self: flex-start;
  margin: 0;
  font-family: var(--font-title);
  font-size: 15px;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: var(--rust);
}

.attempts--spent {
  align-self: flex-start;
  margin: 0;
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
}

.rev-table {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper);
}

.rev-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--ink-line);
  background: var(--paper-deep);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.rev-head__day {
  font-weight: 700;
}

.rev-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px;
  border: 0;
  border-bottom: 1px solid var(--ink-line);
  background: transparent;
  text-align: left;
  font-family: var(--font-body);
  font-size: 17px;
  cursor: pointer;
}

.rev-row:last-child {
  border-bottom: 0;
}

.rev-row[aria-pressed="true"],
.rev-row.is-picked {
  background: var(--paper-hi);
  box-shadow: inset 3px 0 0 var(--rust);
}

.rev-row__day {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.rev-row__num {
  font-variant-numeric: tabular-nums;
}

.rev-row__note {
  grid-column: 1 / -1;
  padding-left: 2px;
  font-size: 13px;
  line-height: 1.25;
  color: var(--ink-soft);
}

.rev-count,
.mix-count {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.units {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0 2px;
  border-top: 1px dashed var(--ink-line);
}

.units__label {
  max-width: 16ch;
  font-size: 15px;
  line-height: 1.25;
}

.units__row {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
}

.units__step {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border: 1px solid var(--ink-line);
  border-radius: 50%;
  background: var(--paper);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.units__step:disabled {
  opacity: 0.35;
  cursor: default;
}

.units__value {
  min-width: 44px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.widget-note {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--rust);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.35;
}

.widget-note[hidden] {
  display: none;
}

.other {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--ink-line);
}

.other__sep {
  margin: 8px 0 0;
  font-family: var(--font-title);
  font-size: 18px;
  text-align: center;
  color: var(--ink-soft);
}

.other__choice {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.other__choice:active {
  background: var(--paper-deep);
}

.confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ink);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.confirm[hidden] {
  display: none;
}

.confirm__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.confirm__row {
  display: flex;
  gap: 10px;
}

.confirm__row .btn {
  flex: 1;
  min-height: 44px;
}

.confirm__no {
  background: transparent;
}

.presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset {
  min-height: 48px;
  align-items: center;
}

.preset__label {
  line-height: 1.3;
}

.frags {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.frag__legend {
  margin: 0;
  padding: 8px 10px;
  border-left: 3px solid var(--sepia);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.frag {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper);
  text-align: left;
  cursor: pointer;
}

.frag[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--paper-hi);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.frag__label {
  font-family: var(--font-title);
  font-size: 15px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.frag__layers {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.frag__layer {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.frag__layer[hidden] {
  display: none;
}

.frag__name {
  flex: none;
  width: 58px;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.frag__chars {
  display: flex;
  gap: 1px;
  min-width: 0;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.frag__char {
  display: inline-block;
  width: 1ch;
  text-align: center;
}

.frag__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.frag__mode {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal, #2c5e54);
}

.frag__text {
  display: block;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  text-align: left;
}

.mixer-rules {
  margin: 8px 0 12px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.frag__char.is-mark {
  border-radius: 1px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 0 0 1px var(--rust);
}

.radio {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper);
}

.radio__row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.radio__play {
  width: auto;
  min-width: var(--tap-min);
  flex: none;
  padding: 8px 12px;
  font-size: var(--fs-caption);
}

.radio__state {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.2;
}

.wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 54px;
  overflow: hidden;
}

.wave__bar {
  flex: 1 1 2px;
  min-width: 2px;
  background: var(--ink-soft);
  border-radius: 1px;
  opacity: 0.55;
}

.wave.is-live .wave__bar {
  animation: wave-pulse 820ms ease-in-out infinite alternate;
}

@keyframes wave-pulse {
  from {
    transform: scaleY(0.55);
    opacity: 0.45;
  }
  to {
    transform: scaleY(1);
    opacity: 0.85;
  }
}

.hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.hints li {
  padding: 6px 10px;
  border-left: 2px solid var(--sepia);
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.hint-btn {
  align-self: flex-start;
  min-height: var(--tap-min);
  padding: 8px 12px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: transparent;
  font-size: var(--fs-caption);
  cursor: pointer;
}

.submit {
  margin-top: var(--sp-1);
}

.result {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: 24px 20px;
  border: 1px solid rgba(34, 28, 21, 0.24);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 8px 24px rgba(34, 28, 21, 0.12);
  overflow-wrap: anywhere;
}

.result__title {
  font-family: var(--font-title);
  font-size: var(--fs-h2);
  line-height: 1.15;
  font-weight: 400;
}

.result__lead {
  font-size: var(--fs-body);
  line-height: 1.45;
}

.echoes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.echoes li {
  padding-left: 14px;
  position: relative;
  font-size: var(--fs-body);
  line-height: 1.4;
}

.echoes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--ink-line);
}

.delta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.delta__title {
  font-size: var(--fs-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.delta__row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-size: var(--fs-body);
}

.delta__row > span {
  min-width: 0;
}

.delta__row img {
  width: 24px;
  height: 24px;
}

.delta__badge {
  width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 16px;
}

.delta__row--loss {
  color: var(--danger);
  font-weight: 600;
}

.delta__row--loss .delta__value {
  font-size: 14px;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.delta__value {
  font-family: var(--font-title);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.delta__now {
  font-size: 14px;
  color: var(--ink-soft);
  min-width: 38px;
  text-align: right;
}

.delta__empty {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.part {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-4);
  margin: auto 0;
  padding: 32px 24px;
  border: 1px solid rgba(34, 28, 21, 0.26);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 12px 30px rgba(34, 28, 21, 0.14);
}

.part__mark {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.part__title {
  font-family: var(--font-title);
  font-size: var(--fs-h1);
  line-height: 1.05;
  font-weight: 400;
}

.part__text {
  max-width: 30ch;
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.turn {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--sp-3);
  margin: auto 0;
  padding: 32px 24px;
  border: 1px solid rgba(34, 28, 21, 0.26);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 12px 30px rgba(34, 28, 21, 0.14);
}

.turn__title {
  font-family: var(--font-title);
  font-size: var(--fs-h1);
  line-height: 1.05;
  font-weight: 400;
}

.turn__day {
  margin: 0;
  font-size: var(--fs-lead);
  letter-spacing: 0.04em;
  color: var(--rust);
}

.turn__text {
  max-width: 30ch;
  font-size: var(--fs-lead);
  line-height: 1.45;
}

.ending {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 100dvh;
  background: url("assets/art/ui/paper-frame-9x16.webp") center / 100% 100% no-repeat;
  border-radius: inherit;
  overflow: hidden;
}

.ending__figure {
  position: relative;
  width: auto;
  max-width: calc(100% - 2 * var(--frame-inline));
  height: min(38dvh, 380px);
  aspect-ratio: 9 / 16;
  margin: max(68px, calc(var(--safe-top) + 56px)) auto 0;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
}

.ending__art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
}

.ending__sheet {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--frame-inline) var(--frame-bottom);
  overflow-wrap: anywhere;
}

.ending__title {
  font-family: var(--font-title);
  font-size: var(--fs-h1);
  line-height: 1.05;
  font-weight: 400;
}

.ending__lead {
  max-width: 34ch;
  font-size: var(--fs-body);
  line-height: 1.5;
}

.ending__score {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-3) 0 var(--sp-2);
  border-top: 1px solid var(--ink-line);
  border-bottom: 1px solid var(--ink-line);
}

.ending__score-label {
  font-size: var(--fs-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ending__score-value {
  font-family: var(--font-title);
  font-size: clamp(64px, 20vw, 104px);
  line-height: 0.9;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.ending__score-line {
  max-width: 32ch;
  font-size: var(--fs-lead);
  line-height: 1.35;
}

.ending__best {
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
}

.ending__stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--ink-line);
}

.ending__stat {
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink);
}

.ending__behind {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-3);
  border: 1px solid var(--ink-line);
  background: var(--paper-hi);
}

.ending__behind-title {
  font-size: var(--fs-caption);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ending__behind-text {
  font-size: var(--fs-body);
  line-height: 1.45;
}

.triage {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  container-type: inline-size;
  container-name: triage;
}

.triage__title {
  font-family: var(--font-title);
  font-size: var(--fs-h3);
  line-height: 1.15;
}

.triage__rule {
  padding: var(--sp-3);
  border-left: 3px solid var(--rust);
  background: var(--paper-hi);
  font-size: var(--fs-lead);
  line-height: 1.4;
}

.patients {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-3);
}

.patient {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--sp-3);
  border: 1px solid var(--ink-line);
  background: var(--paper-hi);
}

.patient__name {
  font-family: var(--font-title);
  font-size: var(--fs-h3);
  line-height: 1.1;
  font-weight: 400;
}

.patient__text {
  font-size: var(--fs-body);
  line-height: 1.4;
}

.patient__lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0;
  list-style: none;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.patient__source {
  font-weight: 700;
}

.triage__choices {
  display: flex;
  flex-direction: column;
  gap: var(--tap-gap);
}

.scheme {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  container-type: inline-size;
  container-name: scheme;
}

.scheme__legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--sepia);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.scheme__legend p {
  margin: 0;
}

.zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: var(--tap-primary);
  padding: var(--sp-3);
  text-align: left;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-1);
  background: var(--paper-hi);
}

.zone.is-picked {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.zone__name {
  font-family: var(--font-title);
  font-size: var(--fs-h3);
  line-height: 1.15;
}

.zone__rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.zone__row {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) 1.6fr;
  gap: 8px;
  font-size: 15px;
}

.zone__source {
  color: var(--ink-soft);
}

.zone__value {
  line-height: 1.35;
}

.choice.is-waiting {
  opacity: 0.6;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image: url("assets/art/ui/paper-tile-512.webp");
  background-size: 512px 512px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding:
    max(12px, var(--safe-top))
    max(16px, var(--safe-right))
    8px
    max(16px, var(--safe-left));
  border-bottom: 1px solid var(--ink-line);
}

.sheet__title {
  font-family: var(--font-title);
  font-size: var(--fs-h3);
  font-weight: 400;
}

.sheet__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding:
    16px
    max(16px, var(--safe-right))
    max(24px, var(--safe-bottom))
    max(16px, var(--safe-left));
}

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--ink-line);
}

.menu-row--slider {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.menu-slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
}

.menu-slider__val {
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.menu-slider {
  width: 100%;
  height: 28px;
  accent-color: var(--ink);
  cursor: pointer;
}

.menu-row__text {
  min-width: 0;
}

.menu-row__title {
  font-size: var(--fs-lead);
}

.menu-row__hint {
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
}

.switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: var(--tap-min);
  padding: 8px 14px;
  flex: none;
  border: 1px solid rgba(32, 34, 30, 0.28);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.2), 0 6px 16px rgba(10, 12, 10, 0.15);
  font-family: var(--font-body);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.switch:active:not([disabled]) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.2), 0 2px 6px rgba(10, 12, 10, 0.12);
}

.switch[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(10, 12, 10, 0.48), 0 8px 18px rgba(10, 12, 10, 0.24);
}

.menu-restart {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.menu-row__hint[hidden] {
  display: none;
}

.menu-meta {
  margin-top: auto;
  padding-top: var(--sp-6);
  font-size: 14px;
  color: var(--ink-soft);
}

.menu-meta--version {
  margin-top: 4px;
  padding-top: 0;
  font-size: 12px;
  letter-spacing: .04em;
  opacity: .7;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  background-color: var(--paper);
  background-image: url("assets/art/ui/paper-tile-512.webp");
  background-size: 512px 512px;
  text-align: center;
}

.boot__mark {
  width: 88px;
  height: 88px;
  object-fit: contain;
  opacity: 0.85;
}

.boot__text {
  font-family: var(--font-title);
  font-size: var(--fs-h3);
  color: var(--ink-soft);
}

.boot .btn {
  width: auto;
  min-width: 180px;
}

.namegate {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding:
    max(20px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
  background:
    linear-gradient(rgba(233, 223, 199, 0.86), rgba(233, 223, 199, 0.86)),
    url("../assets/art/ui/paper-tile-512.webp") repeat;
}

.namegate__card {
  width: min(100%, 360px);
  padding: 24px 20px 20px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  container-type: inline-size;
  container-name: namegate;
}

.namegate__stamp {
  margin: 0 0 18px;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.namegate__title {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(30px, 8vw, 38px);
  line-height: 1.04;
  font-weight: 400;
}

.namegate__lead {
  margin: 10px 0 22px;
  font-size: 17px;
  line-height: 1.3;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.namegate__label {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  color: var(--ink-soft);
}

.namegate__input {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  border-radius: var(--r-2);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 18px;
}

.namegate__input:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.namegate__hint {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.25;
  color: var(--ink-soft);
}

.namegate__error {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 1.25;
  color: var(--rust);
}

.namegate__next {
  width: 100%;
  margin-top: 18px;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--paper);
  opacity: 1;
  transition: opacity 220ms linear;
}

.intro.is-done {
  opacity: 0;
  pointer-events: none;
}

.intro__frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 220ms linear;
}

.intro__frame.is-active {
  opacity: 1;
}

.intro__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  transform: scale(1);
  transition: transform 1400ms linear;
}

.intro__frame.is-zoom .intro__img {
  transform: scale(1.015);
}

.intro__lamp-flicker {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at 32% 19%,
    rgba(16, 20, 18, 0.55) 0%,
    rgba(16, 20, 18, 0.34) 24%,
    rgba(16, 20, 18, 0.18) 55%,
    rgba(16, 20, 18, 0.1) 100%
  );
  opacity: 0;
}

.intro__lamp-flicker--s2 {
  background: radial-gradient(
    circle at 52% 16%,
    rgba(16, 20, 18, 0.58) 0%,
    rgba(16, 20, 18, 0.36) 24%,
    rgba(16, 20, 18, 0.18) 55%,
    rgba(16, 20, 18, 0.1) 100%
  );
}

.intro__lamp-flicker--s3 {
  background: radial-gradient(
    circle at 52% 11%,
    rgba(14, 18, 17, 0.62) 0%,
    rgba(14, 18, 17, 0.38) 22%,
    rgba(14, 18, 17, 0.16) 52%,
    rgba(14, 18, 17, 0.08) 100%
  );
}

.intro__frame.is-active .intro__lamp-flicker {
  animation: intro-lamp-flicker 3.2s infinite;
}

.intro__frame.is-active .intro__lamp-flicker--s2 {
  animation-duration: 2.9s;
  animation-delay: -0.4s;
}

.intro__frame.is-active .intro__lamp-flicker--s3 {
  animation-duration: 3.5s;
  animation-delay: -0.9s;
}

@keyframes intro-lamp-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 78%, 82%, 100% {
    opacity: 0;
  }
  20%, 24%, 55% {
    opacity: 0.92;
  }
  22% {
    opacity: 0.45;
  }
  79% {
    opacity: 0.78;
  }
  80% {
    opacity: 0.15;
  }
  81% {
    opacity: 0.65;
  }
}

.intro__brand {
  position: absolute;
  inset: 31% 24% 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  pointer-events: none;
}

.intro__brand-logo,
.intro__brand-name,
.intro__brand-studio,
.intro__brand-presents {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.intro__brand-logo {
  width: clamp(68px, 18vw, 112px);
  height: auto;
  filter: sepia(0.35) contrast(1.05);
}

.intro__brand-logo--capsgame {
  width: clamp(76px, 21vw, 122px);
  filter: sepia(0.12) contrast(1.04) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.22));
}

.intro__brand-name {
  margin: 4px 0 0;
  font-family: var(--font-title);
  font-size: clamp(16px, 4.2vw, 22px);
  letter-spacing: 0.14em;
  color: var(--ink);
}

.intro__brand-studio {
  margin: 6px 0 0;
  font-family: var(--font-body);
  font-size: clamp(13px, 3.2vw, 16px);
  letter-spacing: 0.08em;
  color: var(--ink);
}

.intro__brand-presents {
  margin: 2px 0 0;
  font-family: var(--font-body);
  font-size: clamp(13px, 3.2vw, 16px);
  font-style: italic;
  color: var(--ink-soft);
}

.intro__frame.is-active .intro__brand-logo,
.intro__frame.is-active .intro__brand-name {
  opacity: 0.92;
  transform: translateY(0);
  transition-delay: 150ms;
}

.intro__frame.is-active .intro__brand-studio {
  opacity: 0.88;
  transform: translateY(0);
  transition-delay: 900ms;
}

.intro__frame.is-active .intro__brand-presents {
  opacity: 0.85;
  transform: translateY(0);
  transition-delay: 1550ms;
}

.intro__frame--partner.is-active .intro__brand-studio {
  transition-delay: 550ms;
}

.intro__frame--partner.is-active .intro__brand-presents {
  font-family: var(--font-title);
  font-style: normal;
  font-size: clamp(15px, 4vw, 20px);
  letter-spacing: 0.08em;
  color: var(--ink);
  opacity: 0.92;
  transition-delay: 1000ms;
}

@media (prefers-reduced-motion: reduce) {
  .intro__lamp-flicker {
    animation: none;
    opacity: 0;
  }

  .intro__brand-logo,
  .intro__brand-name,
  .intro__brand-studio,
  .intro__brand-presents {
    transition-duration: 1ms;
    transition-delay: 0ms !important;
    transform: none;
  }
}

.intro__gate {
  position: absolute;
  left: 50%;
  bottom: 18%;
  z-index: 3;
  transform: translateX(-50%);
  width: min(86%, 340px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 14px 16px;
  text-align: center;
  border-radius: 14px;
  background: rgba(9, 11, 13, 0.72);
  border: 1px solid rgba(233, 223, 199, 0.22);
  backdrop-filter: blur(3px);
}

.intro__gate[hidden] {
  display: none;
}

.intro__gate-title {
  font-family: var(--font-title);
  font-size: clamp(15px, 4vw, 19px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper, #e9dfc7);
}

.intro__gate-note {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(233, 223, 199, 0.82);
  font-variant-numeric: tabular-nums;
}

.group-discuss {
  min-block-size: var(--tap-min);
  text-decoration: none;
  overflow-wrap: break-word;
}

.group-discuss:focus-visible {
  outline: 3px solid var(--rust);
  outline-offset: 3px;
}

.intro__gate-discuss {
  margin-top: 6px;
  min-height: var(--tap-min);
  padding: 10px 14px;
  font-size: 16px;
  border-color: rgba(233, 223, 199, 0.45);
  background: rgba(233, 223, 199, 0.94);
  color: var(--ink);
}

.intro__gate-discuss[hidden] {
  display: none;
}

.intro__skip {
  position: absolute;
  right: max(16px, var(--safe-right));
  bottom: max(16px, var(--safe-bottom));
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 8px 14px;
  border: 1px solid rgba(233, 223, 199, 0.7);
  border-radius: var(--r-2);
  background: rgba(34, 28, 21, 0.72);
  color: var(--paper-hi);
  font-size: var(--fs-caption);
  cursor: pointer;
}

.intro__skip-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

.intro__skip span {
  line-height: 1.1;
}

.intro__start {
  position: absolute;
  left: 50%;
  bottom: max(22px, var(--safe-bottom));
  z-index: 3;
  transform: translateX(-50%);
  width: 82%;
  max-width: 260px;
  box-shadow: 0 10px 28px rgba(10, 8, 6, 0.45);
}

.intro__start[hidden] {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  top: auto;
  bottom: max(18px, var(--safe-bottom));
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: min(calc(100% - 28px), 400px);
  max-width: 400px;
  box-sizing: border-box;
  transform: translateX(-50%);
  padding: 14px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--r-3);
  background: #F7F1E0;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(34, 28, 21, 0.32);
  font-size: var(--fs-caption);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.toast--ok {
  border-color: var(--teal, #3b6b63);
  border-left-width: 4px;
}

.toast--fail {
  border-color: var(--rust);
  border-left-width: 4px;
}

dialog.result-modal {
  width: min(calc(100% - 32px), 380px);
  max-width: 380px;
  margin: auto;
  padding: 20px 18px 18px;
  border: 1px solid rgba(32, 34, 30, 0.3);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  color: var(--ink);
  box-shadow: 0 18px 44px rgba(10, 12, 10, 0.42);
}

dialog.result-modal:modal {
  overscroll-behavior: contain;
}

dialog.result-modal::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(18, 17, 15, 0.56);
  backdrop-filter: blur(3px);
}

dialog.result-modal[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-modal__badge {
  font-family: var(--font-title);
  font-size: 22px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.15;
}

.result-modal.is-ok .result-modal__badge {
  color: var(--teal, #3b6b63);
}

.result-modal.is-fail .result-modal__badge {
  color: var(--rust);
}

.result-modal__text {
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--ink);
}

.result-modal__actions {
  margin-top: 4px;
}

.toast[hidden] {
  display: none;
}

.toast__close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  opacity: 0.7;
}

.noscript {
  padding: var(--sp-6);
  font-size: var(--fs-lead);
}

@media (min-width: 700px) {
  html,
  body {
    background-color: var(--paper-deep);
  }

  body {
    background-image: none;
  }

  .app {
    width: min(430px, 100%);
    max-width: 430px;
    min-height: min(calc(100dvh - 48px), 940px);
    margin: 24px auto;
    overflow: hidden;
    border: 1px solid rgba(34, 28, 21, 0.28);
    border-radius: 28px;
    background-color: var(--paper);
    background-image: url("assets/art/ui/paper-tile-512.webp");
    background-size: 512px 512px;
    background-repeat: repeat;
    box-shadow:
      0 1px 2px rgba(34, 28, 21, 0.14),
      0 18px 48px rgba(34, 28, 21, 0.2);
  }

  .scene {
    height: auto;
    aspect-ratio: 9 / 16;
    max-height: 56dvh;
  }

  .ending {
    min-height: min(calc(100dvh - 48px), 940px);
  }

  .dialog__text,
  .result__lead {
    max-width: 34ch;
  }

  .panel__text,
  .dialog__text {
    font-size: var(--fs-body);
  }

  .sheet,
  .boot,
  .namegate,
  .intro {
    top: 24px;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(430px, 100%);
    height: min(calc(100dvh - 48px), 940px);
    transform: translateX(-50%);
    border: 1px solid rgba(34, 28, 21, 0.28);
    border-radius: 28px;
    box-shadow:
      0 1px 2px rgba(34, 28, 21, 0.14),
      0 18px 48px rgba(34, 28, 21, 0.2);
    overflow: hidden;
  }

  .sheet,
  .namegate {
    overflow-y: auto;
  }
}

@container triage (max-width: 300px) {
  .triage__rule,
  .patient {
    padding: 10px;
  }
}

@container mechanic (max-width: 300px) {
  .mechanic__prompt {
    font-size: 18px;
  }

  .frag__name {
    width: 46px;
  }

  .frag__chars {
    font-size: 13px;
  }
}

@container scheme (max-width: 300px) {
  .zone__row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@container namegate (max-width: 340px) {
  .namegate__title {
    font-size: 30px;
  }

  .namegate__lead {
    white-space: normal;
  }
}

@media (max-width: 360px) {
  :root {
    --fs-body: 16px;
    --fs-lead: 18px;
  }

  .resources {
    gap: 4px;
  }

  .resource {
    gap: 3px;
    padding: 4px;
    min-height: 44px;
  }

  .resource__icon {
    width: 18px;
    height: 18px;
  }

  .resource__value {
    font-size: 19px;
  }

  .resource__label {
    font-size: 16px;
    letter-spacing: -0.01em;
  }

  .resource__slash {
    left: 3px;
    width: 18px;
    height: 18px;
  }

  .doc__note {
    font-size: 13px;
  }

  .frag__name {
    width: 48px;
    font-size: 11px;
  }

  .frag__chars {
    font-size: 14px;
  }

  .rev-head,
  .rev-row {
    grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr);
    gap: 5px;
  }
}

@media (max-height: 660px) {
  .scene {
    height: 168px;
  }

  .app {
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .intro__frame.is-zoom .intro__img {
    transform: none;
  }

  .wave.is-live .wave__bar {
    animation: none;
  }
}

/* --- репутация семьи ------------------------------------------------ */
.repbar {
  position: relative;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}

.app[data-screen="summary"] > .repbar,
.app[data-screen="ending"] > .repbar {
  display: none;
}

.app[data-screen="turn"] .repbar,
.app[data-screen="part"] .repbar {
  padding: 14px 20px 6px;
}

.result__repbar {
  padding: 0;
}

.top-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-section__title {
  margin: 0;
  font-size: var(--fs-caption);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
}

.top-row__main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.top-row__name {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-row__meta {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-row__score {
  flex: none;
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--ink);
  white-space: nowrap;
}

.repbar__label {
  font-size: 15px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.repbar__track {
  position: relative;
  flex: 1;
  height: 8px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  background: var(--paper-hi);
  overflow: hidden;
}

.repbar__fill {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--ink);
  transition: width 0.35s ease;
}

.repbar__value {
  min-width: 2ch;
  font-family: var(--font-title);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.repbar.is-low .repbar__fill {
  background: var(--rust);
}

.repbar.is-low .repbar__value {
  color: var(--rust);
}

/* --- голосование волны ---------------------------------------------- */
.vote__discuss {
  min-height: var(--tap-min);
  padding: 10px 16px;
  font-size: 16px;
  border-color: rgba(154, 72, 42, 0.48);
  background: var(--paper-hi);
  color: var(--ink);
}

.vote {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(154, 72, 42, 0.48);
  background: rgba(154, 72, 42, 0.06);
  box-shadow: 0 2px 10px rgba(154, 72, 42, 0.08);
}

.vote__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vote__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(154, 72, 42, 0.15);
  border: 1px solid rgba(154, 72, 42, 0.35);
  color: #8c3b20;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vote__explain {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.vote__title {
  margin: 0;
  font-family: var(--font-title);
  font-size: 22px;
  line-height: 1.2;
}

.vote__count,
.vote__timer,
.vote__wait {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

.vote__timer {
  font-variant-numeric: tabular-nums;
}

.vote__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vote__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vote__option.is-chosen {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.vote__option.is-late {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  font-weight: 600;
}

.vote__option.is-locked {
  opacity: 0.5;
}

.vote__mark {
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* --- Рычаги: последовательность (пролог) --- */
.door {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin: 10px auto 4px;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  border-radius: 12px;
}

.door__art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.door__chalk {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.chalk {
  stroke: rgba(247, 243, 233, 0.55);
  stroke-width: 0.7;
  stroke-dasharray: 2.4 2.4;
  vector-effect: non-scaling-stroke;
}

.chalk--crossed {
  stroke: rgba(214, 120, 80, 0.9);
  stroke-dasharray: 1.6 1.8;
  stroke-width: 1;
}

.bolt {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap-min);
  height: var(--tap-min);
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(247, 243, 233, 0.75);
  border-radius: 50%;
  background: rgba(24, 26, 24, 0.35);
  color: #f7f3e9;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.bolt.is-crossed {
  border-color: rgba(214, 120, 80, 0.9);
}

.bolt.is-tightened {
  border-style: solid;
  border-color: #f7f3e9;
  background: rgba(24, 26, 24, 0.68);
  transform: translate(-50%, -50%) scale(1.06);
}

.bolt__label {
  font-size: calc(var(--fs-body) * 1.05);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.door__hint {
  margin: 6px 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  text-align: center;
}

.bolt__order {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--rust);
  color: #f7f3e9;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
}

.bolt__order:empty {
  display: none;
}

.bolts__order,
.bolts__hint {
  margin: 6px 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.bolts__reset {
  margin-top: 0;
  min-height: var(--tap-primary);
}

.mechanic__frame {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--sepia);
  background: var(--paper-hi);
}

.mechanic__who {
  margin: 0 0 4px;
  font-size: var(--fs-caption);
  color: var(--rust);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mechanic__quote {
  margin: 0;
  font-size: var(--fs-body);
}

.jugs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.jug {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 204px;
  padding: 12px 8px;
  border: 1px solid rgba(32, 34, 30, 0.28);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.18), 0 6px 14px rgba(10, 12, 10, 0.12);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.jug:active:not([disabled]) {
  transform: translateY(2px);
}

.jug.is-source {
  border-color: var(--rust);
  border-width: 2px;
}

.jug[aria-pressed="true"] {
  border-color: var(--rust);
}

.jug__name {
  font-size: var(--fs-caption);
  font-weight: 700;
  text-align: center;
  min-height: 1.4em;
}

.jug__stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 126px;
  width: 100%;
}

.jug__vessel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jug__neck {
  display: block;
  height: 10px;
  border: 2px solid var(--ink-soft);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: rgba(242, 234, 218, 0.9);
}

.jug--bidon .jug__neck {
  height: 13px;
  border-color: var(--ink);
  background: rgba(169, 136, 92, 0.28);
}

.jug__bar {
  position: relative;
  display: block;
  border: 2px solid var(--ink-soft);
  border-radius: 10px 10px 8px 8px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0%, var(--paper) 28%, rgba(34, 28, 21, 0.06) 100%);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(34, 28, 21, 0.1);
}

.jug--bidon .jug__bar {
  border-color: var(--ink);
  border-radius: 14px 14px 6px 6px;
}

.jug__fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  background: linear-gradient(180deg, #7fa39a 0%, var(--teal-mid) 35%, var(--teal-deep) 100%);
  border-top: 2px solid rgba(242, 234, 218, 0.55);
  transition: height 220ms ease-out;
}

.jug__amount {
  font-size: var(--fs-caption);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.jugs__goal,
.jugs__log {
  margin: 6px 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.slot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px dashed var(--ink-line);
  border-radius: 4px;
  background: var(--paper-hi);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.slot.is-filled {
  border-style: solid;
  border-color: var(--sepia);
}

.slot__index {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--ink-soft);
  font-size: var(--fs-caption);
  line-height: 22px;
  text-align: center;
}

.slot__text {
  font-size: var(--fs-body);
}

.words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}

.word {
  min-height: var(--tap-min);
  padding: 8px 12px;
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-body);
}

.word.is-used {
  opacity: 0.4;
  border-style: dotted;
}

.words__label {
  margin: 10px 0 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.pulse {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: min(176px, 64vw);
  height: min(176px, 64vw);
  margin: 14px auto;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.pulse__heart {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(118px, 44vw);
  height: min(108px, 40vw);
  transition: transform 140ms ease-out, filter 140ms ease-out;
}

.pulse__heart-svg {
  width: 100%;
  height: 100%;
  fill: rgba(163, 64, 47, 0.22);
  stroke: var(--danger);
  stroke-width: 3.2;
  stroke-linejoin: round;
  filter: drop-shadow(0 6px 14px rgba(163, 64, 47, 0.22));
  transition: fill 140ms ease-out, stroke 140ms ease-out;
}

.pulse.is-tick .pulse__heart {
  transform: scale(1.08);
}

.pulse.is-tick .pulse__heart-svg {
  fill: rgba(163, 64, 47, 0.38);
}

.pulse.is-counting .pulse__heart-svg {
  fill: rgba(163, 64, 47, 0.5);
}

.pulse.is-beat .pulse__heart {
  transform: scale(1.22);
}

.pulse.is-beat .pulse__heart-svg {
  fill: var(--danger);
  stroke: var(--ink);
  filter: drop-shadow(0 0 18px rgba(163, 64, 47, 0.55));
}

.pulse.is-ready .pulse__heart-svg {
  fill: var(--teal-deep);
  stroke: var(--ink);
}

.pulse__label {
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.pulse__readout,
.pulse__hint,
.pulse__range {
  margin: 6px 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  text-align: center;
}


.beds {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.bed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--tap-min);
  padding: 10px 12px;
  border: 1px dashed var(--sepia);
  border-radius: 10px;
  background: var(--paper-hi);
  color: var(--ink);
  font: inherit;
  text-align: left;
}

.bed.is-filled {
  border-style: solid;
  border-color: var(--rust);
}

.bed__label {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

.bed__who {
  font-size: var(--fs-body);
}

.people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}

.person {
  min-height: var(--tap-min);
  padding: 8px 14px;
  border: 1px solid var(--sepia);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.person[aria-pressed='true'] {
  border-color: var(--rust);
  background: var(--paper-hi);
}

.person.is-used {
  opacity: 0.45;
}

.beds__order {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
}

/* --- Кто в зале: три силуэта --- */
.cards {
  display: grid;
  gap: 10px;
  margin: 14px 0 6px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: var(--tap-min);
  padding: 14px 16px;
  text-align: left;
  border: 1px dashed var(--line, rgba(255, 255, 255, 0.18));
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.card.is-picked {
  border-style: solid;
  border-color: var(--accent, #e0a84a);
}

.card__title {
  font-weight: 700;
}

.card__line {
  font-size: 0.92rem;
  opacity: 0.82;
  line-height: 1.35;
}

/* --- Тишина: держи и отпусти --- */
.hold__bar {
  position: relative;
  height: 12px;
  margin: 14px 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.hold__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent, #e0a84a);
  transition: width 0.1s linear;
}

.hold__readout {
  margin: 0 0 12px;
  font-size: 0.92rem;
  opacity: 0.85;
}

.hold {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 84px;
  border: 1px solid rgba(32, 34, 30, 0.28);
  border-radius: var(--r-3);
  background: var(--paper-hi);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 3px 0 rgba(32, 34, 30, 0.2), 0 6px 16px rgba(10, 12, 10, 0.15);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.hold.is-held {
  border-color: var(--rust);
  background: rgba(201, 160, 99, 0.28);
  box-shadow: 0 1px 0 rgba(32, 34, 30, 0.2), 0 2px 6px rgba(10, 12, 10, 0.12);
  transform: translateY(2px);
}

.pick__need {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted, #6a6257);
}

.card.is-picked .card__title::after {
  content: " · взято";
  font-weight: 400;
}

.words__budget {
  margin: 6px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #6a6257);
}

.word.is-forbidden {
  opacity: 0.55;
  text-decoration: line-through;
}

/* --- Лестница: двенадцать ступеней и мыши, которые чуют спешку --- */
.ladder {
  position: relative;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  margin: 18px auto 12px;
  padding: 14px 22px 14px 18px;
  width: min(240px, 74vw);
  border: 1px solid rgba(214, 202, 178, 0.22);
  border-radius: 14px;
  background: rgba(10, 12, 14, 0.5);
}

.ladder__rung {
  height: 10px;
  border-radius: 4px;
  background: rgba(214, 202, 178, 0.18);
}

.ladder__rung.is-passed {
  background: rgba(140, 168, 128, 0.65);
}

.ladder__rung.is-current {
  background: rgba(214, 168, 92, 0.85);
}

.ladder__climber {
  position: absolute;
  right: 6px;
  bottom: 0;
  font-size: 12px;
  color: #d6a85c;
  transition: bottom 0.15s ease;
}

.ladder__readout {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
}

.ladder__falls {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}

.ladder__rules {
  margin: 8px 0 10px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.ladder-choice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.ladder-choice__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal, #2c5e54);
  text-align: center;
}

.ladder-choice__btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ladder-choice__btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(34, 28, 21, 0.25);
  background: var(--paper-hi);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ladder-choice__btn:active {
  transform: translateY(1px);
}

.ladder-choice__side {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rust);
}

.ladder-choice__desc {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink);
}

.ladder__tap {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  margin-bottom: 10px;
  padding: 14px 18px;
  border: 1px solid rgba(214, 168, 92, 0.55);
  border-radius: 12px;
  background: rgba(214, 168, 92, 0.12);
  color: #f0e7d6;
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.ladder__tap:disabled {
  opacity: 0.45;
}

/* --- Лабиринт под плитой: клетки, стены и один сквозняк --- */
.maze {
  display: grid;
  gap: 3px;
  margin: 14px auto 10px;
  padding: 10px;
  width: 100%;
  max-width: 320px;
  border: 1.5px solid var(--ink-line);
  border-radius: 14px;
  background: rgba(244, 236, 217, 0.92);
}

.maze__cell {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(34, 28, 21, 0.14);
  border-radius: 6px;
  background: rgba(34, 28, 21, 0.08);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.maze__cell.is-seen {
  background: rgba(255, 250, 238, 0.95);
  border-color: rgba(34, 28, 21, 0.72);
}

.maze__cell.is-open-u {
  border-top-color: transparent;
}

.maze__cell.is-open-d {
  border-bottom-color: transparent;
}

.maze__cell.is-open-l {
  border-left-color: transparent;
}

.maze__cell.is-open-r {
  border-right-color: transparent;
}

.maze__cell.is-path,
.maze__cell.is-visited {
  background: rgba(114, 156, 102, 0.26);
}

.maze__cell.is-next {
  border: 2px dashed #b45d2a;
  background: rgba(235, 186, 114, 0.34);
}

.maze__cell.is-here {
  background: rgba(214, 148, 56, 0.45);
  box-shadow: inset 0 0 0 2px #8a4318;
  color: #4f2207;
}

.maze__cell.is-exit {
  background: rgba(66, 138, 82, 0.28);
  border-color: #2f6b3e;
  color: #1f4f2b;
}

.maze__cell.is-start:not(.is-here) {
  background: rgba(140, 132, 114, 0.24);
}

.maze__readout {
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.maze__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Тридцать секунд: три укрытия и четверо людей --- */
.zones {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 12px 0 10px;
}

.zone {
  min-height: 78px;
  padding: 11px 12px;
  border: 1.5px dashed rgba(34, 28, 21, 0.34);
  border-radius: 12px;
  background: rgba(247, 241, 224, 0.86);
  color: var(--ink);
  transition: border-color 140ms ease, background 140ms ease;
}

.zone.is-ready {
  border-color: var(--accent, #9b4b28);
  background: rgba(255, 249, 236, 0.96);
  cursor: pointer;
}

.zone.is-filled {
  border-style: solid;
  border-color: rgba(47, 107, 62, 0.55);
  background: rgba(244, 248, 240, 0.92);
}

.zone.is-full {
  border-color: rgba(47, 107, 62, 0.8);
}

.zone__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.zone__label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.zone__cap {
  flex: none;
  padding: 2px 8px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  background: var(--paper-hi);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.zone.is-full .zone__cap {
  border-color: rgba(47, 107, 62, 0.65);
  background: rgba(226, 240, 224, 0.95);
  color: #214e2c;
}

.zone__note {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-soft);
}

.zone__slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.zone__person {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid rgba(47, 107, 62, 0.5);
  border-radius: 8px;
  background: rgba(226, 240, 224, 0.95);
  color: #1d3c25;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.zone__person:hover {
  border-color: var(--ink);
  background: rgba(214, 232, 211, 1);
}

.zones__people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.zones__clock,
.zones__readout {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

.zones__clock.is-over {
  color: #a63d28;
  font-weight: 700;
}

/* --- Рамка по волне: шесть секунд записи и один голос --- */
.wave {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 96px;
  margin: 16px 0 10px;
  padding: 8px;
  border: 1px solid rgba(214, 202, 178, 0.22);
  border-radius: 12px;
  background: rgba(10, 12, 14, 0.5);
}

.bar {
  flex: 1;
  min-height: 4px;
  border-radius: 2px;
  background: rgba(214, 202, 178, 0.35);
  cursor: pointer;
}

.bar.is-in {
  background: rgba(140, 168, 128, 0.85);
}

.bar.is-edge {
  background: rgba(235, 172, 68, 1);
}

.wave__readout {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink, #262018);
}

/* --- Таблетки в блистере: пятнашки 3x3 --- */
.pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 6px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border-radius: 14px;
  border: 1.5px solid rgba(38, 32, 24, 0.22);
  background: rgba(38, 32, 24, 0.04);
  padding: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.pill.is-movable {
  border-color: rgba(155, 77, 31, 0.55);
  background: rgba(155, 77, 31, 0.07);
}

.pill--empty {
  border: 2px dashed rgba(38, 32, 24, 0.35);
  background: rgba(38, 32, 24, 0.02);
  cursor: default;
}

.pill__body {
  width: 52px;
  height: 30px;
  border-radius: 16px;
}

.pill--r .pill__body {
  background: #c6554f;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.pill--b .pill__body {
  background: #4f7fc6;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.pill:disabled {
  cursor: default;
}

.pill:not(:disabled):active {
  transform: translateY(2px);
}

.pills__moves {
  margin: 8px 0 0;
  font-size: 13px;
  opacity: 0.72;
}

.pills__hint {
  margin: 4px 0 10px;
  font-size: 12px;
  opacity: 0.6;
}

.pills-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 8px 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(34, 28, 21, 0.04);
  border: 1px solid rgba(34, 28, 21, 0.12);
}

.pills-preview__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.pills-preview__grid {
  display: grid;
  grid-template-columns: repeat(3, 18px);
  gap: 4px;
}

.pills-preview__cell {
  width: 18px;
  height: 12px;
  border-radius: 6px;
}

.pills-preview__cell.is-r {
  background: #c44d44;
  border: 1px solid #96342d;
}

.pills-preview__cell.is-b {
  background: #4a78c2;
  border: 1px solid #325795;
}

.pills-preview__cell.is-empty {
  border: 1px dashed rgba(34, 28, 21, 0.4);
  background: transparent;
}

/* --- Доска заданий акта 1 --- */
.quests {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 8px;
}

.quest {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  min-height: var(--tap-min);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px dashed rgba(38, 32, 24, 0.28);
  background: rgba(38, 32, 24, 0.03);
  color: var(--ink, #262018);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.quest.is-picked {
  border-style: solid;
  border-color: var(--accent, #9b4d1f);
  background: rgba(155, 77, 31, 0.12);
  box-shadow: inset 4px 0 0 var(--accent, #9b4d1f);
}

.quest__title {
  font-size: 15px;
  font-weight: 600;
}

.quest__brief {
  font-size: 13px;
  opacity: 0.75;
}

.quests__count {
  margin: 6px 0 2px;
  font-size: 13px;
  opacity: 0.8;
}

.queststrip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
}

.queststrip__label {
  opacity: 0.6;
}

.queststrip__item.is-taken {
  opacity: 0.85;
}

.queststrip__item.is-done {
  opacity: 1;
}

.queststrip__item.is-failed {
  opacity: 0.55;
  text-decoration: line-through;
}

.questlog {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.questlog__row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 2px 8px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.questlog__mark {
  grid-row: span 3;
  font-size: 16px;
}

.questlog__title {
  font-size: 14px;
  font-weight: 600;
}

.questlog__text {
  margin: 0;
  font-size: 13px;
  opacity: 0.75;
}

.questlog__effect {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* --- Кадр истории: картинка целиком, текст поверх неё --- */
.app--wide {
  min-height: 100dvh;
}

.app--wide .scene {
  position: sticky;
  top: max(8px, var(--safe-top));
  z-index: 1;
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: 9 / 16;
  flex: none;
  border-color: rgba(32, 34, 30, 0.45);
  background: var(--paper-deep);
  isolation: isolate;
}

.app--wide .scene__image {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.app--wide .panel {
  position: relative;
  z-index: 20;
  margin-top: 0;
  gap: var(--sp-3);
  padding: 14px 14px max(18px, var(--safe-bottom));
  border: 1px solid rgba(32, 34, 30, 0.2);
  border-radius: var(--r-3);
  background: rgba(233, 223, 199, 0.94);
  box-shadow: 0 -8px 28px rgba(10, 12, 10, 0.34);
  backdrop-filter: blur(6px);
}

.app--wide .scene:not([hidden]) + .panel {
  margin-top: -6dvh;
}

.app--wide .panel__body > .page {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.app--wide .panel__body > .page .panel__text p {
  font-size: calc(var(--fs-body) * 1.02);
  line-height: 1.42;
}

/* --- Рычаги поверх большой картинки --- */
.door--overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  max-width: none;
  margin: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: none;
}

.door--overlay .door__chalk {
  position: absolute;
  width: auto;
  height: auto;
}

.door--overlay .bolt {
  z-index: 2;
}

.door-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--sp-2);
}

.door-bar__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: stretch;
}

.door-bar__actions .action {
  width: 100%;
  height: 100%;
  min-height: 44px;
  padding: 10px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  font-size: 15px;
}

.search-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.search-back-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 6;
  background: rgba(242, 234, 218, 0.94);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.power-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.power-lamp {
  position: absolute;
  width: 9%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(217, 108, 48, 0.55) 0%, rgba(163, 64, 47, 0.25) 55%, transparent 78%);
  mix-blend-mode: screen;
  transition: background 180ms ease, box-shadow 180ms ease;
}

.power-lamp.is-on {
  background: radial-gradient(circle, rgba(124, 235, 134, 0.92) 0%, rgba(62, 184, 92, 0.55) 55%, transparent 80%);
  box-shadow: 0 0 18px 6px rgba(96, 224, 120, 0.55);
}

.power-switch {
  position: absolute;
  width: 12.5%;
  height: 15.5%;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.power-switch__plate {
  position: relative;
  width: 68%;
  height: 70%;
  border-radius: 6px;
  border: 2px solid #1c1a17;
  background: linear-gradient(180deg, #5d6a68 0%, #3d4745 55%, #2b3332 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 3px 6px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.power-switch__slot {
  width: 26%;
  height: 62%;
  border-radius: 3px;
  background: #141716;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.power-switch__lever {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 44%;
  height: 46%;
  border-radius: 6px;
  border: 2px solid #181614;
  background: linear-gradient(180deg, #b8b1a3 0%, #7d776c 60%, #4d4942 100%);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.55);
  transform: translate(-50%, 6%) scaleY(0.95);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.power-switch.is-on .power-switch__lever {
  background: linear-gradient(180deg, #9ce69e 0%, #4a9659 55%, #285b33 100%);
  transform: translate(-50%, -88%) scaleY(1.02);
  box-shadow: 0 -2px 6px rgba(96, 224, 120, 0.45), 0 2px 4px rgba(0, 0, 0, 0.5);
}

.power-switch__badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(24, 21, 17, 0.92);
  color: #f2eada;
  border: 1px solid rgba(233, 223, 199, 0.45);
  white-space: nowrap;
  transition: background 160ms ease, border-color 160ms ease;
}

.power-switch.is-on .power-switch__badge {
  background: #2f6b3e;
  border-color: #9ee8ad;
  color: #f4fbf5;
}

.power-timer {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.power-timer.is-urgent {
  color: var(--danger);
}

.power-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.power-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-2);
  background: rgba(255, 255, 255, 0.52);
  border: 2px solid var(--ink-line);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 150ms ease, border-color 150ms ease;
}

.power-row.is-on {
  background: rgba(231, 245, 232, 0.88);
  border-color: #2f6b3e;
}

.power-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.power-row__code {
  font-size: 14px;
  color: var(--ink);
}

.power-row__status {
  font-size: 12px;
  color: var(--ink-soft);
}

.power-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.power-toggle__track {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #8b8274;
  transition: background 160ms ease;
}

.power-row.is-on .power-toggle__track,
.tape-eq-row.is-on .power-toggle__track {
  background: #3b7d4b;
}

.power-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper-hi);
  border: 1.5px solid var(--ink);
  transition: transform 160ms ease;
}

.power-row.is-on .power-toggle__thumb,
.tape-eq-row.is-on .power-toggle__thumb {
  transform: translateX(18px);
}

.power-toggle__state {
  min-width: 58px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.power-reset {
  width: 100%;
  min-height: var(--tap-primary);
}

.power-manual {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-overlay.is-loading {
  opacity: 0;
  pointer-events: none;
}

.search-hotspot {
  position: absolute;
  width: 52px;
  height: 52px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.search-hotspot--container {
  width: 24%;
  height: 24%;
  border-radius: 12px;
}

.search-hotspot--item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12%;
  height: auto;
  aspect-ratio: 1 / 1;
  overflow: visible;
}

.search-hotspot--item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: max(100%, 44px);
  transform: translate(-50%, -50%);
}

.search-hotspot--meds {
  width: 22%;
}

.search-item__img {
  display: block;
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.96;
  filter: sepia(0.42) contrast(0.88) brightness(0.72) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

/* Бутылки воды: тёплый бункерный тон и тень опоры без «призрачного» multiply */
.search-hotspot--kind-water .search-item__img {
  opacity: 0.94;
  filter: sepia(0.58) saturate(0.78) contrast(0.94) brightness(0.64) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
}

.search-hotspot:focus-visible {
  outline: 1px solid rgba(34, 28, 21, 0.35);
}

.search-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: var(--sp-2);
}

.search-bar__hint {
  margin: 0;
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  line-height: 1.35;
}

.search-bar__counts {
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.search-bar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(14, 11, 9, 0.58);
}

.search-popup__card {
  width: 82%;
  max-width: 280px;
  padding: 18px 16px;
  border-radius: 12px;
  border: 2px solid var(--ink, #231d16);
  background: var(--paper, #e9dec7);
  color: var(--ink, #231d16);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.48);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.search-popup__text {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.search-popup__btn {
  min-width: 96px;
}

.radio-game {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-game__figure {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 717;
  overflow: hidden;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-deep);
}

.radio-game__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.radio-overlay-dial {
  position: absolute;
  left: 34%;
  top: 19%;
  width: 32%;
  height: 22%;
  border-radius: 8px;
  pointer-events: none;
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.radio-game__figure.is-signal .radio-overlay-dial {
  background: radial-gradient(circle at 50% 62%, rgba(92, 230, 118, 0.52), rgba(56, 185, 86, 0.16) 68%, transparent 100%);
  box-shadow: inset 0 0 18px rgba(92, 230, 118, 0.55), 0 0 16px rgba(92, 230, 118, 0.45);
}

.radio-overlay-needle {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 3px;
  height: 84%;
  border-radius: 2px;
  background: #b93822;
  box-shadow: 0 0 4px rgba(185, 56, 34, 0.55);
  transform-origin: 50% 100%;
  transform: translateX(-50%) rotate(0deg);
  transition: transform 0.14s ease-out;
}

.radio-overlay-knob {
  position: absolute;
  width: 19.5%;
  aspect-ratio: 1 / 1;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.radio-overlay-knob:active {
  cursor: grabbing;
}

.radio-overlay-knob--left {
  left: 22.4%;
  top: 61.5%;
}

.radio-overlay-knob--right {
  left: 77.6%;
  top: 61.5%;
}

.radio-overlay-knob__img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
  transition: transform 0.14s ease-out;
}

.radio-game__msg {
  padding: 12px 14px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  font-size: var(--fs-body);
  line-height: 1.4;
}

.radio-game__msg.is-caught {
  border-color: var(--teal, #3b6b63);
  border-left-width: 4px;
  font-weight: 700;
}

/* --- Десктоп: картинка во всю высоту экрана, текст рядом --- */
@media (min-width: 900px) {
  .app--wide {
    display: grid;
    grid-template-columns: auto minmax(380px, 560px);
    grid-template-areas:
      "art bar"
      "art rep"
      "art res"
      "art panel";
    grid-template-rows: auto auto auto minmax(0, 1fr);
    align-content: start;
    align-items: stretch;
    justify-content: center;
    column-gap: 28px;
    row-gap: 10px;
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 100dvh;
    margin: 0;
    padding: 0 28px 0 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background-color: var(--paper);
  }

  .app--wide .app-bar { grid-area: bar; padding-top: 22px; }
  .app--wide .repbar { grid-area: rep; }
  .app--wide .resources { grid-area: res; }

  .app--wide .panel,
  .app--wide .scene:not([hidden]) + .panel {
    grid-area: panel;
    margin-top: 0;
    padding: 6px 12px 24px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(58, 49, 38, 0.32) transparent;
  }

  .app--wide .panel::-webkit-scrollbar {
    width: 6px;
  }

  .app--wide .panel::-webkit-scrollbar-track {
    background: transparent;
  }

  .app--wide .panel::-webkit-scrollbar-thumb {
    background: rgba(58, 49, 38, 0.28);
    border-radius: 999px;
  }

  .app--wide .scene {
    grid-area: art;
    position: relative;
    top: auto;
    height: 100dvh;
    max-height: none;
    width: auto;
    aspect-ratio: 9 / 16;
    align-self: start;
  }

  .app--wide .scene__image {
    object-fit: contain;
  }

  .ending__figure {
    height: min(40dvh, 400px);
    width: auto;
    max-width: calc(100% - 2 * var(--frame-inline));
    aspect-ratio: 9 / 16;
    margin: max(68px, calc(var(--safe-top) + 56px)) auto 0;
  }

  .intro__frame {
    top: 0;
    bottom: 0;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    height: 100dvh;
    width: auto;
    aspect-ratio: 768 / 1344;
  }

  .intro__img {
    object-fit: contain;
  }

  .app--wide .panel__body > .page {
    box-shadow: none;
    backdrop-filter: none;
  }
}

/* Подсказки и легенды механик оставляем видимыми, чтобы условия задач были понятны. */
.task {
  margin-bottom: var(--sp-2);
}

.scheme__legend,
.door__hint,
.bolts__hint,
.pills__hint {
  margin-top: var(--sp-2);
}

/* --- Вход в браузере: Telegram Login Widget --- */
.logingate__box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  min-height: 56px;
  margin: 14px 0 6px;
}

.logingate__btn,
.logingate__alt {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-align: center;
}

.logingate__code {
  margin: 4px 0 0;
  padding: 8px 10px;
  border: 1px dashed var(--ink-line);
  border-radius: var(--r-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  color: var(--ink);
  text-align: center;
  user-select: all;
}

.logingate__status {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink-soft);
  text-align: center;
}

.namegate--login .namegate__lead {
  max-width: 34ch;
}

.namegate__alt {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  text-decoration: none;
}

.phone-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
}

.phone-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px dashed rgba(242, 234, 218, 0.72);
  border-radius: 12px;
  background: rgba(18, 16, 14, 0.24);
  color: var(--paper);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 4px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.phone-hotspot:hover,
.phone-hotspot.is-active {
  background: rgba(168, 42, 34, 0.34);
  border-color: var(--paper-hi);
}

.phone-hotspot__tag {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(20, 18, 15, 0.86);
  color: var(--paper);
  pointer-events: none;
}

.phone-game {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.phone-tab {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--ink-line);
  background: var(--paper-hi);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  cursor: pointer;
}

.phone-tab.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.phone-room-guide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--sp-3);
  border: 1px solid var(--ink-line);
  background: var(--paper-hi);
}

.phone-room-guide__notice {
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--ink);
}

.phone-room-guide__btns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phone-room-guide__btn,
.phone-back-btn,
.phone-jump-btn {
  width: 100%;
  min-height: var(--tap-primary);
}

.notebook-closeup,
.phone-closeup,
.cabinet-closeup {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.phone-book {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 360px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-left-width: 10px;
  background: repeating-linear-gradient(
    180deg,
    var(--paper-hi) 0,
    var(--paper-hi) 26px,
    rgba(110, 96, 76, 0.14) 27px
  );
  perspective: 900px;
  overflow: hidden;
}

.phone-book__page {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
  transform-origin: left center;
}

@keyframes pageFlipNext {
  0% { opacity: 0.25; transform: rotateY(-58deg) scale(0.97); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1); }
}

@keyframes pageFlipPrev {
  0% { opacity: 0.25; transform: rotateY(52deg) scale(0.97); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1); }
}

.phone-book__page.is-flipping-next {
  animation: pageFlipNext 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.phone-book__page.is-flipping-prev {
  animation: pageFlipPrev 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.phone-book__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ink-line);
}

.phone-book__heading {
  font-family: var(--font-title);
  font-size: var(--fs-lead);
  color: var(--ink);
}

.phone-book__num {
  font-size: var(--fs-caption);
  color: var(--ink-soft);
  white-space: nowrap;
}

.phone-book__entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phone-book__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--ink-line);
  background: rgba(255, 250, 240, 0.72);
}

.phone-book__tel {
  font-family: var(--font-title);
  font-size: 20px;
  line-height: 1.1;
  color: #8b201b;
  padding: 2px 6px;
  border: 1px solid #8b201b;
}

.phone-book__desc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.phone-book__label {
  font-size: var(--fs-body);
  color: var(--ink);
}

.phone-book__note,
.phone-book__footnote {
  font-size: var(--fs-caption);
  line-height: 1.35;
  color: var(--ink-soft);
}

.phone-book__story {
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink);
  font-style: italic;
}

.phone-book__author {
  align-self: flex-end;
  font-family: var(--font-title);
  font-size: var(--fs-lead);
  color: var(--ink);
}

.phone-book__pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--ink-line);
}

.phone-book__flip {
  min-height: var(--tap-primary);
}

.phone-scratched {
  padding: 10px 12px;
  border: 1px dashed #6b533b;
  background: #cbb692;
  color: #2c2116;
}

.phone-scratched__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.phone-scratched__text {
  font-size: var(--fs-body);
  font-weight: 700;
  margin-top: 2px;
}

.red-phone-closeup {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.red-phone__handset-held {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: #efe5d2;
}

.red-phone__receiver {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #b5342b 0%, #861d17 100%);
  border: 2px solid #2b1411;
  color: #fff3e6;
  box-shadow: 0 3px 0 #2b1411;
}

.red-phone__ear,
.red-phone__mic {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5a110d;
  border: 2px solid #f2dfc8;
}

.red-phone__grip {
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.red-phone__voice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-left: 3px solid #8b201b;
  background: var(--paper-hi);
}

.red-phone__voice-tag {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b201b;
  font-weight: 700;
}

.red-phone__voice-text {
  font-size: var(--fs-body);
  line-height: 1.45;
  color: var(--ink);
}

.red-phone__to-lock {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.red-phone-unit {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px 14px 8px 8px;
  border: 3px solid #2b1411;
  background: linear-gradient(180deg, #b8332a 0%, #8e211a 60%, #701610 100%);
  box-shadow: 0 5px 0 #2b1411;
}

.red-phone__cradle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(20, 12, 10, 0.25);
  color: #f6e8d4;
}

.red-phone__fork {
  width: 22px;
  height: 10px;
  border-radius: 4px;
  background: #d7ccb8;
  border: 2px solid #2b1411;
}

.red-phone__cradle-txt {
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.red-phone__screen {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  border: 2px solid #2b1411;
  background: #1f2a1d;
  color: #cfe8be;
}

.red-phone__screen-label {
  font-size: 12px;
  opacity: 0.78;
}

.red-phone__screen-val {
  font-family: var(--font-title);
  font-size: 24px;
  letter-spacing: 0.14em;
}

.red-phone__keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  border: 2px solid #2b1411;
  background: #53130f;
}

.red-phone__key {
  min-height: 48px;
  border-radius: 8px;
  border: 2px solid #2b1411;
  background: #efe5d2;
  color: #201a15;
  font-family: var(--font-title);
  font-size: 22px;
  box-shadow: 0 3px 0 #2b1411;
  cursor: pointer;
}

.red-phone__key:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #2b1411;
}

.red-phone__key.is-target {
  background: #ffe1a8;
  border-color: #ffd06b;
}

.red-phone__bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.red-phone__fn {
  min-height: 46px;
  padding: 6px 4px;
  border-radius: 8px;
  border: 2px solid #2b1411;
  background: #ded2bd;
  color: #1e1814;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.red-phone__fn--call {
  background: #3d6f3b;
  color: #f6f2e9;
}

.red-phone__fn--reset.is-ready {
  background: #f5b942;
  color: #1e1814;
}

.phone-easter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 2px solid var(--ink);
  background: var(--paper-hi);
}

.phone-easter__fig {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--ink-line);
}

.phone-easter__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.phone-easter__title {
  font-family: var(--font-title);
  font-size: var(--fs-lead);
  color: #8b201b;
}

.phone-easter__line {
  font-size: var(--fs-body);
  line-height: 1.4;
}

.phone-easter__reply {
  font-size: var(--fs-lead);
  font-weight: 700;
  color: var(--ink);
}

.cabinet-lock {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--ink);
  background: #d7d4cb;
}

.cabinet-lock__plaque {
  padding: 8px 10px;
  border: 1px solid var(--ink-line);
  background: #ede7da;
  font-size: var(--fs-caption);
  line-height: 1.4;
}

.cabinet-lock__hint {
  padding: 8px 10px;
  border-left: 3px solid #3d6f3b;
  background: #edf5ea;
  font-size: var(--fs-body);
  font-weight: 700;
}

.cabinet-lock__screen {
  padding: 10px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 28px;
  letter-spacing: 0.25em;
  background: #1c2220;
  color: #d6ece0;
  border: 2px solid var(--ink);
}

.cabinet-lock__pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cabinet-lock__key {
  min-height: 46px;
  border: 2px solid var(--ink);
  background: var(--paper-hi);
  font-family: var(--font-title);
  font-size: 20px;
  cursor: pointer;
}

@keyframes reelSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.tape-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: var(--r-2);
  background: linear-gradient(180deg, #dcd2bc 0%, #cfc3aa 100%);
}

.tape-deck__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--ink-line);
  border-radius: var(--r-2);
  background: #272522;
}

.tape-reel {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #d9cfb8;
  background: radial-gradient(circle, #534b40 0%, #24211e 70%);
}

.tape-reel::before,
.tape-reel::after {
  content: "";
  position: absolute;
  background: rgba(233, 223, 199, 0.55);
}

.tape-reel::before {
  width: 78%;
  height: 2px;
}

.tape-reel::after {
  width: 2px;
  height: 78%;
}

.tape-reel__hub {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cbbd9f;
  border: 2px solid #181614;
  z-index: 1;
}

.tape-deck.is-playing .tape-reel {
  animation: reelSpin 2.2s linear infinite;
}

.tape-deck.is-playing[data-speed="0.5"] .tape-reel { animation-duration: 3.6s; }
.tape-deck.is-playing[data-speed="0.75"] .tape-reel { animation-duration: 2.8s; }
.tape-deck.is-playing[data-speed="1.0"] .tape-reel { animation-duration: 1.8s; }
.tape-deck.is-playing[data-speed="1.25"] .tape-reel { animation-duration: 1.3s; }
.tape-deck.is-playing[data-speed="1.5"] .tape-reel { animation-duration: 0.9s; }

.tape-play {
  min-height: 44px;
}

.tape-status {
  margin: 0;
  font-size: var(--fs-caption);
  font-weight: 700;
}

.tape-transcript {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  background: #23201c;
  color: #e6dac2;
  border-radius: var(--r-2);
}

.tape-transcript.is-clear {
  border-color: #469156;
  background: #1b2a1f;
  color: #dcf7df;
}

.tape-transcript__tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
}

.tape-transcript__text {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: 700;
  line-height: 1.4;
}

.tape-section-label {
  margin: 4px 0 0;
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--ink);
}

.tape-speeds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.tape-speed-btn {
  min-height: 44px;
  padding: 6px 8px;
  border: 1.5px solid var(--ink-line);
  border-radius: var(--r-2);
  background: var(--paper-hi);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.tape-speed-btn.is-picked {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.tape-eq {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tape-eq-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--ink-line);
  border-radius: var(--r-2);
  background: rgba(255, 255, 255, 0.52);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
}

.tape-eq-row.is-on {
  border-color: #2f6b3e;
  background: rgba(231, 245, 232, 0.88);
}

.tape-eq-row__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.tape-eq-row__title {
  font-size: 14px;
  color: var(--ink);
}

.tape-eq-row__sub {
  font-size: 12px;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .phone-book__page.is-flipping-next,
  .phone-book__page.is-flipping-prev,
  .tape-deck.is-playing .tape-reel {
    animation: none;
  }

  .credits__slide.is-active .credits__img {
    transform: none;
  }
}

.ending__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.credits {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: #17130f;
  color: var(--paper-hi);
}

@media (min-width: 700px) {
  .credits {
    top: 24px;
    right: auto;
    bottom: auto;
    left: 50%;
    width: min(430px, 100%);
    height: min(calc(100dvh - 48px), 940px);
    transform: translateX(-50%);
    border: 1px solid rgba(34, 28, 21, 0.28);
    border-radius: 28px;
    box-shadow:
      0 1px 2px rgba(34, 28, 21, 0.14),
      0 18px 48px rgba(34, 28, 21, 0.2);
    overflow: hidden;
  }
}

.credits[hidden] {
  display: none;
}

.credits__close {
  position: absolute;
  top: max(12px, var(--safe-top));
  right: max(12px, var(--safe-right));
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(233, 223, 199, 0.45);
  border-radius: 999px;
  background: rgba(23, 19, 15, 0.72);
  color: var(--paper-hi);
  font-size: 16px;
  cursor: pointer;
}

.credits__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.credits__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}

.credits__slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

.credits__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transform: scale(1);
  transition: transform 5200ms linear;
}

.credits__slide.is-active .credits__img {
  transform: scale(1.04);
}

.credits__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 20px 22px;
  background: linear-gradient(to top, rgba(18, 14, 10, 0.94) 0%, rgba(18, 14, 10, 0.76) 62%, rgba(18, 14, 10, 0) 100%);
  text-align: center;
}

.credits__role {
  margin: 0 0 6px;
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(233, 223, 199, 0.74);
}

.credits__names {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(20px, 5.2vw, 26px);
  line-height: 1.3;
  color: var(--paper-hi);
}

.credits__link {
  color: #f3d49b;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.credits__slide--end {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(78, 64, 44, 0.35), rgba(18, 14, 10, 0.98) 74%);
  padding: 24px;
}

.credits__end {
  width: 100%;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.credits__end-stamp {
  margin: 0;
  font-size: var(--fs-caption);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(233, 223, 199, 0.68);
}

.credits__end-title {
  margin: 0 0 8px;
  font-family: var(--font-title);
  font-size: clamp(38px, 11vw, 56px);
  letter-spacing: 0.04em;
  color: var(--paper-hi);
}

.credits__end-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.credits__end-actions .btn {
  width: 100%;
}

.credits__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px max(12px, var(--safe-bottom));
  border-top: 1px solid rgba(233, 223, 199, 0.16);
  background: rgba(16, 13, 10, 0.96);
}

.credits__dots {
  display: flex;
  align-items: center;
  gap: 8px;
}

.credits__dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(233, 223, 199, 0.32);
  cursor: pointer;
}

.credits__dot.is-active {
  width: 22px;
  background: #f3d49b;
}

.credits__next {
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(233, 223, 199, 0.42);
  border-radius: var(--r-2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper-hi);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
