:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --surface: #fffdf8;
  --surface-2: #f0ebe2;
  --text: #20201d;
  --muted: #69645c;
  --border: #ded7cc;
  --accent: #177e72;
  --accent-2: #a45f2a;
  --accent-soft: #e3f1ec;
  --danger-soft: #f4e2d9;
  --shadow: 0 12px 40px rgba(48, 41, 32, 0.12);
  --radius: 8px;
  --max: 1180px;
  font-family: Avenir Next, Avenir, Helvetica Neue, Helvetica, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171816;
  --surface: #20221f;
  --surface-2: #2a2c27;
  --text: #f2efe8;
  --muted: #b8b0a4;
  --border: #3b3c36;
  --accent: #65c7b8;
  --accent-2: #dda064;
  --accent-soft: #17342f;
  --danger-soft: #3b2a23;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
select {
  font: inherit;
}

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

a {
  color: inherit;
}

main {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 96px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  padding: 14px 0 10px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.1;
  letter-spacing: 0;
}

.route-kicker,
.meta-line,
.section-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

#languageLabel {
  font-weight: 700;
  font-size: 13px;
}

.view-section {
  display: none;
}

.view-section.active-view {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 0 14px;
}

.hero-copy,
.route-panel,
.panel,
.day-detail,
.place-card,
.weather-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero-copy {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy h2 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(24px, 3.2vw, 38px);
  line-height: 1.12;
  letter-spacing: 0;
}

.route-caption {
  max-width: 700px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.hero-copy p:last-of-type {
  max-width: 640px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.stat-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.stat-card strong {
  display: block;
  font-size: 18px;
  line-height: 1.15;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.hero-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-link,
.plain-link,
.secondary-button {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--radius);
  text-decoration: none;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.primary-link {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.plain-link,
.secondary-button {
  background: var(--surface);
  color: var(--text);
}

.route-panel {
  position: relative;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 100%;
}

.route-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.route-panel-head h3 {
  margin: 0;
  font-size: 16px;
}

.route-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

#routeStops {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: stretch;
  min-width: max-content;
}

#routeStops li {
  position: relative;
  min-width: 118px;
  padding: 30px 18px 0 0;
}

#routeStops li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  z-index: 1;
}

#routeStops li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 6px;
  top: 14px;
  height: 2px;
  background: color-mix(in srgb, var(--accent) 72%, var(--border));
}

.stop-name {
  font-weight: 700;
  line-height: 1.25;
}

.stop-country {
  color: var(--muted);
  font-size: 13px;
}

.section-grid {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr;
  gap: 16px;
  margin-bottom: 0;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

.people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.person {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.person span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

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

.compact-list li {
  padding-left: 16px;
  border-left: 3px solid var(--accent-2);
  color: var(--muted);
}

.content-section {
  padding: 18px 0 24px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
}

select {
  min-height: 40px;
  max-width: 100%;
  padding: 8px 34px 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.day-strip {
  display: flex;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  gap: 8px;
  margin: 0 0 12px;
  padding-bottom: 4px;
}

.day-pill {
  flex: 0 0 152px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 10px;
  text-align: left;
  cursor: pointer;
  min-height: 64px;
}

.day-pill.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.day-pill strong,
.day-pill span {
  display: block;
}

.day-pill span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.day-detail {
  padding: 18px;
}

.day-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 18px;
}

.summary-box {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  min-width: 0;
}

.summary-box small {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.events {
  display: grid;
  gap: 10px;
}

.event {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
}

.event-time {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.event h4 {
  margin: 0 0 5px;
  font-size: 16px;
}

.event p {
  margin: 0;
  color: var(--muted);
}

.event-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 12px;
}

.place-grid,
.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.place-card {
  overflow: hidden;
}

.place-image {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  background-position: center;
  background-size: cover;
}

.place-body {
  padding: 14px;
}

.place-body h3 {
  margin: 0 0 8px;
}

.place-body p {
  margin: 0;
  color: var(--muted);
}

.place-tip {
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
}

.weather-meta {
  color: var(--muted);
  min-height: 22px;
  margin-bottom: 12px;
}

.weather-card {
  padding: 15px;
}

.weather-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.weather-head h3 {
  margin: 0;
}

.temp {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
}

.weather-facts {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  display: grid;
  gap: 5px;
}

.forecast {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.forecast-day {
  min-width: 0;
  border-radius: 6px;
  background: var(--surface-2);
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
}

.forecast-day strong {
  display: block;
  font-size: 13px;
}

.info-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
}

.booking-list,
.task-list {
  display: grid;
  gap: 10px;
}

.booking-item,
.task-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 84%, var(--surface-2));
}

.booking-item h4,
.task-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.booking-item p,
.task-item p {
  margin: 0;
  color: var(--muted);
}

.booking-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
}

.task-item.done {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

.floating-tabs {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(620px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.tab-link {
  min-height: 48px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
}

.tab-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.tab-link.active {
  color: var(--text);
  background: var(--surface-2);
}

.loading,
.error {
  color: var(--muted);
  padding: 14px;
}

@media (max-width: 860px) {
  main,
  .topbar {
    width: min(100% - 24px, var(--max));
  }

  .hero,
  .section-grid,
  .info-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .hero-copy {
    padding: 22px;
  }

  .route-panel {
    min-height: 0;
  }

  .day-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .topbar {
    align-items: start;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .hero-copy h2 {
    font-size: 24px;
  }

  .route-caption {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .overview-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card {
    padding: 8px;
  }

  .stat-card strong {
    font-size: 16px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

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

  .event-time {
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
  }

  .forecast {
    grid-template-columns: repeat(2, 1fr);
  }

  .floating-tabs {
    width: calc(100% - 14px);
    border-radius: 12px;
  }

  .tab-link {
    min-height: 46px;
    font-size: 11px;
  }
}
