:root {
  --bg: #080d16;
  --bg-soft: #0d1422;
  --panel: rgba(17, 24, 39, 0.84);
  --panel-solid: #111827;
  --panel-border: rgba(148, 163, 184, 0.2);
  --text: #f8fafc;
  --muted: #9ca3af;
  --muted-strong: #cbd5e1;
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.15);
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --max-width: 1120px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.24), transparent 36rem),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.14), transparent 32rem),
    linear-gradient(180deg, #080d16 0%, #0b1020 50%, #080d16 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 70%);
}

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

button,
input {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100px;
  z-index: 100;
  padding: 0.7rem 1rem;
  color: var(--bg);
  background: var(--text);
  border-radius: 999px;
}

.skip-link:focus {
  top: 1rem;
}

.section-shell {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(8, 13, 22, 0.78);
  backdrop-filter: blur(18px);
}

.nav {
  width: min(var(--max-width), calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue), #22c55e);
  color: white;
  font-size: 0.9rem;
  box-shadow: 0 14px 30px rgba(59, 130, 246, 0.26);
}

.brand-text {
  font-size: 1.28rem;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

.nav-links a:hover,
.nav-links a:focus {
  color: var(--text);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  align-items: center;
  gap: 3rem;
  padding: 6rem 0 4.5rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: #93c5fd;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 1.2rem;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: -0.075em;
}

h2 {
  margin-bottom: 0.85rem;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

h3 {
  margin-bottom: 0.55rem;
  letter-spacing: -0.03em;
}

.hero-subtitle,
.section-heading p,
.split-section p,
.search-card p,
.empty-state p,
.feature-card p {
  color: var(--muted-strong);
  line-height: 1.68;
}

.hero-subtitle {
  max-width: 64ch;
  font-size: 1.16rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin: 1.8rem 0 1.05rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  padding: 0.84rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.button:hover,
.button:focus {
  transform: translateY(-1px);
}

.button.primary {
  color: white;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.28);
}

.button.secondary {
  color: var(--text);
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.16);
}

.button[disabled] {
  opacity: 0.7;
  cursor: wait;
}

.fine-print,
.field-group small {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-panel,
.search-card,
.feature-card,
.result-card,
.empty-state {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-panel {
  position: relative;
  overflow: hidden;
  padding: 1.4rem;
  border-radius: var(--radius-xl);
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: -30% -20% auto auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.28);
  filter: blur(30px);
}

.panel-topline,
.advanced-row,
.result-meta,
.provider-badge {
  display: flex;
  align-items: center;
}

.panel-topline {
  position: relative;
  gap: 0.5rem;
  color: var(--muted-strong);
  font-weight: 700;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.12);
}

.mini-route {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 2.25rem 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.route-line {
  flex: 1;
  height: 3px;
  min-width: 70px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.score-card {
  display: grid;
  gap: 0.4rem;
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.72);
}

.score-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.score-card strong {
  font-size: 1.5rem;
}

.score-pill {
  justify-self: start;
  padding: 0.35rem 0.58rem;
  border-radius: 999px;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
  font-size: 0.86rem;
  font-weight: 800;
}

.reason-list {
  padding-left: 1.1rem;
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.6;
}

.reason-list.compact {
  margin-top: 1rem;
}

.search-section {
  padding: 1.5rem 0 5rem;
}

.search-card {
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius-xl);
}

.compact-heading h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 1fr 1.25fr 0.9fr auto;
  gap: 1rem;
  align-items: end;
  margin-top: 1.4rem;
}

.field-group {
  display: grid;
  gap: 0.42rem;
}

.field-group label {
  color: var(--muted-strong);
  font-weight: 700;
  font-size: 0.93rem;
}

.field-group input {
  width: 100%;
  min-height: 52px;
  padding: 0 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.26);
  outline: none;
}

.field-group input:focus {
  border-color: rgba(96, 165, 250, 0.72);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.field-group select {
  width: 100%;
  min-height: 52px;
  padding: 0 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.26);
  outline: none;
}

.field-group select:focus {
  border-color: rgba(96, 165, 250, 0.72);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* "Do you already have a ticket?" — held-ticket capture below the search form */
.held-ticket { margin-top: 1.1rem; }
.held-toggle {
  display: inline-flex; align-items: center; gap: 0.55rem;
  color: var(--muted-strong); font-weight: 600; font-size: 0.95rem; cursor: pointer;
}
.held-toggle input { width: 1.05rem; height: 1.05rem; accent-color: var(--blue); }
.ticket-fields {
  display: grid; gap: 0.85rem;
  margin-top: 0.85rem; max-width: 420px;
}
/* `display: grid` above beats the UA [hidden]{display:none}; restore hiding so
   airline/bags stay hidden until "I already have a ticket" is checked. */
.ticket-fields[hidden] { display: none; }

/* Recovery-channel badge + bag note on each result card */
.channel-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; font-weight: 600; margin-top: 0.4rem;
  padding: 0.2rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--panel-border); color: var(--muted-strong);
}
.channel-badge.same { color: var(--green); border-color: rgba(34, 197, 94, 0.4); }
.channel-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bag-note { font-size: 0.82rem; color: var(--muted); margin-top: 0.4rem; }
.bag-note.recheck { color: var(--amber); }

/* Departure gate/terminal shown in the card header, under the flight title. */
.option-gate {
  margin-top: 0.25rem; font-size: 0.85rem; font-weight: 600;
  color: var(--muted-strong);
}

/* ---- Ticket-first flow (mobile-first) ------------------------------------ */
/* Make the hidden attribute win over any author display (grid/flex). */
[hidden] { display: none !important; }

.step-gate { text-align: center; }
.gate-buttons {
  display: grid; gap: 0.85rem; max-width: 420px; margin: 1.5rem auto 0;
}
.gate-buttons .button { width: 100%; min-height: 56px; font-size: 1.05rem; }

.back-link {
  background: none; border: 0; color: var(--muted-strong);
  font-size: 0.95rem; cursor: pointer; padding: 0.3rem 0; margin-bottom: 0.4rem;
}
.back-link:hover { color: var(--text); }

.ticket-form { display: grid; gap: 1rem; margin-top: 1.2rem; max-width: 480px; }
/* Search toggles sit on the second grid row of .search-form, each aligned
   under its own field: "depart nearby" under From, "land nearby" under To,
   "checked bags" under Date. They wrap within their column so a long label
   can't overlap the neighbouring toggle. */
.search-form .held-toggle {
  grid-row: 2; margin-top: 0.2rem;
  align-self: start; align-items: flex-start; flex-wrap: wrap;
}
.search-form .opt-depart { grid-column: 1; }
.search-form .opt-land   { grid-column: 2; }
.search-form .opt-bags   { grid-column: 3; }
.nearby-hint { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.ticket-form .submit-button { min-height: 54px; }

/* "Your flight" assessment card, shown before any alternatives */
.assessment-region { margin-top: 1.4rem; }
.assessment-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg); padding: 1.4rem; box-shadow: var(--shadow);
}
.assessment-card h3 { margin: 0.2rem 0 0.6rem; font-size: 1.25rem; line-height: 1.3; }
.assessment-status {
  display: inline-block; font-weight: 700; font-size: 1.02rem;
  padding: 0.25rem 0.7rem; border-radius: 999px; margin: 0 0 0.9rem;
}
.assessment-status.good { color: var(--green); background: rgba(34, 197, 94, 0.12); }
.assessment-status.warn { color: var(--amber); background: rgba(245, 158, 11, 0.12); }
.assessment-status.bad  { color: var(--red);   background: rgba(239, 68, 68, 0.12); }
.assessment-detail { display: grid; gap: 0.25rem; color: var(--muted-strong); font-size: 0.95rem; }
.aircraft-note {
  margin-top: 0.7rem; font-size: 0.9rem; font-weight: 600; color: var(--text);
  padding: 0.5rem 0.7rem; border-radius: 8px; background: rgba(96,165,250,0.10);
}
.assessment-card.notfound { text-align: center; }

.final-dest { margin-top: 1.3rem; display: grid; gap: 0.4rem; }
.final-dest label { font-weight: 700; color: var(--muted-strong); }
.final-dest input {
  width: 100%; max-width: 170px; min-height: 52px; padding: 0 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.22); border-radius: 12px;
  color: var(--text); background: rgba(0, 0, 0, 0.26); outline: none;
  text-transform: uppercase; font-size: 1.15rem; letter-spacing: 0.06em;
}
.final-dest small { color: var(--muted); font-size: 0.82rem; }
.final-bags-toggle { margin-top: 1rem; }
.assessment-card > .button { margin-top: 1.3rem; width: 100%; min-height: 54px; }

/* "Which leg?" chooser when a flight number flies several legs that day */
.leg-choices { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.9rem; }
.leg-choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.15rem;
  text-align: left; width: 100%; min-height: 54px;
}
.leg-choice .leg-route { font-weight: 700; }
.leg-choice .leg-when { font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.leg-choice.loading { opacity: 0.6; pointer-events: none; }

/* "Your ticketed flight" flag on the matching option in the list */
.ticketed-badge {
  display: inline-block; margin-top: 0.4rem;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 0.2rem 0.7rem; border-radius: 999px;
  color: var(--bg); background: var(--blue);
}

.submit-button {
  min-height: 52px;
  border-radius: 14px;
}

.button-spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

.is-loading .button-spinner {
  display: inline-block;
}

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

.advanced-row {
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
}

.text-button {
  padding: 0;
  border: 0;
  color: #93c5fd;
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.provider-badge {
  gap: 0.5rem;
  padding: 0.42rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255,255,255,0.04);
  font-size: 0.9rem;
}

.provider-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.advanced-fields {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.results-region {
  margin-top: 1.4rem;
}

.empty-state {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
}

.results-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 2rem 0 1rem;
}

.results-header p {
  color: var(--muted);
  margin-bottom: 0;
}

.results-list {
  display: grid;
  gap: 1rem;
}

.result-card {
  padding: 1.2rem;
  border-radius: var(--radius-lg);
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.header-right {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem;
}
.option-price {
  font-size: 1.2rem; font-weight: 800; color: var(--text); line-height: 1.1;
  white-space: nowrap;
}
.option-price .from { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.option-price .price-note {
  display: block; font-size: 0.66rem; font-weight: 600; color: var(--muted);
  margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em;
}
.price-disclaimer { margin-top: 0.5rem; font-size: 0.82rem; color: var(--muted); }

.option-label {
  margin-bottom: 0.35rem;
  color: #93c5fd;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.option-title {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.probability-ring {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 7px solid rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.08);
  text-align: center;
}

.probability-value {
  font-weight: 900;
  font-size: 1.15rem;
}

.probability-caption {
  margin-top: -0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.result-meta {
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.95rem 0;
}

.meta-pill {
  padding: 0.36rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 999px;
  color: var(--muted-strong);
  background: rgba(255,255,255,0.04);
  font-size: 0.87rem;
  font-weight: 700;
}

.risk-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
}

.risk-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber), var(--red));
}

.result-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.result-body h4 {
  margin: 0 0 0.45rem;
}

.warnings-wrap:empty {
  display: none;
}

.components-details {
  margin-top: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  padding-top: 0.8rem;
  color: var(--muted-strong);
}

.components-details summary {
  cursor: pointer;
  font-weight: 800;
}

.components-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  margin: 0.8rem 0 0;
}

.components-list dt {
  color: var(--muted);
}

.components-list dd {
  margin: 0;
  color: var(--text);
}

.content-grid,
.split-section {
  padding: 5rem 0;
}

.section-heading {
  max-width: 760px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.6rem;
}

.feature-card {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
}

.feature-number {
  display: inline-block;
  margin-bottom: 1rem;
  color: #93c5fd;
  font-weight: 900;
}

.split-section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 3rem;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.site-footer {
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  color: var(--muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.6rem 0;
}

.error-box {
  padding: 1rem;
  border: 1px solid rgba(239, 68, 68, 0.36);
  border-radius: var(--radius-md);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 900px) {
  .hero,
  .split-section {
    grid-template-columns: 1fr;
  }

  .search-form {
    grid-template-columns: 1fr 1fr;
  }

  .submit-button,
  .date-field,
  .party-field {
    grid-column: span 1;
  }

  /* Narrow layouts rearrange the field columns, so per-column alignment no
     longer holds: let each toggle span the full width and stack instead. */
  .search-form .held-toggle {
    grid-column: 1 / -1; grid-row: auto;
  }

  .feature-grid,
  .result-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding-top: 4rem;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .result-header,
  .results-header,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .probability-ring {
    width: 76px;
    height: 76px;
  }
}
