:root {
  color-scheme: light;
  --bg: #f3efe6;
  --card: rgba(255, 252, 247, 0.92);
  --text: #17231f;
  --muted: #53605b;
  --accent: #005b4f;
  --accent-soft: #d8ece8;
  --accent-strong: #0f4a41;
  --line: rgba(0, 91, 79, 0.22);
  --border: rgba(23, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(0, 91, 79, 0.18), transparent 32%),
    linear-gradient(180deg, #f9f4ea 0%, var(--bg) 100%);
  color: var(--text);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 10px 20px;
}

.hero,
.panel {
  background: none;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
  box-shadow: none;
}

.hero {
  padding: 0;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 0.95;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.planner-form {
  display: grid;
  gap: 12px;
}

.form-section {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(0, 91, 79, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(216, 236, 232, 0.42));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--muted);
}

.section-divider span {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(0, 91, 79, 0.1);
  color: var(--accent-strong);
  font-weight: 700;
}

.section-divider-highlight span,
.section-divider-auth span {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(0, 91, 79, 0.18);
}

.section-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.section-copy {
  font-size: 0.88rem;
}

.field-grid,
.choice-group {
  display: grid;
  gap: 8px;
  width: 100%;
}

.choice-group {
  align-items: stretch;
}

.choice-token {
  align-self: center;
  justify-self: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  width: 100%;
}

.field-unlabeled {
  gap: 0;
}

.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;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.quick-trip-grid {
  display: grid;
  gap: 8px;
}

.quick-trip-tools {
  display: flex;
  justify-content: flex-end;
  margin-top: -2px;
}

.quick-trip-tester-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 91, 79, 0.14);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: none;
}

.quick-trip-tester-panel {
  display: grid;
  gap: 6px;
}

.quick-trip-tester-panel[hidden] {
  display: none;
}

.quick-trip-tester-field textarea {
  min-height: 54px;
  padding: 8px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
  resize: vertical;
}

.quick-trip-button {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 91, 79, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(216, 236, 232, 0.55));
  color: var(--accent-strong);
  border-radius: 16px;
  box-shadow: 0 10px 24px rgba(23, 35, 31, 0.06);
  text-align: left;
  position: relative;
}

.quick-trip-button strong {
  font-size: 1rem;
}

.quick-trip-button span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.quick-trip-empty {
  margin: 0;
  padding: 6px 2px;
}

.quick-trip-button.is-loading {
  padding-right: 54px;
}

.quick-trip-button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 18px;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  border-radius: 999px;
  border: 3px solid rgba(0, 91, 79, 0.2);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

.quick-action-button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--accent-strong);
  box-shadow: none;
}

.quick-action-button.is-active {
  background: var(--accent);
  color: white;
}

.field-full {
  grid-column: 1 / -1;
}

.field-compact {
  max-width: 220px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdf9;
  font: inherit;
}

select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fffdf9;
  font: inherit;
}

.field-loader {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(216, 236, 232, 0.58);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
}

.field-loader[hidden] {
  display: none;
}

.loading-spinner-inline {
  width: 16px;
  height: 16px;
  border-width: 3px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.checkbox-field input {
  width: 24px;
  height: 24px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.checkbox-field span {
  color: var(--text);
}

.settings-list {
  display: grid;
  gap: 10px;
}

.checkbox-stack-field {
  gap: 10px;
}

.checkbox-stack-label {
  color: var(--text);
}

.checkbox-stack-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.checkbox-stack-control input {
  width: 24px;
  height: 24px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
}

.full {
  width: 100%;
}

.plan-submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.plan-submit-button[aria-busy="true"] {
  opacity: 0.92;
}

.plan-submit-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.plan-submit-spinner svg {
  width: 20px;
  height: 20px;
  animation: spin 0.75s linear infinite;
  transform-origin: center;
}

.plan-submit-spinner-track,
.plan-submit-spinner-arc {
  fill: none;
  stroke-linecap: round;
}

.plan-submit-spinner-track {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 3;
}

.plan-submit-spinner-arc {
  stroke: #fff;
  stroke-width: 3;
}

.plan-submit-button[aria-busy="true"] .plan-submit-spinner {
  display: inline-flex !important;
}

.full-width {
  grid-column: 1 / -1;
}

.foldout {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.foldout summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.foldout summary::-webkit-details-marker {
  display: none;
}

.foldout summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.foldout[open] summary::before {
  content: "-";
}

.foldout-body {
  padding: 0 12px 12px;
}

.results-shell {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.auth-panel {
  padding: 0;
}

.auth-card {
  display: grid;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(0, 91, 79, 0.14);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(216, 236, 232, 0.42));
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-error {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(145, 46, 46, 0.12);
  color: #7d1d1d;
}

.results-header {
  display: grid;
  gap: 6px;
}

h2,
h3 {
  margin: 0;
}

.journey-view {
  display: grid;
  gap: 10px;
}

.trip-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(216, 236, 232, 0.6));
  padding: 8px;
}

.trip-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 10px;
}

.trip-header p {
  font-size: 0.92rem;
}

.trip-title-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.trip-summary-weather {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.trip-summary-temperature {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.trip-summary-badge {
  gap: 8px;
}

.trip-alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(31, 109, 146, 0.12);
  color: #1f6d92;
}

.trip-alert-badge svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trip-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.trip-footer {
  display: flex;
  justify-content: end;
  margin-top: 14px;
}

.trip-banner {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.trip-arrival {
  background: rgba(15, 74, 65, 0.9);
}

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

.step-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 5px;
  align-items: start;
}

.step-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--accent-strong);
  box-shadow: 0 10px 28px rgba(23, 35, 31, 0.08);
}

.step-icon-labeled {
  gap: 0;
}

.step-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-icon-label {
  font-size: 0.5rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.step-weather-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(23, 35, 31, 0.08);
  background: rgba(216, 236, 232, 0.45);
  color: var(--accent-strong);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-weather-badge svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.weather-sun {
  color: #cf7a11;
}

.weather-partly-cloudy {
  color: #5f6f7a;
}

.weather-cloudy {
  color: #475862;
}

.weather-light-rain {
  color: #1f6d92;
}

.weather-heavy-rain {
  color: #0c4a7b;
}

.step-card {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--border);
}

.step-topline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(86px, max-content) 5.25rem;
  align-items: center;
  gap: 10px;
}

.step-duration {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 700;
  min-width: 5.25rem;
  text-align: right;
  justify-self: end;
}

.step-heading-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.step-topline-weather {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-width: 86px;
}

.step-distance {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 91, 79, 0.08);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-transit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(0, 91, 79, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--accent-strong);
  box-shadow: none;
}

.step-transit-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.step-transit-toggle[aria-expanded="true"] {
  background: var(--accent);
  color: white;
}

.step-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.step-transit-panel {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0, 91, 79, 0.12);
}

.trip-route-panel {
  margin-bottom: 14px;
  display: grid;
  gap: 12px;
  padding-bottom: 2px;
}

.trip-route-panel[hidden] {
  display: none;
}

.trip-route-grid {
  display: grid;
  gap: 12px;
}

.trip-route-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 91, 79, 0.1);
}

.trip-route-card-header {
  display: grid;
  gap: 4px;
}

.trip-route-card-header strong {
  color: var(--accent-strong);
}

.trip-route-card-header span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.trip-route-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(216, 236, 232, 0.45);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.trip-route-legend-line {
  width: 18px;
  height: 0;
  border-top: 3px solid currentColor;
  border-radius: 999px;
}

.trip-route-legend-item.mode-walk {
  color: #6a7170;
}

.trip-route-legend-item.mode-walk .trip-route-legend-line {
  border-top-style: dashed;
}

.trip-route-legend-item.mode-bus {
  color: #0f6b5e;
}

.trip-route-legend-item.mode-train {
  color: #cf7a11;
}

.step-transit-panel[hidden] {
  display: none;
}

.step-transit-headsign {
  font-size: 0.88rem;
  color: var(--accent-strong);
  font-weight: 700;
}

.step-transit-map-shell,
.trip-route-map-shell {
  overflow: hidden;
  position: relative;
  border-radius: 18px;
  border: 1px solid rgba(0, 91, 79, 0.12);
  aspect-ratio: 16 / 9;
  min-height: 180px;
}

.step-transit-map-canvas,
.trip-route-map-canvas,
.step-transit-map-shell .leaflet-container,
.trip-route-map-shell .leaflet-container {
  width: 100%;
  height: 100%;
  display: block;
  min-height: 180px;
  background: linear-gradient(180deg, rgba(216, 236, 232, 0.9), rgba(242, 237, 225, 0.92));
}

.step-transit-map-shell .leaflet-control-attribution,
.trip-route-map-shell .leaflet-control-attribution {
  background: rgba(255, 252, 247, 0.88);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
}

.step-transit-map-shell .leaflet-tooltip,
.trip-route-map-shell .leaflet-tooltip {
  border: 1px solid rgba(0, 91, 79, 0.12);
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.96);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(23, 35, 31, 0.12);
}

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

.step-stop-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(0, 91, 79, 0.08);
}

.step-stop-kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 91, 79, 0.08);
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
}

.step-stop-item.is-origin .step-stop-kind {
  background: rgba(12, 123, 104, 0.14);
}

.step-stop-item.is-destination .step-stop-kind {
  background: rgba(207, 122, 17, 0.14);
}

.step-stop-time {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.step-route {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
  text-align: right;
}

.route-arrow {
  color: var(--accent-strong);
  font-weight: 700;
}

.step-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.mode-bus .step-icon,
.mode-train .step-icon {
  background: linear-gradient(180deg, #fff, rgba(216, 236, 232, 0.95));
}

.json-shell {
  overflow: hidden;
}

.empty-state {
  padding: 12px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.loading-state {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(216, 236, 232, 0.58);
  color: var(--accent-strong);
  font-weight: 700;
}

.loading-spinner {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid rgba(0, 91, 79, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

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

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
}

@media (min-width: 720px) {
  .trip-header {
    align-items: center;
  }
}

@media (max-width: 719px) {
  main {
    padding: 10px 8px 16px;
  }

  .trip-card,
  .form-section,
  .auth-card {
    padding: 10px;
  }

  .trip-header {
    flex-direction: column;
    align-items: start;
  }

  .step-topline {
    grid-template-columns: minmax(0, 1fr) max-content max-content;
    align-items: center;
  }

  .step-meta {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .step-duration {
    min-width: 0;
    text-align: left;
    justify-self: start;
  }

  .step-topline-weather {
    min-width: 0;
  }

  .trip-route-card {
    padding: 10px;
  }

  .step-item {
    grid-template-columns: 38px 1fr;
  }

  .step-icon {
    width: 38px;
    height: 38px;
  }

  .step-icon svg {
    width: 18px;
    height: 18px;
  }

  .step-stop-item {
    grid-template-columns: 1fr;
  }
}