:root {
  --navy-950: #08182b;
  --navy-900: #0d2340;
  --navy-800: #17385f;
  --blue: #347cc4;
  --blue-soft: #dcebf8;
  --coral: #e76f62;
  --coral-dark: #b94f47;
  --coral-soft: #f9ded8;
  --cream: #f4efe6;
  --paper: #fffdf8;
  --ink: #152238;
  --muted: #617083;
  --line: #d9d4ca;
  --warning: #a04431;
  --warning-bg: #fff0e7;
  --shadow: 0 18px 45px rgba(8, 24, 43, 0.12);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.site-header {
  align-items: center;
  background: var(--navy-950);
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 5vw;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.02rem;
  font-weight: 700;
  gap: 12px;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--coral);
  border-radius: 9px;
  color: #fff;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  height: 34px;
  justify-content: center;
  letter-spacing: 0.04em;
  transform: rotate(-3deg);
  width: 34px;
}

.language-switch {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  display: flex;
  padding: 3px;
}

.language-button {
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: #b9c9db;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  min-height: 32px;
  padding: 4px 12px;
}

.language-button.is-active {
  background: #fff;
  color: var(--navy-900);
}

main {
  min-height: calc(100vh - 160px);
}

.hero {
  align-items: end;
  background:
    radial-gradient(circle at 78% 18%, rgba(231, 111, 98, 0.2), transparent 28%),
    linear-gradient(132deg, var(--navy-950), var(--navy-800));
  color: #fff;
  display: flex;
  justify-content: space-between;
  min-height: 290px;
  padding: 58px 7vw 74px;
}

.hero-copy {
  max-width: 790px;
}

.eyebrow {
  color: #f7b6ab;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  margin: 0 0 14px;
}

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

h1 {
  font-size: clamp(2.8rem, 7vw, 5.9rem);
  letter-spacing: -0.065em;
  line-height: 0.95;
  margin-bottom: 22px;
}

.hero-subtitle {
  color: #dbe6f2;
  font-size: clamp(1.02rem, 2vw, 1.28rem);
  margin-bottom: 0;
  max-width: 660px;
}

.hero-note {
  align-items: center;
  color: #c9d5e2;
  display: flex;
  font-size: 0.8rem;
  gap: 8px;
  margin-bottom: 6px;
  white-space: nowrap;
}

.note-dot {
  background: #7ed4ad;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(126, 212, 173, 0.12);
  height: 7px;
  width: 7px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.85fr) minmax(480px, 1.65fr);
  margin: -38px auto 0;
  max-width: 1450px;
  padding: 0 4vw;
  position: relative;
  z-index: 2;
}

.planner-panel,
.map-panel {
  background: var(--paper);
  box-shadow: var(--shadow);
  min-width: 0;
}

.planner-panel {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  padding: 32px;
}

.map-panel {
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  display: flex;
  flex-direction: column;
  min-height: 640px;
  overflow: hidden;
}

.section-heading,
.results-heading,
.map-toolbar > div:first-child {
  align-items: flex-start;
  display: flex;
  gap: 14px;
}

.section-heading {
  margin-bottom: 27px;
}

.section-heading h2,
.map-toolbar h2,
.results-heading h2 {
  font-size: 1.32rem;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
}

.section-heading p,
.map-toolbar p,
.results-heading p {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0;
}

.step-number {
  color: var(--coral-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding-top: 5px;
}

form label {
  color: #35455a;
  display: block;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--navy-800) 50%) calc(100% - 18px) 51% / 5px 5px no-repeat,
    linear-gradient(135deg, var(--navy-800) 50%, transparent 50%) calc(100% - 13px) 51% / 5px 5px no-repeat,
    #fff;
  border: 1px solid #cbd1d8;
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  display: block;
  margin-top: 7px;
  min-height: 46px;
  padding: 10px 36px 10px 12px;
  width: 100%;
}

select:focus,
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(52, 124, 196, 0.3);
  outline-offset: 2px;
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

.primary-button {
  align-items: center;
  background: var(--navy-900);
  border: 0;
  border-radius: 11px;
  color: #fff;
  cursor: pointer;
  display: flex;
  font-weight: 750;
  justify-content: space-between;
  min-height: 52px;
  padding: 12px 17px;
  text-decoration: none;
  transition: background 160ms ease, transform 160ms ease;
  width: 100%;
}

.primary-button:hover {
  background: var(--navy-800);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: progress;
  opacity: 0.64;
  transform: none;
}

.form-error {
  background: var(--warning-bg);
  border-left: 3px solid var(--warning);
  color: var(--warning);
  font-size: 0.82rem;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.method-note {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 28px;
  padding-top: 20px;
}

.method-note strong {
  color: var(--ink);
  display: block;
  margin-bottom: 5px;
}

.method-note p {
  margin-bottom: 0;
}

.map-toolbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 102px;
  padding: 25px 28px;
}

.route-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.route-toggle {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  font-size: 0.73rem;
  font-weight: 750;
  gap: 7px;
  padding: 7px 10px;
}

.route-toggle input {
  accent-color: currentColor;
  margin: 0;
}

.fastest-toggle {
  color: var(--blue);
}

.emotion-toggle {
  color: var(--coral-dark);
}

.map-frame {
  background: #e8e8e0;
  flex: 1;
  min-height: 440px;
  overflow: hidden;
  position: relative;
}

#leaflet-map,
#map-fallback {
  height: 100%;
  inset: 0;
  position: absolute;
  width: 100%;
}

#leaflet-map {
  background:
    linear-gradient(28deg, transparent 48%, rgba(117, 128, 132, 0.12) 49%, rgba(117, 128, 132, 0.12) 51%, transparent 52%) 0 0 / 88px 72px,
    linear-gradient(112deg, transparent 48%, rgba(117, 128, 132, 0.1) 49%, rgba(117, 128, 132, 0.1) 51%, transparent 52%) 0 0 / 104px 86px,
    #e8e8e0;
}

#map-fallback {
  display: none;
}

body[data-map-mode="offline"] #leaflet-map {
  display: none;
}

body[data-map-mode="offline"] #map-fallback {
  display: block;
}

.map-empty {
  align-items: center;
  background: rgba(244, 239, 230, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  box-shadow: 0 12px 25px rgba(8, 24, 43, 0.12);
  display: flex;
  flex-direction: column;
  left: 50%;
  min-width: 220px;
  padding: 18px;
  position: absolute;
  text-align: center;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 500;
}

.map-empty strong {
  font-size: 0.93rem;
  margin-top: 10px;
}

.map-empty span:last-child {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 3px;
}

.map-tile-warning {
  background: rgba(8, 24, 43, 0.92);
  border-radius: 8px;
  color: #fff;
  font-size: 0.73rem;
  font-weight: 700;
  left: 50%;
  padding: 9px 13px;
  position: absolute;
  top: 14px;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 700;
}

.map-legend {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(8, 24, 43, 0.12);
  border-radius: 10px;
  bottom: 14px;
  box-shadow: 0 6px 18px rgba(8, 24, 43, 0.12);
  color: var(--muted);
  display: grid;
  font-size: 0.66rem;
  gap: 6px;
  left: 14px;
  padding: 10px 12px;
  position: absolute;
  z-index: 650;
}

.map-legend strong {
  color: var(--ink);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-legend > span {
  align-items: center;
  display: flex;
  gap: 7px;
}

.legend-dot {
  border-radius: 50%;
  display: inline-block;
  height: 9px;
  width: 9px;
}

.station-dot {
  background: #fffdf8;
  border: 2px solid var(--navy-950);
}

.place-dot {
  background: #8f958f;
  border: 1.5px solid #fff;
}

.legend-line {
  border-radius: 999px;
  display: inline-block;
  height: 4px;
  width: 19px;
}

.fastest-line {
  background: var(--blue);
  height: 8px;
  opacity: 0.76;
}

.emotion-line {
  background: var(--coral);
  opacity: 0.95;
}

.map-popup {
  display: grid;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  gap: 5px;
  line-height: 1.35;
  min-width: 190px;
}

.map-popup strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.map-popup span,
.map-popup em {
  color: var(--muted);
  font-size: 0.72rem;
}

.map-popup em {
  border-top: 1px solid #e4dfd6;
  font-style: normal;
  margin-top: 3px;
  padding-top: 6px;
}

.map-pulse {
  background: var(--coral);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(231, 111, 98, 0.18);
  height: 18px;
  width: 18px;
}

.map-caption {
  align-items: center;
  background: var(--navy-950);
  color: #aebdd0;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.68rem;
  gap: 8px 18px;
  min-height: 52px;
  padding: 11px 28px;
}

.map-caption strong {
  color: #fff;
}

.map-caption a {
  color: #d3dfec;
}

.results-section {
  margin: 52px auto 0;
  max-width: 1450px;
  padding: 0 4vw 70px;
}

.results-heading {
  margin-bottom: 20px;
}

.results-heading p {
  font-size: 0.98rem;
}

.limited-banner {
  background: var(--warning-bg);
  border: 1px solid #efb9a7;
  border-left: 6px solid var(--coral);
  border-radius: var(--radius-md);
  color: #713321;
  margin-bottom: 20px;
  padding: 18px 22px;
}

.limited-banner strong {
  font-size: 1.02rem;
}

.limited-banner p {
  margin: 5px 0;
}

.limited-banner ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.route-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.route-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(8, 24, 43, 0.08);
  overflow: hidden;
}

.route-card.is-limited {
  border: 2px solid #efb9a7;
  box-shadow: none;
}

.route-card-header {
  align-items: center;
  border-top: 5px solid;
  display: flex;
  justify-content: space-between;
  padding: 22px 24px 18px;
}

.fastest-card .route-card-header {
  border-color: var(--blue);
}

.emotion-card .route-card-header {
  border-color: var(--coral);
}

.route-kicker {
  color: var(--muted);
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  margin-bottom: 3px;
}

.route-card h3 {
  font-size: 1.42rem;
  margin-bottom: 0;
}

.route-badge {
  background: #edf1f4;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 6px 9px;
}

.is-limited .route-badge {
  background: var(--warning-bg);
  color: var(--warning);
}

.route-body {
  border-top: 1px solid #ece8df;
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(220px, 1.1fr);
}

.stop-list-wrap,
.metric-wrap {
  padding: 22px 24px;
}

.metric-wrap {
  background: #f7f4ed;
  border-left: 1px solid #e6e0d5;
}

.route-body h4 {
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.12em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.stop-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stop-list li {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 23px 1fr;
  margin-bottom: 12px;
}

.stop-number {
  align-items: center;
  background: var(--navy-900);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 0.66rem;
  font-weight: 800;
  height: 23px;
  justify-content: center;
  width: 23px;
}

.emotion-card .stop-number {
  background: var(--coral);
}

.stop-name {
  display: block;
  font-size: 0.84rem;
  font-weight: 750;
}

.stop-visit {
  color: var(--muted);
  display: block;
  font-size: 0.7rem;
}

.empty-stops {
  color: var(--warning);
  font-size: 0.82rem;
}

.metrics {
  display: grid;
  gap: 8px 14px;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.metrics div {
  border-bottom: 1px solid #ded9ce;
  padding-bottom: 8px;
}

.metrics dt {
  color: var(--muted);
  font-size: 0.67rem;
}

.metrics dd {
  font-size: 0.94rem;
  font-weight: 800;
  margin: 2px 0 0;
}

footer {
  align-items: center;
  background: var(--navy-950);
  color: #aebdd0;
  display: flex;
  font-size: 0.72rem;
  justify-content: space-between;
  min-height: 88px;
  padding: 18px 5vw;
}

footer p {
  margin: 0;
}

.permanent-notice {
  color: #fff;
  font-weight: 700;
}

.error-page {
  align-items: center;
  background: var(--navy-950);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.error-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  max-width: 460px;
  padding: 36px;
  text-align: center;
  width: 100%;
}

.error-card h1 {
  color: var(--ink);
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 20px 0 10px;
}

.error-card .primary-button {
  display: inline-flex;
  justify-content: center;
  margin-top: 10px;
}

@media (max-width: 1050px) {
  .hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 28px;
    padding-bottom: 70px;
  }

  .workspace {
    grid-template-columns: 1fr;
    max-width: 820px;
  }

  .planner-panel {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .map-panel {
    border-left: 0;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: 1px solid var(--line);
    min-height: 580px;
  }

  .route-body {
    grid-template-columns: 1fr;
  }

  .metric-wrap {
    border-left: 0;
    border-top: 1px solid #e6e0d5;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 64px;
    padding: 0 18px;
  }

  .brand {
    font-size: 0.9rem;
  }

  .hero {
    min-height: 260px;
    padding: 44px 22px 68px;
  }

  h1 {
    font-size: clamp(2.7rem, 15vw, 4rem);
  }

  .hero-note {
    white-space: normal;
  }

  .workspace,
  .results-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .planner-panel {
    padding: 25px 20px;
  }

  .form-row,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .map-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    padding: 22px 20px;
  }

  .map-frame {
    min-height: 390px;
  }

  .map-caption {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
    padding: 12px 20px;
  }

  .results-section {
    margin-top: 38px;
    padding-bottom: 46px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
  }

  .map-tile-warning {
    max-width: calc(100% - 28px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 390px) {
  .language-button {
    padding: 4px 9px;
  }

  .brand > span:last-child {
    display: none;
  }

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