/*
 * Visual-first scenario layer.
 * Keeps the JSON-driven story and scoring intact while making artwork,
 * framework state, speaker activity, and decisions lead the experience.
 */

.scene-cue[hidden],
.score-breakdown[hidden] {
  display: none;
}

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

.scenario-shell {
  overflow: clip;
}

.scene-backdrop {
  background:
    linear-gradient(180deg, rgba(7, 11, 18, .25), rgba(7, 11, 18, .02) 42%, rgba(7, 11, 18, .34)),
    var(--scene-bg) center / cover no-repeat;
  filter: saturate(1.02) brightness(1.03) contrast(1.01);
}

.scene-backdrop::after {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), transparent 24%),
    linear-gradient(90deg, rgba(13, 18, 28, .12), transparent 24%, transparent 76%, rgba(13, 18, 28, .12));
  backdrop-filter: none;
}

.scenario-header {
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  padding: 12px 18px;
}

.scenario-heading p,
.scenario-heading span {
  display: none;
}

.scenario-heading h1 {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.42rem);
  line-height: 1.15;
}

.icon-button {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, .94);
}

body[data-scenario-state="role"] .stage,
body[data-scenario-state="role"] .dialogue-panel,
body[data-scenario-state="role"] .scene-cue,
body[data-scenario-state="complete"] .stage,
body[data-scenario-state="complete"] .dialogue-panel,
body[data-scenario-state="complete"] .choice-panel {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Portrait-first role selection */
.role-panel {
  top: 80px;
  width: min(900px, calc(100vw - 32px));
  gap: 12px;
  padding: 22px;
  background: rgba(255, 255, 255, .96);
}

.role-panel > .section-label {
  margin: 0;
}

.role-panel h2 {
  max-width: 640px;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.role-panel > p:not(.section-label):not(.sync-message) {
  font-size: .94rem;
  line-height: 1.45;
}

.role-actions {
  gap: 12px;
}

.role-card {
  position: relative;
  min-height: 242px;
  display: grid;
  grid-template-columns: 142px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  gap: 12px 16px;
  padding: 12px;
  overflow: hidden;
  border-color: rgba(21, 25, 35, .14);
  background: #fff;
}

.role-card::before {
  display: none;
}

.role-portrait {
  position: relative;
  grid-row: 1 / 3;
  overflow: hidden;
  min-height: 216px;
  border-radius: 7px;
  background:
    linear-gradient(180deg, #eef2f5, #dfe5ea);
}

.role-portrait::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background: linear-gradient(180deg, transparent, rgba(21, 25, 35, .08));
  pointer-events: none;
}

.role-portrait img {
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 320%;
  max-width: none;
  height: auto;
  transform: translateX(-50%);
  transform-origin: center bottom;
  transition: transform .28s var(--ease);
}

.role-card:hover .role-portrait img {
  transform: translateX(-50%) scale(1.025);
}
.role-card[data-role="manager"] .role-portrait img {
  left: -10%;
}

.role-card[data-role="manager"]:hover .role-portrait img {
  transform: translateX(-50%) scale(1.025);
}

.role-framework {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  min-width: 44px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #fff;
  color: var(--red-dark);
  box-shadow: 0 6px 16px rgba(21, 25, 35, .12);
  font-size: .7rem;
  font-weight: 950;
  text-align: center;
}

.role-copy {
  align-content: end;
  gap: 5px;
  padding-top: 12px;
}

.role-copy strong {
  font-size: 1.34rem;
}

.role-copy small {
  max-width: 180px;
  font-size: .88rem;
  line-height: 1.4;
}

.role-start {
  width: 100%;
  min-height: 44px;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.role-start svg {
  width: 18px;
  height: 18px;
}

.role-gate-status {
  color: #667085;
  font-size: .78rem;
  font-weight: 800;
}

.role-card.is-locked {
  border-color: rgba(89, 98, 115, .24);
  background: #f6f7f9;
}

.role-card.is-locked .role-start {
  background: var(--red-soft);
  color: var(--red-dark);
  box-shadow: none;
}

.sync-message:empty {
  display: none;
}

/* Compact visual HUD */
.progress-panel {
  top: 78px;
  right: 22px;
  width: min(360px, calc(100vw - 44px));
  gap: 7px;
  padding: 11px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
}

.progress-panel::before {
  height: 2px;
}

.progress-copy {
  align-items: center;
}

#roleBadge {
  font-size: .68rem;
}

#frameworkBadge {
  min-width: 42px;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: .78rem;
  text-align: center;
}

.progress-track {
  height: 6px;
}

#scenarioProgressText {
  margin: 0;
  font-size: .74rem;
  font-weight: 800;
}

.evaluation-note {
  display: none;
}

.score-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.framework-chip {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid rgba(21, 25, 35, .1);
  border-radius: 6px;
  background: #f7f9fb;
}

.framework-chip strong {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--red);
  color: #fff;
  font-size: .72rem;
}

.framework-chip small {
  overflow: hidden;
  color: var(--ink);
  font-size: .62rem;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scene signal replaces explanatory paragraphs with quick visual context. */
.scene-cue {
  position: absolute;
  top: 78px;
  left: 22px;
  z-index: 10;
  width: min(300px, calc(100vw - 44px));
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--shadow-sm);
}

.scene-cue-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #eef2f5;
  color: var(--ink);
}

.cue-icon {
  display: none;
  width: 24px;
  height: 24px;
}

.scene-cue[data-tone="neutral"] .cue-icon.neutral,
.scene-cue[data-tone="success"] .cue-icon.success,
.scene-cue[data-tone="tense"] .cue-icon.tense,
.scene-cue[data-tone="mentor"] .cue-icon.mentor {
  display: block;
}

.scene-cue[data-tone="success"] .scene-cue-icon {
  background: var(--teal-soft);
  color: var(--teal);
}

.scene-cue[data-tone="tense"] .scene-cue-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.scene-cue[data-tone="mentor"] .scene-cue-icon {
  background: var(--gold-soft);
  color: #7a5523;
}

.scene-cue-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.scene-cue-copy small {
  color: var(--muted);
  font-size: .64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scene-cue-copy strong,
.scene-cue-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-cue-copy strong {
  color: var(--ink);
  font-size: .98rem;
  line-height: 1.2;
}

.scene-cue-copy span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 750;
}

/* Give the artwork the centre of the screen. */
.character {
  bottom: 116px;
  height: min(82vh, 760px);
  filter: saturate(.82) brightness(.64);
}

.character.manager,
.character.sarah,
.character.manager.active,
.character.sarah.active,
.character.manager.inactive,
.character.sarah.inactive {
  transform: none;
}

.character.manager {
  right: 5px;
}

.character.sarah {
  left: 5px;
}

.character.active {
  opacity: 1;
  filter: saturate(1.05) brightness(1.05);
}

.character.inactive {
  opacity: .42;
  filter: saturate(.72) brightness(.56);
}
.character.decision-ready {
  opacity: .86;
  filter: saturate(.96) brightness(.92);
}

/* Numbered decisions read like visual actions, not a questionnaire. */
.choice-panel {
  top: auto;
  bottom: 174px;
  left: 50%;
  width: min(1160px, calc(100vw - 48px));
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  transform: translateX(-50%);
}

.choice-button {
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-color: rgba(21, 25, 35, .16);
  background: rgba(255, 255, 255, .96);
  font-size: .91rem;
  line-height: 1.3;
}

.choice-button::before,
.choice-button::after {
  display: none;
}

.choice-button:hover {
  border-color: rgba(201, 24, 34, .46);
  box-shadow: 0 16px 34px rgba(5, 10, 18, .18);
}

.choice-key {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--red-soft);
  color: var(--red-dark);
  font-size: .82rem;
  font-weight: 950;
}

.choice-copy {
  font-weight: 850;
}

.choice-button > svg {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

/* Dialogue becomes a concise caption bar. */
.dialogue-panel {
  right: 18px;
  bottom: 16px;
  left: 18px;
  max-width: 980px;
  gap: 8px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, .95);
}

.dialogue-panel::before {
  height: 2px;
}

.dialogue-meta {
  min-height: 30px;
}

.speaker-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.speaker {
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: .78rem;
}

.scene-count {
  font-size: .76rem;
}

.speaking-bars {
  height: 20px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--red);
  opacity: .28;
}

.speaking-bars i {
  width: 3px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.dialogue-panel.is-speaking .speaking-bars {
  opacity: 1;
}

.dialogue-panel.is-speaking .speaking-bars i {
  animation: voiceBar .58s ease-in-out infinite alternate;
}

.dialogue-panel.is-speaking .speaking-bars i:nth-child(2) {
  animation-delay: .12s;
}

.dialogue-panel.is-speaking .speaking-bars i:nth-child(3) {
  animation-delay: .24s;
}

@keyframes voiceBar {
  from { height: 6px; }
  to { height: 18px; }
}

.dialogue-text {
  min-height: 54px;
  max-height: 18vh;
  font-size: clamp(.98rem, 1.45vw, 1.1rem);
  line-height: 1.5;
}

.dialogue-actions {
  justify-content: flex-end;
}

.text-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
}

.text-button svg {
  width: 17px;
  height: 17px;
}

/* Visual completion summary */
.reflection-panel {
  top: 68px;
  bottom: auto;
  max-width: 1120px;
  max-height: calc(100dvh - 82px);
  grid-template-columns: minmax(270px, .8fr) minmax(380px, 1.2fr);
  gap: 14px;
  padding: 20px;
}

.score-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.score-hero > span:last-child {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.score-ring {
  --score-angle: 0deg;
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--red) var(--score-angle), #e4e9ee 0);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}

.score-ring strong {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: 1.4rem;
}

.evaluation-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.evaluation-card {
  gap: 7px;
  padding: 11px;
}

.evaluation-meter {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e9ee;
}

.evaluation-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.evaluation-card.strong .evaluation-meter span {
  background: var(--teal);
}

.evaluation-card.developing .evaluation-meter span {
  background: var(--amber);
}

.evaluation-card p {
  display: -webkit-box;
  overflow: hidden;
  font-size: .82rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.feedback-columns {
  gap: 0;
  padding-top: 4px;
  border-top: 1px solid var(--line-dark);
}

.feedback-columns section {
  padding: 12px 14px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.feedback-columns section + section {
  border-left: 1px solid var(--line-dark);
}

.feedback-columns ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  list-style: none;
}

.feedback-columns li {
  padding: 5px 8px;
  border-radius: 6px;
  background: #eef2f5;
  font-size: .78rem;
  font-weight: 800;
}

.reflection-field textarea {
  min-height: 88px;
}

@media (max-width: 920px) {
  .framework-chip {
    grid-template-columns: 1fr;
  }

  .framework-chip small {
    display: none;
  }

  .framework-chip strong {
    margin: 0 auto;
  }

  .choice-panel {
    width: calc(100vw - 28px);
  }

  .character {
    height: 70vh;
  }
}

@media (max-width: 760px) {
  .scenario-header {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 9px 10px;
  }

  .scenario-heading h1 {
    font-size: .98rem;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .role-panel {
    top: 58px;
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 68px);
    gap: 9px;
    padding: 14px;
  }

  .role-panel h2 {
    font-size: 1.35rem;
  }

  .role-panel > p:not(.section-label):not(.sync-message) {
    font-size: .84rem;
  }

  .role-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .role-card {
    min-height: 148px;
    grid-template-columns: 104px minmax(0, 1fr);
    padding: 8px;
  }

  .role-portrait {
    min-height: 132px;
  }

  .role-copy {
    padding-top: 5px;
  }

  .role-copy strong {
    font-size: 1.14rem;
  }

  .role-copy small {
    font-size: .78rem;
  }

  .role-start {
    min-height: 38px;
    padding: 7px 9px;
    font-size: .78rem;
  }

  .progress-panel {
    top: 58px;
    right: 10px;
    left: 10px;
    width: auto;
    padding: 9px 10px;
  }

  .score-breakdown {
    gap: 4px;
  }

  .framework-chip {
    padding: 4px;
  }

  .scene-cue {
    top: 166px;
    left: 10px;
    width: min(228px, calc(100vw - 20px));
    padding: 9px;
  }

  .scene-cue-icon {
    width: 36px;
    height: 36px;
  }

  .scene-cue-copy strong {
    font-size: .88rem;
  }

  .character {
    bottom: 150px;
    height: 58vh;
  }

  .character.manager {
    right: 5px;
  }

  .character.sarah {
    left: 5px;
  }

  .choice-panel {
    right: 10px;
    bottom: 174px;
    left: 10px;
    width: auto;
    grid-template-columns: 1fr;
    gap: 6px;
    transform: none;
  }

  .choice-button {
    min-height: 48px;
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    gap: 8px;
    padding: 7px 9px;
    font-size: .82rem;
  }

  .choice-key {
    width: 30px;
    height: 30px;
  }

  .dialogue-panel {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    gap: 6px;
    padding: 10px 11px;
  }

  .dialogue-text {
    min-height: 48px;
    max-height: 104px;
    font-size: .94rem;
    line-height: 1.42;
  }

  .dialogue-actions {
    align-items: stretch;
  }

  .dialogue-actions .text-button {
    width: 100%;
    min-height: 38px;
  }

  .reflection-panel {
    top: 56px;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 66px);
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .score-hero {
    align-items: flex-start;
  }

  .score-ring {
    width: 82px;
    height: 82px;
  }

  .evaluation-grid,
  .feedback-columns,
  .reflection-fields {
    grid-template-columns: 1fr;
  }

  .feedback-columns section + section {
    border-top: 1px solid var(--line-dark);
    border-left: 0;
  }
}

@media (max-width: 430px) {
  .role-panel {
    max-height: calc(100dvh - 62px);
  }

  .role-card {
    min-height: 136px;
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .role-portrait {
    min-height: 120px;
  }

  .scene-cue-copy span {
    display: none;
  }
}

@media (max-width: 760px) and (max-height: 700px) {
  .scene-cue {
    display: none;
  }

  .progress-panel {
    top: 54px;
  }

  .choice-panel {
    bottom: 160px;
  }

  .choice-button {
    min-height: 44px;
  }

  .dialogue-panel {
    bottom: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .speaking-bars i {
    animation: none !important;
  }

  .role-portrait img {
    transition: none;
  }
}




/* Compact dialogue and decision spacing after playtest. */
.score-breakdown {
  gap: 6px;
}

.framework-chip {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 4px;
}

.framework-chip strong {
  width: 24px;
  height: 24px;
  margin: 0;
  font-size: .76rem;
}

.framework-chip small {
  display: none;
}

.choice-panel {
  bottom: 220px;
}

.dialogue-panel {
  max-width: 820px;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 5px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.dialogue-meta {
  grid-column: 1 / -1;
  min-height: 26px;
}

.speaker {
  min-height: 26px;
  padding: 4px 8px;
}

.dialogue-text {
  grid-column: 1;
  min-height: 38px;
  max-height: 15vh;
  font-size: clamp(.94rem, 1.35vw, 1.04rem);
  line-height: 1.42;
}

.dialogue-panel .text-button {
  min-height: 34px;
  padding: 6px 11px;
}

.dialogue-actions {
  grid-column: 2;
  align-self: center;
}

@media (max-width: 760px) {
  .choice-panel {
    bottom: 208px;
  }

  .dialogue-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 4px;
    padding: 8px 10px;
    margin-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .dialogue-meta,
  .dialogue-text,
  .dialogue-actions {
    grid-column: 1;
  }

  .dialogue-text {
    min-height: 34px;
    max-height: 88px;
    font-size: .9rem;
    line-height: 1.38;
  }

  .dialogue-actions .text-button {
    min-height: 34px;
  }
}

@media (max-width: 760px) and (max-height: 700px) {
  .choice-panel {
    bottom: 192px;
  }
}
/* Clean interaction pass: visible defaults and compact mobile role selection. */
:root {
  --motion-fast: 160ms;
  --motion-base: 220ms;
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 6px;
  background: #fff;
  color: #161b24;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18);
  transform: translateY(-160%);
  transition: transform var(--motion-fast) var(--motion-ease);
}

.skip-link:focus {
  transform: translateY(0);
}

body.novel-page .section-label {
  font-size: .8rem;
  font-weight: 800;
  text-transform: none;
}

body.novel-page .role-panel {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.novel-page .role-panel h2,
body.novel-page .reflection-panel h2 {
  text-wrap: balance;
  overflow-wrap: anywhere;
}

body.novel-page .role-card,
body.novel-page .choice-button,
body.novel-page .text-button,
body.novel-page .icon-button {
  transition-duration: var(--motion-fast);
  transition-timing-function: var(--motion-ease);
}

body.novel-page .role-card:hover,
body.novel-page .choice-button:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}

body.novel-page .progress-track span {
  background: var(--red);
}

@media (max-width: 720px) {
  body.novel-page .role-panel {
    top: 58px;
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 68px);
    padding: 14px;
  }

  body.novel-page .role-panel h2 {
    max-width: 100%;
    font-size: 1.28rem;
    line-height: 1.18;
  }

  body.novel-page .role-panel > p:not(.section-label):not(.sync-message) {
    font-size: .83rem;
    line-height: 1.42;
  }

  body.novel-page .role-card {
    min-height: 132px;
    grid-template-columns: 92px minmax(0, 1fr);
  }

  body.novel-page .role-start {
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link {
    transition: none !important;
  }
}

/* Visible artwork alignment and compact phone HUD. */
.character.manager {
  right: calc(5px - min(22.6vh, 210px));
}

.character.sarah {
  left: calc(5px - min(44.6vh, 414px));
}

@media (max-width: 920px) {
  .character.manager {
    right: calc(5px - 19.3vh);
  }

  .character.sarah {
    left: calc(5px - 38.1vh);
  }
}

@media (max-width: 760px) {
  .progress-panel {
    top: 58px;
    right: 10px;
    left: auto;
    width: 132px;
    gap: 5px;
    padding: 7px 8px;
  }

  .progress-copy {
    gap: 5px;
  }

  #roleBadge {
    overflow: hidden;
    font-size: .62rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #frameworkBadge {
    min-width: 36px;
    padding: 3px 5px;
    font-size: .7rem;
  }

  .progress-panel .score-breakdown,
  #scenarioProgressText {
    display: none !important;
  }

  .progress-track {
    height: 4px;
  }

  .scene-cue {
    top: 58px;
    width: calc(100vw - 162px);
    min-height: 47px;
    gap: 7px;
    padding: 7px;
  }

  .scene-cue-icon {
    width: 32px;
    height: 32px;
  }

  .scene-cue-copy span {
    display: none;
  }

  .character.manager {
    right: calc(5px - 16vh);
  }

  .character.sarah {
    left: calc(5px - 31.6vh);
  }
}

/* Scenario achievement and completion swipe. */
.scenario-achievement {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(20, 132, 116, .24);
}

.scenario-achievement-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal-soft);
  color: var(--teal);
}

.scenario-achievement-icon svg,
.completion-wipe-check svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scenario-achievement-icon svg {
  fill: currentColor;
  stroke-width: 1.4;
}

.scenario-achievement > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.scenario-achievement small {
  color: var(--teal);
  font-size: .66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-achievement strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#scenarioRewardDetail {
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}

.completion-wipe[hidden] {
  display: none;
}

.completion-wipe {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: hidden;
  pointer-events: auto;
}

.completion-wipe-surface {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: var(--red);
  color: #fff;
  transform: translateX(-105%);
  will-change: transform;
}

.completion-wipe.is-active .completion-wipe-surface {
  animation: scenarioCompletionSwipe .86s cubic-bezier(.76, 0, .24, 1) both;
}

.completion-wipe-check {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 50%;
}

.completion-wipe-check svg {
  width: 28px;
  height: 28px;
}

.completion-wipe-copy {
  display: grid;
  gap: 3px;
}

.completion-wipe-copy small {
  color: rgba(255, 255, 255, .82);
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.completion-wipe-copy strong {
  max-width: min(560px, 70vw);
  color: #fff;
  font-size: clamp(1.35rem, 4vw, 2.4rem);
  line-height: 1.1;
  text-wrap: balance;
}

@keyframes scenarioCompletionSwipe {
  0% { transform: translateX(-105%); }
  42%, 58% { transform: translateX(0); }
  100% { transform: translateX(105%); }
}

@media (max-width: 760px) {
  .scenario-achievement {
    grid-template-columns: 38px minmax(0, 1fr);
    padding-top: 5px;
  }

  #scenarioRewardDetail {
    grid-column: 2;
    justify-self: start;
  }

  .completion-wipe-surface {
    gap: 12px;
  }

  .completion-wipe-check {
    width: 46px;
    height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .completion-wipe.is-active .completion-wipe-surface {
    animation: none;
  }
}
/* Dialogue audio controls */
.scenario-header {
  grid-template-columns: 44px minmax(0, 1fr) auto;
}

.scenario-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle .sound-off-icon {
  display: none;
}

.sound-toggle[aria-pressed="false"] .sound-on-icon {
  display: none;
}

.sound-toggle[aria-pressed="false"] .sound-off-icon {
  display: block;
}

.sound-toggle[aria-pressed="false"] {
  color: #68717f;
}

@media (max-width: 760px) {
  .scenario-header {
    grid-template-columns: 44px minmax(0, 1fr) auto;
  }

  .scenario-header-actions {
    gap: 6px;
  }
}
@media (max-width: 430px) {
  .scenario-header {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px;
  }

  .scenario-header .icon-button {
    width: 44px;
    height: 44px;
  }

  .scenario-header-actions {
    gap: 4px;
  }

  .scenario-heading h1 {
    overflow: hidden;
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Accessible sync controls and stable interaction targets */
.sync-retry {
  min-height: 44px;
  margin-inline: auto;
}

body.novel-page .icon-button,
body.novel-page .text-button,
body.novel-page .choice-button,
body.novel-page .role-card {
  min-height: 44px;
}

.sync-message[data-tone="error"] {
  color: #7a271a;
}

/* The whole caption is an optional advance target while the button stays primary. */
.dialogue-panel.is-clickable {
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.dialogue-panel.is-clickable:hover {
  border-color: rgba(215, 25, 32, .42);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(215, 25, 32, .08);
}

.dialogue-panel.is-clickable .dialogue-text::after {
  content: "\203A";
  display: inline-block;
  margin-inline-start: .45rem;
  color: var(--red);
  font-size: 1.2em;
  font-weight: 900;
  line-height: 1;
  opacity: .62;
  animation: dialogueAdvanceCue 1.2s ease-in-out infinite alternate;
}

@keyframes dialogueAdvanceCue {
  from { transform: translateX(0); opacity: .46; }
  to { transform: translateX(3px); opacity: .82; }
}

@media (prefers-reduced-motion: reduce) {
  .dialogue-panel.is-clickable .dialogue-text::after {
    animation: none;
  }
}

/* Generated character model cutouts */
.role-portrait img {
  top: -6px;
  bottom: auto;
  left: 50%;
  width: auto;
  height: 148%;
}

.role-card[data-role="manager"] .role-portrait img {
  left: 50%;
}

.character.manager {
  right: 5px;
}

.character.sarah {
  left: 5px;
}

@media (min-width: 921px) {
  .character.manager {
    right: clamp(72px, 9vw, 140px);
  }

  .character.sarah {
    left: clamp(72px, 9vw, 140px);
  }
}

/* Generated model mobile framing */
@media (max-width: 760px) {
  .character {
    bottom: 170px;
    height: 38vh;
  }
}