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

:root {
  --bg:           #f1e7cf;
  --bg-panel:     #fbf5e4;
  --bg-panel-2:   #ffffff;
  --text:         #1c150c;
  --text-2:       #453a2a;
  --text-3:       #7e7260;
  --accent:       #566f58;
  --accent-b:     #3f5340;
  --accent-soft:  rgba(86, 111, 88, 0.14);
  --accent-line:  rgba(86, 111, 88, 0.4);
  --line:         rgba(28, 21, 12, 0.10);
  --line-soft:    rgba(28, 21, 12, 0.05);
  --red:          #a45050;
  --green:        #567e5f;
  --blue:         #52709a;
  --sans:         "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Typography refactor 2026-04-28: --serif aliases --sans (Inter). */
  --serif:        "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Good-run celebration: alias the existing state colors (see .fill-tension
     etc. below) rather than introduce new hues. */
  --good:         var(--green);
  --tension:      var(--red);
  --openness:     var(--blue);
  --trust:        var(--green);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  /* Viewport-locked: the page itself never scrolls during a scenario.
     Only the dialogue-box (messages) scrolls inside the right panel. */
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
}

/* ---- LAYOUT ---- */
.shell {
  width: 100%;
  max-width: 1120px;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 28px;
  align-items: stretch;
  min-height: 0;
}

.shell.hidden { display: none; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 28px 26px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 2px 18px rgba(28, 21, 12, 0.04);
  transition: background 0.9s ease, box-shadow 0.35s ease, border-color 0.6s ease;
}

/* Atmosphere: right panel bg shifts with tension */
.right-panel.low-tension  { background: var(--bg-panel); }
.right-panel.mid-tension  { background: #fbf2e0; }
.right-panel.high-tension { background: #f6e2e0; border-color: rgba(164, 80, 80, 0.15); }

/* Flash: immediate feedback on a choice */
.right-panel.feedback-positive {
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset,
              0 2px 18px rgba(28, 21, 12, 0.04),
              inset 0 0 0 2px rgba(86, 126, 95, 0.28);
}
.right-panel.feedback-negative {
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset,
              0 2px 18px rgba(28, 21, 12, 0.04),
              inset 0 0 0 2px rgba(164, 80, 80, 0.28);
}

/* --- LEFT PANEL --- */
.left-panel {
  gap: 22px;
  overflow-y: auto;  /* scroll internally if context/state gets tall */
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.turn-dots { display: flex; gap: 5px; align-items: center; }

.turn-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.3;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.turn-dot.done   { opacity: 0.55; }
.turn-dot.active { opacity: 1; transform: scale(1.4); background: var(--accent); }

.title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.scenario-subtitle {
  font-size: 14px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.005em;
  line-height: 1.4;
  margin-top: 6px;
}
.scenario-subtitle:empty { display: none; }

.character-tag {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-2);
  letter-spacing: 0.01em;
  margin-top: 2px;
}

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

.principle {
  font-family: var(--serif);
  font-size: 17px;
  font-style: italic;
  color: var(--text);
  line-height: 1.5;
  padding: 14px 16px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  transition: box-shadow 0.5s ease;
}

.principle.pulse-positive { box-shadow: 0 0 0 2px rgba(86, 111, 88, 0.25); }
.principle.pulse-negative { box-shadow: 0 0 0 2px rgba(164, 80, 80, 0.22); }

.scene-hook {
  font-family: var(--serif);
  font-size: 14.5px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.55;
  padding: 2px 2px 0;
  letter-spacing: 0.005em;
}

/* --- INSIGHT (left-panel aside) --- */
.insight-card {
  display: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  padding: 2px 0 0;
}

.insight-card.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.insight-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.insight-text {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--text-2);
  line-height: 1.5;
  letter-spacing: 0.005em;
}

/* --- STATE CARD --- */
.state-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 18px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  margin-top: auto;
}

.state-card-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.state-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--text-3);
  font-size: 10px;
  font-style: normal;
  cursor: help;
  position: relative;
  font-family: var(--sans);
  line-height: 1;
  text-transform: none;
  letter-spacing: 0;
  transition: color 0.15s, background 0.15s;
}
.state-info:hover, .state-info:focus {
  color: var(--text-2);
  background: var(--accent-soft);
  outline: none;
}
.state-info::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--text);
  color: var(--bg-panel);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: left;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  text-transform: none;
}
.state-info:hover::after, .state-info:focus::after { opacity: 1; }

.turn-micro-feedback {
  display: none;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.005em;
  line-height: 1.4;
  padding: 2px 0;
}

.state-pip { display: flex; flex-direction: column; gap: 6px; position: relative; }

.state-pip-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  position: relative;  /* anchors the absolute .state-delta-badge */
}

.state-pip-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.state-pip-value {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-3, var(--text-2));
  letter-spacing: 0.02em;
  min-width: 1.6em;
  text-align: right;
}

.state-pip-track {
  height: 5px;
  background: rgba(28, 21, 12, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
[data-theme="dark"] .state-pip-track {
  background: rgba(232, 223, 199, 0.14);
}

.state-pip-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.7s cubic-bezier(0.34, 1.1, 0.64, 1);
  opacity: 0.92;
}

.fill-tension  { background: var(--red); }
.fill-openness { background: var(--blue); }
.fill-trust    { background: var(--green); }

/* --- STATE CHANGE FEEDBACK ---
   The delta badge was previously suppressed here ("hidden for now so it
   doesn't overlap the current value"). The canonical rule defined later
   in this file positions it absolutely at right:2.4em from the row, which
   matches the per-scenario inline definition and avoids the overlap that
   the old suppression was working around. So we no longer hide it. */

.state-pip-fill.changed { animation: barPulse 1.4s ease; }
@keyframes barPulse {
  0%   { filter: brightness(1) saturate(1); box-shadow: none; }
  20%  { filter: brightness(1.7) saturate(1.9); box-shadow: 0 0 10px currentColor; }
  50%  { filter: brightness(1.4) saturate(1.6); box-shadow: 0 0 6px currentColor; }
  100% { filter: brightness(1) saturate(1); box-shadow: none; }
}

/* --- RIGHT PANEL (chat) --- */
.right-panel {
  gap: 14px;
  padding: 24px 24px 24px;
  min-height: 0;
}

/* --- DIALOGUE (bubbles) ---
   .dialogue-wrap is the non-scrolling positioning context; .dialogue-box
   is the actual scrolling message list inside it. This split exists so
   the optional background illustration (.dialogue-bg) can stay visually
   fixed in place while only the messages scroll — a background image
   positioned as part of the SAME element that scrolls (the previous
   approach, a pseudo-element of .dialogue-box itself) scrolls away with
   the content once the list overflows, which is a real bug: verified by
   forcing overflow and watching the illustration disappear entirely
   once scrolled to the bottom. */
.dialogue-wrap {
  position: relative;
  /* z-index:0 (not just position:relative) forces .dialogue-wrap to
     establish its own stacking context — without it, .dialogue-bg's
     z-index:-1 can escape past this element entirely and render behind
     the whole panel's opaque background instead of just behind the
     chat bubbles, making the illustration invisible. Confirmed by
     testing: same symptom, fixed by adding this. */
  z-index: 0;
  flex: 1 1 auto;
  min-height: 0;  /* allow flex child to shrink so overflow kicks in */
  overflow: hidden;
}

.dialogue-box {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
  padding: 6px 2px;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36px, #000 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 36px, #000 100%);
}

/* Optional faded scenario illustration behind the chat bubbles — opt-in
   via MODULE.chatBackgroundImage. Sibling of .dialogue-box (not a
   pseudo-element of it), positioned relative to the non-scrolling
   .dialogue-wrap, so it never moves as the messages scroll. */
.dialogue-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
}

.dialogue-bg.has-scenario-background {
  opacity: 0.22;
}

@media (max-width: 880px) {
  .dialogue-bg.has-scenario-background {
    background-position: 55% top;
    opacity: 0.16;
  }
}

.chat-bubble {
  max-width: 86%;
  padding: 11px 15px;
  border-radius: 18px;
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.42;
  word-wrap: break-word;
  animation: bubbleIn 0.35s ease both;
}

.chat-bubble.other {
  align-self: flex-start;
  background: var(--bg-panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-top-left-radius: 6px;
}

.chat-bubble.you {
  align-self: flex-end;
  background: var(--accent);
  color: #ffffff;
  border-top-right-radius: 6px;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: var(--target-opacity, 1); transform: translateY(0) scale(1); }
}

.chat-narration {
  align-self: center;
  text-align: center;
  font-family: var(--sans);
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-3);
  padding: 6px 16px;
  line-height: 1.5;
  max-width: 92%;
  animation: narrationIn 0.45s ease both;
}

@keyframes narrationIn {
  from { opacity: 0; }
  to   { opacity: var(--target-opacity, 1); }
}

.chat-bubble.fading-out,
.chat-narration.fading-out {
  opacity: 0 !important;
  max-height: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  border-width: 0 !important;
  margin-top: -8px;
  transform: translateY(-2px);
  transition: opacity 0.35s ease,
              max-height 0.4s ease,
              padding 0.4s ease,
              margin 0.4s ease,
              border-width 0.4s ease,
              transform 0.35s ease;
}

.chat-prompt {
  align-self: center;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 0 2px;
  animation: narrationIn 0.45s ease both;
}

/* --- TYPING INDICATOR --- */
.typing-indicator {
  align-self: flex-start;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  border-top-left-radius: 6px;
  padding: 12px 16px;
  display: flex;
  gap: 5px;
  align-items: center;
  animation: bubbleIn 0.25s ease both;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-3);
  border-radius: 50%;
  animation: typingPulse 1.3s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes typingPulse {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* --- CHOICES --- */
.choices-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  transition: opacity 0.3s ease, max-height 0.4s ease, padding 0.3s ease, border-color 0.3s ease;
  max-height: 600px;
  overflow: hidden;
  flex-shrink: 0;  /* stay pinned at bottom; do not get squeezed by dialogue */
}

.choices-box.committed {
  opacity: 0;
  pointer-events: none;
  max-height: 0;
  padding-top: 0;
  border-color: transparent;
}

.choice-btn {
  width: 100%;
  text-align: left;
  padding: 13px 17px;
  background: var(--bg-panel-2);
  border: 1.5px solid var(--line);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, opacity 0.2s ease;
  line-height: 1.45;
  border-radius: 22px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
}

.choice-letter {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  min-width: 14px;
  flex-shrink: 0;
  letter-spacing: 0.06em;
}

.choice-btn:hover:not(:disabled) {
  background: #fff;
  border-color: var(--accent-line);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(28, 21, 12, 0.06);
}

.choice-btn:disabled { opacity: 0.35; cursor: default; }

.choice-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  opacity: 1 !important;
}

.choice-btn.selected .choice-letter { color: var(--accent); }

/* --- END SCREEN --- */
.end-shell {
  width: 100%;
  max-width: 640px;
  display: none;
}
.end-shell.active { display: block; }

.end-panel {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 34px 30px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.5) inset, 0 2px 18px rgba(28, 21, 12, 0.04);
}

.end-header { margin-bottom: 22px; }

.end-eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.end-title {
  font-family: var(--serif);
  font-size: 30px; font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

.end-summary {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  color: var(--text);
  line-height: 1.5;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--line);
}

.end-state-section {
  padding: 22px 0 24px;
  border-bottom: 1px solid var(--line);
}

.end-state-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.end-state-grid { display: flex; gap: 10px; }

.end-state-item {
  flex: 1;
  background: var(--bg-panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-3);
}

.end-state-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1;
  letter-spacing: -0.03em;
}

.end-state-delta {
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.delta-pos { color: var(--green); }
.delta-neg { color: var(--red); }
.delta-neu { color: var(--text-3); }

.end-reflection-section {
  padding: 22px 0 4px;
}

.end-reflection-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.reflection-question {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.6;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.reflection-question:last-child { border-bottom: none; }

.end-footer {
  display: flex;
  justify-content: center;
  padding-top: 22px;
}

.btn {
  padding: 11px 22px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
  border-radius: 99px;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0.01em;
}

.btn-secondary {
  background: rgba(28, 21, 12, 0.07);
  color: var(--text-2);
}
.btn-secondary:hover { background: rgba(28, 21, 12, 0.12); color: var(--text); }

/* --- Good-run celebration ---
   Purely additive: inert unless .end-panel carries .is-good, which
   scenario-engine.js toggles based on the run's tension/openness/trust
   delta. Nothing here changes when .is-good is absent. */
.end-celebrate { display: none; position: relative; }
.end-panel.is-good .end-celebrate {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.end-sparks { position: absolute; inset: -12px -12px auto -12px; height: 64px; pointer-events: none; overflow: hidden; }
.sp {
  position: absolute; width: 8px; height: 8px; border-radius: 2px;
  opacity: 0; animation: end-spark-pop 2.8s ease-in-out infinite;
}
.sp:nth-child(odd)  { width: 6px; height: 6px; border-radius: 50%; }
.sp:nth-child(3n)   { width: 10px; height: 10px; }
@keyframes end-spark-pop {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0); }
  35%      { opacity: .9; transform: scale(1) rotate(25deg); }
}

.medallion {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; position: relative; flex: none;
  background: radial-gradient(circle at 50% 40%, rgba(86, 126, 95, .28), rgba(86, 126, 95, .12));
  box-shadow: 0 0 0 1px rgba(86, 126, 95, .25), 0 8px 22px rgba(86, 126, 95, .2);
  animation: end-medal-pop .6s cubic-bezier(.34, 1.56, .64, 1) both;
}
.medallion svg { width: 28px; height: 28px; stroke: var(--good); }
.medallion::after, .medallion::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 2px solid rgba(86, 126, 95, .4);
  animation: end-medal-ring 2.4s ease-out infinite;
}
.medallion::before { animation-delay: 1.2s; }
@keyframes end-medal-ring {
  0%   { opacity: .75; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.42); }
}
@keyframes end-medal-pop {
  0%   { transform: scale(.4); opacity: 0; }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

.end-panel.is-good #headline {
  font-family: var(--serif); font-size: 20px; font-weight: 500; color: var(--text);
  animation: end-headline-pop .55s cubic-bezier(.34, 1.56, .64, 1) both;
  animation-delay: .15s;
}
@keyframes end-headline-pop {
  0%   { opacity: 0; transform: translateY(6px) scale(.96); }
  100% { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .medallion, .medallion::before, .medallion::after,
  .sp, .end-panel.is-good #headline { animation: none !important; }
}

/* --- RESPONSIVE --- */
@media (max-width: 880px) {
  body { padding: 14px; }
  .shell {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 540px;
    /* On mobile, stack panels as a flex column inside the viewport-locked shell */
    display: flex;
    flex-direction: column;
  }
  .panel { padding: 20px 18px; }
  .left-panel {
    gap: 16px;
    flex-shrink: 0;
    max-height: 32vh;  /* keep context compact; user can scroll it if needed */
  }
  .right-panel {
    flex: 1 1 auto;
    min-height: 0;
  }
  .right-panel .dialogue-box { min-height: 120px; max-height: none; }
  .title { font-size: 24px; }
  .scenario-subtitle { font-size: 13.5px; margin-top: 4px; }
  .chat-bubble { font-size: 17px; }
  .state-card { margin-top: 0; }

  /* Mobile: state-card relocates into chat panel for visibility during play */
  .right-panel > .state-card {
    margin: 0 0 10px;
    padding: 10px 14px 12px;
    background: var(--bg-panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    order: -1;
    flex-shrink: 0;
    gap: 8px;
  }
  .right-panel > .state-card .state-card-label { display: none; }
  .right-panel > .state-card .state-pip { gap: 4px; }
  .right-panel > .state-card .state-pip-label { font-size: 11px; letter-spacing: 0.02em; }
  .right-panel > .state-card .state-pip-value { font-size: 11px; }
  .right-panel > .state-card .state-pip-track { height: 6px; }
}

/* ================================================================
   Skill-banner family + chat-coach + chat-prompt + turn-insight
   text styles. These were inlined per-scenario in every existing
   guided HTML file but never made it into this shared stylesheet.
   Added June 2026 so scenario.html (the new shared shell) has full
   visual parity with the inline-CSS scenarios.
   ================================================================ */
.skill-banner {
  grid-column: 1 / -1;
  background: var(--bg-panel-2);
  border: 1px solid var(--accent-line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.skill-eyebrow {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.skill-text {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text);
  letter-spacing: 0.005em;
}
@media (max-width: 880px) {
  .skill-banner { padding: 8px 14px; order: -2; }
  .skill-text { font-size: 14px; }
}

/* Chat-coach: in-line coach insight bubble (pushed into the
   transcript after a turn). Sits inside the dialogue-box like a
   chat-bubble but has its own visual identity. */
/* Verbatim port of the inline definitions in the existing scenario
   HTMLs — the warmer --bg-panel cream + no full border, the heavier
   coach-tag, the medium-weight non-italic micro line. */
.chat-coach {
  align-self: stretch;
  background: var(--bg-panel);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: coachIn 0.4s cubic-bezier(0.34, 1.1, 0.64, 1);
}
.chat-coach .coach-tag {
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.chat-coach .coach-micro {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.chat-coach .coach-text {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.5;
}
@keyframes coachIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Per-turn current prompt (the framing question above the choices). */
.chat-prompt {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--text);
  padding: 8px 2px 4px;
  line-height: 1.45;
}

/* Typing indicator (the three-dot pulse before the AI reply). */
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-panel-2);
  border-radius: 14px;
  margin: 4px 0;
  align-self: flex-start;
}
.typing-indicator .typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.6;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-indicator .typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator .typing-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes typing-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-3px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-indicator .typing-dot { animation: none; }
}

/* State-pip delta badge (the small +N/-N marker that flashes
   beside a state value after a delta). Verbatim port of the inline
   definitions — absolute-positioned, text-only (no pill background).
   Anchors to .state-pip-row which is now position:relative above. */
.state-delta-badge {
  position: absolute;
  top: 0;
  right: 2.4em;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.3s ease, transform 0.4s ease;
  pointer-events: none;
}
.state-delta-badge.show { opacity: 1; transform: translateY(0); }
.state-delta-badge.fade { opacity: 0; transform: translateY(-4px); transition: opacity 0.7s ease, transform 0.7s ease; }
.state-delta-badge.delta-up   { color: var(--green); }
.state-delta-badge.delta-down { color: var(--red); }
/* (The .state-pip-fill.changed pulse already lives earlier in this
   file as @keyframes barPulse — don't redefine it here.) */

/* ================================================================
   End-screen reflection panel — verbatim port of the inline rules
   from the existing scenario HTMLs. The skill-recap / alignment /
   takeaway sections all use small uppercase eyebrow labels and the
   alignment-list uses left-accent borders instead of default browser
   bullets. Added so the smart-summary engine's output renders the
   same here as it does in the inline-CSS scenarios.
   ================================================================ */
.end-skill-recap { padding: 18px 0 20px; border-bottom: 1px solid var(--line); }
.end-skill-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 6px; }
.end-skill-name  { font-family: var(--serif); font-size: 18px; font-style: normal; color: var(--text); }

.end-alignment { padding: 20px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.end-alignment-group { display: flex; flex-direction: column; gap: 8px; }
.end-alignment-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.end-alignment-list  { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.end-alignment-list li { font-size: 14px; color: var(--text-2); padding-left: 10px; border-left: 2px solid var(--accent-soft); line-height: 1.5; }
.end-alignment-list li.list-empty { color: var(--text-3); font-style: normal; border-left-color: var(--line); }

.end-takeaway       { padding: 20px 0; border-bottom: 1px solid var(--line); }
.end-takeaway-label { font-size: 10px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.end-takeaway-text  { font-family: var(--serif); font-size: 16px; font-style: normal; color: var(--text); line-height: 1.5; }
