:root {
  --bg: #05070d;
  --surface: rgba(12, 16, 26, 0.86);
  --surface-solid: #0c101a;
  --surface-alt: rgba(22, 30, 45, 0.88);
  --surface-hover: rgba(32, 42, 59, 0.9);
  --ink: #f4f7fb;
  --muted: #aab4c4;
  --line: rgba(255, 255, 255, 0.12);
  --strong: #ffb45f;
  --strong-2: #9bd7ff;
  --danger: #ff7a68;
  --danger-bg: rgba(255, 122, 104, 0.13);
  --danger-line: rgba(255, 122, 104, 0.42);
  --warning: #ffd08a;
  --warning-bg: rgba(255, 180, 95, 0.12);
  --ok: #8ee0b3;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(255, 180, 95, 0.28);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 92px;
  background:
    linear-gradient(180deg, #02040a 0%, #050b16 46%, #080b14 72%, #130b10 88%, #24110d 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before,
body::after {
  position: fixed;
  right: 0;
  left: 0;
  z-index: 0;
  content: "";
  pointer-events: none;
}

body::before {
  bottom: -22vh;
  height: 42vh;
  background:
    radial-gradient(ellipse at 50% 74%, rgba(255, 218, 150, 0.7) 0 9%, rgba(255, 150, 84, 0.28) 10% 24%, transparent 38%),
    radial-gradient(ellipse at 50% 92%, rgba(255, 169, 90, 0.2) 0 18%, transparent 54%),
    linear-gradient(180deg, transparent 0 62%, rgba(255, 178, 95, 0.14) 67%, rgba(255, 135, 78, 0.07) 76%, transparent 88%),
    linear-gradient(180deg, transparent 0%, rgba(6, 8, 15, 0.58) 74%, rgba(5, 7, 13, 0.92) 100%);
  filter: blur(38px);
  transform: perspective(900px) rotateX(64deg) translateY(22%) scale(1.55);
  transform-origin: 50% 100%;
}

body::after {
  top: clamp(120px, 19vh, 210px);
  left: 50%;
  width: clamp(300px, 52vw, 560px);
  height: clamp(300px, 52vw, 560px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 29% 26%, rgba(255, 255, 255, 0.18) 0 6%, transparent 7%),
    radial-gradient(ellipse at 35% 40%, rgba(156, 215, 255, 0.34) 0 16%, transparent 32%),
    radial-gradient(ellipse at 62% 61%, rgba(96, 142, 114, 0.28) 0 14%, transparent 30%),
    radial-gradient(ellipse at 49% 50%, rgba(33, 91, 139, 0.46) 0 44%, rgba(8, 23, 45, 0.94) 70%, rgba(2, 4, 10, 0.98) 100%),
    conic-gradient(from 20deg, rgba(28, 83, 132, 0.9), rgba(65, 116, 96, 0.58), rgba(18, 51, 98, 0.9), rgba(116, 137, 116, 0.44), rgba(28, 83, 132, 0.9));
  background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
  background-size: 100% 100%, 130% 92%, 125% 110%, 100% 100%, 185% 100%;
  box-shadow:
    inset -42px -28px 78px rgba(0, 0, 0, 0.78),
    inset 24px 18px 54px rgba(143, 205, 255, 0.11),
    0 0 120px rgba(63, 122, 174, 0.16);
  filter: blur(13px) saturate(0.8) brightness(0.72);
  opacity: 0.34;
  transform: translateX(-50%) rotate(-8deg);
  animation: earth-turn 220s linear infinite;
}

@keyframes earth-turn {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
    transform: translateX(-50%) rotate(-8deg);
  }

  50% {
    background-position: 0 0, 34% 0, -28% 0, 0 0, 54% 0;
    transform: translateX(-50%) rotate(1deg);
  }

  100% {
    background-position: 0 0, 68% 0, -56% 0, 0 0, 108% 0;
    transform: translateX(-50%) rotate(10deg);
  }
}

body > * {
  position: relative;
  z-index: 1;
}

a {
  color: var(--strong-2);
}

a.brand {
  color: inherit;
  text-decoration: none;
}

button,
input,
a.button {
  font: inherit;
}

button,
a.button {
  min-height: 44px;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  transform: translateY(-140%);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  text-decoration: none;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(5, 7, 13, 0.54);
  padding: 12px clamp(16px, 4vw, 40px);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--strong);
}

.brand-mark svg {
  width: 28px;
  height: 28px;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1rem;
  font-weight: 760;
}

.brand small {
  color: var(--muted);
  font-size: 0.82rem;
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 24px auto 34px;
}

.screen {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 680px) minmax(220px, 280px);
  justify-content: center;
  gap: clamp(16px, 2vw, 20px);
  align-items: start;
}

.screen::before {
  grid-column: 1;
  content: "";
}

.screen-main,
.side-panel,
.noscript {
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.screen-main {
  grid-column: 2;
  display: flex;
  min-height: clamp(540px, calc(100vh - 190px), 720px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(24px, 5vh, 48px) clamp(20px, 4vw, 34px) clamp(58px, 11vh, 112px);
  text-align: center;
}

.screen-main > * {
  width: min(100%, 600px);
}

.side-panel {
  grid-column: 3;
  padding: 18px 0;
}

.emergency-rail {
  position: sticky;
  top: 96px;
  margin-top: clamp(58px, 13vh, 118px);
  box-shadow: none;
  opacity: 0.88;
}

.emergency-rail p {
  max-width: 24ch;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--strong);
  font-size: 0.82rem;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.16;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.5rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.45rem, 3.8vw, 2.35rem);
  max-width: 22ch;
  margin-inline: auto;
}

h3 {
  font-size: 1.05rem;
}

.lead {
  max-width: 680px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.1rem);
}

.intro-band {
  margin: 0 0 28px;
  padding-bottom: 24px;
}

.context-actions,
.choice-grid,
.scenario-grid,
.button-row,
.resource-grid {
  display: grid;
  gap: 12px;
}

.context-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 28px;
}

.scenario-grid {
  grid-template-columns: 1fr;
  margin-top: 22px;
}

.choice-grid {
  grid-template-columns: 1fr;
  margin-top: 22px;
}

.button-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-grid {
  grid-template-columns: 1fr;
}

.choice-card,
.scenario-card,
.button,
.primary,
.secondary,
.ghost,
.danger,
.danger-soft,
.quick-exit,
.link-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
}

.choice-card,
.scenario-card {
  justify-content: center;
  min-height: 64px;
  border: 1px solid var(--line);
  background: rgba(12, 16, 26, 0.36);
  color: var(--ink);
  padding: 15px 18px;
  text-align: center;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.choice-card:hover,
.scenario-card:hover {
  border-color: rgba(255, 180, 95, 0.42);
  background: rgba(32, 42, 59, 0.46);
  transform: translateY(-1px);
}

.primary,
.secondary,
.ghost,
.danger,
.danger-soft,
.quick-exit,
.button {
  gap: 8px;
  padding: 11px 14px;
  font-weight: 740;
}

.primary {
  background: var(--strong);
  color: #16100a;
}

.secondary {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--strong-2);
}

.danger {
  background: var(--danger);
  color: #180806;
}

.danger-soft {
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.quick-exit {
  background: transparent;
  color: var(--ink);
}

.question-block {
  margin-top: 0;
}

.question-block p {
  margin: 0;
  font-weight: 740;
}

.answer-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 16, 26, 0.36);
  color: var(--ink);
  padding: 12px 16px;
  font-weight: 680;
  text-align: center;
}

.answer-button.is-selected {
  border-color: var(--strong);
  background: rgba(255, 180, 95, 0.12);
  color: var(--strong);
}

.answer-button.is-risk {
  border-color: var(--danger-line);
}

.callout {
  margin-top: 22px;
  background: transparent;
  padding: 16px;
}

.callout.danger-note {
  background: var(--danger-bg);
}

.callout.warning-note {
  border-color: rgba(255, 208, 138, 0.38);
  background: var(--warning-bg);
}

.callout p {
  margin: 0;
}

.callout p + p {
  margin-top: 8px;
}

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

.plan-actions {
  flex-direction: column;
  align-items: center;
  flex-wrap: nowrap;
}

.plan-actions .primary,
.plan-actions .secondary {
  width: min(100%, 430px);
}

.delayed-action {
  position: relative;
  min-height: 52px;
  line-height: 1.18;
}

.delayed-action:disabled {
  cursor: wait;
  opacity: 0.82;
}

.delay-loader {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
  transition: width 180ms ease, opacity 180ms ease;
}

.delay-loader svg {
  width: 20px;
  height: 20px;
  transform: rotate(-90deg);
}

.delay-loader circle {
  fill: none;
  stroke: currentColor;
  stroke-dasharray: 44;
  stroke-dashoffset: 0;
  stroke-linecap: round;
  stroke-width: 2.2;
  animation: delay-ring var(--delay-duration, 7000ms) linear forwards;
}

.delayed-action.is-ready .delay-loader {
  width: 0;
  opacity: 0;
}

.delay-label {
  overflow-wrap: anywhere;
}

.delayed-back {
  min-height: 40px;
  opacity: 0.86;
}

.delayed-back[hidden] {
  display: none;
}

@keyframes delay-ring {
  to {
    opacity: 0;
    stroke-dashoffset: 44;
  }
}

.single-step {
  margin-top: 24px;
}

.contact-panel,
.plan-section {
  margin-top: 22px;
  padding-top: 22px;
}

.contact-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.contact-panel input {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 1rem;
}

.contact-panel .button-row {
  margin-top: 12px;
}

.number-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.number-list.compact {
  margin-top: 0;
}

.number-link {
  display: block;
  padding: 6px 0;
  text-decoration: none;
}

.number-link.danger-note {
  background: transparent;
}

.emergency-rail .number-link {
  grid-template-columns: 1fr;
  gap: 4px;
}

.number-link strong {
  color: var(--danger);
  font-size: 1.08rem;
}

.number-link span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.32;
}

.full-width {
  width: 100%;
  margin-top: 14px;
}

.plan-header {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.plan-header h2 {
  max-width: 26ch;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  background: transparent;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 680;
}

.plan-step-card {
  margin-top: 22px;
}

.link-card {
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 96px;
  padding: 0;
  color: var(--ink);
  text-align: left;
}

.link-card strong,
.link-card span {
  display: block;
}

.link-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.side-panel h3 {
  margin-bottom: 10px;
}

.side-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-list li {
  padding-left: 10px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: var(--radius);
  background: #f4f7fb;
  color: #05070d;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.page-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  padding: 22px 16px 30px;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-footer p {
  flex-basis: 100%;
  margin: 0;
  text-align: center;
}

.ambient-control {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
}

.idle-overlay {
  position: fixed;
  inset: 0;
  z-index: 32;
  background: rgba(2, 4, 9, 0.58);
  backdrop-filter: blur(16px) brightness(0.68);
  pointer-events: none;
}

.idle-overlay[hidden] {
  display: none;
}

.idle-reassurance {
  position: fixed;
  top: 50%;
  right: 50%;
  z-index: 34;
  width: min(760px, calc(100% - 42px));
  transform: translate(50%, -50%);
  color: rgba(244, 247, 251, 0.78);
  font-size: clamp(1.45rem, 5vw, 3.8rem);
  font-weight: 720;
  line-height: 1.12;
  text-align: center;
  text-shadow: 0 12px 36px rgba(0, 0, 0, 0.58);
  pointer-events: none;
  opacity: 0;
}

.idle-reassurance[hidden] {
  display: none;
}

.idle-reassurance.is-animating {
  animation: reassurance-in 720ms ease-out forwards, reassurance-breathe 4.8s ease-in-out 720ms infinite;
}

@keyframes reassurance-in {
  from {
    opacity: 0;
    transform: translate(50%, calc(-50% + 16px)) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(50%, -50%) scale(1);
  }
}

@keyframes reassurance-breathe {
  0%,
  100% {
    transform: translate(50%, -50%) scale(1);
  }

  50% {
    transform: translate(50%, -50%) scale(1.025);
  }
}

.ambient-button {
  display: grid;
  width: 46px;
  height: 46px;
  min-height: 46px;
  place-items: center;
  background: transparent;
  color: var(--strong);
}

.ambient-button svg {
  width: 26px;
  height: 26px;
}

.ambient-button path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.noscript {
  width: min(760px, calc(100% - 32px));
  margin: 24px auto;
  padding: 24px;
}

.static-page {
  width: min(760px, calc(100% - 32px));
  margin: 48px auto 72px;
  padding: clamp(20px, 5vw, 36px);
}

.static-page h1 {
  max-width: 13ch;
}

.static-page h2 {
  margin-top: 34px;
  font-size: clamp(1.25rem, 3vw, 1.72rem);
}

.static-page p,
.static-page li {
  color: var(--muted);
}

.static-page ul {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding-left: 20px;
}

.static-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.emergency-static .number-list {
  margin-top: 16px;
}

.scenario-page {
  width: min(980px, calc(100% - 32px));
}

.scenario-page h1 {
  max-width: 14ch;
}

.scenario-library {
  display: grid;
  gap: 0;
  margin-top: 42px;
}

.scenario-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 220px);
  gap: clamp(18px, 4vw, 36px);
  align-items: center;
  border-top: 1px solid var(--line);
  padding: 28px 0;
}

.scenario-row:last-child {
  border-bottom: 1px solid var(--line);
}

.scenario-row h2 {
  margin-top: 0;
}

.scenario-points {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.scenario-points p {
  margin: 0;
}

.scenario-points strong {
  color: var(--ink);
  font-weight: 760;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .choice-card:hover,
  .scenario-card:hover {
    transform: none;
  }

  .idle-reassurance.is-animating {
    animation: none;
    opacity: 1;
    transform: translate(50%, -50%);
  }

  .delay-loader circle {
    animation: none !important;
    opacity: 0.78;
    stroke-dashoffset: 0;
  }
}

@media (max-width: 880px) {
  .topbar {
    align-items: flex-start;
  }

  .screen {
    grid-template-columns: 1fr;
  }

  .screen::before {
    display: none;
  }

  .screen-main,
  .side-panel {
    grid-column: 1;
  }

  .side-panel {
    box-shadow: none;
    padding: 12px 0;
  }

  .emergency-rail {
    position: static;
    margin-top: 12px;
    opacity: 1;
  }

  .screen-main {
    min-height: auto;
    padding-bottom: clamp(28px, 7vh, 64px);
  }

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

@media (max-width: 760px) {
  .scenario-row {
    grid-template-columns: 1fr;
  }

  .scenario-row .button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    position: static;
    flex-direction: column;
  }

  .top-actions,
  .context-actions,
  .choice-grid,
  .button-row {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .app-shell {
    width: min(100% - 20px, 1080px);
    margin-top: 12px;
  }

  .intro-band {
    display: block;
  }

  h1 {
    max-width: 12ch;
  }

  .number-link {
    grid-template-columns: 1fr;
  }

  .ambient-control {
    right: 12px;
    bottom: 12px;
  }

  .idle-reassurance {
    width: min(100% - 28px, 760px);
    text-align: center;
  }
}
