:root {
  --bg: #f3efe4;
  --paper: rgba(255, 252, 246, 0.86);
  --ink: #1f2b24;
  --muted: #627166;
  --line: rgba(31, 43, 36, 0.12);
  --accent: #004e64;
  --accent-strong: #007b8a;
  --warm: #f2b35d;
  --route: #ef476f;
  --route-alt: #118ab2;
  --shadow: 0 18px 50px rgba(23, 31, 29, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Avenir Next", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(242, 179, 93, 0.32), transparent 34%),
    radial-gradient(circle at bottom right, rgba(0, 123, 138, 0.26), transparent 28%),
    linear-gradient(180deg, #f8f4eb 0%, #eee6d6 100%);
}

.page-shell {
  display: grid;
  grid-template-columns: 390px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  backdrop-filter: blur(16px);
}

.map-area {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 18px 0;
  gap: 14px;
}

.panel,
.brand-card,
.map-toolbar {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.brand-card,
.panel {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  font-weight: 750;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
}

.lede,
.muted,
.selection-summary,
.route-subline,
.airport-meta,
.route-stops {
  color: var(--muted);
}

.lede {
  margin: 14px 0 0;
  line-height: 1.55;
}

.field-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

label {
  font-size: 14px;
  font-weight: 650;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 123, 138, 0.18);
  border-color: rgba(0, 123, 138, 0.4);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  font-weight: 700;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink);
  border: 1px solid var(--line);
}

.option-grid {
  display: grid;
  gap: 14px;
}

.option {
  display: grid;
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle input {
  width: auto;
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1200;
  display: none;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.suggestions.show {
  display: flex;
}

.suggestion {
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.suggestion:hover {
  background: rgba(0, 123, 138, 0.08);
}

.suggestion-title {
  font-weight: 700;
}

.suggestion-subline {
  font-size: 13px;
  color: var(--muted);
}

.selection-summary {
  font-size: 14px;
  line-height: 1.5;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.route-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 450px);
  overflow: auto;
}

.route-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.route-card.active {
  border-color: rgba(239, 71, 111, 0.45);
  background: rgba(239, 71, 111, 0.08);
}

.route-line {
  font-weight: 750;
  font-size: 17px;
}

.route-subline {
  margin-top: 8px;
  line-height: 1.45;
  font-size: 14px;
}

.route-stops {
  margin-top: 10px;
  font-size: 13px;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding: 18px 22px;
}

.map-toolbar-copy {
  display: grid;
  gap: 10px;
}

.map-toolbar-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.map-stats {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

.preview-summary {
  margin: 0;
  max-width: 620px;
  line-height: 1.5;
  color: var(--muted);
}

#map {
  flex: 1;
  min-height: calc(100vh - 110px);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.airport-dot {
  opacity: 0.78;
}

.leaflet-popup-content-wrapper {
  border-radius: 18px;
}

.popup-card {
  min-width: 220px;
}

.popup-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 750;
}

.airport-meta {
  margin: 0 0 10px;
  font-size: 13px;
}

.popup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.popup-actions button {
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
}

@media (max-width: 1040px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .map-area {
    padding: 0 18px 18px;
  }

  #map {
    min-height: 62vh;
  }

  .route-results {
    max-height: none;
  }

  .map-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .map-toolbar-side {
    justify-items: start;
  }

  .map-stats {
    text-align: left;
  }
}
