:root {
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Outfit", "Segoe UI", sans-serif;
  --font-script: "Noto Serif Tibetan", serif;
  --bg-night: #0f1f27;
  --bg-deep: #071117;
  --bg-mist: #183543;
  --paper: #faf7f1;
  --paper-soft: #f2ece2;
  --paper-edge: #e8dccd;
  --ink-strong: #162029;
  --ink: #23303a;
  --ink-soft: #64717c;
  --line: rgba(22, 32, 41, 0.08);
  --line-strong: rgba(22, 32, 41, 0.14);
  --accent-saffron: #c68c42;
  --accent-gold: #d1b368;
  --accent-crimson: #8b4637;
  --accent-cypress: #45655f;
  --sheet-paper-top: #f6e8c5;
  --sheet-paper-bottom: #ead4a8;
  --sheet-ink-strong: #4d3623;
  --sheet-ink-soft: #735842;
  --sheet-line: rgba(120, 86, 48, 0.16);
  --shadow-lg: 0 28px 78px rgba(3, 9, 12, 0.28);
  --shadow-md: 0 18px 44px rgba(8, 14, 18, 0.12);
  --shadow-sm: 0 10px 24px rgba(8, 14, 18, 0.08);
  --safe-top-inset: env(safe-area-inset-top);
  --safe-right-inset: env(safe-area-inset-right);
  --safe-bottom-inset: env(safe-area-inset-bottom);
  --safe-left-inset: env(safe-area-inset-left);
  --safe-top: max(var(--safe-top-inset), 1rem);
  --safe-right: max(var(--safe-right-inset), 1rem);
  --safe-bottom: max(var(--safe-bottom-inset), 1rem);
  --safe-left: max(var(--safe-left-inset), 1rem);
  --app-height: 100vh;
  --hero-frame-thickness: 15px;
  --hero-frame-thickness-horizontal: 8px;
  --sheet-top-radius: 2rem;
  --sheet-peek-height: calc(clamp(15.5rem, 31%, 20rem) + 56px);
  --sheet-expanded-height: clamp(22rem, 74%, 46rem);
  --sheet-overlap: calc(var(--sheet-top-radius) + 2px);
  --scene-pane-height: calc(var(--app-height) - var(--sheet-peek-height) + var(--sheet-overlap));
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  background:
    radial-gradient(circle at top, rgba(209, 179, 104, 0.14), transparent 24%),
    radial-gradient(circle at bottom left, rgba(139, 70, 55, 0.12), transparent 30%),
    linear-gradient(180deg, #234452 0%, var(--bg-night) 38%, var(--bg-deep) 100%);
  color: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: var(--app-height);
  overflow: hidden;
  background: transparent;
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  min-height: var(--app-height);
  width: 100%;
  margin: 0;
  padding: 0;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(0.3rem);
}

.app-shell::before {
  top: 4rem;
  right: -2rem;
  width: 11rem;
  height: 11rem;
  background: radial-gradient(circle, rgba(209, 179, 104, 0.18), transparent 72%);
}

.app-shell::after {
  left: -2rem;
  bottom: 10rem;
  width: 12rem;
  height: 12rem;
  background: radial-gradient(circle, rgba(139, 70, 55, 0.16), transparent 72%);
}

.audio-controls {
  position: fixed;
  top: calc(var(--safe-top) + 0.8rem);
  right: calc(var(--safe-right) + 0.8rem);
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  color: #fffaf2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.26)),
    rgba(121, 175, 224, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  box-shadow: 0 16px 32px rgba(35, 81, 121, 0.18);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
}

.audio-button:active {
  transform: scale(0.97);
}

.audio-toggle.is-paused {
  background:
    linear-gradient(180deg, rgba(139, 70, 55, 0.3), rgba(139, 70, 55, 0.16)),
    rgba(255, 245, 240, 0.28);
}

.audio-button__icon,
.audio-toggle__icon {
  display: inline-flex;
  width: 1.05rem;
  height: 1.05rem;
}

.audio-button__icon svg,
.audio-toggle__icon svg {
  width: 100%;
  height: 100%;
}

.audio-toggle__icon--play {
  display: none;
}

.audio-toggle.is-paused .audio-toggle__icon--pause {
  display: none;
}

.audio-toggle.is-paused .audio-toggle__icon--play {
  display: inline-flex;
}

.screen {
  position: relative;
  z-index: 1;
  display: none;
  min-height: var(--app-height);
}

.screen--active {
  display: flex;
  flex-direction: column;
}

.screen--complete {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding:
    calc(var(--safe-top) + 1.1rem)
    calc(var(--safe-right) + 1.1rem)
    calc(var(--safe-bottom) + 1.1rem)
    calc(var(--safe-left) + 1.1rem);
}

.screen--gate,
.screen--welcome {
  align-items: stretch;
  justify-content: stretch;
  overflow: hidden;
  padding: 0;
  background: #5f8fc1;
}

.hero-panel {
  position: relative;
  display: grid;
  gap: 1.2rem;
  width: min(32rem, 100%);
  padding: 1.45rem;
  border-radius: 2rem;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(209, 179, 104, 0.08), transparent 34%),
    radial-gradient(circle at top left, rgba(139, 70, 55, 0.05), transparent 38%),
    linear-gradient(180deg, rgba(250, 247, 241, 0.98), rgba(244, 238, 230, 0.98));
  border: 1px solid rgba(22, 32, 41, 0.08);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  top: 0;
  height: 0.22rem;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(139, 70, 55, 0.82) 0%,
      rgba(139, 70, 55, 0.82) 14%,
      rgba(198, 140, 66, 0.78) 14%,
      rgba(198, 140, 66, 0.78) 34%,
      rgba(69, 101, 95, 0.72) 34%,
      rgba(69, 101, 95, 0.72) 66%,
      rgba(209, 179, 104, 0.78) 66%,
      rgba(209, 179, 104, 0.78) 86%,
      rgba(139, 70, 55, 0.82) 86%,
      rgba(139, 70, 55, 0.82) 100%
    );
  opacity: 0.54;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 20%),
    linear-gradient(0deg, rgba(255, 255, 255, 0.16), transparent 22%);
  pointer-events: none;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-panel--compact {
  margin-top: auto;
  margin-bottom: auto;
  width: min(27rem, 100%);
}

.hero-panel--gate,
.hero-panel--welcome {
  gap: 0;
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  display: block;
  padding:
    max(var(--safe-top), var(--hero-frame-thickness))
    max(var(--safe-right-inset), var(--hero-frame-thickness-horizontal))
    max(var(--safe-bottom), var(--hero-frame-thickness))
    max(var(--safe-left-inset), var(--hero-frame-thickness-horizontal));
  border: 0;
  border-radius: 0;
  background: #5f8fc1;
  box-shadow: none;
}

.hero-panel--gate::before,
.hero-panel--gate::after,
.hero-panel--welcome::before,
.hero-panel--welcome::after {
  display: none;
}

.eyebrow,
.progress-label,
.feedback-tag {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.feedback-tag {
  color: rgba(35, 48, 58, 0.56);
}

.eyebrow {
  color: rgba(35, 48, 58, 0.52);
}

.eyebrow--light {
  color: rgba(255, 247, 235, 0.86);
}

.progress-label {
  color: rgba(250, 247, 241, 0.74);
}

#gate-title,
#app-title,
#complete-title,
.scene-title,
.feedback-title,
.choices-panel__header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}

#gate-title,
#app-title {
  font-size: clamp(3.1rem, 10.5vw, 5rem);
  color: var(--ink-strong);
  font-family: var(--font-script);
  line-height: 1.12;
}

#complete-title {
  font-size: clamp(2.45rem, 8.5vw, 3.45rem);
  color: var(--ink-strong);
}

.hero-copy,
.status-text {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.62;
  color: var(--ink-soft);
}

.brand-lockup {
  display: grid;
  gap: 0.2rem;
}

.brand-roman {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(35, 48, 58, 0.42);
}

.brand-roman--welcome {
  font-size: clamp(1.08rem, 3.9vw, 1.34rem);
  font-weight: 800;
  letter-spacing: 0.025em;
  text-transform: none;
  color: rgba(255, 249, 241, 0.94);
}

.status-text {
  min-height: 1.4rem;
  font-size: 0.96rem;
  color: rgba(35, 48, 58, 0.58);
}

.status-text.is-error {
  color: var(--accent-crimson);
}

.access-form {
  display: grid;
  gap: 0.85rem;
}

.access-form__label {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(35, 48, 58, 0.58);
}

.text-field {
  width: 100%;
  min-height: 3.35rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(22, 32, 41, 0.1);
  border-radius: 1.2rem;
  color: var(--ink-strong);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 246, 238, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 10px 24px rgba(8, 14, 18, 0.05);
  outline: none;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.text-field::placeholder {
  color: rgba(35, 48, 58, 0.36);
}

.text-field:focus {
  border-color: rgba(198, 140, 66, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 0 0 0.18rem rgba(209, 179, 104, 0.16);
}

.hero-scene-card {
  position: relative;
  display: grid;
  overflow: hidden;
  padding: 0.72rem;
  border-radius: 1.85rem;
  background:
    radial-gradient(circle at top right, rgba(209, 179, 104, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(252, 248, 241, 0.96));
  border: 1px solid rgba(22, 32, 41, 0.08);
  box-shadow: var(--shadow-md);
}

.hero-scene-card--gate,
.hero-scene-card--welcome {
  height: 100%;
  min-height: calc(
    var(--app-height) - max(var(--safe-top), var(--hero-frame-thickness)) - max(var(--safe-bottom), var(--hero-frame-thickness))
  );
  padding: 0;
  border: 2px solid rgba(35, 66, 101, 0.34);
  border-radius: 2.18rem;
  background: rgba(103, 152, 205, 0.3);
  box-shadow: 0 18px 34px rgba(32, 63, 97, 0.22);
}

.hero-scene-card__image {
  width: 100%;
  aspect-ratio: 3 / 3.9;
  object-fit: cover;
  object-position: center center;
  border-radius: 1.2rem;
  border: 1px solid rgba(22, 32, 41, 0.08);
  background: rgba(225, 218, 205, 0.6);
}

.hero-scene-card--gate .hero-scene-card__image,
.hero-scene-card--welcome .hero-scene-card__image {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: inherit;
  transform: scale(1);
  transform-origin: center center;
}

.hero-scene-card__overlay--gate,
.hero-scene-card__overlay--welcome {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding:
    calc(var(--safe-top) + 0.92rem)
    calc(var(--safe-right) + 0.95rem)
    calc(var(--safe-bottom) + 0.96rem)
    calc(var(--safe-left) + 0.95rem);
  background:
    linear-gradient(180deg, rgba(17, 42, 66, 0.14) 0%, rgba(17, 42, 66, 0.03) 30%, rgba(17, 42, 66, 0.54) 100%);
  text-shadow:
    0.7px 0 rgba(0, 0, 0, 0.72),
    -0.7px 0 rgba(0, 0, 0, 0.72),
    0 0.7px rgba(0, 0, 0, 0.72),
    0 -0.7px rgba(0, 0, 0, 0.72);
}

.hero-scene-card__heading {
  display: grid;
  gap: 0.75rem;
  max-width: min(21rem, 92%);
}

.brand-lockup--welcome {
  gap: 0.3rem;
}

.hero-panel--gate #gate-title,
.hero-panel--welcome #app-title {
  font-size: clamp(2.8rem, 8.7vw, 4.3rem);
  color: rgba(255, 249, 241, 0.97);
  white-space: nowrap;
  text-shadow: 0 10px 24px rgba(8, 20, 31, 0.3);
}

.hero-copy--gate {
  color: rgba(255, 247, 235, 0.94);
  text-shadow:
    0.7px 0 rgba(0, 0, 0, 0.56),
    -0.7px 0 rgba(0, 0, 0, 0.56),
    0 0.7px rgba(0, 0, 0, 0.56),
    0 -0.7px rgba(0, 0, 0, 0.56);
}

.gate-actions {
  display: grid;
  gap: 0.9rem;
  align-self: stretch;
  margin-top: auto;
}

.access-form--overlay {
  gap: 0.75rem;
}

.access-form__label--overlay {
  color: rgba(255, 247, 235, 0.86);
  text-shadow:
    0.6px 0 rgba(0, 0, 0, 0.5),
    -0.6px 0 rgba(0, 0, 0, 0.5),
    0 0.6px rgba(0, 0, 0, 0.5),
    0 -0.6px rgba(0, 0, 0, 0.5);
}

.text-field--overlay {
  border-color: rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.9), rgba(249, 241, 228, 0.94));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 14px 28px rgba(18, 41, 63, 0.16);
}

.status-text--overlay {
  min-height: 1.5rem;
  color: rgba(255, 247, 235, 0.9);
  text-shadow:
    0.6px 0 rgba(0, 0, 0, 0.52),
    -0.6px 0 rgba(0, 0, 0, 0.52),
    0 0.6px rgba(0, 0, 0, 0.52),
    0 -0.6px rgba(0, 0, 0, 0.52);
}

.hero-panel--welcome .primary-button--hero {
  width: 100%;
  min-height: 3.7rem;
  align-self: stretch;
  margin-top: auto;
}

.hero-panel--gate .primary-button--hero {
  width: 100%;
  min-height: 3.7rem;
}

.hero-scene-card__label {
  position: absolute;
  left: 1.15rem;
  right: 1.15rem;
  bottom: 1.1rem;
  margin: 0;
  padding: 0.68rem 0.82rem;
  border-radius: 1rem;
  background: rgba(250, 247, 241, 0.88);
  border: 1px solid rgba(22, 32, 41, 0.08);
  color: var(--ink-strong);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}

.hero-actions {
  display: grid;
  gap: 0.78rem;
}

.hero-summary-card {
  display: grid;
  gap: 0.45rem;
  padding: 1rem 1.05rem;
  border-radius: 1.45rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(252, 248, 241, 0.96));
  border: 1px solid rgba(22, 32, 41, 0.08);
  box-shadow: var(--shadow-sm);
}

.hero-summary-card__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(35, 48, 58, 0.46);
}

.hero-summary-card .hero-copy {
  font-size: 1rem;
}

.primary-button,
.secondary-button,
.choice-button {
  border: 0;
  border-radius: 1.45rem;
  transition:
    transform 180ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background 220ms ease,
    opacity 180ms ease;
  touch-action: manipulation;
}

.primary-button:active,
.secondary-button:active,
.choice-button:active {
  transform: scale(0.988);
}

.primary-button {
  padding: 1rem 1.2rem;
  color: #fffdf9;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #d19755, #95513a);
  border: 1px solid rgba(117, 68, 40, 0.22);
  box-shadow: 0 16px 34px rgba(117, 68, 40, 0.18);
}

.primary-button[disabled] {
  opacity: 0.56;
  box-shadow: none;
}

.primary-button--hero {
  width: 100%;
  min-height: 3.65rem;
  font-size: 1rem;
}

.secondary-button {
  padding: 1rem 1.2rem;
  color: var(--ink-strong);
  font-weight: 700;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(252, 248, 241, 0.96));
  border: 1px solid rgba(21, 31, 40, 0.1);
  box-shadow: var(--shadow-sm);
}

.screen--game {
  position: relative;
}

.scene-stage {
  position: relative;
  flex: 1;
  min-height: inherit;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8, 16, 20, 0.44), rgba(8, 16, 20, 0.82));
}

.scene-media {
  position: absolute;
  inset: 0 0 auto;
  height: var(--scene-pane-height);
  background: linear-gradient(180deg, rgba(14, 29, 36, 0.6), rgba(7, 14, 18, 0.88));
}

.scene-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 15, 18, 0.08) 0%, rgba(7, 15, 18, 0.04) 34%, rgba(7, 15, 18, 0.38) 100%),
    linear-gradient(0deg, rgba(7, 15, 18, 0.12), transparent 26%);
  pointer-events: none;
}

.scene-media__loading {
  position: absolute;
  left: calc(var(--safe-left) + 1rem);
  bottom: clamp(1rem, 3vw, 1.4rem);
  z-index: 2;
  padding: 0.72rem 0.92rem;
  border-radius: 999px;
  background: rgba(9, 17, 21, 0.62);
  color: rgba(255, 250, 246, 0.9);
  font-size: 0.92rem;
  font-weight: 600;
  backdrop-filter: blur(0.6rem);
}

.scene-media__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  transition: opacity 240ms ease;
}

.scene-media__image.is-loaded {
  opacity: 1;
}

.game-topbar {
  position: absolute;
  top: calc(var(--safe-top) + 0.68rem);
  left: calc(var(--safe-left) + 0.9rem);
  right: calc(var(--safe-right) + 0.9rem);
  z-index: 3;
  display: grid;
  gap: 0.45rem;
  justify-items: start;
}

.progress-copy,
.progress-meter {
  background: linear-gradient(180deg, rgba(250, 247, 241, 0.88), rgba(244, 236, 225, 0.74));
  border: 1px solid rgba(18, 30, 38, 0.08);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(0.75rem);
}

.progress-copy {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  width: auto;
  min-width: 5.6rem;
  padding: 0.54rem 0.7rem 0.56rem;
  border-radius: 1rem;
}

.progress-copy::before {
  content: "";
  position: absolute;
  left: 0.58rem;
  right: 0.58rem;
  top: 0;
  height: 0.16rem;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(139, 70, 55, 0.85) 0%,
      rgba(139, 70, 55, 0.85) 18%,
      rgba(209, 179, 104, 0.8) 18%,
      rgba(209, 179, 104, 0.8) 38%,
      rgba(69, 101, 95, 0.76) 38%,
      rgba(69, 101, 95, 0.76) 62%,
      rgba(209, 179, 104, 0.8) 62%,
      rgba(209, 179, 104, 0.8) 82%,
      rgba(139, 70, 55, 0.85) 82%,
      rgba(139, 70, 55, 0.85) 100%
    );
  opacity: 0.7;
}

.progress-label {
  color: rgba(35, 48, 58, 0.48);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
}

.progress-value {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink-strong);
}

.progress-divider {
  opacity: 0.34;
  padding: 0 0.08rem;
}

.progress-meter {
  position: relative;
  overflow: hidden;
  width: min(11.25rem, calc(100% - 0.5rem));
  height: 0.52rem;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(139, 70, 55, 0.08) 0 0.45rem,
      rgba(209, 179, 104, 0.08) 0.45rem 0.9rem,
      rgba(69, 101, 95, 0.07) 0.9rem 1.35rem
    ),
    linear-gradient(180deg, rgba(250, 247, 241, 0.9), rgba(244, 236, 225, 0.78));
}

.progress-meter::before {
  content: "";
  position: absolute;
  inset: 0.11rem 0.12rem;
  border-radius: inherit;
  background: rgba(19, 30, 38, 0.06);
  pointer-events: none;
}

.progress-meter::after {
  content: "";
  position: absolute;
  inset: auto 0.3rem 0.12rem auto;
  width: 1.1rem;
  height: 0.16rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(250, 247, 241, 0.55), transparent);
  pointer-events: none;
}

.progress-meter__fill {
  position: absolute;
  inset: 0.11rem auto 0.11rem 0.12rem;
  width: 0%;
  border-radius: inherit;
  background:
    linear-gradient(
      90deg,
      rgba(69, 101, 95, 0.96) 0%,
      rgba(69, 101, 95, 0.96) 36%,
      rgba(209, 179, 104, 0.96) 36%,
      rgba(209, 179, 104, 0.96) 68%,
      rgba(198, 140, 66, 0.96) 68%,
      rgba(198, 140, 66, 0.96) 100%
    );
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: width 240ms ease;
}

.story-sheet {
  position: absolute;
  inset: auto 0 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: var(--sheet-current-height, var(--sheet-peek-height));
  color: var(--sheet-ink-soft);
  border-radius: var(--sheet-top-radius) var(--sheet-top-radius) 0 0;
  background:
    radial-gradient(circle at top right, rgba(209, 179, 104, 0.18), transparent 34%),
    radial-gradient(circle at top left, rgba(139, 70, 55, 0.1), transparent 38%),
    linear-gradient(180deg, rgba(246, 232, 197, 0.99), rgba(234, 212, 168, 0.985));
  border-top: 1px solid var(--sheet-line);
  box-shadow: 0 -24px 64px rgba(71, 46, 23, 0.18);
  overflow: hidden;
  transition: height 280ms cubic-bezier(0.22, 0.61, 0.36, 1), box-shadow 280ms ease;
  will-change: height;
}

.story-sheet::before {
  content: "";
  position: absolute;
  left: calc(var(--safe-left) + 1.4rem);
  right: calc(var(--safe-right) + 1.4rem);
  top: 0;
  z-index: 2;
  height: 0.22rem;
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      rgba(139, 70, 55, 0.82) 0%,
      rgba(139, 70, 55, 0.82) 14%,
      rgba(198, 140, 66, 0.78) 14%,
      rgba(198, 140, 66, 0.78) 34%,
      rgba(69, 101, 95, 0.72) 34%,
      rgba(69, 101, 95, 0.72) 66%,
      rgba(209, 179, 104, 0.78) 66%,
      rgba(209, 179, 104, 0.78) 86%,
      rgba(139, 70, 55, 0.82) 86%,
      rgba(139, 70, 55, 0.82) 100%
    );
  opacity: 0.44;
}

.story-sheet::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4.2rem;
  background: linear-gradient(180deg, rgba(234, 212, 168, 0), rgba(234, 212, 168, 1));
  pointer-events: none;
  opacity: 1;
  transition: opacity 200ms ease;
}

.story-sheet--expanded {
  height: var(--sheet-expanded-height);
  box-shadow: 0 -26px 70px rgba(71, 46, 23, 0.2);
}

.story-sheet--expanded::after {
  opacity: 0;
}

.story-sheet--no-animate {
  transition: none;
}

.story-sheet__scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding:
    1.25rem
    calc(var(--safe-right) + 1.35rem)
    calc(var(--safe-bottom) + 1.5rem)
    calc(var(--safe-left) + 1.35rem);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.story-sheet__content {
  display: grid;
  gap: 1.55rem;
}

.scene-copy {
  display: grid;
  gap: 0.95rem;
}

.scene-copy::after {
  content: "";
  height: 1px;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(120, 86, 48, 0.12) 16%,
      rgba(198, 140, 66, 0.34) 50%,
      rgba(120, 86, 48, 0.12) 84%,
      transparent
    );
}

.story-sheet .scene-title {
  font-size: clamp(2rem, 7.8vw, 2.8rem);
  color: var(--sheet-ink-strong);
}

.story-sheet .scene-description,
.story-sheet #choices-hint,
.feedback-message {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.68;
  color: var(--sheet-ink-soft);
}

.choices-panel {
  display: grid;
  gap: 1rem;
}

.choices-panel__header {
  display: grid;
  gap: 0.35rem;
}

.story-sheet .choices-panel__header h3 {
  font-size: 1.14rem;
  color: var(--sheet-ink-strong);
}

.choices-list {
  display: grid;
  gap: 0.85rem;
}

.story-sheet .choice-button {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.95rem;
  width: 100%;
  padding: 1rem 1rem 1rem 0.95rem;
  text-align: left;
  color: var(--sheet-ink-strong);
  background:
    linear-gradient(90deg, rgba(198, 140, 66, 0.12) 0, rgba(198, 140, 66, 0.12) 0.32rem, transparent 0.32rem),
    linear-gradient(180deg, rgba(252, 243, 220, 0.97), rgba(244, 227, 190, 0.98));
  border: 1px solid rgba(120, 86, 48, 0.12);
  box-shadow: 0 10px 22px rgba(120, 86, 48, 0.08);
  overflow: hidden;
}

.story-sheet .choice-button::after {
  content: "";
  position: absolute;
  inset: auto 1rem 0.6rem 4.1rem;
  height: 1px;
  background: linear-gradient(90deg, rgba(198, 140, 66, 0.24), transparent);
  pointer-events: none;
}

.story-sheet .choice-button__mark {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.9rem;
  background:
    linear-gradient(135deg, rgba(198, 140, 66, 0.18), rgba(233, 212, 168, 0.45)),
    rgba(251, 243, 223, 0.96);
  border: 1px solid rgba(120, 86, 48, 0.1);
  color: var(--accent-crimson);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.story-sheet .choice-button__text {
  display: block;
  padding-top: 0.16rem;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.52;
}

.story-sheet .choice-button.is-selected {
  border-color: rgba(139, 70, 55, 0.18);
  background:
    linear-gradient(90deg, rgba(139, 70, 55, 0.16) 0, rgba(139, 70, 55, 0.16) 0.38rem, transparent 0.38rem),
    linear-gradient(180deg, rgba(255, 248, 233, 1), rgba(242, 220, 176, 0.98));
  box-shadow: 0 16px 30px rgba(139, 70, 55, 0.12);
}

.story-sheet .choice-button.is-selected .choice-button__mark {
  background:
    linear-gradient(135deg, rgba(139, 70, 55, 0.18), rgba(209, 179, 104, 0.16)),
    rgba(250, 240, 214, 0.98);
  border-color: rgba(139, 70, 55, 0.14);
}

.choice-button:disabled {
  cursor: default;
  color: var(--ink-strong);
  opacity: 1;
}

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

.feedback-sheet[hidden] {
  display: none !important;
}

.feedback-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: end;
}

.feedback-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 15, 0.4);
  backdrop-filter: blur(0.18rem);
}

.feedback-sheet__panel {
  position: relative;
  display: grid;
  gap: 0.9rem;
  padding:
    1.45rem
    calc(var(--safe-right) + 1.1rem)
    calc(var(--safe-bottom) + 1.1rem)
    calc(var(--safe-left) + 1.1rem);
  border-radius: 2rem 2rem 0 0;
  background:
    radial-gradient(circle at top right, rgba(209, 179, 104, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(250, 247, 241, 0.99), rgba(243, 237, 228, 0.99));
  color: var(--ink);
  box-shadow: 0 -24px 52px rgba(7, 12, 15, 0.22);
}

.feedback-title {
  font-size: 2.2rem;
  color: var(--ink-strong);
}

.feedback-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.feedback-actions .primary-button,
.feedback-actions .secondary-button {
  width: 100%;
}

@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;
  }
}
