:root {
  --bg0: #1a1410;
  --bg1: #2a1f18;
  --ink: #f3ebe2;
  --muted: #b09a88;
  --line: rgba(243, 235, 226, 0.14);
  --amber: #e8a04a;
  --danger: #d94b3d;
  --calm: #6f9e7a;
  --hero: #3aa0ff;
  --panel: rgba(20, 14, 10, 0.72);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  color: var(--ink);
  font-family: "Source Sans 3", system-ui, sans-serif;
  background: var(--bg0);
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(232, 160, 74, 0.18), transparent 55%),
    radial-gradient(ellipse 55% 45% at 90% 80%, rgba(58, 160, 255, 0.12), transparent 50%),
    linear-gradient(165deg, #241a14 0%, #15100d 48%, #0f0c0a 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  opacity: 0.35;
  pointer-events: none;
}

.top {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-mini {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 1.05rem;
}

.meter {
  flex: 1;
  max-width: 280px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.meter-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid var(--line);
}

.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--danger));
  transition: width 0.45s ease;
  box-shadow: 0 0 16px rgba(217, 75, 61, 0.35);
}

.meter.hot .meter-fill {
  animation: pulse 0.9s ease infinite;
}

@keyframes pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 18px 40px;
}

.screen.hidden { display: none; }

.title-stage, .end-card {
  margin-top: 28px;
  padding: clamp(24px, 5vw, 40px);
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
}

.eyebrow {
  margin-top: 8px;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
}

h1, h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 3.4rem);
  line-height: 1.05;
  margin: 10px 0 14px;
}

.lead, #end-text {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 34rem;
  margin: 0 auto 22px;
}

.hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 22px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn.primary {
  background: var(--ink);
  color: #1a1410;
}

.btn.primary:hover { background: #fff; }

.btn.choice {
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--ink);
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.btn.choice:hover {
  border-color: rgba(232, 160, 74, 0.55);
  background: rgba(232, 160, 74, 0.08);
}

.btn.choice:disabled {
  opacity: 0.55;
  cursor: default;
}

.scene-meta {
  margin: 8px 0 18px;
}

.place {
  color: var(--amber);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.scene-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  margin-top: 4px;
}

.stage {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cast {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  min-height: 140px;
}

.portrait {
  width: 96px;
  height: 124px;
  position: relative;
  flex-shrink: 0;
  overflow: visible;
}

.portrait.big {
  width: 128px;
  height: 158px;
  margin: 0 auto 8px;
}

.portrait::before,
.portrait::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Monsieur Z. — SVG (chapeau + cravate noirs) */
.portrait.hero {
  display: grid;
  place-items: end center;
}

.portrait.hero .mz-sprite {
  width: 100%;
  height: 100%;
  display: block;
}

.portrait.hero::before,
.portrait.hero::after {
  content: none;
  display: none;
}

/* Interlocuteurs */
.portrait.other::before {
  width: 50px;
  height: 66px;
  bottom: 8px;
  border-radius: 40% 40% 35% 35%;
}

.portrait.other::after {
  width: 34px;
  height: 34px;
  bottom: 58px;
  border-radius: 50%;
}

.portrait.other[data-kind="wife"]::before {
  background: linear-gradient(180deg, #c97b63 0%, #9a5544 100%);
  box-shadow: inset 0 -16px 0 #7a4033;
}
.portrait.other[data-kind="wife"]::after {
  background: #f0c2a8;
  box-shadow: 0 -12px 0 7px #3b2218;
}

.portrait.other[data-kind="colleague"]::before {
  background: linear-gradient(180deg, #6b7280 0%, #4b5563 100%);
  box-shadow: inset 0 -16px 0 #374151;
}
.portrait.other[data-kind="colleague"]::after {
  background: #e8c4a8;
  box-shadow: 0 -2px 0 0 #222, inset 0 -8px 0 -4px #1f2937;
}

.portrait.other[data-kind="passenger"]::before {
  background: linear-gradient(180deg, #5b7c99 0%, #3f5a73 100%);
  box-shadow: inset 0 -16px 0 #2f4558;
}
.portrait.other[data-kind="passenger"]::after {
  background: #d7b29a;
  box-shadow: 0 -10px 0 6px #243447;
}

.portrait.other[data-kind="neighbor"]::before {
  background: linear-gradient(180deg, #8a9a6a 0%, #5f6d45 100%);
  box-shadow: inset 0 -16px 0 #4a5536;
}
.portrait.other[data-kind="neighbor"]::after {
  background: #e2c2a4;
  box-shadow: 0 -8px 0 5px #c9b8a0;
}

.portrait.other[data-kind="shopper"]::before {
  background: linear-gradient(180deg, #c47a9a 0%, #9a5575 100%);
  box-shadow: inset 0 -16px 0 #7a3f5a;
}
.portrait.other[data-kind="shopper"]::after {
  background: #f0c8b4;
  box-shadow: 0 -10px 0 6px #5c3a28;
}

.portrait.other[data-kind="driver"]::before {
  background: linear-gradient(180deg, #4a5568 0%, #2d3544 100%);
  box-shadow: inset 0 -16px 0 #1e2530;
}
.portrait.other[data-kind="driver"]::after {
  background: #d4a888;
  box-shadow: 0 -2px 0 0 #111, inset 0 -6px 0 -3px #1a1a1a;
}

.portrait.other[data-kind="diner"]::before {
  background: linear-gradient(180deg, #b85c38 0%, #8a3f24 100%);
  box-shadow: inset 0 -16px 0 #6b3018;
}
.portrait.other[data-kind="diner"]::after {
  background: #e8b898;
  box-shadow: 0 -8px 0 5px #3d2918;
}

.portrait.other[data-kind="courier"]::before {
  background: linear-gradient(180deg, #e8a020 0%, #c47e10 100%);
  box-shadow: inset 0 -16px 0 #9a620c;
}
.portrait.other[data-kind="courier"]::after {
  background: #c9a07a;
  box-shadow: 0 -6px 0 4px #2a2a2a;
}

.portrait.other[data-kind="agent"]::before {
  background: linear-gradient(180deg, #5a7a8a 0%, #3d5a68 100%);
  box-shadow: inset 0 -16px 0 #2c4450;
}
.portrait.other[data-kind="agent"]::after {
  background: #e0c4a8;
  box-shadow: 0 -4px 0 2px #4a5560, inset 0 -8px 0 -4px #1f2933;
}

.portrait.other[data-kind="patient"]::before {
  background: linear-gradient(180deg, #7a8fa0 0%, #5a6f80 100%);
  box-shadow: inset 0 -16px 0 #3f5260;
}
.portrait.other[data-kind="patient"]::after {
  background: #e5c4a8;
  box-shadow: 0 -6px 0 4px #c8c8c8;
}

.portrait.other[data-kind="cyclist"]::before {
  background: linear-gradient(180deg, #2f9e6a 0%, #1f7a50 100%);
  box-shadow: inset 0 -16px 0 #165c3c;
}
.portrait.other[data-kind="cyclist"]::after {
  background: #d2a888;
  box-shadow: 0 -12px 0 8px #1a1a1a;
}

.portrait.other[data-kind="elevator"]::before {
  background: linear-gradient(180deg, #9a7ab0 0%, #735889 100%);
  box-shadow: inset 0 -16px 0 #5a446c;
}
.portrait.other[data-kind="elevator"]::after {
  background: #f0c8b0;
  box-shadow: 0 -10px 0 6px #4a3050;
}

.portrait.other[data-kind="baker"]::before {
  background: linear-gradient(180deg, #c4a06a 0%, #9a7848 100%);
  box-shadow: inset 0 -16px 0 #7a5c34;
}
.portrait.other[data-kind="baker"]::after {
  background: #e8c4a0;
  box-shadow: 0 -4px 0 2px #5a4030;
}

.portrait.other[data-kind="moviegoer"]::before {
  background: linear-gradient(180deg, #3d4a5c 0%, #2a3340 100%);
  box-shadow: inset 0 -16px 0 #1a222c;
}
.portrait.other[data-kind="moviegoer"]::after {
  background: #d4b090;
  box-shadow: 0 -4px 0 2px #111;
}

.portrait.other[data-kind="cafe"]::before {
  background: linear-gradient(180deg, #6b9e8a 0%, #4a7a68 100%);
  box-shadow: inset 0 -16px 0 #356050;
}
.portrait.other[data-kind="cafe"]::after {
  background: #f0d0b8;
  box-shadow: 0 -10px 0 6px #3a2820;
}

.portrait.other[data-kind="gym"]::before {
  background: linear-gradient(180deg, #4a4a4a 0%, #2e2e2e 100%);
  box-shadow: inset 0 -16px 0 #1a1a1a;
}
.portrait.other[data-kind="gym"]::after {
  background: #c9a07a;
  box-shadow: 0 -2px 0 0 #111;
}

.portrait.other[data-kind="dog"]::before {
  background: linear-gradient(180deg, #8a6a4a 0%, #6a4e34 100%);
  box-shadow: inset 0 -16px 0 #4a3624;
}
.portrait.other[data-kind="dog"]::after {
  background: #e0b898;
  box-shadow: 0 -8px 0 5px #5a4030;
}

.portrait.other[data-kind="admin"]::before {
  background: linear-gradient(180deg, #6a7a9a 0%, #4a5a7a 100%);
  box-shadow: inset 0 -16px 0 #344058;
}
.portrait.other[data-kind="admin"]::after {
  background: #e4c4a8;
  box-shadow: 0 -6px 0 4px #888;
}

.portrait.other[data-kind="pharma"]::before {
  background: linear-gradient(180deg, #5a9a8a 0%, #3d7a6a 100%);
  box-shadow: inset 0 -16px 0 #2c5c50;
}
.portrait.other[data-kind="pharma"]::after {
  background: #e8c8b0;
  box-shadow: 0 -6px 0 4px #4a6060;
}

.dialogue {
  text-align: left;
}

.speaker {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 700;
  margin-bottom: 8px;
}

.line {
  font-size: 1.12rem;
  line-height: 1.5;
  min-height: 3.3em;
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.feedback.bad {
  border-color: rgba(217, 75, 61, 0.45);
  color: #f0b4ad;
}

.feedback.good {
  border-color: rgba(111, 158, 122, 0.45);
  color: #b7d4bf;
}

.end-meter {
  margin-bottom: 18px;
  color: var(--muted);
}

.back {
  display: inline-block;
  margin-top: 16px;
  color: var(--muted);
  text-decoration: none;
}

.back:hover { color: var(--ink); }

@media (min-width: 640px) {
  .stage {
    grid-template-columns: 200px 1fr;
    align-items: center;
  }
  .cast {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
  }
  .portrait.other { order: -1; margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill, .btn, .meter.hot .meter-fill {
    transition: none;
    animation: none;
  }
}
