:root {
  color-scheme: light;
  --ink: #172023;
  --muted: #637074;
  --line: #d8ded9;
  --paper: #fbfcfb;
  --surface: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0b5852;
  --amber: #b86e00;
  --rose: #b4234c;
  --green: #217a3f;
  --sky: #2b6cb0;
  --shadow: 0 18px 48px rgba(23, 32, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Pretendard", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  min-height: 100vh;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #f6f8f5;
}

.brand-block {
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.28;
}

.panel-section {
  display: grid;
  gap: 8px;
}

.field-label {
  color: #2c393c;
  font-size: 0.86rem;
  font-weight: 750;
}

.label-row,
.inline-control,
.result-heading,
.result-main,
.card-actions,
.map-toolbar {
  display: flex;
  align-items: center;
}

.label-row,
.result-heading,
.result-main {
  justify-content: space-between;
  gap: 12px;
}

.inline-control {
  gap: 8px;
}

.text-input,
.select-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.text-input:focus,
.select-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-primary {
  min-height: 48px;
  color: #ffffff;
  background: var(--teal);
}

.button-primary:hover {
  background: var(--teal-dark);
}

.button-quiet {
  color: var(--teal-dark);
  border-color: #b7d7d2;
  background: #ffffff;
}

.button-subtle {
  color: #244143;
  background: #e8f1ee;
}

.full-width {
  width: 100%;
}

.status-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.choice-list {
  display: grid;
  gap: 6px;
}

.choice-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.choice-button strong {
  display: block;
  margin-bottom: 2px;
}

.choice-button span {
  color: var(--muted);
  font-size: 0.8rem;
}

.range-input {
  width: 100%;
  accent-color: var(--teal);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}

.metric-pill,
.count-badge,
.toolbar-badge,
.score-badge,
.metric {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 850;
}

.metric-pill {
  color: #ffffff;
  background: var(--amber);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.segment {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.segment.active {
  color: #ffffff;
  background: var(--teal);
}

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

.mode-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(360px, 56vh) minmax(360px, 1fr);
  min-width: 0;
}

.map-wrap {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  background: #e6efed;
}

.map,
.fallback-map {
  position: absolute;
  inset: 0;
}

.map {
  z-index: 2;
}

.map.is-hidden {
  display: none;
}

.fallback-map {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(15, 118, 110, 0.09) 1px, transparent 1px),
    #edf5f3;
  background-size: 42px 42px;
}

.fallback-grid {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 35%, rgba(184, 110, 0, 0.22), transparent 16%),
    radial-gradient(circle at 64% 46%, rgba(43, 108, 176, 0.18), transparent 18%),
    radial-gradient(circle at 47% 70%, rgba(33, 122, 63, 0.14), transparent 22%);
}

.fallback-pin {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 8px 18px rgba(23, 32, 35, 0.22);
  transform: translate(-50%, -50%);
}

.fallback-pin.origin {
  width: 18px;
  height: 18px;
  background: var(--teal);
}

.fallback-pin.low {
  background: var(--green);
}

.fallback-pin.mid {
  background: var(--sky);
}

.fallback-pin.high {
  background: var(--amber);
}

.fallback-pin.premium {
  background: var(--rose);
}

.map-toolbar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-badge {
  color: #1e3132;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(23, 32, 35, 0.1);
}

.budget-legend {
  gap: 6px;
  flex-wrap: wrap;
  min-height: 32px;
}

.budget-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.tier-low {
  background: var(--green);
}

.tier-mid {
  background: var(--sky);
}

.tier-high {
  background: var(--amber);
}

.tier-premium {
  background: var(--rose);
}

.result-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  padding: 22px;
  overflow: hidden;
  background: var(--paper);
}

.count-badge {
  color: #ffffff;
  background: var(--ink);
}

.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #354144;
  font-size: 0.88rem;
}

.summary-chip {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  background: #ffffff;
  font-weight: 750;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  overflow-y: auto;
  padding: 2px 4px 4px 0;
}

.result-card {
  display: grid;
  gap: 12px;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 6px 18px rgba(23, 32, 35, 0.06);
}

.result-card.is-active {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.place-meta,
.route-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.score-badge.easy,
.score-badge.low {
  color: #ffffff;
  background: var(--green);
}

.score-badge.medium,
.score-badge.mid {
  color: #1f2b30;
  background: #ffd166;
}

.score-badge.hard,
.score-badge.high,
.score-badge.premium {
  color: #ffffff;
  background: var(--rose);
}

.route-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.metric {
  color: #263336;
  background: #eef2ef;
}

.metric.time {
  color: #ffffff;
  background: var(--sky);
}

.metric.fare {
  color: #ffffff;
  background: var(--amber);
}

.metric.mode {
  color: #ffffff;
  background: var(--teal);
}

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

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #ffffff;
  text-align: center;
}

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

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    grid-template-rows: 420px auto;
  }
}

@media (max-width: 560px) {
  .control-panel,
  .result-panel {
    padding: 18px;
  }

  h1 {
    font-size: 1.65rem;
  }

  .inline-control {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

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