:root {
  color-scheme: light;
  --ink: #25314b;
  --blue: #536daa;
  --blue-dark: #3f578f;
  --blue-soft: #e8edf8;
  --paper: #f6f3f0;
  --surface: #fffdfb;
  --rose: #f6d2d1;
  --rose-strong: #edb8b6;
  --line: #ddd8d2;
  --muted: #6e7582;
  --shadow: 0 12px 30px rgba(49, 52, 70, 0.09);
  --radius: 20px;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: #e8e5e2;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.8), transparent 32rem),
    #e8e5e2;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible + label,
summary:focus-visible {
  outline: 3px solid rgba(83, 109, 170, 0.42);
  outline-offset: 3px;
}

.app-frame {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 60px rgba(45, 45, 60, 0.12);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  padding: max(14px, env(safe-area-inset-top)) 20px 0;
  background: rgba(246, 243, 240, 0.94);
  backdrop-filter: blur(14px);
}

.header-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  min-height: 42px;
}

.brand {
  display: flex;
  grid-column: 2;
  align-items: center;
  gap: 8px;
  justify-self: start;
  color: var(--blue-dark);
  font-size: 0.77rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-mark {
  width: 11px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.step-label {
  grid-column: 3;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.icon-button {
  display: inline-grid;
  grid-column: 1;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.icon-button:hover {
  background: var(--blue-soft);
}

.icon-button svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.progress-track {
  width: 100%;
  height: 3px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3ded9;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 260ms ease;
}

#app:focus {
  outline: none;
}

.wizard-view {
  display: flex;
  min-height: calc(100dvh - 67px);
  flex-direction: column;
  padding: 42px 20px max(24px, env(safe-area-inset-bottom));
}

.question-copy {
  padding: 0 8px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

.question-copy h1 {
  max-width: 390px;
  margin: 0 auto;
  color: var(--blue-dark);
  font-size: clamp(1.65rem, 7vw, 2.15rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.helper-text {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.choice-list {
  display: grid;
  gap: 12px;
  width: 100%;
  min-width: 0;
  margin: 38px 0 32px;
  padding: 0;
  border: 0;
}

.choice-list--compact {
  gap: 10px;
}

.choice-item {
  min-width: 0;
}

.choice-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.choice-card {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 18px 20px;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--rose);
  box-shadow: 0 5px 12px rgba(79, 70, 70, 0.08);
  color: var(--blue-dark);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.choice-card:hover {
  border-color: rgba(83, 109, 170, 0.26);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(79, 70, 70, 0.11);
}

.choice-card strong {
  display: block;
  font-size: 1.18rem;
  line-height: 1.22;
}

.choice-card small {
  display: block;
  margin-top: 5px;
  color: #656c7c;
  font-size: 0.78rem;
  font-weight: 550;
}

.choice-indicator {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(63, 87, 143, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.35);
  place-items: center;
}

input[type="radio"] + .choice-card .choice-indicator {
  border-radius: 50%;
}

.choice-indicator svg {
  width: 19px;
  fill: none;
  stroke: white;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.choice-input:checked + .choice-card {
  border-color: var(--blue);
  background: #f2c2c0;
  box-shadow: 0 8px 18px rgba(63, 87, 143, 0.14);
}

.choice-input:checked + .choice-card .choice-indicator {
  border-color: var(--blue);
  background: var(--blue);
}

.choice-input:checked + .choice-card .choice-indicator svg {
  opacity: 1;
  transform: scale(1);
}

.action-bar {
  position: sticky;
  bottom: 0;
  margin: auto -4px -4px;
  padding-top: 12px;
  background: linear-gradient(to bottom, transparent, var(--paper) 20%);
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 52px;
  border-radius: 14px;
  font-weight: 750;
  cursor: pointer;
}

.primary-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border: 0;
  background: var(--blue);
  box-shadow: 0 9px 20px rgba(63, 87, 143, 0.23);
  color: white;
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
}

.primary-button:disabled {
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.42;
}

.primary-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.result-view {
  padding: 30px 20px max(36px, env(safe-area-inset-bottom));
}

.result-hero {
  padding: 27px 22px 22px;
  border-radius: 24px;
  background: var(--blue);
  box-shadow: var(--shadow);
  color: white;
  text-align: center;
}

.result-hero .eyebrow {
  margin-bottom: 8px;
  color: #dce4fb;
}

.result-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  place-items: center;
}

.result-icon svg {
  width: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.result-hero h1 {
  margin: 0;
  font-size: 1.85rem;
  line-height: 1.15;
}

.result-hero > p:not(.eyebrow) {
  margin: 12px auto 20px;
  color: #edf1fc;
  font-size: 0.9rem;
  line-height: 1.5;
}

.result-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.18);
}

.result-facts span {
  padding: 11px 6px;
  background: rgba(34, 51, 91, 0.22);
  font-size: 0.68rem;
}

.result-facts strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1.05rem;
}

.cluster-section {
  margin-top: 38px;
}

.cluster-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.cluster-kicker {
  margin: 0 0 3px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cluster-heading h2 {
  margin: 0;
  color: var(--blue-dark);
  font-size: 1.55rem;
  letter-spacing: -0.02em;
}

.cluster-time {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 99px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 0.77rem;
  font-weight: 750;
}

.cluster-description {
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.station-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  padding: 17px 16px;
  border: 1px solid #e4ded9;
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(44, 48, 64, 0.055);
}

.station-number {
  display: grid;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rose);
  color: var(--blue-dark);
  font-size: 0.82rem;
  font-weight: 800;
  place-items: center;
}

.station-copy {
  min-width: 0;
}

.station-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.station-title-row h3 {
  margin: 2px 0 0;
  color: var(--blue-dark);
  font-size: 1rem;
  line-height: 1.3;
}

.station-title-row > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.station-copy > p {
  margin: 7px 0 10px;
  color: #5f6673;
  font-size: 0.82rem;
  line-height: 1.5;
}

.reason-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reason-list span {
  padding: 4px 7px;
  border-radius: 6px;
  background: #f5e7e6;
  color: #6c5158;
  font-size: 0.66rem;
  font-weight: 700;
}

.matching-details {
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
}

.matching-details summary {
  padding: 16px;
  color: var(--blue-dark);
  font-size: 0.86rem;
  font-weight: 750;
  cursor: pointer;
}

.details-content {
  padding: 0 16px 16px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.details-content p {
  margin: 0 0 12px;
}

.details-content ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.details-content li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.details-content li span:first-child {
  color: var(--ink);
  font-weight: 700;
}

.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.secondary-button {
  padding: 12px 18px;
  border: 2px solid var(--blue);
  background: transparent;
  color: var(--blue-dark);
}

.secondary-button:hover {
  background: var(--blue-soft);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
}

.text-button:hover {
  text-decoration: underline;
}

.empty-result,
.status-view {
  padding: 70px 28px;
  text-align: center;
}

.status-view {
  display: grid;
  min-height: 70dvh;
  align-content: center;
  justify-items: center;
  color: var(--muted);
}

.status-view h1,
.empty-result h2 {
  color: var(--blue-dark);
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.error-icon {
  display: grid;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--rose);
  color: #8a4646;
  font-size: 1.5rem;
  font-weight: 800;
  place-items: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (min-width: 600px) {
  body {
    padding: 24px 0;
  }

  .app-frame {
    min-height: calc(100dvh - 48px);
    overflow: hidden;
    border-radius: 30px;
  }

  .wizard-view {
    min-height: calc(100dvh - 115px);
  }
}

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