:root {
  color-scheme: light;
  --bg: #fff5f5;
  --bg2: #f8fafc;
  --ink: #171717;
  --muted: #6b7280;
  --line: rgba(20, 20, 20, .11);
  --card: rgba(255, 255, 255, .78);
  --card-strong: rgba(255, 255, 255, .94);
  --surface: rgba(127, 146, 176, .08);
  --surface-strong: rgba(255, 255, 255, .82);
  --brand: #e50914;
  --brand2: #8f0f18;
  --brand3: #ff3b45;
  --danger: #ef233c;
  --warn: #ffb020;
  --ok: #13c784;
  --shadow: 0 24px 70px rgba(140, 18, 28, .16);
  --soft-shadow: 0 14px 42px rgba(17, 17, 17, .09);
  --radius: 24px;
}

html.dark {
  color-scheme: dark;
  --bg: #050505;
  --bg2: #121212;
  --ink: #f7f7f7;
  --muted: #a3a3a3;
  --line: rgba(255, 255, 255, .10);
  --card: rgba(18, 18, 18, .74);
  --card-strong: rgba(22, 22, 22, .94);
  --surface: rgba(127, 146, 176, .09);
  --surface-strong: rgba(14, 14, 14, .88);
  --shadow: 0 24px 70px rgba(0, 0, 0, .52);
  --soft-shadow: 0 14px 42px rgba(0, 0, 0, .34);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "SF Pro Text", "Helvetica Neue", Arial, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 12% 0%, rgba(229, 9, 20, .20), transparent 31rem),
    radial-gradient(circle at 94% 8%, rgba(40, 40, 40, .22), transparent 28rem),
    radial-gradient(circle at 64% 92%, rgba(255, 59, 69, .11), transparent 28rem),
    linear-gradient(145deg, var(--bg), var(--bg2));
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(6px);
}

body::before {
  width: 18rem;
  height: 18rem;
  top: 12rem;
  left: -7rem;
  background: rgba(229, 9, 20, .10);
}

body::after {
  width: 20rem;
  height: 20rem;
  right: -8rem;
  bottom: 4rem;
  background: rgba(229, 9, 20, .10);
}

button,
input { font: inherit; }
button { border: 0; -webkit-tap-highlight-color: transparent; }

.app {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px max(36px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.logo-mark {
  display: block;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 17px;
  object-fit: cover;
  background: #080808;
  box-shadow: 0 14px 32px rgba(229, 9, 20, .28), 0 0 0 6px rgba(229, 9, 20, .08);
}

.brand-copy { min-width: 0; }
.brand-copy h1 {
  margin: 0;
  font-size: clamp(1.55rem, 5.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.045em;
}

.brand-copy p {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .84rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.theme-toggle {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--card-strong);
  box-shadow: var(--soft-shadow);
  cursor: pointer;
  backdrop-filter: blur(18px);
  transition: transform .2s ease, border-color .2s ease;
}

.theme-toggle:active { transform: scale(.94) rotate(-4deg); }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: clamp(20px, 5vw, 28px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(255, 255, 255, .44));
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px);
}

html.dark .hero-card {
  background: linear-gradient(135deg, rgba(22, 22, 22, .90), rgba(6, 6, 6, .74));
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(110deg, rgba(229, 9, 20, .22), transparent 40%, rgba(0, 0, 0, .22)),
    radial-gradient(circle at 88% 10%, rgba(255, 59, 69, .16), transparent 12rem);
  pointer-events: none;
}

.hero-content { position: relative; z-index: 1; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 7px 11px;
  border: 1px solid rgba(229, 9, 20, .18);
  border-radius: 999px;
  color: #b40b16;
  background: rgba(229, 9, 20, .10);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

html.dark .eyebrow { color: #ff737b; }

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--brand3);
  box-shadow: 0 0 0 6px rgba(229, 9, 20, .12);
}

.headline {
  max-width: 680px;
  margin: 0;
  font-size: clamp(1.9rem, 7.6vw, 3.25rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.048em;
}

.headline .grad {
  color: transparent;
  background: linear-gradient(100deg, #ff636b, #e50914 55%, var(--ink));
  background-clip: text;
  -webkit-background-clip: text;
}

.hero-copy {
  max-width: 640px;
  margin: 15px 0 0;
  color: var(--muted);
  font-size: .93rem;
  line-height: 1.55;
}

.flow-steps {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
}

.flow-step span {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  font-size: .72rem;
  font-weight: 900;
}

.flow-step strong { font-size: .73rem; line-height: 1.2; }
.flow-step.is-active { color: var(--ink); }
.flow-step.is-active span {
  border-color: rgba(229, 9, 20, .24);
  color: #fff;
  background: linear-gradient(135deg, var(--brand3), var(--brand2));
  box-shadow: 0 9px 18px rgba(229, 9, 20, .22);
}

.flow-line {
  height: 1px;
  min-width: 14px;
  background: linear-gradient(90deg, rgba(229, 9, 20, .45), var(--line));
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 14px 0 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--card);
  box-shadow: var(--soft-shadow);
  font-size: .82rem;
  font-weight: 750;
  backdrop-filter: blur(18px);
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 99px;
  color: #60a5fa;
  background: currentColor;
  box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 14%, transparent);
  animation: statusPulse 1.35s ease-in-out infinite;
}

.status-ready { color: var(--ok); }
.status-error { color: var(--danger); }
.status-error .status-dot { animation: none; }
@keyframes statusPulse { 50% { transform: scale(.74); opacity: .48; } }

.stack { display: grid; gap: 16px; margin-top: 16px; }

.section,
.submit-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px);
}

.section::after,
.submit-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 18px;
  left: 18px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent);
  opacity: .65;
  pointer-events: none;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.section-sub { margin: 5px 0 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }

.step-badge {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: 0 12px 26px rgba(229, 9, 20, .22);
  font-size: .86rem;
  font-weight: 900;
}

.route-builder {
  position: relative;
  padding: 12px;
  border: 1px solid rgba(127, 146, 176, .15);
  border-radius: 24px;
  background: rgba(127, 146, 176, .06);
}

.place-field {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 66px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.place-field:focus-within {
  border-color: rgba(229, 9, 20, .48);
  box-shadow: 0 12px 28px rgba(229, 9, 20, .09), inset 0 1px 0 rgba(255, 255, 255, .08);
  transform: translateY(-1px);
}

.field-badge,
.summary-badge {
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 950;
}

.field-badge {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #12b981, #059669);
  box-shadow: 0 8px 18px rgba(5, 150, 105, .18);
  font-size: .76rem;
}

.drop-field .field-badge {
  background: linear-gradient(135deg, var(--brand3), var(--brand2));
  box-shadow: 0 8px 18px rgba(229, 9, 20, .18);
}

.field-copy { min-width: 0; }
.field-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.field-copy input {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: .94rem;
  font-weight: 730;
}

.field-copy input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.field-copy input.is-selected { color: var(--ok); }

.route-connector { display: flex; height: 10px; padding-left: 28px; }
.route-connector span { width: 1px; height: 100%; background: linear-gradient(var(--ok), var(--brand)); opacity: .65; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 16px;
  border-radius: 17px;
  cursor: pointer;
  font-weight: 850;
  transition: transform .16s ease, filter .16s ease, opacity .16s ease;
}

.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { cursor: not-allowed; opacity: .44; filter: grayscale(.2); }

.btn-soft {
  width: 100%;
  margin-top: 11px;
  border: 1px solid rgba(229, 9, 20, .17);
  color: var(--brand);
  background: rgba(229, 9, 20, .07);
}

.btn-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand3), var(--brand2));
  font-size: 1rem;
}

.map-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.map {
  width: 100%;
  height: min(49vh, 390px);
  min-height: 285px;
  background: radial-gradient(circle at 50% 50%, rgba(229, 9, 20, .10), transparent 60%), rgba(127, 146, 176, .12);
}

.map-chip {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 8, 8, .72);
  box-shadow: 0 10px 25px rgba(0, 0, 0, .22);
  backdrop-filter: blur(13px);
  font-size: .72rem;
  font-weight: 850;
}

.map-chip span { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); box-shadow: 0 0 0 4px rgba(19, 199, 132, .14); }

.route-summary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(127, 146, 176, .13), rgba(127, 146, 176, .065));
}

.summary-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 15px;
  background: rgba(127, 146, 176, .08);
}

.summary-badge { width: 30px; height: 30px; background: linear-gradient(135deg, #12b981, #059669); font-size: .7rem; }
.drop-summary-row .summary-badge { background: linear-gradient(135deg, var(--brand3), var(--brand2)); }
.summary-row div { min-width: 0; }
.summary-row small { display: block; margin-bottom: 3px; color: var(--muted); font-size: .66rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.summary-row strong { display: block; overflow: hidden; color: var(--ink); font-size: .81rem; line-height: 1.38; text-overflow: ellipsis; }

.rules-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 176, 32, .20);
  border-radius: 18px;
  background: rgba(255, 176, 32, .065);
}

.rules-card summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.rules-card summary::-webkit-details-marker { display: none; }
.rules-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 12px; background: rgba(255, 176, 32, .13); }
.rules-card summary strong { display: block; color: var(--ink); font-size: .81rem; }
.rules-card summary small { display: block; margin-top: 3px; color: var(--muted); font-size: .69rem; }
.rules-caret { color: var(--warn); font-size: 1.1rem; transition: transform .18s ease; }
.rules-card[open] .rules-caret { transform: rotate(180deg); }

.rules-content { padding: 0 13px 13px 56px; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.rules-content p { margin: 0; }
.rules-content p + p { margin-top: 9px; }
.rules-content strong { color: color-mix(in srgb, var(--ink) 88%, var(--warn)); }

.submit-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .8fr);
  align-items: center;
  gap: 16px;
}

.submit-copy { display: flex; align-items: center; min-width: 0; gap: 11px; }
.submit-copy div { min-width: 0; }
.submit-copy strong { display: block; color: var(--ink); font-size: .92rem; }
.submit-copy small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; line-height: 1.4; }

.btn-primary {
  width: 100%;
  min-height: 54px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand3), var(--brand) 48%, var(--brand2));
  box-shadow: 0 16px 34px rgba(229, 9, 20, .28);
}

.btn-primary span { font-size: 1.2rem; }
.privacy { margin: -2px 8px 0; color: var(--muted); text-align: center; font-size: .69rem; line-height: 1.5; }

.result-panel { margin-top: 16px; padding: clamp(34px, 8vw, 56px) clamp(20px, 6vw, 44px); text-align: center; }
.result-icon { display: grid; width: 68px; height: 68px; margin: 0 auto 17px; place-items: center; border-radius: 24px; color: #fff; font-size: 2rem; font-weight: 950; }
.success-icon { background: linear-gradient(135deg, #2dd99c, #059669); box-shadow: 0 18px 38px rgba(5, 150, 105, .25); }
.error-icon { background: linear-gradient(135deg, var(--brand3), var(--brand2)); box-shadow: 0 18px 38px rgba(229, 9, 20, .26); }
.result-kicker { display: inline-block; margin-bottom: 10px; color: var(--ok); font-size: .7rem; font-weight: 900; letter-spacing: .12em; }
.error-panel .result-kicker { color: var(--danger); }
.result-panel h2 { margin: 0; color: var(--ink); font-size: clamp(1.45rem, 5vw, 2rem); letter-spacing: -.035em; }
.result-panel p { max-width: 560px; margin: 12px auto 0; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.result-note { width: fit-content; margin: 18px auto 0; padding: 10px 13px; border: 1px solid rgba(19, 199, 132, .17); border-radius: 999px; color: var(--ok); background: rgba(19, 199, 132, .07); font-size: .75rem; font-weight: 800; }

.pac-container {
  z-index: 999999 !important;
  overflow: hidden;
  border: 1px solid rgba(229, 9, 20, .22);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .30);
  font-family: "SF Pro Text", "Helvetica Neue", Arial, system-ui, sans-serif;
}

html.dark .pac-container { border-color: rgba(255, 255, 255, .14); background: #151515; }
.pac-item { padding: 10px 12px; border-top-color: var(--line); color: var(--muted); cursor: pointer; }
.pac-item:hover, .pac-item-selected { background: rgba(229, 9, 20, .08); }
.pac-item-query { color: var(--ink); font-size: .9rem; }

@media (min-width: 780px) {
  .app { padding: 30px 24px 46px; }
  .section { padding: 22px; }
}

@media (max-width: 680px) {
  .flow-steps { gap: 6px; }
  .flow-step { display: grid; justify-items: center; gap: 5px; text-align: center; }
  .flow-step strong { max-width: 74px; font-size: .64rem; }
  .flow-line { align-self: start; margin-top: 14px; }
  .submit-card { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .app { padding-right: 12px; padding-left: 12px; }
  .topbar { margin-top: 2px; }
  .logo-mark { width: 43px; height: 43px; border-radius: 15px; }
  .brand-copy h1 { font-size: 1.48rem; }
  .brand-copy p { font-size: .76rem; }
  .theme-toggle { width: 44px; height: 44px; border-radius: 16px; }
  .hero-card { padding: 19px 17px; border-radius: 29px; }
  .headline { font-size: clamp(1.78rem, 10vw, 2.4rem); }
  .hero-copy { font-size: .85rem; }
  .section { padding: 15px; border-radius: 24px; }
  .section-sub { font-size: .8rem; }
  .route-builder { padding: 9px; border-radius: 20px; }
  .place-field { grid-template-columns: 31px minmax(0, 1fr); min-height: 62px; padding: 8px 10px; border-radius: 16px; }
  .field-badge { width: 31px; height: 31px; border-radius: 11px; }
  .field-copy input { font-size: .88rem; }
  .route-connector { padding-left: 24px; }
  .map { height: 42vh; min-height: 265px; max-height: 340px; }
  .rules-content { padding-left: 13px; }
  .submit-card {
    position: sticky;
    z-index: 15;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 11px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--card-strong) 90%, transparent);
    backdrop-filter: blur(24px);
  }
  .submit-copy { display: none; }
  .privacy { margin-top: 2px; padding-bottom: 4px; }
}

@media (max-width: 360px) {
  .brand-copy p { max-width: 185px; }
  .flow-step strong { font-size: .59rem; }
  .flow-line { min-width: 6px; }
  .field-copy input { font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
