:root {
  color-scheme: light;
  --ink: #241f1a;
  --muted: #6c6258;
  --paper: #f7f0e3;
  --panel: #fffaf0;
  --line: #cdbf9f;
  --accent: #8f3f2a;
  --accent-dark: #642817;
  --good: #2f6f4e;
  --bad: #9b3326;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #0f0c0a;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

.app {
  position: relative;
  min-height: 100vh;
}

.topbar,
.status,
.scene,
.history {
  border: 1px solid rgba(205, 191, 159, 0.42);
  background: rgba(15, 12, 10, 0.55);
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  color: #f7f0e3;
  backdrop-filter: blur(8px);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.topbar-subtitle {
  margin: 4px 0 0;
  color: rgba(247, 240, 227, 0.72);
  font-size: 0.9rem;
}

.eyebrow,
.chapter {
  margin: 0;
  color: rgba(247, 240, 227, 0.82);
  font-size: 0.88rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
}

h2 {
  font-size: 1rem;
}

button {
  min-height: 44px;
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.topbar button {
  padding: 0 14px;
  flex: 0 0 auto;
}

button.subtle {
  background: rgba(255, 250, 240, 0.08);
  color: #f7f0e3;
  border-color: rgba(247, 240, 227, 0.24);
}

button.subtle:hover {
  background: rgba(255, 250, 240, 0.18);
  color: #fff;
}

.status {
  position: fixed;
  z-index: 22;
  top: 82px;
  right: 16px;
  width: min(720px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 1px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.status.is-collapsed {
  display: none;
}

.status div {
  min-width: 0;
  padding: 10px;
  background: rgba(244, 234, 217, 0.92);
}

.status span {
  display: block;
  color: #4b3828;
  font-size: 0.74rem;
  font-weight: 700;
}

.status strong {
  display: block;
  color: #1c140f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status strong.textual {
  white-space: normal;
  font-size: 0.9rem;
  line-height: 1.35;
}

.scene {
  min-height: 100vh;
  padding: 0;
  border: 0;
  background: transparent;
}

.stage {
  position: relative;
  min-height: 100vh;
}

.stage.is-transitioning .visual {
  animation: sceneDissolve 420ms ease;
}

.stage.is-transitioning .dialogue-window,
.stage.is-transitioning .choices,
.stage.is-transitioning .overlay-label {
  animation: windowDip 320ms ease;
}

.story {
  font-size: clamp(1rem, 1.3vw, 1.1rem);
  line-height: 1.9;
}

.visual {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #c9d2c3;
}

.visual::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(12, 9, 7, 0.84) 0 18%, rgba(12, 9, 7, 0.18) 36%, rgba(12, 9, 7, 0.38) 100%),
    radial-gradient(circle at center, transparent 0 46%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
}

.dialogue-window {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  max-width: min(920px, calc(100vw - 48px));
  padding: 18px 20px 16px;
  border: 1px solid rgba(205, 191, 159, 0.9);
  background: rgba(34, 26, 20, 0.66);
  color: #f7f0e3;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
  z-index: 8;
}

.stage.has-choices .dialogue-window {
  bottom: 192px;
}

.stage.choices-2 .dialogue-window {
  bottom: 254px;
}

.stage.choices-3 .dialogue-window {
  bottom: 316px;
}

.dialogue-window .story,
.dialogue-window .result {
  max-height: min(28vh, 260px);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}

.effect-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(214, 160, 77, 0.54);
  background: linear-gradient(180deg, rgba(92, 69, 44, 0.46), rgba(43, 30, 21, 0.72));
  box-shadow: inset 0 0 0 1px rgba(247, 240, 227, 0.06);
}

.effect-summary[hidden] {
  display: none !important;
}

.effect-summary.floating {
  position: fixed;
  z-index: 26;
  top: 118px;
  right: 24px;
  width: min(340px, calc(100vw - 48px));
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.effect-summary.is-revealing {
  animation: summaryFlash 0.95s ease;
}

.effect-card {
  padding: 8px 10px;
  border: 1px solid rgba(247, 240, 227, 0.14);
  background: rgba(255, 246, 232, 0.06);
}

.effect-card-label {
  display: block;
  color: rgba(247, 240, 227, 0.7);
  font-size: 0.76rem;
}

.effect-card-value {
  display: block;
  margin-top: 4px;
  font-weight: 700;
  font-size: 1rem;
}

.effect-card-value.good {
  color: #b8e3c5;
}

.effect-card-value.bad {
  color: #f1b0a3;
}

.effect-card.is-strong {
  border-color: rgba(255, 228, 154, 0.7);
  background: linear-gradient(180deg, rgba(255, 228, 154, 0.14), rgba(255, 246, 232, 0.06));
  box-shadow: 0 0 18px rgba(255, 211, 123, 0.2);
}

.effect-card.is-strong .effect-card-value {
  text-shadow: 0 0 10px rgba(255, 214, 135, 0.35);
}

.dialogue-window .story::-webkit-scrollbar,
.dialogue-window .result::-webkit-scrollbar {
  width: 8px;
}

.dialogue-window .story::-webkit-scrollbar-thumb,
.dialogue-window .result::-webkit-scrollbar-thumb {
  background: rgba(247, 240, 227, 0.32);
}

.visual .sky,
.visual .ground,
.visual .city,
.visual .focus,
.visual .dust,
.visual .ambient,
.visual .featured-object {
  position: absolute;
}

.ambient {
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.featured-object {
  z-index: 3;
  display: none;
  max-width: min(32vw, 320px);
  max-height: 44vh;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.34));
  transform-origin: center;
}

.featured-object.is-visible {
  display: block;
  animation: objectReveal 420ms ease;
}

.featured-object--stool-leg {
  right: 4%;
  bottom: 12%;
  width: min(34vw, 420px);
  max-height: 52vh;
  transform: none;
}

.featured-object--ledger {
  right: 7%;
  bottom: 12%;
  width: min(30vw, 290px);
  max-height: 42vh;
  transform: rotate(-7deg);
}

.featured-object--bowl {
  right: 6%;
  bottom: 11%;
  width: min(30vw, 300px);
  max-height: 34vh;
}

.featured-object--parchment {
  right: 5%;
  bottom: 10%;
  width: min(32vw, 320px);
  max-height: 42vh;
  transform: rotate(4deg);
}

.featured-object--firewood {
  right: 7%;
  bottom: 12%;
  width: min(30vw, 300px);
  max-height: 28vh;
  transform: rotate(-6deg);
}

.featured-object--salt-bag {
  right: 6%;
  bottom: 10%;
  width: min(26vw, 240px);
  max-height: 34vh;
  transform: rotate(6deg);
}

.visual .sky {
  inset: 0;
  background: linear-gradient(#b7c3bd, #eee0c7 64%, #9a7853);
}

.visual .ground {
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(#826448, #5f4837);
}

.city {
  left: 4%;
  right: 4%;
  bottom: 31%;
  height: 46%;
  display: flex;
  align-items: end;
  gap: 2%;
  opacity: 0.88;
}

.city span {
  display: block;
  flex: 1;
  min-width: 40px;
  background: #6d5b4a;
  border: 1px solid rgba(36, 31, 26, 0.25);
}

.city span:nth-child(1) {
  height: 48%;
}

.city span:nth-child(2) {
  height: 72%;
}

.city span:nth-child(3) {
  height: 56%;
}

.city span:nth-child(4) {
  height: 88%;
}

.city span::before {
  content: "";
  display: block;
  width: 42%;
  height: 18%;
  margin: -14% auto 0;
  background: #554331;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.focus {
  width: 58px;
  height: 58px;
  border: 3px solid rgba(255, 246, 232, 0.9);
  background: #8f3f2a;
  box-shadow: 0 8px 22px rgba(36, 31, 26, 0.25);
  transform: rotate(45deg);
}

.focus-a {
  left: 18%;
  bottom: 24%;
}

.focus-b {
  left: 48%;
  bottom: 34%;
}

.focus-c {
  right: 18%;
  bottom: 22%;
}

.dust {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.78);
  animation: drift 6s linear infinite;
}

.dust-a {
  left: 16%;
  bottom: 22%;
}

.dust-b {
  left: 58%;
  bottom: 36%;
  animation-delay: -2s;
}

.dust-c {
  right: 20%;
  bottom: 28%;
  animation-delay: -4s;
}

.ambient-fire {
  width: 70px;
  height: 90px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 50% 70%, rgba(255, 213, 136, 0.95), rgba(210, 105, 38, 0.72) 45%, rgba(210, 105, 38, 0) 70%);
  filter: blur(4px);
}

.ambient-smoke {
  width: 180px;
  height: 220px;
  background: radial-gradient(circle, rgba(200, 196, 188, 0.24), rgba(200, 196, 188, 0) 70%);
  filter: blur(18px);
}

.ambient-shadow {
  width: 54px;
  height: 150px;
  border-radius: 24px 24px 10px 10px;
  background: linear-gradient(180deg, rgba(33, 28, 24, 0.35), rgba(22, 18, 15, 0.78));
  filter: blur(1px);
}

.ambient-glow {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 199, 0.24), rgba(255, 240, 199, 0) 72%);
  filter: blur(14px);
}

.ambient-drape {
  width: 68px;
  height: 140px;
  border-radius: 40px 40px 12px 12px;
  background: linear-gradient(180deg, rgba(128, 98, 79, 0.28), rgba(71, 51, 40, 0.48));
  filter: blur(1px);
}

.ambient-prop {
  width: 120px;
  height: 64px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(72, 50, 34, 0.72), rgba(37, 25, 18, 0.88));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.22);
}

.ambient-door {
  width: 98px;
  height: 210px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, rgba(34, 28, 23, 0.14), rgba(18, 14, 11, 0.82));
  filter: blur(0.5px);
}

.ambient-bird {
  width: 44px;
  height: 14px;
  border-top: 2px solid rgba(30, 27, 22, 0.8);
  border-radius: 50%;
  transform-origin: center;
}

.ambient-figure {
  width: 106px;
  height: 244px;
  z-index: 4;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  /* blur softens the hard vector edge; opacity() multiplies the per-scene
     opacity so every figure recedes into the scene as a distant shape */
  /* blur softens the hard vector edge so the figure reads as a distant shape
     rather than a pasted cutout; the dark shadow grounds it. The fill itself
     is a warm brown (not pure black) so it stays visible on dark backgrounds.
     Opacity is driven by the per-figure animations below. */
  filter:
    blur(0.8px)
    drop-shadow(0 6px 11px rgba(0, 0, 0, 0.42));
  mix-blend-mode: normal;
}

.scene-intro .focus-a {
  background: #77543d;
}

.scene-intro .focus-b {
  background: #a86c3f;
  animation: pulse 2.8s ease-in-out infinite;
}

.scene-workshop .sky {
  background:
    linear-gradient(rgba(26, 20, 15, 0.18), rgba(26, 20, 15, 0.18)),
    url("assets/workshop-paris-1500.png") center center / cover no-repeat;
}

.scene-workshop .city,
.scene-workshop .ground,
.scene-workshop .focus-a,
.scene-workshop .focus-b,
.scene-workshop .focus-c {
  display: none;
}

.scene-workshop .ambient-fire {
  left: 34.2%;
  bottom: 28.1%;
  width: 58px;
  height: 68px;
  opacity: 0.66;
  animation: fireFlicker 2s ease-in-out infinite;
}

.scene-workshop .ambient-smoke {
  left: 29.8%;
  bottom: 35.6%;
  width: 148px;
  height: 196px;
  opacity: 0.26;
  animation: smokeRise 9s linear infinite;
}

.scene-workshop .ambient-glow {
  left: 29.4%;
  bottom: 20.3%;
  width: 164px;
  height: 164px;
  opacity: 0.18;
  animation: lightBreath 4.8s ease-in-out infinite;
}

.scene-workshop .ambient-prop-a {
  left: 2%;
  bottom: 5%;
  opacity: 0.58;
  transform: rotate(-6deg);
}

.scene-workshop .ambient-prop-b {
  display: none;
}

.scene-workshop .ambient-door {
  right: 24%;
  bottom: 20%;
  opacity: 0.18;
}

.scene-workshop .ambient-figure-a {
  left: 13%;
  bottom: 12%;
  width: 104px;
  height: 240px;
  opacity: 0.96;
  transform: scale(1.05);
  animation: craftsmanShift 7s ease-in-out infinite;
  background-image: url("assets/silhouette-standing.svg");
}

.scene-workshop .ambient-figure-b {
  display: none;
}

.scene-market .sky {
  background:
    linear-gradient(rgba(22, 18, 14, 0.14), rgba(22, 18, 14, 0.14)),
    url("assets/market-paris-1509.png") center center / cover no-repeat;
}

.scene-market .city,
.scene-market .ground,
.scene-market .focus-a,
.scene-market .focus-b,
.scene-market .focus-c {
  display: none;
}

.scene-market .ambient-shadow-a {
  left: 18%;
  bottom: 16%;
  width: 78px;
  height: 192px;
  opacity: 0.54;
  animation: passerBy 8.5s linear infinite;
}

.scene-market .ambient-shadow-b {
  left: 63%;
  bottom: 14%;
  width: 64px;
  height: 176px;
  opacity: 0.42;
  animation: passerByAlt 7.2s linear infinite;
}

.scene-market .ambient-drape {
  right: 18%;
  top: 21%;
  width: 108px;
  height: 240px;
  opacity: 0.54;
  animation: clothSwayWide 3.4s ease-in-out infinite;
}

.scene-market .ambient-prop-a {
  left: 5%;
  bottom: 8%;
  width: 180px;
  height: 52px;
  opacity: 0.44;
  transform: rotate(-5deg);
}

.scene-market .ambient-prop-b {
  right: 10%;
  bottom: 10%;
  width: 82px;
  height: 84px;
  opacity: 0.3;
}

.scene-market .ambient-prop-c {
  right: 28%;
  bottom: 13%;
  width: 100px;
  height: 66px;
  opacity: 0.18;
}

.scene-market .ambient-door {
  left: 74%;
  bottom: 17%;
  opacity: 0.18;
}

.scene-market .ambient-glow {
  left: 33%;
  top: 8%;
  opacity: 0.3;
  animation: lightBreath 4.6s ease-in-out infinite;
}

.scene-market .ambient-bird {
  left: 56%;
  top: 18%;
  opacity: 0.48;
  animation: birdCross 9s linear infinite;
}

.scene-market .ambient-bird-b {
  left: 18%;
  top: 12%;
  opacity: 0.32;
  animation: birdCrossAlt 11s linear infinite;
}

/* Placed back in the crowd band (deeper), not in the empty foreground street,
   so the small size reads as distance instead of a tiny person standing close. */
.scene-market .ambient-figure-a {
  left: 30%;
  bottom: 34%;
  width: 44px;
  height: 100px;
  opacity: 0.9;
  animation: figureWalk 8.5s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-market .ambient-figure-b {
  left: 58%;
  bottom: 35%;
  width: 40px;
  height: 92px;
  opacity: 0.86;
  animation: figureWalkAlt 7s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-table .sky {
  background:
    linear-gradient(rgba(26, 20, 15, 0.18), rgba(26, 20, 15, 0.18)),
    url("assets/table-paris-1509.png") center center / cover no-repeat;
}

.scene-table .city,
.scene-table .ground,
.scene-table .focus-a,
.scene-table .focus-b,
.scene-table .focus-c {
  display: none;
}

.scene-table .ambient-fire {
  left: 44%;
  bottom: 29%;
  opacity: 0.76;
  animation: fireFlicker 2.4s ease-in-out infinite;
}

.scene-table .ambient-glow {
  left: 35%;
  bottom: 19%;
  opacity: 0.28;
  animation: lightBreath 5.8s ease-in-out infinite;
}

.scene-table .ambient-shadow-a {
  right: 14%;
  bottom: 17%;
  opacity: 0.16;
  animation: seatedShift 7s ease-in-out infinite;
}

.scene-table .ambient-prop-a {
  left: 8%;
  bottom: 6%;
  width: 132px;
  height: 48px;
  opacity: 0.32;
}

.scene-table .ambient-prop-b {
  right: 16%;
  bottom: 14%;
  width: 62px;
  height: 62px;
  opacity: 0.22;
}

.scene-table .ambient-door {
  left: 64%;
  bottom: 18%;
  opacity: 0.14;
}

.scene-table .ambient-figure-a {
  right: 16%;
  bottom: 15%;
  height: 166px;
  width: 106px;
  opacity: 0.9;
  animation: seatedFigure 7s ease-in-out infinite;
  background-image: url("assets/silhouette-seated.svg");
}

.scene-table .ambient-figure-b {
  display: none;
}

.scene-crossroads .sky {
  background:
    linear-gradient(rgba(20, 17, 14, 0.16), rgba(20, 17, 14, 0.16)),
    url("assets/crossroads-paris-1509.png") center center / cover no-repeat;
}

.scene-crossroads .city,
.scene-crossroads .ground,
.scene-crossroads .focus-a,
.scene-crossroads .focus-b,
.scene-crossroads .focus-c {
  display: none;
}

.scene-crossroads .ambient-shadow-a {
  left: 26%;
  bottom: 19%;
  opacity: 0.2;
  animation: passerBy 13s linear infinite;
}

.scene-crossroads .ambient-smoke {
  left: 46%;
  bottom: 24%;
  opacity: 0.24;
  animation: mistDrift 11s linear infinite;
}

.scene-crossroads .ambient-prop-a {
  left: 5%;
  bottom: 8%;
  width: 90px;
  height: 112px;
  opacity: 0.2;
}

.scene-crossroads .ambient-door {
  right: 8%;
  bottom: 16%;
  opacity: 0.12;
}

.scene-crossroads .ambient-bird {
  left: 48%;
  top: 24%;
  opacity: 0.22;
  animation: birdCross 12s linear infinite;
}

.scene-crossroads .ambient-figure-a {
  left: 30%;
  bottom: 18%;
  width: 70px;
  height: 160px;
  opacity: 0.92;
  animation: figureWalk 12s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-crossroads .ambient-figure-b {
  left: 60%;
  bottom: 17%;
  width: 62px;
  height: 142px;
  opacity: 0.86;
  animation: figureWalkAlt 14s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-study .sky {
  background:
    linear-gradient(rgba(20, 18, 17, 0.16), rgba(20, 18, 17, 0.16)),
    url("assets/study-paris-1509.png") center center / cover no-repeat;
}

.scene-study .city,
.scene-study .ground,
.scene-study .focus-a,
.scene-study .focus-b,
.scene-study .focus-c {
  display: none;
}

.scene-study .ambient-fire {
  right: 27%;
  bottom: 26%;
  width: 44px;
  height: 58px;
  opacity: 0.52;
  animation: candleFlicker 2.1s ease-in-out infinite;
}

.scene-study .ambient-glow {
  left: 5%;
  top: 16%;
  opacity: 0.24;
  animation: lightBreath 6.6s ease-in-out infinite;
}

.scene-study .ambient-drape {
  left: 11%;
  top: 18%;
  opacity: 0.22;
  animation: clothSway 6s ease-in-out infinite;
}

.scene-study .ambient-prop-a {
  left: 16%;
  bottom: 10%;
  width: 128px;
  height: 44px;
  opacity: 0.28;
  transform: rotate(-8deg);
}

.scene-study .ambient-figure-a {
  right: 20%;
  bottom: 16%;
  height: 152px;
  opacity: 0.9;
  animation: readerLean 6.2s ease-in-out infinite;
  background-image: url("assets/silhouette-reader.svg");
}

.scene-study .ambient-figure-b {
  display: none;
}

.scene-study .ambient-prop-b {
  right: 17%;
  bottom: 16%;
  width: 64px;
  height: 86px;
  opacity: 0.2;
}

.scene-study .ambient-door {
  left: 62%;
  bottom: 16%;
  opacity: 0.12;
}

.scene-alley .sky {
  background:
    linear-gradient(rgba(18, 15, 12, 0.18), rgba(18, 15, 12, 0.18)),
    url("assets/alley-paris-1509.png") center center / cover no-repeat;
}

.scene-alley .city,
.scene-alley .ground,
.scene-alley .focus-a,
.scene-alley .focus-b,
.scene-alley .focus-c {
  display: none;
}

.scene-alley .ambient-smoke {
  left: 54%;
  bottom: 38%;
  width: 190px;
  height: 220px;
  opacity: 0.24;
  animation: smokeRise 10s linear infinite;
}

.scene-alley .ambient-glow {
  left: 8%;
  top: 28%;
  width: 96px;
  height: 96px;
  opacity: 0.22;
  animation: lightBreath 5.2s ease-in-out infinite;
}

.scene-alley .ambient-prop-a {
  display: none;
}

.scene-alley .ambient-door {
  right: 10%;
  bottom: 24%;
  opacity: 0.12;
}

.scene-alley .ambient-figure-a {
  left: 49%;
  bottom: 11%;
  width: 58px;
  height: 132px;
  opacity: 0.98;
  animation: craftsmanShift 8s ease-in-out infinite;
  background-image: url("assets/silhouette-standing.svg");
}

.scene-alley .ambient-figure-b {
  left: 16%;
  bottom: 13%;
  width: 84px;
  height: 188px;
  opacity: 0.9;
  animation: figureWalk 12s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-church .sky {
  background:
    linear-gradient(rgba(18, 16, 14, 0.16), rgba(18, 16, 14, 0.16)),
    url("assets/church-paris-1509.png") center center / cover no-repeat;
}

.scene-church .city,
.scene-church .ground,
.scene-church .focus-a,
.scene-church .focus-b,
.scene-church .focus-c {
  display: none;
}

.scene-church .ambient-glow {
  right: 18%;
  bottom: 26%;
  width: 110px;
  height: 110px;
  opacity: 0.2;
  animation: lightBreath 4.8s ease-in-out infinite;
}

.scene-church .ambient-bird {
  left: 30%;
  top: 12%;
  opacity: 0.28;
  animation: birdCross 12s linear infinite;
}

.scene-church .ambient-prop-a {
  right: 14%;
  bottom: 20%;
  width: 120px;
  height: 42px;
  opacity: 0.14;
  transform: rotate(-6deg);
}

.scene-church .ambient-door {
  right: 17%;
  bottom: 34%;
  opacity: 0.18;
}

.scene-church .ambient-figure-a {
  left: 17%;
  bottom: 12%;
  width: 78px;
  height: 168px;
  opacity: 0.94;
  animation: figureWalk 11s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-church .ambient-figure-b {
  left: 53%;
  bottom: 16%;
  width: 64px;
  height: 142px;
  opacity: 0.84;
  animation: figureWalkAlt 13s linear infinite;
  background-image: url("assets/silhouette-standing.svg");
}

.scene-quay .sky {
  background:
    linear-gradient(rgba(16, 15, 14, 0.14), rgba(16, 15, 14, 0.14)),
    url("assets/quay-paris-1509.png") center center / cover no-repeat;
}

.scene-quay .city,
.scene-quay .ground,
.scene-quay .focus-a,
.scene-quay .focus-b,
.scene-quay .focus-c {
  display: none;
}

.scene-quay .ambient-smoke {
  left: 54%;
  bottom: 36%;
  width: 210px;
  height: 250px;
  opacity: 0.18;
  animation: mistDrift 12s linear infinite;
}

.scene-quay .ambient-prop-a {
  right: 4%;
  bottom: 8%;
  width: 120px;
  height: 90px;
  opacity: 0.18;
}

.scene-quay .ambient-bird {
  left: 60%;
  top: 16%;
  opacity: 0.24;
  animation: birdCrossAlt 10s linear infinite;
}

.scene-quay .ambient-figure-a {
  left: 20%;
  bottom: 16%;
  width: 78px;
  height: 170px;
  opacity: 0.94;
  animation: figureWalk 10s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-quay .ambient-figure-b {
  left: 34%;
  bottom: 16%;
  width: 66px;
  height: 150px;
  opacity: 0.88;
  animation: figureWalkAlt 12s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-bridge .sky {
  background:
    linear-gradient(rgba(22, 18, 14, 0.18), rgba(22, 18, 14, 0.18)),
    url("assets/bridge-paris-1515.png") center center / cover no-repeat;
}

.scene-bridge .city,
.scene-bridge .ground,
.scene-bridge .focus-a,
.scene-bridge .focus-b,
.scene-bridge .focus-c {
  display: none;
}

.scene-bridge .ambient-smoke {
  left: 40%;
  bottom: 31%;
  width: 168px;
  height: 196px;
  opacity: 0.22;
  animation: smokeRise 10s linear infinite;
}

.scene-bridge .ambient-prop-a {
  left: 4%;
  bottom: 8%;
  width: 188px;
  height: 50px;
  opacity: 0.34;
  transform: rotate(-4deg);
}

.scene-bridge .ambient-bird {
  left: 62%;
  top: 14%;
  opacity: 0.3;
  animation: birdCross 10s linear infinite;
}

.scene-bridge .ambient-figure-a {
  left: 24%;
  bottom: 15%;
  width: 80px;
  height: 168px;
  opacity: 0.94;
  animation: figureWalk 10s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-bridge .ambient-figure-b {
  left: 40%;
  bottom: 15%;
  width: 66px;
  height: 146px;
  opacity: 0.86;
  animation: figureWalkAlt 11s linear infinite;
  background-image: url("assets/silhouette-walking.svg");
}

.scene-table-night .sky {
  background:
    linear-gradient(rgba(22, 17, 13, 0.18), rgba(22, 17, 13, 0.18)),
    url("assets/table-night-paris-1509.png") center center / cover no-repeat;
}

.scene-table-night .city,
.scene-table-night .ground,
.scene-table-night .focus-a,
.scene-table-night .focus-b,
.scene-table-night .focus-c {
  display: none;
}

.scene-table-night .ambient-fire {
  left: 74%;
  bottom: 27%;
  width: 70px;
  height: 86px;
  opacity: 0.82;
  animation: fireFlicker 2.1s ease-in-out infinite;
}

.scene-table-night .ambient-glow {
  left: 60%;
  bottom: 16%;
  width: 160px;
  height: 160px;
  opacity: 0.2;
  animation: lightBreath 6.2s ease-in-out infinite;
}

.scene-table-night .ambient-figure-a {
  right: 18%;
  bottom: 12%;
  width: 108px;
  height: 172px;
  opacity: 0.92;
  animation: seatedFigure 7.4s ease-in-out infinite;
  background-image: url("assets/silhouette-seated.svg");
}

.scene-table-night .ambient-figure-b {
  left: 28%;
  bottom: 14%;
  width: 104px;
  height: 168px;
  opacity: 0.8;
  animation: seatedShift 8s ease-in-out infinite;
  background-image: url("assets/silhouette-seated.svg");
}

.scene-scribe-room .sky {
  background:
    linear-gradient(rgba(18, 16, 14, 0.18), rgba(18, 16, 14, 0.18)),
    url("assets/scribe-room-paris-1509.png") center center / cover no-repeat;
}

.scene-scribe-room .city,
.scene-scribe-room .ground,
.scene-scribe-room .focus-a,
.scene-scribe-room .focus-b,
.scene-scribe-room .focus-c {
  display: none;
}

.scene-scribe-room .ambient-fire {
  left: 38%;
  bottom: 25%;
  width: 44px;
  height: 60px;
  opacity: 0.54;
  animation: candleFlicker 2.1s ease-in-out infinite;
}

.scene-scribe-room .ambient-glow {
  left: 30%;
  bottom: 16%;
  width: 120px;
  height: 120px;
  opacity: 0.16;
  animation: lightBreath 5.6s ease-in-out infinite;
}

.scene-scribe-room .ambient-drape {
  right: 9%;
  top: 16%;
  width: 90px;
  height: 220px;
  opacity: 0.18;
  animation: clothSway 6.4s ease-in-out infinite;
}

.scene-scribe-room .ambient-figure-a {
  right: 24%;
  bottom: 15%;
  width: 96px;
  height: 156px;
  opacity: 0.88;
  animation: readerLean 6.4s ease-in-out infinite;
  background-image: url("assets/silhouette-reader.svg");
}

.scene-scribe-room .ambient-figure-b {
  display: none;
}

.scene-records-room .sky {
  background:
    linear-gradient(rgba(18, 16, 14, 0.22), rgba(18, 16, 14, 0.22)),
    url("assets/records-room-paris-1515.png") center center / cover no-repeat;
}

.scene-records-room .city,
.scene-records-room .ground,
.scene-records-room .focus-a,
.scene-records-room .focus-b,
.scene-records-room .focus-c {
  display: none;
}

.scene-records-room .ambient-fire {
  left: 72%;
  bottom: 18%;
  width: 48px;
  height: 62px;
  opacity: 0.34;
  animation: candleFlicker 2.1s ease-in-out infinite;
}

.scene-records-room .ambient-glow {
  left: 56%;
  top: 13%;
  width: 160px;
  height: 160px;
  opacity: 0.18;
  animation: lightBreath 5.6s ease-in-out infinite;
}

.scene-records-room .ambient-drape {
  right: 10%;
  top: 18%;
  width: 88px;
  height: 210px;
  opacity: 0.22;
  animation: clothSway 6.2s ease-in-out infinite;
}

.scene-records-room .ambient-figure-a {
  right: 18%;
  bottom: 13%;
  width: 94px;
  height: 156px;
  opacity: 0.88;
  animation: readerLean 6.4s ease-in-out infinite;
  background-image: url("assets/silhouette-reader.svg");
}

.scene-records-room .ambient-figure-b {
  display: none;
}

/* Interiors read as complete on their own. In these tight, dark rooms a
   foreground silhouette breaks both scale and lighting (it sinks into the
   shadow or floats up like plaster), so the figures are hidden here and the
   ambient props / fire / candle carry the sense of life instead. */
.scene-workshop .ambient-figure-a,
.scene-workshop .ambient-figure-b,
.scene-table .ambient-figure-a,
.scene-table .ambient-figure-b,
.scene-table-night .ambient-figure-a,
.scene-table-night .ambient-figure-b,
.scene-study .ambient-figure-a,
.scene-study .ambient-figure-b,
.scene-records-room .ambient-figure-a,
.scene-records-room .ambient-figure-b,
.scene-scribe-room .ambient-figure-a,
.scene-scribe-room .ambient-figure-b {
  display: none;
}

@keyframes drift {
  0% {
    transform: translate(0, 0);
    opacity: 0;
  }
  20% {
    opacity: 0.7;
  }
  100% {
    transform: translate(70px, -90px);
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: rotate(45deg) scale(1);
  }
  50% {
    transform: rotate(45deg) scale(1.08);
  }
}

@keyframes objectReveal {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes flame {
  0%,
  100% {
    transform: rotate(45deg) scale(0.92);
    filter: brightness(1);
  }
  50% {
    transform: rotate(45deg) scale(1.08);
    filter: brightness(1.25);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes sceneDissolve {
  0% {
    filter: brightness(1) saturate(1) blur(0);
    opacity: 1;
  }
  35% {
    filter: brightness(0.42) saturate(0.74) blur(3px);
    opacity: 0.68;
  }
  70% {
    filter: brightness(0.88) saturate(0.92) blur(1px);
    opacity: 0.9;
  }
  100% {
    filter: brightness(1) saturate(1) blur(0);
    opacity: 1;
  }
}

@keyframes windowDip {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  35% {
    opacity: 0.25;
    transform: translateY(6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes summaryFlash {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    box-shadow: 0 0 0 rgba(255, 219, 137, 0);
  }
  30% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 28px rgba(255, 219, 137, 0.34);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(255, 219, 137, 0);
  }
}

@keyframes fireFlicker {
  0%,
  100% {
    transform: scale(0.96) translateY(0);
    filter: blur(4px) brightness(0.95);
  }
  50% {
    transform: scale(1.08) translateY(-4px);
    filter: blur(5px) brightness(1.18);
  }
}

@keyframes candleFlicker {
  0%,
  100% {
    transform: scale(0.96) rotate(-2deg);
    filter: blur(3px) brightness(0.9);
  }
  50% {
    transform: scale(1.08) rotate(2deg);
    filter: blur(4px) brightness(1.15);
  }
}

@keyframes smokeRise {
  0% {
    transform: translate(0, 14px) scale(0.88);
    opacity: 0.08;
  }
  30% {
    opacity: 0.26;
  }
  100% {
    transform: translate(26px, -80px) scale(1.16);
    opacity: 0;
  }
}

@keyframes mistDrift {
  0% {
    transform: translateX(-26px);
    opacity: 0.08;
  }
  35% {
    opacity: 0.22;
  }
  100% {
    transform: translateX(42px);
    opacity: 0;
  }
}

@keyframes lightBreath {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.18;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.34;
  }
}

@keyframes clothSway {
  0%,
  100% {
    transform: rotate(-1deg) translateY(0);
  }
  50% {
    transform: rotate(2deg) translateY(2px);
  }
}

@keyframes clothSwayWide {
  0%,
  100% {
    transform: rotate(-2deg) translateY(0) scaleX(0.98);
  }
  50% {
    transform: rotate(5deg) translateY(5px) scaleX(1.04);
  }
}

@keyframes passerBy {
  0% {
    transform: translateX(-48px) scale(0.96);
    opacity: 0;
  }
  18% {
    opacity: 0.36;
  }
  50% {
    opacity: 0.52;
  }
  100% {
    transform: translateX(320px) scale(1.04);
    opacity: 0;
  }
}

@keyframes passerByAlt {
  0% {
    transform: translateX(56px) scale(1.02);
    opacity: 0;
  }
  22% {
    opacity: 0.32;
  }
  60% {
    opacity: 0.44;
  }
  100% {
    transform: translateX(-260px) scale(0.94);
    opacity: 0;
  }
}

@keyframes birdCross {
  0% {
    transform: translateX(-18px) translateY(0) scale(0.9);
    opacity: 0;
  }
  18% {
    opacity: 0.4;
  }
  50% {
    transform: translateX(80px) translateY(-10px) scale(1);
    opacity: 0.52;
  }
  100% {
    transform: translateX(200px) translateY(-18px) scale(1.06);
    opacity: 0;
  }
}

@keyframes birdCrossAlt {
  0% {
    transform: translateX(0) translateY(0) scale(0.84);
    opacity: 0;
  }
  24% {
    opacity: 0.24;
  }
  58% {
    transform: translateX(140px) translateY(8px) scale(0.96);
    opacity: 0.38;
  }
  100% {
    transform: translateX(280px) translateY(-4px) scale(1.04);
    opacity: 0;
  }
}

@keyframes craftsmanShift {
  0%,
  100% {
    transform: translateX(0) scale(1.02);
    opacity: 0.68;
  }
  50% {
    transform: translateX(4px) scale(1.04);
    opacity: 0.76;
  }
}

@keyframes figureWalk {
  0% {
    transform: translateX(-28px);
    opacity: 0;
  }
  16% {
    opacity: 0.52;
  }
  54% {
    opacity: 0.72;
  }
  100% {
    transform: translateX(130px);
    opacity: 0;
  }
}

@keyframes figureWalkAlt {
  0% {
    transform: translateX(32px);
    opacity: 0;
  }
  18% {
    opacity: 0.46;
  }
  56% {
    opacity: 0.66;
  }
  100% {
    transform: translateX(-116px);
    opacity: 0;
  }
}

@keyframes seatedFigure {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.66;
  }
  50% {
    transform: translateY(2px);
    opacity: 0.74;
  }
}

@keyframes readerLean {
  0%,
  100% {
    transform: rotate(1deg) translateY(0);
    opacity: 0.64;
  }
  50% {
    transform: rotate(-2deg) translateY(2px);
    opacity: 0.72;
  }
}

@keyframes seatedShift {
  0%,
  100% {
    transform: translateX(0);
    opacity: 0.62;
  }
  50% {
    transform: translateX(-6px);
    opacity: 0.72;
  }
}

.story p,
.result p {
  margin: 0 0 1em;
}

.overlay-label {
  position: fixed;
  z-index: 18;
  left: 24px;
  top: 94px;
  padding: 6px 10px;
  border: 1px solid rgba(247, 240, 227, 0.22);
  background: rgba(18, 14, 12, 0.54);
  backdrop-filter: blur(6px);
}

.choices {
  position: absolute;
  z-index: 16;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 10px;
  max-width: min(920px, calc(100vw - 48px));
}

.choice {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  text-align: left;
  background: rgba(24, 18, 14, 0.84);
  color: #f7f0e3;
  border: 1px solid rgba(205, 191, 159, 0.62);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(6px);
}

.choice:hover {
  background: rgba(58, 41, 30, 0.94);
  color: #fff;
}

.choice.is-selected {
  border-color: rgba(255, 224, 153, 0.88);
  box-shadow: 0 0 0 2px rgba(255, 224, 153, 0.22), 0 10px 18px rgba(0, 0, 0, 0.16);
  background: rgba(68, 48, 35, 0.96);
}

.result {
  margin-top: 12px;
  padding: 16px;
  border-left: 5px solid rgba(214, 160, 77, 0.9);
  background: rgba(255, 246, 232, 0.12);
  line-height: 1.85;
  display: none;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.pager-button {
  min-width: 110px;
}

.effects {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.effect {
  padding: 4px 8px;
  border-radius: 999px;
  background: #ede0ca;
  font-size: 0.86rem;
  font-weight: 700;
}

.effect.good {
  color: var(--good);
}

.effect.bad {
  color: var(--bad);
}

.next {
  padding: 0 18px;
}

.history {
  position: fixed;
  z-index: 22;
  top: 82px;
  left: 16px;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - 100px);
  padding: 14px;
  color: #f7f0e3;
  overflow: auto;
  backdrop-filter: blur(10px);
}

.history.is-collapsed {
  display: none;
}

.history ol {
  margin: 12px 0 0;
  padding-left: 22px;
  color: rgba(247, 240, 227, 0.82);
  font-size: 0.9rem;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    display: block;
    padding: 7px 10px 6px;
    min-height: 0;
    background: rgba(15, 12, 10, 0.42);
  }

  .topbar-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    width: auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .topbar-actions button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .topbar-subtitle,
  #audioButton,
  #fullscreenButton,
  #restartButton {
    display: none;
  }

  .topbar h1 {
    margin-top: 4px;
    max-width: calc(100vw - 132px);
    font-size: clamp(1.05rem, 6vw, 1.4rem);
    line-height: 1.05;
  }

  .eyebrow {
    max-width: calc(100vw - 132px);
    font-size: 0.64rem;
    line-height: 1.3;
  }

  .status {
    top: 72px;
    right: 8px;
    width: min(420px, calc(100vw - 16px));
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .scene {
    min-height: auto;
  }

  .visual {
    min-height: 100vh;
  }

  .dialogue-window {
    left: 8px;
    right: 8px;
    max-width: none;
    bottom: 8px;
    padding: 13px 13px 12px;
    background: rgba(28, 21, 16, 0.72);
  }

  .featured-object--stool-leg {
    right: 2%;
    bottom: 18%;
    width: min(48vw, 270px);
    max-height: 34vh;
  }

  .featured-object--ledger,
  .featured-object--bowl,
  .featured-object--parchment,
  .featured-object--firewood,
  .featured-object--salt-bag {
    right: 2%;
    width: min(40vw, 220px);
  }

  .effect-summary.floating {
    top: 82px;
    right: 8px;
    width: min(360px, calc(100vw - 20px));
  }

  .overlay-label {
    display: none;
  }

  .stage.has-choices .dialogue-window {
    bottom: 156px;
  }

  .stage.choices-2 .dialogue-window {
    bottom: 210px;
  }

  .stage.choices-3 .dialogue-window {
    bottom: 264px;
  }

  .choices {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-width: none;
  }

  .dialogue-window .story,
  .dialogue-window .result {
    max-height: 22vh;
    font-size: 0.98rem;
    line-height: 1.85;
  }

  .history {
    top: 72px;
    left: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 82px);
  }

  .scene-workshop .ambient-figure-a,
  .scene-market .ambient-figure-a,
  .scene-crossroads .ambient-figure-a,
  .scene-church .ambient-figure-a,
  .scene-bridge .ambient-figure-a,
  .scene-quay .ambient-figure-a {
    opacity: 0.98;
  }

  .scene-alley .ambient-figure-a {
    opacity: 1;
  }

  .scene-alley .ambient-figure-b {
    opacity: 0.94;
  }

  .scene-table-night .ambient-figure-a,
  .scene-table .ambient-figure-a,
  .scene-study .ambient-figure-a,
  .scene-records-room .ambient-figure-a,
  .scene-scribe-room .ambient-figure-a {
    opacity: 0.94;
  }
}
