:root {
  color-scheme: only light;
  font-family: "Pretendard", "Malgun Gothic", sans-serif;
  color: #303637;
  background: #fafaf9;
  --orange: #e97627;
  --teal: #448b90;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: #fafaf9; }
body { min-height: 100svh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--teal); outline-offset: 4px;
}
main { max-width: 1080px; margin: auto; padding: 34px 28px 48px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #4e5555; text-decoration: none; font-size: 16px; font-weight: 700; }
.brand b { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--orange); color: white; }
h1 { font-size: 36px; letter-spacing: -1.5px; margin: 0; font-weight: 800; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 48px 0 22px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.secondary { background: #fff; border: 1px solid #e3e5e2; border-radius: 24px; padding: 10px 17px; font-size: 12px; }
.secondary:hover { border-color: #d3b49d; }
.text-button { border: 0; background: transparent; padding: 8px 0 8px 10px; color: #8d9692; font-size: 11px; }
.status-row { display: flex; gap: 11px; align-items: center; font-size: 11px; color: #979e99; margin-bottom: 16px; }
.status-row .text-button { margin-left: auto; }
.pill { background: #fff0e5; color: #bb6529; padding: 5px 9px; border-radius: 6px; font-size: 10px; }
.notice { color: #976e43; background: #fff3e6; padding: 12px 16px; border-radius: 10px; font-size: 12px; line-height: 1.7; }
.map-panel { background: #fff; border: 1px solid #ecece8; border-radius: 22px; padding: 26px 26px 14px; }
.map-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #a4aaa4; font-size: 10px; }
#map-direction { color: #bb6d33; font-size: 12px; font-weight: 700; }
.station-labels { position: relative; height: 98px; margin-top: 22px; }
.station-label { position: absolute; top: 23px; transform: translateX(-50%); text-align: center; width: 24%; }
.station-label small { display: block; color: #a2aaa4; font-size: 10px; margin-bottom: 9px; }
.station-label strong { font-size: 19px; letter-spacing: -.6px; }
.station-label.mine strong { color: #df6c1e; }
.station-label.mine small { display: inline-block; background: #fff0e4; color: #c16c31; padding: 3px 9px; margin-top: -3px; margin-bottom: 6px; border-radius: 10px; }
.station-label.mine strong { display: block; }
.track-lane { position: relative; margin-bottom: 12px; color: var(--orange); }
.opposite-lane { color: var(--teal); }
.lane-caption { position: absolute; top: -10px; left: 8%; font-size: 9px; opacity: .65; }
.track-line { position: absolute; top: 34px; height: 4px; left: 8%; right: 8%; background: #f4c9a8; border-radius: 4px; }
.opposite-lane .track-line { background: #d3e6e5; }
.track-dot { position: absolute; top: 36px; transform: translate(-50%,-50%); width: 12px; height: 12px; border: 3px solid currentColor; border-radius: 50%; background: #fff; }
.track-dot.mine { box-shadow: 0 0 0 5px #fff0e4; width: 15px; height: 15px; }
.opposite-lane .track-dot.mine { box-shadow: 0 0 0 5px #edf5f4; }
.horizontal-train { position: absolute; z-index: 2; transform: translate(-50%,-15px); width: 74px; text-align: center; font-size: 10px; }
.horizontal-train { border: 0; padding: 0; background: transparent; color: inherit; touch-action: manipulation; }
.horizontal-train.uncertain { color: #a2a9a4; }
.lane-pages { position: absolute; right: 5%; top: -19px; display: flex; gap: 5px; align-items: center; z-index: 3; font-size: 9px; }
.lane-pages button { width: 30px; height: 28px; background: #fff; border: 1px solid #e9ece7; border-radius: 7px; font-size: 18px; padding: 0; }
.train-symbol { display: block; position: relative; width: 37px; height: 27px; line-height: 25px; font-size: 19px; font-weight: 800; margin: 0 auto 6px; border: 2px solid currentColor; border-radius: 8px 8px 5px 5px; background: #fff8f1; box-shadow: 0 2px 0 currentColor; }
.opposite-lane .train-symbol { background: #f2f9f8; }
.horizontal-train strong { display: block; font-weight: 600; font-size: 10px; background: #fff; border-radius: 4px; }
.horizontal-train small { display: block; font-size: 8px; color: #929b94; background: #fff; }
.train-stem { position: absolute; left: calc(50% - 1px); bottom: calc(100% - 15px); width: 1px; background: currentColor; opacity: .25; z-index: -1; }
.uncertain { color: #a2a9a4; }
.uncertain .train-symbol { background: #f7f8f6; }
.segment-distances { position: relative; height: 48px; margin: 0 0 16px; }
.segment-distance { position: absolute; transform: translateX(-50%); text-align: center; font-size: 10px; color: #9fa79f; }
.segment-distance small { display: block; font-size: 9px; margin-top: 5px; }
.nearby-trains { border-top: 1px solid #f0f1ed; }
.nearby-trains:empty { border: 0; }
.nearby-train { display: grid; grid-template-columns: 155px 1fr auto; align-items: center; gap: 10px; padding: 13px 0; border-bottom: 1px solid #f3f3ef; font-size: 11px; }
.nearby-train:last-child { border-bottom: 0; }
.nearby-train strong { font-size: 11px; font-weight: 600; }
.nearby-train span { color: #8a948b; }
.nearby-train small { font-size: 9px; color: #a0a8a0; }
#map-empty { text-align: center; color: #a1a8a1; font-size: 12px; margin: 8px 0; }
#map-empty:empty { display: none; }
.setup { max-width: 400px; margin: 70px auto 30px; }
.setup h1 { font-size: 29px; margin-bottom: 32px; }
.setup label:not(fieldset label) { display: block; font-size: 12px; color: #808c81; margin: 22px 0 9px; }
.setup input[type=search], .setup select { width: 100%; padding: 14px; border: 1px solid #e0e5dd; border-radius: 10px; background: #fff; font-size: 14px; }
.setup fieldset { border: 0; padding: 0; margin: 24px 0; }
.setup legend { color: #808c81; font-size: 12px; margin-bottom: 13px; }
.setup fieldset label { font-size: 13px; margin-right: 22px; }
.setup input[type=radio] { accent-color: var(--orange); }
.primary { border: 0; border-radius: 10px; background: var(--orange); color: #fff; width: 100%; padding: 14px; font-weight: 700; }
@media (max-width: 600px) {
  main { padding: 23px 12px 30px; }
  .brand { margin-left: 5px; font-size: 14px; }
  .title-row { margin: 30px 4px 20px; gap: 8px; }
  h1 { font-size: 27px; }
  .actions { gap: 5px; }
  .secondary { font-size: 10px; padding: 8px 10px; }
  .map-panel { padding: 18px 10px 9px; border-radius: 16px; }
  .map-heading { font-size: 8px; gap: 4px; }
  #map-direction { font-size: 10px; }
  .station-label strong { font-size: 13px; letter-spacing: -.8px; }
  .station-label small { font-size: 8px; }
  .station-label.mine small { padding: 3px 6px; }
  .station-labels { height: 88px; margin-top: 14px; }
  .horizontal-train { width: 54px; }
  .horizontal-train strong { font-size: 8px; }
  .train-symbol { width: 30px; height: 24px; line-height: 21px; font-size: 16px; }
  .nearby-train { grid-template-columns: 1fr auto; gap: 6px; padding: 12px 4px; font-size: 10px; }
  .nearby-train span { grid-column: 1 / -1; grid-row: 2; }
  .nearby-train strong { font-size: 10px; }
  .nearby-train small { font-size: 8px; }
  .setup { margin: 45px 12px 20px; max-width: none; }
}
/* Phone layout: the map owns the remaining viewport, never a scroll region. */
@media all {
  html, body { height: 100%; min-height: 0; overflow: hidden; overscroll-behavior: none; }
  body { height: 100dvh; }
  main { height: 100%; height: min(812px, 100dvh); min-height: 0; width: 100%; max-width: 375px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 8px; }
  .brand { flex: 0 0 25px; align-self: flex-start; font-size: 13px; gap: 7px; margin: 0 3px; }
  .brand b { width: 25px; height: 25px; }
  #dashboard { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .title-row { flex: 0 0 42px; margin: 0 2px 5px; }
  h1 { font-size: 25px; }
  .secondary { min-height: 36px; padding: 8px 11px; font-size: 11px; }
  .status-row { flex: 0 0 30px; margin: 0 2px 6px; gap: 7px; }
  .status-row .text-button { min-height: 30px; padding-block: 6px; }
  .notice { flex: 0 0 auto; padding: 7px 10px; font-size: 10px; line-height: 1.4; margin: 0 0 6px; max-height: 42px; overflow: hidden; }
  .map-panel { flex: 1; min-height: 0; padding: 14px 10px 10px; display: flex; flex-direction: column; }
  .map-heading { flex: 0 0 18px; }
  #route { display: grid; flex: 1; min-height: 0; grid-template-rows: 60px minmax(105px, 1fr) minmax(105px, 1fr) 34px 55px; }
  .station-labels { height: auto; margin: 0; }
  .station-label { top: 12px; }
  .station-label strong { font-size: 13px; }
  .station-label small { margin-bottom: 6px; }
  .track-lane { min-height: 0; margin: 0; align-self: stretch; }
  .track-line { top: 28px; }
  .track-dot { top: 30px; }
  .lane-caption { top: 0; }
  .lane-pages { top: -10px; }
  .horizontal-train { width: 56px; min-height: 44px; }
  .train-symbol { width: 30px; height: 23px; line-height: 20px; font-size: 16px; margin-bottom: 4px; }
  .horizontal-train strong { font-size: 9px; }
  .horizontal-train small { font-size: 8px; }
  .segment-distances { height: auto; margin: 0; }
  .segment-distance { font-size: 9px; }
  .segment-distance small { font-size: 8px; margin-top: 4px; }
  .nearby-trains { min-width: 0; min-height: 0; }
  .nearby-train { height: 55px; min-width: 0; padding: 7px 1px; gap: 4px; grid-template-columns: minmax(0,1fr) auto; }
  .nearby-train strong { font-size: 10px; white-space: nowrap; }
  .nearby-train span { font-size: 9px; white-space: nowrap; letter-spacing: -.2px; }
  .nearby-train small { font-size: 8px; }
  #map-empty { flex: 0 0 18px; margin: 0; font-size: 10px; }
  .setup { flex: 1; min-height: 0; width: 100%; max-width: 400px; margin: 10px auto 0; padding: 0 8px; }
  .setup h1 { font-size: 25px; margin: 8px 0 16px; }
  .setup label:not(fieldset label) { margin: 12px 0 6px; }
  .setup input[type=search], .setup select { padding: 10px 12px; height: 44px; font-size: 16px; }
  .setup fieldset { margin: 17px 0; }
  .setup legend { margin-bottom: 10px; }
  .setup fieldset label { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; }
  .primary { min-height: 44px; padding: 12px; }
  #cancel-setup { min-height: 36px; padding: 8px 0; }
}
@media (max-height: 560px) {
  main { gap: 4px; padding-block: 6px; }
  main:has(#station-search:focus) .brand { display: none; }
  .setup { margin-top: 0; }
  .setup h1 { margin: 0 0 6px; font-size: 21px; }
  .setup label:not(fieldset label) { margin: 6px 0 3px; }
  .setup fieldset { margin: 6px 0; }
  .setup legend { margin-bottom: 3px; }
  .setup input[type=search], .setup select { height: 40px; padding-block: 7px; }
  .setup fieldset label { min-height: 26px; }
  .title-row { flex-basis: 36px; margin-bottom: 0; }
  #route { grid-template-rows: 51px minmax(105px,1fr) minmax(105px,1fr) 28px 48px; }
  .nearby-train { height: 48px; padding-block: 4px; }
  .map-panel { padding-block: 10px; }
}
