:root {
  color-scheme: dark;
  --night: #101722;
  --night-soft: #1b2233;
  --paper: #f2e6cf;
  --paper-muted: #cfc4b0;
  --amber: #e8a34a;
  --coral: #ff5a4e;
  --steel: #8da0ae;
  --green: #2f5d50;
  --glass: rgba(15, 21, 31, 0.74);
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--night);
  overscroll-behavior: none;
}

body {
  display: grid;
  place-items: center;
  min-height: 100svh;
  color: var(--paper);
  background:
    radial-gradient(circle at 20% 10%, rgba(232, 163, 74, 0.1), transparent 28rem),
    linear-gradient(135deg, #0a1019, #1b2233 55%, #0c131e);
}

button {
  color: inherit;
  font: inherit;
}

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

.app-shell {
  position: relative;
  width: min(100vw, 460px);
  height: 100svh;
  max-height: 960px;
  overflow: hidden;
  isolation: isolate;
  background: var(--night-soft);
}

.boot-screen {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 100%;
  padding: 32px;
  text-align: center;
  background:
    linear-gradient(rgba(10, 15, 23, 0.76), rgba(10, 15, 23, 0.94)),
    url("/media/intro-03.jpg") center / cover;
}

.boot-screen h1 {
  margin: 10px 0 12px;
  font: 500 clamp(40px, 12vw, 58px)/0.98 Georgia, serif;
}

.boot-copy {
  margin: 0;
  color: var(--paper-muted);
}

.brand-mark {
  display: flex;
  align-items: end;
  gap: 5px;
  height: 50px;
  margin-bottom: 22px;
}

.brand-mark i {
  display: block;
  width: 18px;
  border: 1px solid rgba(242, 230, 207, 0.72);
  border-bottom: 3px solid var(--amber);
  background: rgba(242, 230, 207, 0.08);
}

.brand-mark i:nth-child(1) { height: 31px; }
.brand-mark i:nth-child(2) { height: 41px; }
.brand-mark i:nth-child(3) {
  height: 49px;
  border-color: var(--coral);
  box-shadow: inset 5px 0 12px rgba(255, 90, 78, 0.28), 0 0 22px rgba(255, 90, 78, 0.18);
}

.eyebrow {
  margin: 0;
  color: var(--amber);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.22em;
}

.library-screen {
  overflow-x: hidden;
  overflow-y: auto;
  padding: calc(var(--safe-top) + 2px) 20px calc(var(--safe-bottom) + 18px);
  background:
    radial-gradient(circle at 82% 13%, rgba(232, 163, 74, 0.14), transparent 31%),
    radial-gradient(circle at 8% 52%, rgba(47, 93, 80, 0.2), transparent 32%),
    linear-gradient(160deg, #111a27 0%, #0a1019 78%);
  scrollbar-width: none;
}

.library-screen::-webkit-scrollbar {
  display: none;
}

.library-screen::before {
  position: absolute;
  top: -50px;
  right: -86px;
  width: 230px;
  height: 310px;
  border: 1px solid rgba(232, 163, 74, 0.1);
  border-radius: 120px 120px 0 0;
  content: "";
  transform: rotate(16deg);
}

.library-header {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
}

.free-chip,
.lock-chip {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(232, 163, 74, 0.32);
  border-radius: 999px;
  background: rgba(232, 163, 74, 0.08);
  color: var(--amber);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.library-copy {
  position: relative;
  z-index: 1;
  padding: 28px 2px 20px;
}

.library-copy h1 {
  margin: 7px 0 10px;
  font: 500 clamp(36px, 10vw, 46px)/1 Georgia, serif;
  letter-spacing: -0.035em;
}

.library-copy > p:last-child {
  max-width: 380px;
  margin: 0;
  color: var(--paper-muted);
  font: 14px/1.48 Georgia, serif;
}

.story-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 13px;
}

.story-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(242, 230, 207, 0.15);
  border-radius: 24px;
  background: rgba(242, 230, 207, 0.045);
}

.story-card-primary {
  min-height: 390px;
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.3);
}

.story-card-primary > img,
.story-card-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.story-card-primary > img {
  object-fit: cover;
  object-position: center;
  filter: saturate(0.82) brightness(0.84);
  transform: scale(1.025);
  animation: library-cover-drift 14s ease-in-out infinite alternate;
}

.story-card-shade {
  background:
    linear-gradient(to bottom, rgba(5, 8, 13, 0.08) 8%, rgba(5, 8, 13, 0.22) 36%, rgba(6, 10, 16, 0.98) 82%),
    linear-gradient(120deg, transparent 45%, rgba(232, 163, 74, 0.1));
}

.story-card-copy {
  position: absolute;
  z-index: 1;
  right: 18px;
  bottom: 18px;
  left: 18px;
}

.story-card-copy h2,
.story-card-locked h2 {
  margin: 5px 0 8px;
  font: 500 34px/1 Georgia, serif;
  letter-spacing: -0.025em;
}

.story-card-copy > p:not(.eyebrow) {
  margin: 0 0 14px;
  color: rgba(242, 230, 207, 0.82);
  font: 13px/1.45 Georgia, serif;
}

.story-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: rgba(242, 230, 207, 0.72);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.story-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 11px rgba(232, 163, 74, 0.72);
}

.story-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.story-actions .primary-button,
.story-actions .secondary-button {
  min-height: 48px;
}

.story-actions .secondary-button {
  padding-inline: 14px;
  font-size: 11px;
}

.story-card-locked {
  display: grid;
  grid-template-columns: 1fr auto;
  min-height: 112px;
  align-items: center;
  gap: 6px 14px;
  padding: 17px 18px;
  opacity: 0.68;
}

.story-card-locked h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.story-card-locked > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--paper-muted);
  font-size: 11px;
  line-height: 1.45;
}

.lock-chip {
  color: var(--paper-muted);
  border-color: rgba(242, 230, 207, 0.2);
  background: rgba(242, 230, 207, 0.05);
}

.local-progress-note {
  margin: 14px 0 0;
  color: rgba(242, 230, 207, 0.42);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-align: center;
}

.screen {
  position: absolute;
  inset: 0;
  animation: screen-in 440ms cubic-bezier(.22,.9,.3,1) both;
}

.scene-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  animation: slow-push 9s ease-out both;
}

.scene-effects {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.scene-effects.rain::before,
.scene-effects.rain::after {
  position: absolute;
  inset: -22% -18%;
  content: "";
  opacity: 0.34;
  transform: rotate(4deg);
  background-image: repeating-linear-gradient(
    102deg,
    transparent 0,
    transparent 16px,
    rgba(214, 231, 242, 0.52) 17px,
    transparent 18px,
    transparent 35px
  );
  background-size: 38px 86px;
  animation: rain-fall 760ms linear infinite;
}

.scene-effects.rain::after {
  opacity: 0.16;
  background-size: 53px 122px;
  filter: blur(0.6px);
  animation-duration: 1040ms;
  animation-delay: -620ms;
}

.scene-effects.dust::before,
.scene-effects.dust::after,
.scene-effects.dust-soft::before,
.scene-effects.dust-soft::after {
  position: absolute;
  inset: 8% 5% 23%;
  content: "";
  opacity: 0.62;
  background-image:
    radial-gradient(circle, rgba(255, 225, 168, 0.75) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255, 225, 168, 0.55) 0 0.8px, transparent 1.3px),
    radial-gradient(circle, rgba(255, 225, 168, 0.5) 0 1px, transparent 1.6px);
  background-position: 14% 24%, 71% 13%, 42% 73%;
  background-size: 73px 89px, 111px 131px, 137px 97px;
  animation: dust-float 12s ease-in-out infinite alternate;
}

.scene-effects.dust::after,
.scene-effects.dust-soft::after {
  opacity: 0.34;
  filter: blur(0.7px);
  transform: scale(1.15);
  animation-duration: 17s;
  animation-direction: alternate-reverse;
}

.scene-effects.dust-soft::before { opacity: 0.22; }
.scene-effects.dust-soft::after { opacity: 0.12; }

.scene-effects.phone-glow i,
.scene-effects.warm-light i,
.scene-effects.page-light i,
.scene-effects.doorway-light i,
.scene-effects.tower-light i {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 52% 48%, rgba(232, 163, 74, 0.14), transparent 35%);
  mix-blend-mode: screen;
  animation: light-breathe 5.8s ease-in-out infinite alternate;
}

.scene-effects.phone-glow i {
  background: radial-gradient(circle at 47% 35%, rgba(147, 202, 255, 0.25), transparent 23%);
}

.scene-effects.phone-glow b {
  position: absolute;
  inset: 0;
  background: url("/media/intro-01.jpg") center / cover no-repeat;
  clip-path: polygon(21% 18%, 63% 17%, 73% 67%, 4% 76%, 3% 58%);
  transform-origin: 39% 45%;
  animation: phone-vibration 4.2s ease-in-out infinite;
}

.cinematic.phone-glow .scene-image {
  animation: none;
  transform: none;
}

.scene-effects.rain::before,
.scene-effects.rain::after,
.scene-effects.dust::before,
.scene-effects.dust::after,
.scene-effects.dust-soft::before,
.scene-effects.dust-soft::after,
.scene-effects.phone-glow b,
.cabinet-effects i,
.case-effects::before,
.case-effects b {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  will-change: transform, opacity, background-position;
}

.scene-effects.page-light i {
  background: radial-gradient(ellipse at 63% 26%, rgba(255, 202, 104, 0.34), transparent 39%);
  animation: page-flicker 4.8s ease-in-out infinite;
}

.scene-effects.doorway-light i {
  background: linear-gradient(102deg, transparent 36%, rgba(232, 163, 74, 0.08) 53%, transparent 72%);
  animation: light-sweep 9s ease-in-out infinite alternate;
}

.scene-effects.tower-light i {
  background: radial-gradient(ellipse at 53% 32%, rgba(255, 90, 78, 0.14), transparent 23%);
  animation-duration: 8.5s;
}

.cinematic::before,
.cabinet::before,
.case-screen::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
}

.case-screen .scene-image {
  animation: none;
  transform: none;
}

.case-effects::before {
  position: absolute;
  top: 5.4%;
  left: 0;
  width: 30.5%;
  height: 36.8%;
  content: "";
  opacity: 0.3;
  background-image: repeating-linear-gradient(
    101deg,
    transparent 0,
    transparent 13px,
    rgba(211, 231, 242, 0.58) 14px,
    transparent 15px,
    transparent 31px
  );
  background-size: 34px 82px;
  clip-path: polygon(7% 1%, 99% 1%, 97% 94%, 8% 96%);
  animation: case-window-rain 920ms linear infinite;
}

.case-effects b {
  position: absolute;
  top: 1.5%;
  left: 31.5%;
  width: 3px;
  height: 10px;
  border-radius: 50% 50% 55% 55%;
  background: linear-gradient(to bottom, rgba(225, 241, 249, 0.28), rgba(225, 241, 249, 0.9));
  box-shadow: 0 0 3px rgba(205, 231, 246, 0.42);
  opacity: 0;
  animation: ceiling-drop 2.35s cubic-bezier(.32,.02,.76,.72) infinite;
}

.case-effects::after {
  position: absolute;
  top: 42.5%;
  left: 19.8%;
  width: 11%;
  height: 1.8%;
  border: 1px solid rgba(219, 237, 246, 0.46);
  border-radius: 50%;
  content: "";
  opacity: 0;
  transform: scale(0.25);
  animation: bucket-ripple 2.35s ease-out infinite;
}

.cinematic::before {
  background:
    linear-gradient(to bottom, rgba(6, 10, 17, 0.38) 0%, transparent 32%),
    linear-gradient(to top, rgba(7, 11, 18, 0.97) 0%, rgba(7, 11, 18, 0.7) 32%, transparent 64%);
}

.topline {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topline-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(242, 230, 207, 0.86);
  font: 600 12px/1 Georgia, serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.door-glyph {
  width: 13px;
  height: 19px;
  border: 1px solid var(--amber);
  border-radius: 6px 6px 1px 1px;
  box-shadow: inset -3px 0 6px rgba(232, 163, 74, 0.22);
  animation: glyph-glow 4.8s ease-in-out infinite alternate;
}

.quiet-button {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(242, 230, 207, 0.25);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.36);
  backdrop-filter: blur(10px);
  color: rgba(242, 230, 207, 0.85);
  font-size: 12px;
  cursor: pointer;
}

.cinematic-copy {
  position: absolute;
  z-index: 3;
  right: 22px;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 22px;
}

.intro-points {
  display: grid;
  gap: 8px;
  margin: -8px 0 20px;
  padding: 0;
  list-style: none;
}

.intro-points li {
  position: relative;
  padding-left: 22px;
  color: rgba(242, 230, 207, 0.87);
  font-size: 13px;
  line-height: 1.35;
}

.intro-points li::before {
  position: absolute;
  top: 0.48em;
  left: 2px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--amber);
  border-radius: 50% 50% 2px 50%;
  content: "";
  transform: rotate(-45deg);
}

.briefing-screen .scene-image {
  filter: brightness(0.72) saturate(0.78);
}

.briefing-screen .cinematic-copy h1 {
  font-size: clamp(36px, 10vw, 50px);
}

.briefing-screen .cinematic-copy > p:not(.eyebrow) {
  min-height: auto;
  margin-bottom: 18px;
  font-size: 15px;
}

.cinematic-copy h1 {
  max-width: 360px;
  margin: 8px 0 12px;
  font: 500 clamp(38px, 11vw, 54px)/0.98 Georgia, serif;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.cinematic-copy > p:not(.eyebrow) {
  max-width: 370px;
  min-height: 52px;
  margin: 0 0 25px;
  color: rgba(242, 230, 207, 0.82);
  font: 17px/1.5 Georgia, serif;
}

.progress-row {
  display: flex;
  gap: 7px;
  margin-bottom: 20px;
}

.progress-row i {
  display: block;
  width: 26px;
  height: 2px;
  border: 0;
  border-radius: 2px;
  background: rgba(242, 230, 207, 0.26);
  transition: width 220ms ease, background 220ms ease;
}

.progress-row i.is-active {
  width: 42px;
  background: var(--amber);
  box-shadow: 0 0 10px rgba(232, 163, 74, 0.28);
  animation: progress-glow 2.6s ease-in-out infinite alternate;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.primary-button,
.secondary-button {
  min-height: 54px;
  border-radius: 16px;
  cursor: pointer;
}

.primary-button {
  padding: 0 22px;
  border: 1px solid #f2bb70;
  background: linear-gradient(145deg, #efb462, #d88c34);
  box-shadow: 0 13px 34px rgba(232, 163, 74, 0.24);
  color: #17202b;
  font-size: 14px;
  font-weight: 780;
  transition: transform 140ms ease, filter 140ms ease;
}

.primary-button:active,
.secondary-button:active,
.quiet-button:active {
  transform: scale(0.975);
  filter: brightness(1.08);
}

.secondary-button {
  padding: 0 18px;
  border: 1px solid rgba(242, 230, 207, 0.22);
  background: rgba(242, 230, 207, 0.07);
  color: var(--paper);
  font-size: 13px;
}

.rules-screen {
  display: grid;
  grid-template-rows: minmax(210px, 42%) 1fr;
  background: #121b28;
}

.vera-panel {
  position: relative;
  overflow: hidden;
  background: var(--green);
}

.vera-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 28%;
  filter: saturate(0.86) contrast(1.04);
  transform: scale(1.035);
  animation: portrait-drift 12s ease-in-out infinite alternate;
}

.vera-panel::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(to top, #121b28 0%, transparent 42%);
}

.vera-label {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 25px;
  left: 20px;
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.vera-label h1 {
  margin: 6px 0 0;
  font: 500 36px/1 Georgia, serif;
}

.rule-count {
  color: var(--amber);
  font: 500 26px/1 Georgia, serif;
}

.rule-copy {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px 24px var(--safe-bottom);
}

.rule-card {
  position: relative;
  flex: 1;
  margin: 0 0 18px;
  padding: 24px 23px;
  overflow: hidden;
  border: 1px solid rgba(242, 230, 207, 0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 100% 0%, rgba(232, 163, 74, 0.12), transparent 50%),
    rgba(242, 230, 207, 0.045);
}

.rule-card::after {
  position: absolute;
  right: -15px;
  bottom: -34px;
  width: 110px;
  height: 150px;
  border: 1px solid rgba(232, 163, 74, 0.19);
  border-radius: 58px 58px 0 0;
  content: "";
  box-shadow: inset 8px 0 22px rgba(232, 163, 74, 0.04);
  animation: rule-door-glow 4.6s ease-in-out infinite alternate;
}

.rule-card h2 {
  max-width: 320px;
  margin: 4px 0 14px;
  font: 500 clamp(28px, 8vw, 36px)/1.05 Georgia, serif;
  letter-spacing: -0.025em;
}

.rule-card p {
  max-width: 330px;
  margin: 0;
  color: var(--paper-muted);
  font-size: 15px;
  line-height: 1.58;
}

.rule-card .rule-hint {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid rgba(232, 163, 74, 0.24);
  color: var(--amber);
  font: italic 14px/1.45 Georgia, serif;
}

.rule-footer {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.mini-progress {
  display: flex;
  gap: 6px;
}

.mini-progress i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(242, 230, 207, 0.2);
}

.mini-progress i.is-active {
  background: var(--amber);
  box-shadow: 0 0 12px rgba(232, 163, 74, 0.6);
}

.cabinet::before {
  background: linear-gradient(to bottom, rgba(7, 11, 17, 0.52), transparent 24%, transparent 64%, rgba(7, 11, 17, 0.64));
}

.cabinet .scene-image {
  animation-duration: 14s;
}

.cabinet-effects,
.case-effects {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cabinet-effects i {
  position: absolute;
  top: 0;
  left: 0;
  width: 39.5%;
  height: 30%;
  content: "";
  opacity: 0.18;
  background-image: repeating-linear-gradient(
    100deg,
    transparent 0,
    transparent 19px,
    rgba(196, 216, 228, 0.4) 20px,
    transparent 21px,
    transparent 43px
  );
  background-size: 47px 104px;
  clip-path: polygon(1% 0, 98% 0, 96% 91%, 2% 92%);
  animation: cabinet-rain 1.35s linear infinite;
}

.cabinet-effects b {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 39%, rgba(255, 195, 103, 0.17), transparent 20%),
    radial-gradient(circle at 84% 31%, rgba(255, 190, 89, 0.12), transparent 18%);
  mix-blend-mode: screen;
  animation: cabinet-lamps 6.4s ease-in-out infinite alternate;
}

.cabinet-hud {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  right: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-chip,
.bureau-chip {
  min-height: 40px;
  padding: 8px 13px;
  border: 1px solid rgba(242, 230, 207, 0.2);
  border-radius: 14px;
  background: rgba(7, 11, 17, 0.54);
  backdrop-filter: blur(14px);
}

.day-chip strong,
.bureau-chip strong {
  display: block;
  font-size: 12px;
  line-height: 1.1;
}

.day-chip span,
.bureau-chip span {
  color: var(--paper-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hotspot {
  position: absolute;
  z-index: 3;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(242, 230, 207, 0.74);
  border-radius: 50%;
  background: rgba(14, 20, 28, 0.47);
  box-shadow: 0 0 0 6px rgba(242, 230, 207, 0.07);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.hotspot::before,
.hotspot::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
  background: rgba(242, 230, 207, 0.88);
  transform: translate(-50%, -50%);
}

.hotspot::before { width: 11px; height: 1px; }
.hotspot::after { width: 1px; height: 11px; }

.hotspot:active {
  transform: scale(0.86);
  background: rgba(232, 163, 74, 0.55);
  transition: transform 100ms ease, background 100ms ease;
}

.hotspot.folder {
  top: 41%;
  left: 27%;
  border-color: var(--amber);
  background: rgba(90, 52, 15, 0.62);
  box-shadow: 0 0 0 8px rgba(232, 163, 74, 0.11), 0 0 30px rgba(232, 163, 74, 0.64);
  animation: breathe 2.1s ease-in-out infinite;
}

.hotspot.phone { top: 36%; left: 42%; }
.hotspot.door { top: 25%; left: 56%; }
.hotspot.board { top: 25%; right: 7%; }
.hotspot.tower { top: 15%; left: 19%; }

.cabinet-prompt {
  position: absolute;
  z-index: 4;
  right: 18px;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid rgba(242, 230, 207, 0.18);
  border-radius: 20px;
  background: rgba(9, 14, 22, 0.74);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.cabinet-prompt p {
  margin: 2px 0 0;
  color: var(--paper-muted);
  font-size: 12px;
}

.cabinet-prompt .primary-button {
  min-height: 44px;
  padding: 0 17px;
}

.toast {
  position: absolute;
  z-index: 8;
  top: calc(var(--safe-top) + 58px);
  right: 18px;
  left: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(242, 230, 207, 0.2);
  border-radius: 16px;
  background: rgba(9, 14, 22, 0.88);
  box-shadow: 0 12px 38px rgba(0, 0, 0, 0.35);
  color: var(--paper);
  font: 14px/1.45 Georgia, serif;
  backdrop-filter: blur(18px);
  animation: toast-in 240ms ease-out both;
}

.case-screen::before {
  background:
    linear-gradient(to bottom, rgba(8, 12, 18, 0.3), transparent 30%),
    linear-gradient(to top, #0d141e 0%, rgba(13, 20, 30, 0.92) 28%, transparent 68%);
}

.case-effects i {
  position: absolute;
  inset: -15%;
  background: linear-gradient(112deg, transparent 38%, rgba(232, 163, 74, 0.1) 50%, transparent 61%);
  mix-blend-mode: screen;
  animation: case-light-pass 10s ease-in-out infinite;
}

.back-button {
  position: absolute;
  z-index: 4;
  top: var(--safe-top);
  left: 18px;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(242, 230, 207, 0.23);
  border-radius: 50%;
  background: rgba(7, 11, 17, 0.52);
  backdrop-filter: blur(12px);
  cursor: pointer;
}

.case-copy {
  position: absolute;
  z-index: 3;
  right: 22px;
  bottom: calc(var(--safe-bottom) + 12px);
  left: 22px;
}

.case-copy h1 {
  margin: 7px 0 2px;
  font: 500 clamp(48px, 14vw, 66px)/0.95 Georgia, serif;
  letter-spacing: -0.04em;
}

.case-subtitle {
  margin: 0 0 22px;
  color: var(--amber);
  font: italic 17px/1.4 Georgia, serif;
}

.case-meta {
  display: grid;
  gap: 12px;
  margin: 0 0 20px;
  padding: 17px 0;
  border-top: 1px solid rgba(242, 230, 207, 0.18);
  border-bottom: 1px solid rgba(242, 230, 207, 0.18);
}

.case-meta div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
}

.case-meta dt {
  color: var(--steel);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.case-meta dd {
  margin: 0;
  color: rgba(242, 230, 207, 0.88);
  font-size: 13px;
  line-height: 1.42;
}

.preview-note {
  margin: 10px 0 0;
  color: rgba(242, 230, 207, 0.5);
  font-size: 10px;
  text-align: center;
}

.notebook-screen,
.scene-map-screen {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.notebook-screen::-webkit-scrollbar,
.scene-map-screen::-webkit-scrollbar {
  display: none;
}

.notebook-screen {
  padding: var(--safe-top) 18px var(--safe-bottom);
  background:
    radial-gradient(circle at 50% 12%, rgba(232, 163, 74, 0.18), transparent 35%),
    linear-gradient(160deg, #182130, #0a1019 74%);
}

.flow-header {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto;
  min-height: 48px;
  align-items: center;
  gap: 12px;
}

.flow-header strong {
  display: block;
  margin-top: 3px;
  font: 500 15px/1.1 Georgia, serif;
}

.flow-back {
  position: static;
  width: 40px;
  height: 40px;
}

.page-side,
.day-number {
  color: var(--paper-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.notebook-visual {
  position: relative;
  height: 235px;
  margin: 4px -26px -42px;
  overflow: hidden;
  pointer-events: none;
}

.notebook-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(to bottom, transparent 55%, #121925 94%);
}

.notebook-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 35px rgba(0, 0, 0, 0.45));
  transform: rotate(-1deg) scale(1.08);
}

.notebook-sheet {
  position: relative;
  z-index: 2;
  min-height: 475px;
  padding: 26px 23px 20px;
  border: 1px solid rgba(100, 67, 31, 0.38);
  border-radius: 7px 18px 18px 7px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 30px, rgba(92, 69, 42, 0.1) 31px),
    linear-gradient(105deg, #e8d5b3, #f3e6ca 52%, #dfc49b);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.4), inset 12px 0 24px rgba(99, 67, 35, 0.09);
  color: #352a20;
}

.notebook-sheet::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 18px;
  width: 1px;
  content: "";
  background: rgba(143, 72, 53, 0.18);
}

.notebook-sheet .eyebrow {
  color: #8a5324;
}

.notebook-sheet h1 {
  margin: 8px 0 16px;
  font: 500 clamp(31px, 9vw, 42px)/1 Georgia, serif;
  letter-spacing: -0.035em;
}

.lesson-lead {
  margin: 0 0 17px;
  font: italic 16px/1.48 Georgia, serif;
}

.notebook-sheet ul {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.42;
}

.lesson-rule {
  margin: 0;
  padding: 13px 15px;
  border-left: 3px solid #a66a2e;
  background: rgba(107, 70, 35, 0.08);
  font: 600 16px/1.35 Georgia, serif;
}

.lesson-details {
  display: grid;
  gap: 12px;
}

.lesson-details p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.notebook-sheet blockquote {
  margin: 17px 0 0;
  padding: 13px 15px;
  border-left: 3px solid #8a5324;
  background: rgba(107, 70, 35, 0.08);
  font: italic 13px/1.48 Georgia, serif;
}

.notebook-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: 20px;
}

.notebook-actions .primary-button,
.notebook-actions .secondary-button {
  min-height: 48px;
}

.paper-button {
  border-color: rgba(67, 44, 24, 0.25);
  background: rgba(70, 45, 22, 0.08);
  color: #493725;
}

.scene-map-screen {
  background: #0b111a;
}

.scene-map-screen > .scene-image {
  position: sticky;
  inset: auto;
  top: 0;
  display: block;
  width: 100%;
  height: 100svh;
  max-height: 960px;
  margin-bottom: max(-100svh, -960px);
  filter: brightness(0.62) saturate(0.75);
  animation: none;
}

.scene-map-shade {
  position: sticky;
  z-index: 1;
  top: 0;
  display: block;
  width: 100%;
  height: 100svh;
  max-height: 960px;
  margin-bottom: max(-100svh, -960px);
  background:
    linear-gradient(to bottom, rgba(7, 11, 17, 0.18), rgba(7, 11, 17, 0.72) 34%, #0b111a 92%),
    radial-gradient(circle at 12% 30%, rgba(232, 163, 74, 0.11), transparent 25%);
}

.map-header {
  position: sticky;
  top: 0;
  margin: 0;
  padding: var(--safe-top) 18px 12px;
  background: linear-gradient(to bottom, rgba(7, 11, 17, 0.92), rgba(7, 11, 17, 0.58), transparent);
  backdrop-filter: blur(5px);
}

.scene-map-copy {
  position: relative;
  z-index: 2;
  padding: 160px 20px calc(var(--safe-bottom) + 16px);
}

.scene-map-copy > h1 {
  margin: 0 0 12px;
  font: 500 clamp(46px, 14vw, 64px)/0.95 Georgia, serif;
  letter-spacing: -0.04em;
}

.scene-map-copy > blockquote {
  margin: 0 0 18px;
  padding: 13px 15px;
  border: 1px solid rgba(232, 163, 74, 0.24);
  border-radius: 15px;
  background: rgba(8, 13, 20, 0.68);
  color: rgba(242, 230, 207, 0.84);
  font: italic 14px/1.48 Georgia, serif;
  backdrop-filter: blur(12px);
}

.briefing-grid {
  display: grid;
  gap: 9px;
}

.briefing-grid article {
  padding: 14px 15px;
  border: 1px solid rgba(242, 230, 207, 0.14);
  border-radius: 15px;
  background: rgba(9, 14, 22, 0.74);
  backdrop-filter: blur(14px);
}

.briefing-grid span {
  color: var(--steel);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.briefing-grid p {
  margin: 5px 0 0;
  color: rgba(242, 230, 207, 0.88);
  font-size: 13px;
  line-height: 1.42;
}

.briefing-grid .locked-dossier {
  border-color: rgba(232, 163, 74, 0.22);
}

.outcome-ladder {
  display: grid;
  gap: 8px;
  margin: 22px 0 18px;
}

.outcome-ladder > .eyebrow {
  margin-bottom: 2px;
}

.outcome-step {
  display: grid;
  grid-template-columns: 25px 68px 1fr;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(242, 230, 207, 0.12);
  border-radius: 13px;
  background: rgba(9, 14, 22, 0.76);
}

.outcome-step i {
  width: 14px;
  height: 20px;
  border: 1px solid rgba(242, 230, 207, 0.48);
  border-radius: 7px 7px 1px 1px;
}

.outcome-step span {
  color: var(--steel);
  font-size: 9px;
  text-transform: uppercase;
}

.outcome-step strong {
  font-size: 11px;
  line-height: 1.35;
}

.outcome-step.is-secret {
  border-color: rgba(255, 90, 78, 0.3);
  background: linear-gradient(90deg, rgba(255, 90, 78, 0.09), rgba(9, 14, 22, 0.8));
}

.outcome-step.is-secret i {
  border-color: var(--coral);
  box-shadow: inset 4px 0 8px rgba(255, 90, 78, 0.16), 0 0 13px rgba(255, 90, 78, 0.13);
}

.map-start {
  width: 100%;
}

.error-screen {
  display: grid;
  align-content: center;
  min-height: 100%;
  padding: 28px;
  background: #111925;
}

.error-screen h1 {
  margin: 8px 0 12px;
  font: 500 42px/1 Georgia, serif;
}

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.012); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes library-cover-drift {
  from { transform: scale(1.025) translate3d(-0.3%, 0, 0); }
  to { transform: scale(1.075) translate3d(0.5%, -0.5%, 0); }
}

@keyframes slow-push {
  from { transform: scale(1.035) translate3d(0, 0, 0); }
  to { transform: scale(1.09) translate3d(-0.45%, -0.28%, 0); }
}

@keyframes rain-fall {
  from { transform: translate3d(0, -8%, 0) rotate(4deg); }
  to { transform: translate3d(-2%, 8%, 0) rotate(4deg); }
}

@keyframes phone-vibration {
  0%, 58%, 82%, 100% { transform: translate3d(0, 0, 0) rotate(0); }
  61% { transform: translate3d(-4px, 0, 0) rotate(-0.34deg); }
  64% { transform: translate3d(5px, 1px, 0) rotate(0.4deg); }
  67% { transform: translate3d(-5px, -1px, 0) rotate(-0.42deg); }
  70% { transform: translate3d(5px, 0, 0) rotate(0.36deg); }
  73% { transform: translate3d(-4px, 1px, 0) rotate(-0.3deg); }
  76% { transform: translate3d(3px, 0, 0) rotate(0.22deg); }
  79% { transform: translate3d(-1px, 0, 0) rotate(-0.1deg); }
}

@keyframes page-flicker {
  0%, 18%, 22%, 68%, 100% { opacity: 0.48; transform: scale(0.99); }
  20%, 70% { opacity: 1; transform: scale(1.035); }
  21%, 71% { opacity: 0.7; }
}

@keyframes dust-float {
  from { transform: translate3d(-1%, 1.5%, 0); }
  to { transform: translate3d(2%, -2.2%, 0); }
}

@keyframes light-breathe {
  from { opacity: 0.36; transform: scale(0.98); }
  to { opacity: 0.92; transform: scale(1.035); }
}

@keyframes light-sweep {
  from { opacity: 0.28; transform: translateX(-2%); }
  to { opacity: 0.88; transform: translateX(2%); }
}

@keyframes glyph-glow {
  from { box-shadow: inset -3px 0 6px rgba(232, 163, 74, 0.18), 0 0 0 rgba(232, 163, 74, 0); }
  to { box-shadow: inset -3px 0 8px rgba(232, 163, 74, 0.45), 0 0 12px rgba(232, 163, 74, 0.28); }
}

@keyframes progress-glow {
  from { box-shadow: 0 0 5px rgba(232, 163, 74, 0.14); }
  to { box-shadow: 0 0 15px rgba(232, 163, 74, 0.46); }
}

@keyframes portrait-drift {
  from { transform: scale(1.035) translate3d(-0.3%, 0, 0); }
  to { transform: scale(1.075) translate3d(0.5%, -0.6%, 0); }
}

@keyframes rule-door-glow {
  from { opacity: 0.5; border-color: rgba(232, 163, 74, 0.15); }
  to { opacity: 1; border-color: rgba(232, 163, 74, 0.34); }
}

@keyframes cabinet-rain {
  from { background-position: 0 -104px; }
  to { background-position: -18px 104px; }
}

@keyframes cabinet-lamps {
  from { opacity: 0.42; transform: scale(0.985); }
  to { opacity: 1; transform: scale(1.025); }
}

@keyframes case-light-pass {
  0%, 18% { opacity: 0; transform: translateX(-22%); }
  43%, 58% { opacity: 0.9; }
  82%, 100% { opacity: 0; transform: translateX(25%); }
}

@keyframes case-window-rain {
  from { transform: translate3d(0, -9%, 0) rotate(2deg); }
  to { transform: translate3d(-2%, 10%, 0) rotate(2deg); }
}

@keyframes ceiling-drop {
  0%, 16% { top: 1.5%; left: 31.5%; opacity: 0; transform: scaleY(0.65); }
  20% { opacity: 0.85; }
  78% { opacity: 0.85; }
  88%, 100% { top: 42%; left: 24.3%; opacity: 0; transform: scaleY(1.12); }
}

@keyframes bucket-ripple {
  0%, 82% { opacity: 0; transform: scale(0.2); }
  88% { opacity: 0.52; }
  100% { opacity: 0; transform: scale(1.2); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.11); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 620px) and (min-height: 720px) {
  .app-shell {
    height: min(92svh, 900px);
    border: 1px solid rgba(242, 230, 207, 0.14);
    border-radius: 28px;
    box-shadow: 0 34px 90px rgba(0, 0, 0, 0.48);
  }
}

@media (max-height: 700px) {
  .rules-screen { grid-template-rows: minmax(180px, 38%) 1fr; }
  .rule-card { padding: 18px 20px; }
  .rule-card h2 { font-size: 28px; }
  .rule-copy { padding-inline: 18px; }
  .case-meta { margin-bottom: 12px; padding-block: 12px; }
  .case-copy h1 { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .scene-image,
  .story-card-primary > img,
  .vera-panel img {
    animation: none !important;
    transform: none !important;
  }

  .scene-effects.rain::before { animation-duration: 1.5s; opacity: 0.2; }
  .scene-effects.rain::after { animation-duration: 2.2s; opacity: 0.09; }
  .scene-effects.dust::before,
  .scene-effects.dust::after,
  .scene-effects.dust-soft::before,
  .scene-effects.dust-soft::after { animation-duration: 24s; }
  .scene-effects.phone-glow b { animation: reduced-phone-pulse 2.8s ease-in-out infinite; }
}

@keyframes reduced-phone-pulse {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}
