:root {
  color-scheme: light;
  --surface: #eff5fa;
  --ink: #172f43;
  --muted: #435d72;
  --border: #d4e2eb;
  --blue: #124b72;
  --error: #a62e23;
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, dl, dd { margin: 0; }
p, dt { word-break: keep-all; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:is(button, input, a, summary, h2):focus-visible {
  outline: 3px solid #23749b;
  outline-offset: 3px;
}

.shell {
  width: min(1100px, 100% - 46px);
  margin: 0 auto;
  padding: 42px 0 31px;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 166px;
  padding: 26px 34px;
  margin-bottom: 18px;
  border: 1px solid #a8c5dc;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(109deg, #dceffe 1%, #cde5f7 61%, #b8d7ef);
}

.hero-copy { max-width: 70%; }
h1 {
  font-size: clamp(2.25rem, 5.85vw, 3.75rem);
  font-weight: 850;
  letter-spacing: -.09em;
  line-height: 1.12;
}

.hero p {
  margin-top: 11px;
  font-size: 1.02rem;
  line-height: 1.49;
  color: #325570;
}

.line-art {
  position: absolute;
  right: -3px;
  bottom: 2px;
  z-index: -1;
  width: 280px;
  height: 177px;
  opacity: .77;
}

.line-art i, .line-art b, .line-art span {
  position: absolute;
  display: block;
  transform: rotate(-28deg);
  height: 16px;
  border-radius: 50px;
}

.line-art i { width: 278px; top: 87px; left: 29px; background: #1b73ae; }
.line-art b { width: 235px; top: 119px; left: 59px; background: #299779; }
.line-art span { width: 171px; top: 55px; left: 102px; background: #e2a32f; }
.line-art i::before, .line-art i::after, .line-art b::after, .line-art span::after {
  content: "";
  display: block;
  position: absolute;
  border: 7px solid;
  border-radius: 50%;
  width: 11px;
  height: 11px;
  top: -4px;
  background: #f1fbff;
}

.line-art i::before { border-color: #1b73ae; left: 38px; }
.line-art i::after { border-color: #1b73ae; right: 70px; }
.line-art b::after { border-color: #299779; left: 53px; }
.line-art span::after { border-color: #e2a32f; right: 47px; }

.layout {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 23px;
  border: 1px solid var(--border);
  border-radius: 21px;
  background: #fff;
}

.panel h2 {
  letter-spacing: -.062em;
  font-size: 1.42rem;
  font-weight: 850;
  line-height: 1.2;
}

.field-hint, #results-context {
  margin-top: 6px;
  font-size: .91rem;
  line-height: 1.45;
  color: var(--muted);
}

.fields { display: grid; gap: 13px; margin: 16px 0 11px; }
.station-field { min-width: 0; }
.field-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 24px;
  margin-bottom: 5px;
}

.field-label label { font-size: .91rem; font-weight: 760; }
.remove {
  min-height: 40px;
  padding: 2px 7px;
  border: 0;
  border-radius: 7px;
  background: #f3f7fa;
  color: #3a5368;
  font-size: .85rem;
}

.station-field input {
  display: block;
  width: 100%;
  min-height: 47px;
  padding: 9px 13px;
  color: var(--ink);
  border: 1px solid #aebfcc;
  border-radius: 11px;
  background: #fafdff;
  font-size: 1rem;
}

.station-field input::placeholder { color: #5b7183; }
.station-field input[aria-invalid="true"] { border-color: var(--error); }
.field-error, .form-message {
  color: var(--error);
  font-size: .88rem;
  line-height: 1.45;
  font-weight: 650;
}

.field-error { margin-top: 6px; }
.form-message { margin: 6px 0 8px; }
.autocomplete { position: relative; }
.options {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 5px) 0 auto;
  display: grid;
  max-height: 200px;
  overflow: auto;
  border: 1px solid #aebfcc;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 15px #29495e2b;
}

.station-field:last-child .options { inset: auto 0 calc(100% + 5px); }

.station-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 43px;
  gap: 10px;
  padding: 7px 11px;
  cursor: pointer;
  border-bottom: 1px solid #e6edf2;
  font-size: .93rem;
  font-weight: 770;
}

.station-option:last-child { border-bottom: 0; }
.station-option:hover, .station-option[aria-selected="true"] { background: #e4f1f9; }
.station-option small { color: var(--muted); text-align: right; font-size: .8rem; }
.primary, .add-button {
  width: 100%;
  border-radius: 11px;
  font-weight: 790;
}

.primary {
  min-height: 51px;
  padding: 9px 14px;
  border: 0;
  color: #fff;
  background: var(--blue);
}

.primary:hover { background: #0c3d5e; }
.add-button {
  min-height: 43px;
  margin-bottom: 11px;
  border: 1px dashed #8dadc1;
  color: #245671;
  background: #f3f9fd;
  font-size: .9rem;
}

.add-button:hover:not(:disabled), .remove:hover { background: #e7f2f8; }
.add-button:disabled {
  border-color: #cddbe4;
  background: #f5f8fa;
  color: #536c7c;
  cursor: default;
}

.result-header { margin-bottom: 14px; }
#results-heading { scroll-margin-top: 16px; }
.result-panel { min-height: 380px; }
.station-results { display: grid; gap: 9px; }
.empty-result {
  min-height: 259px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 12px;
  background: #f2f8fc;
  border: 1px dashed #c0d7e8;
  border-radius: 14px;
}

.empty-result p { color: var(--muted); font-size: .91rem; text-align: center; line-height: 1.45; }

.empty-marker {
  display: block;
  width: 45px;
  height: 45px;
  border: 7px solid #7fb0ce;
  background: #f7fdff;
  border-radius: 50% 50% 50% 7px;
  transform: rotate(-45deg);
  box-shadow: -3px 4px 0 #d6e8f3;
}

.example {
  display: block;
  min-height: 43px;
  margin: 3px auto 0;
  border-radius: 8px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
  color: #215971;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: .87rem;
  font-weight: 720;
}

.example:hover { background: #e6f1f8; }

.result-card {
  padding: 12px 14px;
  border: 1px solid #dce7ef;
  border-radius: 13px;
  background: #f8fbfd;
}

.result-card.best {
  border-color: #9ebfd7;
  background: #e9f4fc;
}

.card-top { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.card-top h3 {
  font-size: clamp(1.15rem, 3.8vw, 1.44rem);
  letter-spacing: -.061em;
  font-weight: 850;
  line-height: 1.24;
}

.best .card-top h3 { font-size: clamp(1.38rem, 5.1vw, 1.86rem); }
.station-area { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.lines { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.lines span {
  border: 1px solid #c0d5e6;
  color: #184765;
  background: #f5fbff;
  padding: 1px 6px 2px;
  border-radius: 99px;
  white-space: nowrap;
  font-size: .76rem;
  font-weight: 760;
}

.lines [data-line="2"] { border-color: #a6cdb2; color: #255c32; background: #eff8ef; }
.lines [data-line="3"] { border-color: #e3bb9b; color: #843b16; background: #fcf0e6; }
.lines [data-line="5"] { border-color: #c5b3df; color: #5a3b83; background: #f5f0fc; }
.lines [data-line="6"] { border-color: #d8bc9e; color: #704219; background: #fcf0e2; }
.lines [data-line="7"] { border-color: #c4c894; color: #4b531c; background: #f4f5e6; }
.lines [data-line="8"] { border-color: #dca9c3; color: #82345c; background: #fcf0f6; }

.maximum {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  padding: 5px 8px;
  border-radius: 9px;
  color: #315367;
  font-variant-numeric: tabular-nums;
}

.best .maximum { color: #4d3a08; background: #fbe6a8; }
.maximum span { font-size: .76rem; font-weight: 720; }
.maximum strong { font-size: 1.15rem; font-weight: 880; }
.best .maximum strong { font-size: 1.32rem; }
.travel-times {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid #c8dae7;
}

.travel-times dt { margin-bottom: 3px; color: var(--muted); font-size: .83rem; }
.time-entry { display: flex; align-items: center; gap: 5px; color: #173e58; font-weight: 750; font-size: .86rem; }
.time-entry input {
  width: 4.1rem;
  min-width: 0;
  min-height: 43px;
  padding: 5px 6px;
  border: 1px solid #9bb6c9;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

.time-entry input[aria-invalid="true"] { border-color: var(--error); }
.route-links { display: flex; flex-wrap: wrap; gap: 2px 6px; }
.route-links a {
  display: inline-flex;
  align-items: center;
  min-height: 43px;
  padding: 4px 2px;
  color: #175478;
  line-height: 1.2;
  text-underline-offset: 3px;
}

.time-controls { margin-top: 12px; }
.time-controls .field-hint:empty { display: none; }
.method {
  margin-top: 14px;
  padding: 0 15px;
  border: 1px solid #c8dbe8;
  border-radius: 11px;
  background: #f5fafd;
  color: #325369;
}

.method summary {
  min-height: 43px;
  padding: 10px 0;
  font-size: .88rem;
  font-weight: 780;
  cursor: pointer;
}

.method p { font-size: .87rem; line-height: 1.55; margin: 0 0 7px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px 15px; margin: 10px 0; }
.sources a { color: #134f76; font-size: .85rem; font-weight: 730; text-underline-offset: 3px; }
.method .checked-on { font-size: .8rem; margin-bottom: 11px; }

@media (hover: hover) and (pointer: fine) {
  .route-links .naver-app { display: none; }
}

@media (max-width: 760px) {
  .shell { width: min(540px, 100% - 28px); padding: 16px 0 26px; }
  .hero { min-height: 108px; border-radius: 18px; margin-bottom: 12px; padding: 16px; }
  .hero-copy { max-width: 90%; }
  .hero h1 { font-size: clamp(2.02rem, 8vw, 2.9rem); }
  .hero p { margin-top: 6px; font-size: .94rem; }
  .line-art { transform: scale(.55); transform-origin: right bottom; right: -41px; opacity: .34; }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 15px; border-radius: 16px; }
  .panel h2 { font-size: 1.28rem; }
  .fields { gap: 11px; margin-top: 12px; }
  .result-panel { min-height: 0; }
  .result-header { margin-bottom: 11px; }
  .empty-result { min-height: 100px; gap: 7px; }
  .empty-marker { width: 29px; height: 29px; border-width: 5px; margin-top: 7px; }
  .travel-times { gap: 8px; }
  .time-entry { justify-content: space-between; }
  .route-links a { min-height: 34px; }
  .method { margin-top: 11px; }
}

@media (max-width: 350px) {
  .shell { width: calc(100% - 20px); }
  .hero-copy { max-width: 100%; }
  .panel { padding-inline: 12px; }
}
