:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #111416;
  color: #edf2f2;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef1ef;
  opacity: 1;
  visibility: visible;
  transition: opacity 520ms ease, visibility 520ms ease;
}

body.simulation-entered .intro-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f4f5f3;
}

.intro-shade {
  position: absolute;
  inset: 0;
  background: rgba(13, 21, 23, 0.14);
}

.intro-content {
  position: absolute;
  right: 24px;
  bottom: 24px;
  left: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f7fbfa;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
}

.intro-kicker {
  margin: 0 0 7px;
  color: #c7e8e1;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-content h1 {
  margin: 0 0 18px;
  font-size: clamp(27px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.simulate-button {
  width: min(280px, 72vw);
  height: 52px;
  border-color: rgba(255, 255, 255, 0.5);
  background: #e8f6f2;
  color: #15332d;
  font-size: 16px;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
}

.veteran-speech {
  position: fixed;
  z-index: 6;
  width: max-content;
  max-width: min(330px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid rgba(29, 48, 50, 0.22);
  border-radius: 8px;
  background: rgba(242, 249, 247, 0.96);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.24);
  color: #172426;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.4;
  text-align: center;
  transform: translate(-50%, calc(-100% - 16px));
  transition: opacity 160ms ease, transform 160ms ease;
}

.veteran-speech::after {
  position: absolute;
  bottom: -8px;
  left: 50%;
  width: 16px;
  height: 16px;
  background: rgba(242, 249, 247, 0.96);
  content: "";
  transform: translateX(-50%) rotate(45deg);
}

.veteran-speech[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
}

.hud {
  position: fixed;
  z-index: 5;
  border: 1px solid rgba(240, 246, 246, 0.16);
  background: rgba(16, 22, 24, 0.72);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.hud-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 7;
  width: 46px;
  min-width: 46px;
  height: 46px;
  border-color: rgba(240, 246, 246, 0.2);
  background: rgba(16, 22, 24, 0.82);
  color: #edf5f4;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(14px);
  transition: background 160ms ease, opacity 180ms ease;
}

body.simulation-entered .hud-toggle {
  opacity: 1;
  pointer-events: auto;
}

.hud-toggle:hover {
  background: rgba(39, 51, 54, 0.96);
}

#hudToggleSymbol {
  display: block;
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}

body.hud-minimized .hud {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.hud-top {
  top: 18px;
  left: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.hud-top > div {
  min-width: 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.035);
}

.command-panel {
  top: 94px;
  left: 18px;
  width: 374px;
  padding: 11px;
  border-radius: 8px;
}

.command-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}

.command-actions button {
  height: 38px;
  min-width: 0;
  padding: 0 7px;
  font-size: 12px;
}

.command-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.simulation-start-panel {
  bottom: 18px;
  left: 50%;
  padding: 7px;
  border-color: rgba(132, 226, 207, 0.48);
  border-radius: 8px;
  background: rgba(14, 27, 29, 0.9);
  transform: translateX(-50%);
}

.simulation-start-panel button {
  width: 244px;
  height: 54px;
  border-color: #7ce3d2;
  background: #dff8f2;
  color: #123b34;
  font-size: 16px;
  box-shadow: 0 0 0 1px rgba(124, 227, 210, 0.16), 0 10px 30px rgba(0, 0, 0, 0.28);
}

.simulation-start-panel button:hover {
  background: #f2fffc;
}

.simulation-start-panel button:disabled {
  cursor: default;
  opacity: 0.45;
}

.simulation-choice-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  display: none;
  width: min(430px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid rgba(132, 226, 207, 0.5);
  border-radius: 8px;
  background: rgba(14, 27, 29, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.simulation-choice-panel p {
  margin: 0 0 10px;
  color: #d9e8e5;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

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

.simulation-choice-actions button {
  min-width: 0;
  height: 52px;
  border-color: #7ce3d2;
  background: #dff8f2;
  color: #123b34;
  font-size: 16px;
}

.simulation-choice-actions button:hover {
  background: #f2fffc;
}

body.simulation-choice-active .simulation-choice-panel {
  display: block;
}

body.simulation-choice-active .hud-toggle,
body.simulation-choice-active .hud-top,
body.simulation-choice-active .command-panel,
body.simulation-choice-active .simulation-start-panel,
body.simulation-choice-active .scenario-panel,
body.simulation-choice-active .battery-hud,
body.simulation-choice-active .quick-change-panel,
body.simulation-choice-active .controls,
body.simulation-choice-active .hint {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.story-action-panel {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 10;
  display: none;
  width: min(360px, calc(100vw - 32px));
  padding: 8px;
  border: 1px solid rgba(132, 226, 207, 0.5);
  border-radius: 8px;
  background: rgba(14, 27, 29, 0.94);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.38);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.story-action-panel button {
  width: 100%;
  height: 54px;
  border-color: #7ce3d2;
  background: #dff8f2;
  color: #123b34;
  font-size: 16px;
}

.story-action-panel button:hover {
  background: #f2fffc;
}

body.story-action-active .story-action-panel {
  display: block;
}

body.story-mode-active .hud-toggle,
body.story-mode-active .hud-top,
body.story-mode-active .command-panel,
body.story-mode-active .simulation-start-panel,
body.story-mode-active .scenario-panel,
body.story-mode-active .battery-hud,
body.story-mode-active .quick-change-panel,
body.story-mode-active .controls,
body.story-mode-active .hint {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.end-credits {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #101719;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 420ms ease, visibility 420ms ease;
}

.end-credits[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.end-credits-content {
  width: min(560px, 100%);
  text-align: center;
}

.end-credits-kicker {
  margin: 0 0 8px;
  color: #83ddcd;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.end-credits h2 {
  margin: 0;
  color: #f3f8f7;
  font-size: clamp(32px, 7vw, 58px);
  line-height: 1.05;
}

.end-credits-content > p:not(.end-credits-kicker) {
  max-width: 470px;
  margin: 18px auto 0;
  color: #bed0ce;
  line-height: 1.55;
}

.end-credits-summary {
  display: grid;
  gap: 8px;
  margin: 28px 0;
  color: #e5efed;
  font-size: 14px;
}

.end-credits-summary span {
  padding: 10px;
  border-top: 1px solid rgba(213, 238, 233, 0.12);
}

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

.end-credits-actions button {
  min-width: 0;
  height: 50px;
}

.scenario-panel {
  top: 178px;
  left: 18px;
  width: 374px;
  padding: 11px;
  border-radius: 8px;
}

.patient-info-card {
  top: 94px;
  left: 18px;
  display: none;
  width: 374px;
  padding: 13px;
  border-color: rgba(132, 226, 207, 0.32);
  border-radius: 8px;
}

body.patient-profile-active .command-panel,
body.patient-profile-active .scenario-panel {
  display: none;
}

body.patient-profile-active .patient-info-card {
  display: block;
  z-index: 7;
}

.patient-info-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.patient-risk-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(123, 219, 179, 0.5);
  border-radius: 6px;
  background: rgba(93, 181, 143, 0.16);
  color: #baf0d6;
  font-size: 11px;
  font-weight: 750;
}

.patient-risk-badge[data-risk="medium"] {
  border-color: rgba(242, 190, 91, 0.52);
  background: rgba(216, 153, 48, 0.17);
  color: #ffe0a3;
}

.patient-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 0;
}

.patient-details > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(224, 238, 237, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.patient-details .patient-disability {
  grid-column: 1 / -1;
}

.patient-details dt {
  color: #93a5a6;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.patient-details dd {
  margin: 3px 0 0;
  color: #f1f7f6;
  font-size: 13px;
  line-height: 1.35;
}

.scenario-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 10px;
}

.scenario-actions button {
  height: 36px;
  min-width: 0;
  padding: 0 8px;
  font-size: 12px;
}

.scenario-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

#scenarioStatus {
  color: #c9d7d6;
  font-size: 12px;
}

.label {
  margin: 0 0 3px;
  color: #a9b6b8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

strong {
  display: block;
  overflow: hidden;
  color: #f6fbfb;
  font-size: 15px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battery-hud {
  top: 18px;
  right: 72px;
  display: flex;
  width: 208px;
  height: 64px;
  align-items: center;
  overflow: hidden;
  padding: 8px;
  border-radius: 8px;
  transition: width 180ms ease;
}

.battery-hud.is-collapsed {
  width: 60px;
}

.quick-change-panel {
  top: 94px;
  right: 18px;
  width: 208px;
  padding: 10px;
  border-radius: 8px;
}

.quick-change-panel button {
  width: 100%;
  min-width: 0;
  height: 42px;
  margin-top: 5px;
  padding: 0 10px;
  font-size: 12px;
}

.quick-change-panel button:disabled {
  cursor: default;
  opacity: 0.45;
}

.battery-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #eef5f4;
}

.battery-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
}

.battery-symbol {
  position: relative;
  display: block;
  width: 24px;
  height: 13px;
  margin: 0 auto;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.battery-symbol::after {
  position: absolute;
  top: 2px;
  right: -5px;
  width: 3px;
  height: 5px;
  border-radius: 0 2px 2px 0;
  background: currentColor;
  content: "";
}

#batteryIconFill {
  position: absolute;
  inset: 2px;
  right: auto;
  width: calc((100% - 4px) * var(--battery-level, 1));
  background: #72d6a1;
  transition: width 240ms ease, background 240ms ease;
}

.battery-details {
  display: grid;
  width: 140px;
  min-width: 140px;
  margin-left: 10px;
  gap: 7px;
  opacity: 1;
  transition: opacity 120ms ease;
}

.battery-hud.is-collapsed .battery-details {
  opacity: 0;
  pointer-events: none;
}

.battery-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.battery-copy .label {
  margin: 0;
}

.battery-copy strong {
  font-size: 14px;
}

.battery-meter {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}

#batteryFill {
  display: block;
  width: 100%;
  height: 100%;
  background: #72d6a1;
  transition: width 240ms ease, background 240ms ease;
}

.battery-hud[data-level="medium"] #batteryFill,
.battery-hud[data-level="medium"] #batteryIconFill {
  background: #e4bf63;
}

.battery-hud[data-level="low"] #batteryFill,
.battery-hud[data-level="low"] #batteryIconFill {
  background: #e66f68;
}

.controls {
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
}

#chargeButton.is-charging {
  border-color: #7ce3d2;
  background: #dff8f2;
  color: #173c35;
}

#chargeButton.is-charging:disabled {
  opacity: 1;
}

button {
  min-width: 92px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: #e8f0ef;
  color: #172124;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
}

button:hover {
  background: #ffffff;
}

button:active {
  transform: translateY(1px);
}

.hint {
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(520px, calc(100vw - 36px));
  padding: 10px 12px;
  border-radius: 8px;
  color: #d8e2e2;
  font-size: 13px;
}

.hint span {
  white-space: nowrap;
}

@media (max-width: 760px) {
  body.story-bathroom-view .patient-info-card {
    display: none;
  }

  .hud-top {
    right: 64px;
    left: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls {
    right: 12px;
    bottom: 12px;
  }

  .battery-hud {
    top: 94px;
    right: 12px;
  }

  .hud-toggle {
    top: 18px;
    right: 12px;
  }

  .quick-change-panel {
    top: 94px;
    right: auto;
    left: 12px;
    width: 146px;
  }

  .scenario-panel {
    top: 251px;
    left: 12px;
    width: min(366px, calc(100vw - 24px));
  }

  .command-panel {
    top: 166px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .patient-info-card {
    top: 166px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .simulation-start-panel {
    bottom: 176px;
  }

  .simulation-start-panel button {
    width: 210px;
  }

  .simulation-choice-panel {
    bottom: 20px;
  }

  .story-action-panel {
    bottom: 20px;
  }

  .scenario-actions {
    gap: 5px;
  }

  .scenario-actions button {
    height: 34px;
    font-size: 11px;
  }

  .command-actions button {
    font-size: 11px;
  }

  .hint {
    right: 12px;
    bottom: 72px;
    left: 12px;
  }

  button {
    min-width: 80px;
  }
}

@media (max-width: 480px) {
  .intro-content {
    bottom: 18px;
  }

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

  .scenario-panel {
    width: 244px;
  }

  .simulate-button {
    width: min(280px, 82vw);
  }
}
