:root {
  color-scheme: light;
  --ink: #18202a;
  --muted: #5f6975;
  --line: #d9dee5;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --green: #1d6d5f;
  --green-dark: #114f47;
  --blue: #2f6f9f;
  --amber: #c17a24;
  --rose: #9b4057;
  --shadow: 0 18px 45px rgba(31, 40, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(251, 250, 247, 0.82), rgba(251, 250, 247, 0.95)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=80") center/cover fixed;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 42px;
}

.page-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 18px;
}

.page-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--green-dark);
  padding: 0 12px;
  font-size: 0.86rem;
  font-weight: 850;
  text-decoration: none;
}

.page-nav a[aria-current="page"] {
  background: var(--green);
  color: #fff;
}

.hero {
  min-height: 40vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: end;
  gap: 28px;
  padding: 52px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(3.1rem, 8vw, 7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.intro {
  max-width: 600px;
  color: #303a45;
  font-size: 1.08rem;
  line-height: 1.6;
}

.trip-summary,
.settings,
.leg-form,
.route-panel,
.transfer-panel {
  border: 1px solid rgba(217, 222, 229, 0.86);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.trip-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--line);
}

.trip-summary div {
  min-height: 96px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.95);
}

.trip-summary span,
.leg-stats dt {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.trip-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 1.45rem;
}

.settings {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 230px) minmax(190px, 250px);
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
  padding: 20px;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 8px;
  color: #33404d;
  font-size: 0.88rem;
  font-weight: 750;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd3dc;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
}

input {
  min-height: 42px;
}

textarea {
  min-height: 360px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(47, 111, 159, 0.2);
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.leg-form,
.route-panel,
.transfer-panel {
  border-radius: 8px;
  padding: 20px;
}

.transfer-shell {
  max-width: 1100px;
}

.transfer-hero {
  min-height: 28vh;
  grid-template-columns: 1fr;
}

.transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  align-items: start;
}

.status-message {
  min-height: 48px;
  margin: 18px 0 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  padding: 14px 16px;
  color: var(--muted);
  font-weight: 800;
}

.status-message[data-type="success"] {
  color: var(--green-dark);
}

.status-message[data-type="error"] {
  color: var(--rose);
}

.form-heading,
.route-heading {
  margin-bottom: 18px;
}

.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.wide-field {
  margin-bottom: 14px;
}

.duration-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.duration-fields span {
  color: var(--muted);
  font-weight: 800;
}

fieldset {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 8px;
  color: var(--green-dark);
  font-size: 0.82rem;
  font-weight: 850;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.button,
.icon-button,
.edit-leg,
.remove-leg {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 850;
}

.primary {
  background: var(--green);
  color: #fff;
}

.secondary {
  background: #e9edf1;
  color: #26313c;
}

.hidden {
  display: none;
}

.route-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.icon-button,
.remove-leg {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: #e8f1ef;
  color: var(--green-dark);
  font-size: 1.3rem;
  font-weight: 900;
}

.edit-leg {
  min-height: 38px;
  border-radius: 6px;
  background: #f1eadd;
  color: #69502d;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 850;
}

.legs {
  display: grid;
  gap: 14px;
}

.leg-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
}

.leg-marker {
  position: relative;
}

.leg-marker::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
}

.leg-marker::after {
  content: "";
  position: absolute;
  top: 22px;
  bottom: -18px;
  left: 11px;
  width: 2px;
  background: #c9d1d9;
}

.leg-card:last-child .leg-marker::after {
  display: none;
}

.leg-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.leg-content header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.leg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.maps-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e8f1ef;
  color: var(--green-dark);
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.leg-number {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--rose);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.leg-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.leg-stats div {
  min-height: 74px;
  border-radius: 6px;
  background: #f4f6f7;
  padding: 10px;
}

.leg-stats dd {
  margin: 6px 0 0;
  font-weight: 850;
}

.campsite {
  display: none;
  margin-top: 14px;
  border-left: 4px solid var(--blue);
  background: #eef5f9;
  border-radius: 6px;
  padding: 12px;
  color: #2b3a46;
  line-height: 1.5;
}

.campsite.has-campsite {
  display: block;
}

.campsite a {
  color: var(--blue);
  font-weight: 800;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed #bcc6d0;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

@media (max-width: 920px) {
  .hero,
  .settings,
  .planner-grid,
  .transfer-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 12px;
  }

  .field-pair,
  .trip-summary,
  .leg-stats {
    grid-template-columns: 1fr;
  }

  .leg-content header,
  .leg-actions {
    align-items: start;
  }

  .leg-content header {
    flex-direction: column;
  }

  .leg-form,
  .route-panel,
  .transfer-panel,
  .settings {
    padding: 16px;
  }

  h1 {
    font-size: 3rem;
  }
}
