:root {
  color-scheme: light;
  --bg: #fff5e9;
  --ink: #1c1c1c;
  --muted: #5c5c5c;
  --accent: #ff6f5e;
  --accent-dark: #f1483b;
  --lime: #b6f05c;
  --mint: #6dd9b8;
  --card: #ffffff;
  --shadow: 0 20px 50px rgba(31, 31, 31, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "DM Sans", "Trebuchet MS", sans-serif;
  background: radial-gradient(circle at top, #fffdf7 0%, var(--bg) 55%, #ffd9c9 100%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-shapes {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.shape {
  position: absolute;
  display: block;
  border-radius: 999px;
  opacity: 0.7;
  filter: blur(0px);
}

.shape-a {
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, #ffe58a 0%, #ffc658 60%, transparent 100%);
  top: -120px;
  left: -90px;
}

.shape-b {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, #b8f2d8 0%, #6dd9b8 65%, transparent 100%);
  bottom: -120px;
  right: -110px;
}

.shape-c {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #ffd3c4 0%, #ff8c7a 70%, transparent 100%);
  top: 45%;
  right: 8%;
}

.app {
  position: relative;
  z-index: 1;
  padding: 32px 20px 48px;
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero {
  text-align: left;
  padding: 8px 4px;
}

.eyebrow {
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.hero h1 {
  font-family: "Fredoka", "Trebuchet MS", sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.05;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 520px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff0e1;
  color: #6a351f;
}

.pill.soft {
  background: #edf8f3;
  color: #1e5c4a;
}

.primary,
.cta {
  border: none;
  border-radius: 999px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary {
  background: #fff6ef;
  color: var(--ink);
  border: 2px solid #ffd2ba;
}

.cta {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  box-shadow: 0 16px 30px rgba(255, 111, 94, 0.28);
}

.primary:active,
.cta:active {
  transform: scale(0.98);
}

.primary:disabled,
.cta:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.distance-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.label {
  font-weight: 600;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segment {
  border: 2px solid #f3e5d9;
  border-radius: 14px;
  background: #fff;
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.segment.active {
  background: #ffefe2;
  border-color: #ffc6a6;
  color: #c23b28;
}

.hint,
.small {
  font-size: 0.85rem;
  color: var(--muted);
}

.map-section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#map {
  width: 100%;
  height: 55vh;
  min-height: 320px;
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result.hidden {
  display: none;
}

.result h2 {
  font-size: 1.3rem;
}

.result .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.result .meta span {
  background: #fff4ec;
  padding: 6px 10px;
  border-radius: 12px;
}

.result .route {
  background: #f7f9ff;
  border-radius: 14px;
  padding: 12px;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.result a {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 600;
}

.result .place-description {
  color: var(--text);
  line-height: 1.7;
  font-size: 0.95rem;
  background: #faf8f6;
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.result .recommendations {
  background: #f0f9f5;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.result .park-note {
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.dot-hint {
  color: #6dd9b8;
  font-style: normal;
  font-size: 0.85em;
}

.error-explanation {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 12px;
}

.error-criteria,
.error-advice {
  font-size: 0.9rem;
  color: var(--muted);
  background: #f8f5f2;
  padding: 10px 14px;
  border-radius: 8px;
  line-height: 1.5;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 6px;
}

.maps-link {
  padding: 10px 16px;
  background: #fff4ec;
  border-radius: 999px;
  display: inline-block;
}

.another-btn {
  border: 2px solid #e0e0e0;
  border-radius: 999px;
  background: #fff;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.another-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #fff8f6;
}

.another-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Options toggle button */
.options-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  background: linear-gradient(135deg, #fff8f3 0%, #ffefe5 100%);
  border: 2px dashed #ffc6a6;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  color: #c25a3c;
  cursor: pointer;
  transition: all 0.2s ease;
}

.options-toggle:hover {
  background: linear-gradient(135deg, #ffefe5 0%, #ffe5d8 100%);
  border-style: solid;
}

.options-toggle .toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.options-toggle.expanded .toggle-icon {
  transform: rotate(180deg);
}

/* Options panel - collapsible */
.options-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: #faf8f6;
  border-radius: 16px;
  margin-top: -8px;
}

.options-panel.expanded {
  display: flex;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint-inline {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85em;
}

/* Speed segments */
.speed-segmented {
  grid-template-columns: repeat(3, 1fr);
}

.speed-segment {
  border: 2px solid #e8e4e0;
  border-radius: 12px;
  background: #fff;
  padding: 10px 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.speed-segment.active {
  background: #edf8f3;
  border-color: #6dd9b8;
  color: #1e5c4a;
}

/* Run mode toggle */
.mode-toggle {
  display: flex;
  gap: 12px;
}

.mode-option {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border: 2px solid #e8e4e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mode-option:has(input:checked) {
  background: #fff8f0;
  border-color: #ffc6a6;
}

.mode-option input {
  display: none;
}

.mode-label {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Snack type grid */
.snack-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.snack-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 2px solid #e8e4e0;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.snack-option:has(input:checked) {
  background: #fff4ec;
  border-color: #ffc6a6;
}

.snack-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* Reviews link styling */
.reviews-link {
  background: #fff4ec;
  padding: 6px 10px;
  border-radius: 12px;
  text-decoration: none;
}

.reviews-link:hover {
  background: #ffe8dc;
}

@media (min-width: 600px) {
  .snack-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 900px) {
  .app {
    padding: 40px 24px 60px;
  }

  .controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .controls > * {
    flex: 1 1 220px;
  }

  .distance-block {
    flex: 2 1 320px;
  }

  .options-toggle,
  .options-panel {
    flex: 1 1 100%;
  }

  #map {
    height: 60vh;
  }
}

/* Pre-scan progress indicator */
.prescan-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  margin: 8px 0;
  background: #f0f8f5;
  border-radius: 12px;
  border-left: 4px solid #6dd9b8;
}

.prescan-progress.hidden {
  display: none;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: #e0f0ea;
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6dd9b8, #4ac9a0);
  width: 0%;
  transition: width 0.4s ease;
  border-radius: 2px;
}

.prescan-text {
  font-size: 0.85rem;
  color: #1e5c4a;
  margin: 0;
}
