:root {
  --navy: #182857;
  --navy-deep: #101d43;
  --orange: #f7931d;
  --amber: #fcb215;
  --blue: #6ba8db;
  --white: #ffffff;
  --ink: #1b2540;
  --muted: #667085;
  --page: #182857;
  --black-tag: #333333;
  --red-tag: #c0392b;
  --yellow-tag: #b8860b;
  --green-tag: #27ae60;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  --soft-shadow: 0 5px 14px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

html.orientation-warning-active,
html.orientation-warning-active body,
html.tablet-orientation-advisory-active,
html.tablet-orientation-advisory-active body {
  overflow: hidden;
}

.tablet-orientation-advisory {
  position: fixed;
  z-index: 9000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background: rgba(16, 29, 67, 0.78);
  backdrop-filter: blur(5px);
}

.tablet-orientation-advisory.is-visible {
  display: flex;
}

.tablet-orientation-advisory-card {
  width: min(700px, 100%);
  border: 1px solid rgba(24, 40, 87, 0.08);
  border-radius: 18px;
  padding: clamp(42px, 6vw, 64px) clamp(28px, 6vw, 68px) clamp(38px, 5vw, 54px);
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 24px 60px rgba(5, 7, 13, 0.34);
  text-align: center;
}

.tablet-orientation-graphic {
  display: flex;
  min-height: clamp(128px, 21vw, 168px);
  align-items: center;
  justify-content: center;
  gap: clamp(26px, 5vw, 48px);
  margin-bottom: clamp(32px, 5vw, 48px);
}

.tablet-device {
  position: relative;
  display: block;
  flex: 0 0 auto;
  border: 6px solid currentColor;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff 0%, #edf3fc 100%);
  box-shadow: inset 0 0 0 3px var(--white), 0 5px 14px rgba(24, 40, 87, 0.08);
}

.tablet-device::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.tablet-device-portrait {
  width: clamp(86px, 14vw, 112px);
  height: clamp(124px, 20vw, 162px);
  color: #76839f;
}

.tablet-device-landscape {
  width: clamp(164px, 27vw, 224px);
  height: clamp(108px, 17vw, 142px);
  border-width: 8px;
  color: #11285d;
}

.tablet-rotate-arrow {
  position: relative;
  display: block;
  width: clamp(54px, 9vw, 82px);
  height: 7px;
  flex: 0 1 auto;
  border-radius: 999px;
  background: var(--orange);
}

.tablet-rotate-arrow::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1px;
  width: 26px;
  height: 26px;
  border-top: 7px solid var(--orange);
  border-right: 7px solid var(--orange);
  border-radius: 3px;
  transform: translateY(-50%) rotate(45deg);
}

.tablet-orientation-advisory h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.35rem, 6vw, 4.1rem);
  line-height: 1;
  white-space: nowrap;
}

.tablet-orientation-advisory-card > p {
  margin: clamp(20px, 3vw, 28px) auto 0;
  color: var(--navy);
  font-size: clamp(1.15rem, 2.5vw, 1.55rem);
  font-weight: 400;
  line-height: 1.35;
}

.tablet-orientation-advisory .tablet-orientation-continue {
  min-width: clamp(250px, 43vw, 330px);
  min-height: 58px;
  margin-top: clamp(36px, 5vw, 52px);
  border: 2px solid var(--navy);
  border-radius: 8px;
  padding: 12px 24px;
  color: var(--navy);
  background: var(--white);
  box-shadow: none;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  font-weight: 400;
}

.tablet-orientation-advisory .tablet-orientation-continue:hover,
.tablet-orientation-advisory .tablet-orientation-continue:focus-visible {
  outline: 3px solid rgba(24, 40, 87, 0.32);
  outline-offset: 3px;
  color: var(--navy);
  background: #edf3fc;
  box-shadow: none;
}

.orientation-warning {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(20px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  color: var(--white);
  background: #05070d;
  text-align: center;
}

.orientation-warning.is-visible {
  display: flex;
}

.orientation-warning-content {
  width: min(620px, 100%);
}

.rotate-phone-graphic {
  display: grid;
  grid-template-columns: minmax(54px, 0.3fr) minmax(220px, 1fr) minmax(54px, 0.3fr);
  gap: clamp(12px, 4vw, 34px);
  align-items: center;
  width: min(590px, 90vw);
  margin: 0 auto 18px;
}

.rotate-phone {
  position: relative;
  display: flex;
  aspect-ratio: 1.95 / 1;
  align-items: center;
  justify-content: center;
  border: 3px solid currentColor;
  border-radius: 24px;
  box-shadow: inset 0 0 0 3px #05070d, inset 0 0 0 4px rgba(255, 255, 255, 0.65);
}

.rotate-phone::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 8px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.rotate-phone::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 8px;
  width: 4px;
  height: 4px;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateY(-50%);
}

.rotate-phone span {
  font-size: clamp(1rem, 4.2vw, 1.55rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.rotate-arrow {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: solid currentColor;
}

.rotate-arrow-left {
  border-width: 0 0 4px 4px;
  border-radius: 0 0 0 28px;
}

.rotate-arrow-right {
  border-width: 4px 4px 0 0;
  border-radius: 0 28px 0 0;
}

.rotate-arrow::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: solid currentColor;
  transform: rotate(45deg);
}

.rotate-arrow-left::after {
  top: -2px;
  left: -11px;
  border-width: 0 0 4px 4px;
}

.rotate-arrow-right::after {
  right: -11px;
  bottom: -2px;
  border-width: 4px 4px 0 0;
}

.orientation-warning h1 {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 2rem);
}

.orientation-warning p {
  margin: 8px auto 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.86rem, 2.6vw, 1rem);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.app-shell {
  --scene-image: url("scene_images/Toy store.png?v=20260922-tornado-store-layout-3");
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  background: var(--navy-deep);
}

.title-screen {
  position: relative;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
  color: var(--ink);
  background: #f3f6fb;
}

.title-screen::before {
  content: none;
}

.title-card,
.title-footer {
  position: relative;
  z-index: 1;
}

.title-card {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: center;
  width: min(1040px, 100%);
  margin: clamp(18px, 4vh, 36px) auto 0;
  border-radius: 24px;
  padding: clamp(22px, 3vw, 36px);
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.title-copy {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  text-align: center;
}

.title-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 38px);
  margin-bottom: 20px;
}

.title-hero::after {
  content: none;
}

.title-copy h1 {
  min-width: 0;
  margin: 0;
  color: var(--navy);
  font-size: clamp(3rem, 6.5vw, 5.2rem);
  line-height: 0.94;
}

.title-copy h1 span {
  display: block;
  white-space: nowrap;
}

.title-copy > p {
  max-width: 780px;
  margin: 0 auto;
  color: #344054;
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  font-weight: 700;
  line-height: 1.48;
}

.audio-note {
  display: grid;
  grid-template-columns: clamp(56px, 6vw, 76px) minmax(0, 1fr);
  max-width: 720px;
  align-items: center;
  gap: 14px;
  margin: 24px auto 0;
  border: 1px solid #d7e4f5;
  border-radius: 16px;
  padding: 14px 16px;
  color: #182857;
  background: #edf3fc;
  text-align: left;
}

.audio-note-icon-slot {
  display: inline-flex;
  width: clamp(56px, 6vw, 76px);
  height: clamp(56px, 6vw, 76px);
  align-items: center;
  justify-content: center;
}

.audio-note-icon-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.audio-note-play-icon {
  display: inline-flex;
  width: clamp(28px, 3vw, 38px);
  height: clamp(28px, 3vw, 38px);
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  opacity: 0.72;
}

.audio-note-play-icon .narration-icon {
  margin-left: 3px;
  border-top-width: 6px;
  border-bottom-width: 6px;
  border-left-width: 9px;
}

.audio-note p {
  margin: 0;
  font-size: clamp(0.95rem, 1.5vw, 1.12rem);
  font-weight: 700;
  line-height: 1.35;
}

.title-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: min(1040px, 100%);
  margin: 10px auto 0;
}

.title-hero-logo {
  width: clamp(108px, 13vw, 170px);
  height: clamp(108px, 13vw, 170px);
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 12px rgba(24, 40, 87, 0.16));
}

.title-start-button {
  min-width: clamp(132px, 16vw, 190px);
  min-height: clamp(52px, 6vw, 60px);
  border-radius: 14px;
  padding: 14px 28px;
  color: #000000;
  background: var(--orange);
  box-shadow: 0 6px 14px rgba(24, 40, 87, 0.16);
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  font-weight: 900;
  text-transform: uppercase;
  transition: transform 160ms ease, filter 160ms ease;
}

.title-start-button:hover,
.title-start-button:focus-visible {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.scenario-screen {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  padding: max(24px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(30px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  color: var(--ink);
  background: #f3f6fb;
}

.scenario-wrap {
  display: grid;
  max-width: 1100px;
  margin: 0 auto;
  gap: 16px;
}

.intro-narrow-wrap {
  max-width: 920px;
}

.scenario-hero-card,
.scenario-card {
  border-radius: 18px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.scenario-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: stretch;
  overflow: hidden;
}

.scenario-copy {
  padding: clamp(22px, 3.2vw, 38px);
}

.scenario-copy .eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scenario-card .eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.scenario-copy h1 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

.intro-page-card h1 {
  margin: 0 0 16px;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1;
}

.scenario-copy p,
.scenario-card p,
.scenario-card li {
  color: #344054;
  font-size: clamp(0.98rem, 1.3vw, 1.1rem);
  line-height: 1.52;
}

.scenario-copy strong {
  color: var(--navy);
  font-weight: 900;
}

.scenario-copy p,
.scenario-card p {
  margin: 0 0 12px;
}

.scenario-copy p:last-child,
.scenario-card p:last-child {
  margin-bottom: 0;
}

.scenario-visual-panel {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
}

.scenario-card {
  padding: clamp(18px, 2.5vw, 28px);
}

.intro-page-card {
  padding: clamp(24px, 3.5vw, 40px);
}

.scenario-card h2 {
  margin: 0 0 10px;
  color: var(--navy);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.scenario-card ul {
  margin: 0 0 14px;
  padding-left: 1.2rem;
}

.scenario-card li {
  margin: 0 0 5px;
}

.narration-heading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  color: var(--orange);
}

.scenario-copy .narration-heading-row .eyebrow,
.scenario-card .narration-heading-row .eyebrow {
  margin: 0;
}

.narration-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: inherit;
}

.narration-toggle {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  box-shadow: none;
  opacity: 0.7;
}

.narration-toggle:hover,
.narration-toggle:focus-visible,
.narration-speed:hover,
.narration-speed:focus-visible {
  opacity: 1;
}

.narration-speed {
  display: inline-flex;
  min-width: 42px;
  height: 28px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 8px;
  color: inherit;
  background: transparent;
  box-shadow: none;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.78;
}

.narration-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.narration-toggle.playing .narration-icon {
  width: 11px;
  height: 12px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(currentColor 0 0) left / 3px 100% no-repeat,
    linear-gradient(currentColor 0 0) right / 3px 100% no-repeat;
}

.triage-level-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.triage-level {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 9px 13px;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.triage-level small {
  font-size: 0.78rem;
  font-weight: 800;
}

.triage-level.tag-yellow {
  color: #000000;
}

.scenario-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.intro-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-radius: 18px;
  padding: 14px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.intro-nav .ghost-button,
.intro-nav .primary-button,
.intro-nav .scenario-start-button {
  width: 148px;
  min-width: 148px;
}

.intro-nav .scenario-start-button {
  min-height: 42px;
  padding: 9px 13px;
  font-size: 0.88rem;
  line-height: 1;
}

.algorithm-chart {
  display: block;
  width: min(100%, 760px);
  margin: 18px auto 0;
  border: 1px solid #d7e4f5;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(24, 40, 87, 0.1);
}

.scenario-resource-button {
  display: inline-flex;
  min-height: 56px;
  align-items: center;
  gap: 10px;
  border-radius: 14px;
  padding: 10px 16px;
  color: #000000;
  background: var(--orange);
  box-shadow: 0 6px 14px rgba(24, 40, 87, 0.12);
  font-weight: 900;
  text-decoration: none;
}

.scenario-resource-button.text-only {
  min-width: 160px;
  justify-content: center;
}

.scenario-resource-button img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.scenario-start-button {
  min-height: 56px;
  box-shadow: 0 6px 14px rgba(24, 40, 87, 0.12);
}

.scenario-time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.scenario-time-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d7e4f5;
  border-radius: 12px;
  padding: 10px 12px;
  color: #344054;
  background: #edf3fc;
  font-weight: 700;
}

.scenario-time-item img {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  object-fit: contain;
}

.scenario-time-item span {
  flex: 1 1 auto;
}

.scenario-time-item strong {
  flex: 0 0 auto;
  color: var(--navy);
  font-size: 1.02rem;
}

.download-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  border-top: 1px solid #d7e4f5;
  padding-top: 16px;
}

.download-callout p {
  margin: 0;
  color: #344054;
  font-weight: 800;
  line-height: 1.35;
}

.download-button {
  flex: 0 0 auto;
}

@media (max-width: 520px) {
  .download-callout {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }
}

.practice-card {
  display: grid;
  gap: 12px;
}

.practice-card h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.practice-actions .ghost-button,
.practice-actions .primary-button {
  min-width: 156px;
}

.toolbar,
.status-bar {
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-right: max(12px, env(safe-area-inset-right));
  padding-left: max(12px, env(safe-area-inset-left));
  color: var(--white);
  background: var(--navy);
}

.toolbar {
  min-height: 62px;
  flex-wrap: wrap;
  justify-content: space-between;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-bottom: 8px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28);
}

.status-bar {
  min-height: 52px;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  font-size: 0.9rem;
}

.status-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.status-leading > span {
  min-width: 0;
  flex: 1 1 240px;
}

.toolbar-group,
.toolbar-metrics,
.status-actions,
.patient-toolbar-center,
.patient-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.patient-toolbar-center {
  min-width: 0;
  justify-content: center;
}

.toolbar-button,
.primary-button,
.secondary-button,
.ghost-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  padding: 9px 13px;
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.toolbar-button {
  background: rgba(255, 255, 255, 0.12);
}

.toolbar-button.active {
  color: #000000;
  background: var(--orange);
}

@media (hover: hover) and (pointer: fine) {
  .toolbar-button:hover {
    color: #000000;
    background: var(--orange);
  }
}

.scene-switcher {
  justify-content: center;
}

.scene-switch-button {
  min-width: 90px;
}

.toolbar-button:active,
.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: scale(0.97);
}

.toolbar-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  object-fit: contain;
}

.primary-button {
  color: #000000;
  background: var(--orange);
}

.secondary-button {
  background: var(--navy);
}

.status-bar .secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
}

.status-bar .secondary-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.ghost-button {
  border: 1px solid rgba(24, 40, 87, 0.2);
  color: var(--navy);
  background: #edf3fc;
}

.button-hidden {
  display: none;
}

.debrief-button-wrap {
  display: inline-flex;
}

.metric {
  position: relative;
  min-width: 82px;
  border-radius: 9px;
  padding: 7px 10px;
  color: var(--white);
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.metric-label {
  display: block;
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 2px;
  font-size: 1.04rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.metric.warning .metric-value {
  color: #ff867a;
}

.score-flash {
  position: absolute;
  right: 4px;
  bottom: -22px;
  z-index: 50;
  border-radius: 20px;
  padding: 4px 8px;
  color: var(--white);
  background: var(--green-tag);
  font-size: 0.75rem;
  font-weight: 800;
  animation: score-pop 1.25s ease forwards;
}

.score-flash.negative {
  background: var(--red-tag);
}

@keyframes score-pop {
  0% {
    opacity: 0;
    transform: translateY(5px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-7px);
  }
}

.scene-area {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #26365e;
}

.scene-area::before,
.patient-workspace::before {
  position: absolute;
  z-index: -2;
  background-color: #26365e;
  background-image: var(--scene-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  content: "";
  filter: blur(11px) saturate(0.9) brightness(0.74);
  inset: -18px;
  transform: scale(1.04);
}

.scene-area::after,
.patient-workspace::after {
  position: absolute;
  z-index: -1;
  background: rgba(24, 40, 87, 0.18);
  content: "";
  inset: 0;
}

.scene-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1 1 auto;
  align-self: stretch;
  container-type: inline-size;
  overflow: hidden;
  background-color: #1d2b50;
  background-image: var(--scene-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.24);
}

.scene-patient,
.patient-figure,
.treatment-overlay,
.ankle-tag {
  position: absolute;
}

.scene-patient {
  --position-rotation: 0deg;
  --position-scale: 1;
  z-index: 3;
  border: 0;
  padding: 0;
  background: transparent;
  pointer-events: none;
  transform: scale(var(--position-scale)) rotate(var(--position-rotation));
  transform-origin: center bottom;
  transition: filter 160ms ease, transform 160ms ease;
}

.patient-figure {
  --position-rotation: 0deg;
  --position-scale: 1;
  transform: scale(var(--position-scale)) rotate(var(--position-rotation));
  transform-origin: center bottom;
}

.scene-patient-hit-target {
  position: absolute;
  z-index: 2;
  display: block;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.scene-patient:hover,
.scene-patient:focus-visible {
  --position-scale: 1.035;
  filter: drop-shadow(0 0 7px rgba(252, 178, 21, 0.95));
}

.scene-patient.assigned-tag {
  filter:
    drop-shadow(0 0 2px var(--tag-glow-outline, var(--tag-glow-color)))
    drop-shadow(0 0 8px var(--tag-glow-color));
}

.scene-patient.assigned-tag:hover,
.scene-patient.assigned-tag:focus-visible {
  filter:
    drop-shadow(0 0 3px var(--tag-glow-outline, var(--tag-glow-color)))
    drop-shadow(0 0 12px var(--tag-glow-color));
}

.scene-patient.tag-glow-black {
  --tag-glow-color: rgba(0, 0, 0, 1);
  --tag-glow-outline: rgba(255, 255, 255, 0.82);
  filter:
    drop-shadow(0 0 1px var(--tag-glow-outline))
    drop-shadow(0 0 4px #000000)
    drop-shadow(0 0 8px #000000);
}

.scene-patient.tag-glow-black:hover,
.scene-patient.tag-glow-black:focus-visible {
  filter:
    drop-shadow(0 0 2px var(--tag-glow-outline))
    drop-shadow(0 0 6px #000000)
    drop-shadow(0 0 11px #000000);
}

.scene-patient.tag-glow-black.tag-glow-pulse {
  animation-name: tag-glow-black-pulse;
}

.scene-patient.tag-glow-red {
  --tag-glow-color: rgba(226, 57, 45, 0.96);
}

.scene-patient.tag-glow-yellow {
  --tag-glow-color: rgba(255, 202, 25, 0.98);
}

.scene-patient.tag-glow-green {
  --tag-glow-color: rgba(39, 174, 96, 0.98);
}

.scene-patient.tag-glow-pulse {
  animation: tag-glow-pulse 1.55s ease-out;
}

@keyframes tag-glow-pulse {
  0%,
  100% {
    filter:
      drop-shadow(0 0 2px var(--tag-glow-outline, var(--tag-glow-color)))
      drop-shadow(0 0 8px var(--tag-glow-color));
  }
  35% {
    filter:
      drop-shadow(0 0 5px var(--tag-glow-outline, var(--tag-glow-color)))
      drop-shadow(0 0 20px var(--tag-glow-color));
  }
}

@keyframes tag-glow-black-pulse {
  0%,
  100% {
    filter:
      drop-shadow(0 0 1px var(--tag-glow-outline))
      drop-shadow(0 0 4px #000000)
      drop-shadow(0 0 8px #000000);
  }
  35% {
    filter:
      drop-shadow(0 0 2px var(--tag-glow-outline))
      drop-shadow(0 0 8px #000000)
      drop-shadow(0 0 14px #000000);
  }
}

.scene-patient img,
.patient-figure,
.treatment-overlay,
.ankle-tag {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.scene-patient > .scene-patient-art {
  position: absolute;
  inset: 0;
}

.speech-bubble {
  position: absolute;
  z-index: 8;
  border-radius: 0.6cqw;
  box-shadow: var(--soft-shadow);
  font-size: clamp(8px, 1.2cqw, 16px);
  font-weight: 800;
}

.tag-black {
  background: var(--black-tag);
}

.tag-red {
  background: var(--red-tag);
}

.tag-yellow {
  background: var(--yellow-tag);
}

.tag-green {
  background: var(--green-tag);
}

.speech-bubble {
  min-width: 8cqw;
  padding: 0.7cqw 2.1cqw 0.7cqw 0.9cqw;
  color: var(--navy);
  background: var(--white);
  white-space: nowrap;
}

.speech-bubble.configured-callout {
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
  white-space: normal;
}

.scene-callout-bubble {
  top: 10%;
  left: 50%;
  min-width: min(280px, 72cqw);
  padding: 12px 42px 12px 16px;
  font-size: clamp(12px, 1.2cqw, 17px);
  text-align: center;
  transform: translateX(-50%);
}

.scene-callout-box {
  position: absolute;
  top: 10%;
  left: 50%;
  z-index: 8;
  display: inline-flex;
  min-width: min(280px, 72cqw);
  max-width: min(420px, 84cqw);
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(24, 40, 87, 0.16);
  border-radius: 8px;
  padding: 12px 14px 12px 18px;
  color: var(--navy);
  background: var(--white);
  box-shadow: var(--soft-shadow);
  font-size: clamp(12px, 1.2cqw, 17px);
  font-weight: 800;
  text-align: center;
  transform: translateX(-50%);
}

.scene-callout-box.configured-callout {
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
  overflow: hidden;
  transform: none;
}

.scene-callout-box .bubble-close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  font-size: 1rem;
}

.speech-bubble::after {
  position: absolute;
  bottom: -0.75cqw;
  left: 50%;
  width: 0;
  height: 0;
  border-top: 0.85cqw solid var(--white);
  border-right: 0.7cqw solid transparent;
  border-left: 0.7cqw solid transparent;
  content: "";
  transform: translateX(-50%);
}

.bubble-close,
.toast-close,
.modal-close {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: currentColor;
  background: transparent;
  font-size: 1.1rem;
  font-weight: 800;
}

.speech-bubble .bubble-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 2cqw;
  height: 2cqw;
  min-width: 18px;
  min-height: 18px;
  font-size: clamp(11px, 1.4cqw, 18px);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 72px;
  z-index: 60;
  display: flex;
  max-width: min(420px, calc(100vw - 32px));
  align-items: flex-start;
  gap: 8px;
  border-left: 6px solid var(--amber);
  border-radius: 10px;
  padding: 13px 12px 13px 15px;
  color: var(--navy);
  background: var(--white);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  line-height: 1.38;
}

.toast.toast-anchored {
  right: auto;
  bottom: auto;
}

.patient-workspace {
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #26365e;
}

.patient-stage-stack {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  flex: 1 1 auto;
  flex-direction: column;
  align-self: stretch;
}

.patient-scene-frame {
  position: relative;
  width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  container-type: inline-size;
  overflow: hidden;
  background-color: #1d2b50;
  background-image: var(--scene-image);
  background-position: center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.24);
}

.patient-figure {
  z-index: 3;
}

.wound-box {
  position: absolute;
  z-index: 12;
  box-sizing: border-box;
  width: clamp(170px, 30cqw, 340px);
  max-width: calc(100% - 12px);
  border: max(1px, 0.15cqw) dashed var(--navy);
  border-radius: 0.7cqw;
  padding: 0.85cqw;
  color: #14213f;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  font-size: clamp(8px, 1.1cqw, 15px);
  font-weight: 700;
  line-height: 1.28;
}

.wound-box.configured-box {
  min-width: 0;
  max-width: none;
  overflow: hidden;
}

@media (max-width: 1024px) and (orientation: portrait) {
  .wound-box {
    width: min(180px, calc(100% - 12px));
    max-width: calc(100% - 12px);
    padding: 4px;
    font-size: 10px;
  }
}

.vitals-stack {
  position: absolute;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5cqw;
}

.vital-row {
  display: flex;
  align-items: flex-end;
  gap: 0.55cqw;
}

.vital-unit {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.16cqw;
}

.vital-updated {
  color: #111827;
  font-size: clamp(8px, 0.95cqw, 14px);
  font-weight: 800;
  line-height: 1;
}

.vital-pill {
  border: max(1px, 0.12cqw) solid rgba(24, 40, 87, 0.16);
  border-radius: 2cqw;
  padding: 0.38cqw 0.75cqw;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  font-size: clamp(8px, 1cqw, 14px);
  font-weight: 800;
}

.vital-pill.vital-refresh {
  border-color: rgba(24, 40, 87, 0.46);
  background: #d9ebf7;
  animation: vital-refresh 3s ease-in-out;
}

@keyframes vital-refresh {
  0% {
    background: #d9ebf7;
    box-shadow: var(--soft-shadow);
    transform: scale(1);
  }
  18%,
  52%,
  82% {
    background: #c9e4f7;
    box-shadow: 0 0 0 0.32cqw rgba(75, 144, 205, 0.24), 0 0 1.1cqw rgba(75, 144, 205, 0.62);
    transform: scale(1.1);
  }
  34%,
  68% {
    background: #e8f4fb;
    box-shadow: var(--soft-shadow);
    transform: scale(1);
  }
  100% {
    background: #d9ebf7;
    box-shadow: var(--soft-shadow);
    transform: scale(1);
  }
}

.vital-note {
  max-width: min(270px, 28cqw);
  border-radius: 0.6cqw;
  padding: 0.5cqw 0.7cqw;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
  font-size: clamp(8px, 0.9cqw, 13px);
  font-weight: 800;
  line-height: 1.25;
}

@media (min-width: 701px) {
  .vital-row {
    position: relative;
  }

  .vital-row .vital-note {
    position: absolute;
    right: calc(100% + 0.55cqw);
    bottom: 0;
    width: max-content;
  }
}

.treatment-overlay {
  z-index: 5;
  object-fit: contain;
}

.ankle-tag {
  z-index: 9;
}

@media (prefers-reduced-motion: reduce) {
  .scene-patient.tag-glow-pulse,
  .vital-pill.vital-refresh {
    animation: none;
  }
}

.control-host {
  position: absolute;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  pointer-events: none;
}

.control-panel,
.tag-card {
  pointer-events: auto;
}

.control-panel {
  border-bottom: 3px solid var(--amber);
  padding: 10px 12px 12px;
  color: var(--white);
  background: rgba(16, 29, 67, 0.97);
  box-shadow: var(--shadow);
}

.control-panel-header,
.tag-card-header,
.section-heading,
.detail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.control-panel-header h2,
.tag-card h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-result {
  grid-column: 1 / -1;
  min-height: 22px;
  margin: 0 0 1px;
  border-radius: 7px;
  padding: 5px 8px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.93);
  font-size: 0.9rem;
  font-weight: 700;
}

.panel-result.empty {
  color: rgba(255, 255, 255, 0.96);
  background: rgba(255, 255, 255, 0.16);
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(72px, 1fr));
  gap: 7px;
}

.control-grid.has-result {
  grid-template-rows: auto auto;
}

.control-grid.has-result .panel-result.contextual {
  position: relative;
  grid-column: var(--result-start) / span var(--result-span);
  grid-row: 1;
  justify-self: stretch;
  text-align: center;
}

.control-grid.has-result .panel-result.contextual::after {
  position: absolute;
  bottom: -7px;
  left: var(--result-pointer-x, var(--result-pointer, 50%));
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.93);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.control-grid.has-result .control-button {
  grid-row: 2;
}

.control-button {
  position: relative;
  display: flex;
  min-height: 85px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 6px 4px;
  color: var(--navy);
  background: var(--white);
  text-align: center;
}

.control-button.visited {
  border-color: var(--blue);
  background: #e9f4ff;
}

.control-button:hover {
  background: #fff4e6;
}

.control-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.control-label {
  font-size: 0.69rem;
  font-weight: 800;
  line-height: 1.05;
}

.control-cost-flash {
  position: absolute;
  z-index: 3;
  top: -11px;
  left: 50%;
  border-radius: 20px;
  padding: 4px 7px;
  color: #000000;
  background: var(--orange);
  box-shadow: var(--soft-shadow);
  font-size: 0.68rem;
  font-weight: 900;
  white-space: nowrap;
  animation: cost-pop 1000ms ease forwards;
}

@keyframes cost-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.82);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  84% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -17px) scale(1);
  }
}

.visited-check {
  position: absolute;
  top: 3px;
  right: 4px;
  color: #1976a5;
  font-size: 0.76rem;
  font-weight: 900;
}

.tag-card {
  width: min(430px, calc(100% - 24px));
  margin: 12px auto 0;
  border-radius: 12px;
  padding: 14px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.tag-card p {
  margin: 7px 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.tag-card .tag-instruction {
  border-radius: 8px;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.96);
  background: rgba(16, 29, 67, 0.78);
}

.tag-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tag-option {
  min-height: 62px;
  border: 3px solid transparent;
  border-radius: 9px;
  padding: 8px 4px;
  color: var(--white);
  font-weight: 800;
  text-align: center;
}

.tag-option.selected {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--navy);
}

.tag-confirmation-card {
  width: min(560px, calc(100% - 24px));
  border-top: 5px solid var(--orange);
}

.tag-confirmation-message {
  margin-top: 10px;
  border-radius: 10px;
  padding: 12px;
  background: #edf3fc;
}

.tag-card .tag-confirmation-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 800;
}

.tag-confirmation-message p:last-child {
  margin: 0;
  color: var(--navy);
  font-size: 0.88rem;
}

.tag-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 12px;
}

.tag-confirmation-actions .primary-button,
.tag-confirmation-actions .ghost-button {
  min-width: 150px;
}

.patient-title {
  overflow: hidden;
  max-width: 170px;
  color: var(--amber);
  font-size: 0.98rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  display: grid;
  align-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.68);
  inset: 0;
  justify-items: center;
}

.modal-card {
  width: min(470px, 100%);
  border-top: 7px solid var(--orange);
  border-radius: 14px;
  padding: 24px;
  color: var(--navy);
  background: var(--white);
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 9px;
  font-size: 1.5rem;
}

.modal-card p {
  margin: 0 0 19px;
  color: #4b5872;
  line-height: 1.45;
}

.lightbox-backdrop {
  align-items: stretch;
  overflow: auto;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.lightbox-card {
  display: flex;
  width: min(980px, 100%);
  max-height: calc(100dvh - 36px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  color: var(--ink);
  background: #f3f6fb;
  box-shadow: var(--shadow);
}

.lightbox-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  color: var(--white);
  background: var(--navy);
}

.lightbox-header h2 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.2;
}

.lightbox-close-button {
  min-height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--white);
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  font-weight: 800;
}

.lightbox-close-button:hover,
.lightbox-close-button:focus-visible {
  color: #000000;
  background: var(--orange);
}

.lightbox-content {
  display: grid;
  flex: 1 1 auto;
  gap: 16px;
  overflow: auto;
  padding: 16px;
}

.lightbox-content .scenario-card {
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.timeout-card {
  width: min(650px, 100%);
  text-align: left;
}

.timeout-card h2 {
  font-size: 1.22rem;
}

.timeout-card ul {
  margin: -2px 0 26px;
  padding-left: 1rem;
  line-height: 1.6;
}

.timeout-card .modal-actions {
  justify-content: space-around;
}

.modal-actions,
.debrief-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
}

.summary-screen,
.detail-screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px max(18px, env(safe-area-inset-right)) 30px max(18px, env(safe-area-inset-left));
  background: #f3f6fb;
}

.summary-wrap,
.detail-wrap {
  max-width: 1080px;
  margin: 0 auto;
}

.summary-title,
.detail-title {
  margin: 0;
  color: var(--navy);
}

.summary-subtitle {
  margin: 7px 0 20px;
  color: #3f4b63;
}

.results-heading-hint {
  color: #53617a;
  font-size: 0.72em;
  font-weight: 600;
}

.scroll-cue {
  display: inline-flex;
  margin: -8px 0 18px;
  border-radius: 999px;
  padding: 6px 11px;
  color: #30405f;
  background: #e6eef9;
  font-size: 0.82rem;
  font-weight: 800;
}

.performance-grid {
  display: grid;
  margin-bottom: 20px;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.performance-card {
  border-top: 4px solid var(--orange);
  border-radius: 10px;
  padding: 14px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.performance-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.performance-value {
  display: block;
  margin-top: 5px;
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 900;
}

.progress-screen {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    max(28px, env(safe-area-inset-top))
    max(20px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 85% 0%, rgba(107, 168, 219, 0.17), transparent 33%),
    #f3f6fb;
}

.progress-wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.progress-topline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.progress-topline h1 {
  margin: 7px 0 5px;
  color: var(--navy);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1;
}

.progress-topline p,
.progress-section-heading p,
.progress-chart-heading p,
.progress-game-copy > p {
  margin: 0;
  color: #526079;
  line-height: 1.45;
}

.personal-results-badge,
.progress-status,
.progress-source {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
}

.personal-results-badge {
  padding: 7px 11px;
  color: var(--navy);
  background: #dcecff;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.progress-preview-note {
  margin-bottom: 18px;
  border: 1px solid #f1cf80;
  border-radius: 12px;
  padding: 13px 15px;
  color: #4c3b15;
  background: #fff8e6;
  line-height: 1.45;
}

.progress-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.progress-overview .performance-card {
  min-width: 0;
}

.progress-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.progress-chart-card,
.progress-game-card {
  border: 1px solid #e2e8f2;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 4px 14px rgba(24, 40, 87, 0.08);
}

.progress-chart-card {
  min-width: 0;
  padding: 18px;
}

.progress-chart-heading {
  margin-bottom: 17px;
}

.progress-chart-heading h2,
.progress-section-heading h2 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 1.14rem;
}

.progress-chart-heading p,
.progress-section-heading p {
  font-size: 0.84rem;
}

.progress-bars {
  display: grid;
  gap: 13px;
}

.progress-bar-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(88px, 118px) minmax(60px, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.progress-bar-label {
  overflow: hidden;
  color: #34405a;
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar-track {
  display: block;
  height: 13px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress-bar-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange), var(--amber));
}

.time-chart .progress-bar-track > span {
  background: linear-gradient(90deg, #4b8dcc, var(--blue));
}

.progress-bar-row > strong {
  color: var(--navy);
  font-size: 0.82rem;
  text-align: right;
}

.progress-bar-row.is-pending {
  opacity: 0.54;
}

.progress-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.progress-game-list {
  display: grid;
  gap: 12px;
}

.progress-game-card {
  display: grid;
  min-width: 0;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  padding: 17px;
}

.progress-game-card.is-current {
  border-color: #f3ae4d;
  box-shadow: 0 5px 18px rgba(247, 147, 29, 0.15);
}

.progress-game-card.is-pending {
  border-style: dashed;
  background: #f8f9fc;
  box-shadow: none;
}

.progress-game-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  color: var(--white);
  background: var(--navy);
  font-size: 1rem;
  font-weight: 900;
}

.progress-game-card.is-current .progress-game-number {
  color: #1b1b1b;
  background: var(--orange);
}

.progress-game-card.is-pending .progress-game-number {
  color: #667085;
  background: #e3e7ee;
}

.progress-game-copy {
  min-width: 0;
}

.progress-game-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.progress-game-heading h3 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 1.1rem;
}

.progress-source {
  color: #5f6c84;
  font-size: 0.7rem;
}

.progress-status {
  flex: 0 0 auto;
  padding: 6px 9px;
}

.progress-status.completed {
  color: #155e3d;
  background: #daf2e6;
}

.progress-status.pending {
  color: #667085;
  background: #e8ebf0;
}

.progress-game-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.progress-game-metrics > div {
  min-width: 0;
  border-radius: 9px;
  padding: 10px 11px;
  background: #f3f6fb;
}

.progress-game-metrics span,
.progress-game-metrics strong {
  display: block;
}

.progress-game-metrics span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.progress-game-metrics strong {
  margin-top: 4px;
  color: var(--navy);
  font-size: 1.14rem;
}

.progress-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.results-table {
  width: 100%;
  margin-bottom: 18px;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.results-section {
  margin-bottom: 22px;
}

.results-section h2 {
  margin: 0 0 9px;
  color: var(--navy);
  font-size: 1.12rem;
}

.results-table th,
.results-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5eaf2;
  text-align: left;
  vertical-align: middle;
}

.results-table th {
  color: var(--white);
  background: var(--navy);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.results-row {
  cursor: pointer;
  transition: background 160ms ease;
}

.results-row:hover,
.results-row:focus {
  background: #edf5ff;
}

.results-row.visited-detail {
  background: #f4f8fe;
  box-shadow: inset 4px 0 0 var(--blue);
}

.detail-visited-pill {
  display: inline-flex;
  margin-left: 8px;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--navy);
  background: #d9ecff;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.patient-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.patient-thumb-aydan,
.patient-thumb-marcus,
.patient-thumb-conrad {
  transform: scale(0.82);
  transform-origin: center;
}

.tag-chip,
.outcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 20px;
  padding: 5px 9px;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tag-chip.missing,
.outcome-badge.untagged {
  color: #596275;
  background: #e3e7ed;
}

.outcome-badge.accurate {
  background: #2978a8;
}

.outcome-badge.overtriage,
.outcome-badge.undertriage {
  background: var(--red-tag);
}

.detail-topline {
  margin-bottom: 8px;
}

.detail-bottom-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 32%) minmax(0, 1fr);
  gap: 18px;
}

.detail-figure-card,
.detail-content-card {
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 3px 10px rgba(24, 40, 87, 0.09);
}

.detail-figure-card {
  display: flex;
  min-height: 380px;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.detail-figure-card img {
  max-width: 100%;
  max-height: 480px;
  object-fit: contain;
}

.detail-content-card {
  padding: 18px;
}

.detail-section + .detail-section {
  margin-top: 18px;
}

.detail-section h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1rem;
}

.detail-section p {
  margin: 0;
  color: #43506b;
  font-size: 0.93rem;
  line-height: 1.5;
}

.triage-outcome-lines {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
}

.rationale-box,
.feedback-box {
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 11px 12px;
  background: #edf6ff;
}

.feedback-box {
  border-left-color: var(--amber);
  background: #fff7e7;
}

.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

.compact-table th,
.compact-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #e5eaf2;
  text-align: left;
}

.compact-table th {
  color: var(--navy);
  background: #edf3fc;
}

.check {
  color: #167948;
  font-weight: 900;
}

.mobile-result-label {
  display: none;
}

@media (max-width: 900px) {
  .progress-chart-grid {
    grid-template-columns: 1fr;
  }

  .title-screen {
    padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }

  .title-card {
    text-align: center;
  }

  .title-copy {
    max-width: none;
  }

  .title-hero {
    justify-content: center;
    gap: 14px;
    text-align: left;
  }

  .title-copy h1 {
    flex: 0 1 auto;
    font-size: clamp(2.25rem, 8vw, 4.4rem);
  }

  .title-copy > p,
  .audio-note {
    margin-right: auto;
    margin-left: auto;
  }

  .title-hero-logo {
    width: clamp(82px, 20vw, 150px);
    height: clamp(82px, 20vw, 150px);
    max-height: 18vh;
  }

  .scenario-hero-card {
    grid-template-columns: 1fr;
  }

  .scenario-visual-panel {
    order: -1;
    min-height: 220px;
    max-height: 34vh;
  }

  .scenario-time-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .status-bar {
    gap: 6px;
  }

  .toolbar-button {
    min-height: 39px;
    padding: 8px 10px;
    font-size: 0.77rem;
  }

  .toolbar-icon {
    width: 19px;
    height: 19px;
  }

  .metric {
    min-width: 68px;
    padding: 6px 7px;
  }

  .metric-value {
    font-size: 0.93rem;
  }

  .control-grid {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }
}

@media (min-width: 701px) and (max-width: 900px) and (orientation: portrait) {
  .control-grid.has-result .panel-result.contextual {
    grid-column: 1 / -1;
  }

  .control-grid.has-result .panel-result.contextual::after {
    display: none;
  }

  .control-grid.has-result .control-button {
    grid-row: auto;
  }
}

@media (max-width: 700px) and (orientation: portrait) {
  .tag-confirmation-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .tag-confirmation-actions .primary-button,
  .tag-confirmation-actions .ghost-button {
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }

  .progress-screen {
    padding:
      max(18px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }

  .progress-topline,
  .progress-section-heading {
    display: block;
  }

  .progress-topline .ghost-button {
    width: 100%;
    margin-top: 14px;
  }

  .progress-preview-note {
    padding: 11px 12px;
    font-size: 0.86rem;
  }

  .progress-overview {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .progress-overview .performance-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .progress-overview .performance-value {
    margin-top: 0;
  }

  .progress-chart-card {
    padding: 14px 12px;
  }

  .progress-bar-row {
    grid-template-columns: 82px minmax(46px, 1fr) 43px;
    gap: 7px;
  }

  .progress-bar-label,
  .progress-bar-row > strong {
    font-size: 0.7rem;
  }

  .progress-section-heading p {
    margin-top: 4px;
  }

  .progress-game-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
    padding: 13px 11px;
  }

  .progress-game-number {
    width: 32px;
    height: 32px;
    font-size: 0.84rem;
  }

  .progress-game-heading {
    display: block;
  }

  .progress-status {
    margin-top: 8px;
  }

  .progress-game-metrics {
    grid-template-columns: 1fr 1fr;
  }

  .progress-game-metrics > div:last-child:nth-child(3) {
    grid-column: 1 / -1;
  }

  .progress-actions .primary-button,
  .progress-actions .secondary-button {
    flex: 1 1 140px;
  }

  .title-screen {
    justify-content: flex-start;
    overflow: auto;
  }

  .title-card {
    flex: 0 0 auto;
    margin: clamp(18px, 6vh, 54px) auto 0;
    padding-bottom: 16px;
  }

  .title-hero {
    gap: 10px;
  }

  .title-copy h1 {
    font-size: clamp(2.05rem, 8.8vw, 3.1rem);
  }

  .title-copy > p {
    font-size: 1rem;
  }

  .audio-note {
    align-items: center;
    padding: 10px 12px;
    text-align: left;
  }

  .audio-note {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .audio-note-icon-slot {
    width: 56px;
    height: 56px;
  }

  .title-hero-logo {
    width: clamp(72px, 22vw, 96px);
    height: clamp(72px, 22vw, 96px);
    max-height: 104px;
  }

  .title-footer {
    flex: 0 0 auto;
    margin-top: 12px;
    padding-top: 0;
  }

  .title-start-button {
    min-width: 128px;
    min-height: 52px;
    padding: 12px 22px;
  }

  .scenario-screen {
    padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .scenario-wrap {
    gap: 12px;
  }

  .scenario-copy,
  .scenario-card {
    padding: 16px;
  }

  .scenario-copy h1 {
    font-size: clamp(1.85rem, 8vw, 2.35rem);
  }

  .scenario-copy p,
  .scenario-card p,
  .scenario-card li {
    font-size: 0.98rem;
    line-height: 1.45;
  }

  .scenario-visual-panel {
    min-height: 180px;
    max-height: 28vh;
  }

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

  .intro-nav {
    padding: 12px;
  }

  .scenario-resource-button,
  .scenario-start-button {
    flex: 1 1 170px;
    justify-content: center;
  }

  .intro-nav .ghost-button,
  .intro-nav .primary-button,
  .intro-nav .scenario-start-button {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
  }

  .scenario-time-item {
    align-items: center;
    padding: 9px 10px;
  }

  .scenario-time-item img {
    width: 30px;
    height: 30px;
  }

  .practice-actions .ghost-button,
  .practice-actions .primary-button {
    flex: 1 1 0;
    min-width: 0;
  }

  .app-shell {
    overflow: hidden;
  }

  .toolbar {
    position: sticky;
    top: 0;
    min-height: auto;
    padding-top: max(6px, env(safe-area-inset-top));
    padding-bottom: 6px;
  }

  .toolbar-group,
  .patient-toolbar-center,
  .patient-panel-actions {
    gap: 5px;
  }

  .patient-toolbar {
    display: grid;
    grid-template-areas:
      "resources title metrics"
      "panels panels panels";
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 6px;
    row-gap: 5px;
  }

  .patient-toolbar > .toolbar-group {
    grid-area: resources;
  }

  .patient-toolbar > .patient-toolbar-center {
    display: contents;
  }

  .patient-toolbar .patient-title {
    grid-area: title;
    justify-self: center;
  }

  .patient-toolbar .patient-panel-actions {
    grid-area: panels;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: center;
  }

  .patient-toolbar > .toolbar-metrics {
    grid-area: metrics;
    margin-left: 0;
  }

  .toolbar .resource-label,
  .toolbar .action-label {
    display: none;
  }

  .toolbar-button {
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
  }

  .scene-switch-button {
    min-width: 72px;
    padding-inline: 9px;
  }

  .scene-toolbar .toolbar-button,
  .patient-toolbar > .toolbar-group .toolbar-button {
    min-width: 50px;
    min-height: 50px;
    padding: 9px;
  }

  .toolbar-icon.utility-icon {
    width: 32px;
    height: 32px;
  }

  .toolbar-icon.utility-icon {
    clip-path: inset(1px round 7px);
  }

  .toolbar-metrics {
    margin-left: auto;
    gap: 5px;
  }

  .metric {
    min-width: 60px;
    padding: 5px 6px;
  }

  .metric-label {
    font-size: 0.54rem;
  }

  .metric-value {
    font-size: 0.84rem;
  }

  .scene-area {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .scene-frame,
  .patient-stage-stack {
    width: 100%;
  }

  .scene-patient,
  .scene-patient:hover,
  .scene-patient:focus-visible {
    --position-scale: 1;
  }

  .patient-workspace {
    display: flex;
    overflow: hidden;
  }

  .patient-stage-stack {
    align-self: stretch;
  }

  .patient-stage-stack.panel-open {
    min-height: 0;
    align-self: stretch;
  }

  .control-host {
    position: absolute;
    background: transparent;
  }

  .control-panel {
    border-top: 0;
    border-bottom: 3px solid var(--amber);
    padding: 7px 8px 9px;
  }

  .panel-result {
    min-height: 25px;
    margin: 5px 0;
    padding: 4px 7px;
    font-size: 0.84rem;
  }

  .control-grid.has-result .panel-result.contextual {
    grid-column: 1 / -1;
  }

  .control-grid.has-result .panel-result.contextual::after {
    display: none;
  }

  .control-grid.has-result .control-button {
    grid-row: auto;
  }

  .control-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .control-button {
    min-height: 86px;
    gap: 3px;
    padding: 4px 3px;
  }

  .control-icon {
    width: 37px;
    height: 37px;
  }

  .control-label {
    font-size: 0.63rem;
  }

  .tag-card {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .status-bar {
    position: sticky;
    bottom: 0;
    min-height: auto;
    gap: 5px;
    padding-top: 6px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    font-size: 0.72rem;
  }

  .status-bar .primary-button,
  .status-bar .secondary-button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 0.77rem;
  }

  .scene-status-bar .status-leading,
  .scene-status-bar .status-actions {
    flex: 1 1 100%;
  }

  .scene-status-bar .status-actions {
    justify-content: space-between;
  }

  .patient-title {
    max-width: 92px;
    font-size: 0.79rem;
  }

  .speech-bubble {
    min-width: 74px;
    padding: 5px 23px 5px 7px;
    font-size: 10px;
  }

  .speech-bubble .bubble-close {
    top: 50%;
    right: 2px;
    width: 18px;
    height: 18px;
    min-width: 18px;
    min-height: 18px;
    transform: translateY(-50%);
  }

  .patient-figure {
    --position-scale: 1.3;
  }


  .wound-box {
    width: min(160px, calc(100% - 12px));
    max-width: calc(100% - 12px);
    padding: 4px;
    font-size: 10px;
  }

  .vital-note {
    max-width: 42cqw;
    font-size: clamp(9px, 1.25cqw, 13px);
  }

  .toast {
    right: 10px;
    bottom: 62px;
  }

  .performance-grid {
    gap: 7px;
  }

  .performance-card {
    padding: 10px;
  }

  .performance-label {
    font-size: 0.64rem;
  }

  .performance-value {
    font-size: 1.17rem;
  }

  .results-table thead {
    display: none;
  }

  .results-table,
  .results-table tbody,
  .results-table tr,
  .results-table td {
    display: block;
    width: 100%;
  }

  .results-row {
    position: relative;
    padding: 9px 82px 9px 10px;
    border-bottom: 1px solid #e5eaf2;
  }

  .results-table td {
    border: 0;
    padding: 4px 0;
  }

  .results-table td:first-child {
    position: absolute;
    top: 16px;
    right: 14px;
    width: 54px;
  }

  .mobile-result-label {
    display: inline;
    color: var(--muted);
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .detail-grid {
    display: block;
  }

  .detail-figure-card {
    min-height: 220px;
    margin-bottom: 12px;
  }

  .detail-figure-card img {
    max-height: 280px;
  }
}

@media (max-width: 365px) and (orientation: portrait) {
  .patient-toolbar {
    grid-template-areas:
      "resources . metrics"
      "panels panels panels";
  }

  .patient-toolbar .patient-title {
    display: none;
  }
}

@media (max-height: 510px) and (orientation: landscape) {
  .toolbar {
    min-height: 48px;
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  .toolbar-button {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.69rem;
  }

  .toolbar-icon {
    width: 17px;
    height: 17px;
  }

  .metric {
    min-width: 58px;
    padding: 4px 6px;
  }

  .metric-label {
    font-size: 0.51rem;
  }

  .metric-value {
    font-size: 0.82rem;
  }

  .status-bar {
    min-height: 40px;
    padding-top: 4px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    font-size: 0.72rem;
  }

  .status-bar .primary-button,
  .status-bar .secondary-button {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 0.72rem;
  }

  .control-panel {
    padding: 5px 7px 7px;
  }

  .control-panel-header h2 {
    font-size: 0.84rem;
  }

  .panel-result {
    min-height: 18px;
    margin: 4px 0;
    padding: 3px 6px;
    font-size: 0.78rem;
  }

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

  .control-button {
    min-height: 63px;
    gap: 2px;
    padding: 3px 2px;
  }

  .control-icon {
    width: 30px;
    height: 30px;
  }

  .control-label {
    font-size: 0.56rem;
  }

  .tag-card {
    margin-top: 7px;
    padding: 9px;
  }

  .tag-card p {
    margin: 4px 0 7px;
    font-size: 0.7rem;
  }

  .tag-option {
    min-height: 48px;
    padding: 5px 3px;
    font-size: 0.73rem;
  }
}
