:root {
  --ink: #252b57;
  --ink-2: #3c4270;
  --ink-3: #5a5f85;
  --mute: #6b7096;
  --line: #8e93b3;
  --soft: #eef0fa;
  --soft-2: #f4f5fb;
  --red: #d92f3e;
  --yellow: #ffc933;
  --teal: #0b7a6f;
  --blue: #2e5fd8;
  --mint: #dff5ee;
  --cream: #fff0bf;
  --river: #c6e7f6;
  --grass: #d5efb2;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--soft);
  scrollbar-color: var(--line) transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}

::selection { background: var(--yellow); color: var(--ink); }

h1, h2, h3, p, ol { margin: 0; padding: 0; }

button, input { font: inherit; color: inherit; }

button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled { cursor: default; }

:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--grass);
}

/* 지도 위 머리 */

.top {
  position: absolute;
  z-index: 1;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.top h1 {
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.top p {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.top p svg { display: block; flex: none; margin: -2px 0 -2px -3px; }

/* 지도 */

.mapbox { position: relative; }

#map { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }

.map-spot { position: absolute; inset: 0 0 52px; pointer-events: none; }

#map text { text-anchor: middle; }

#route path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
#route .case { stroke: #fff; stroke-width: 9; }
#route .line { stroke: var(--red); stroke-width: 5.5; }
#route .line.later { stroke-dasharray: 1 9; }
#route .ride { stroke: var(--blue); stroke-width: 5.5; }
#route .draw { stroke-dasharray: 1; animation: draw .6s var(--ease); }

@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.step rect { fill: #fff; stroke: var(--ink); stroke-width: 1; }
.step text { font-size: 12px; font-weight: 700; fill: var(--ink); }
.step.hot rect { fill: var(--red); stroke: #fff; stroke-width: 1.6; }
.step.hot text { font-weight: 800; fill: #fff; }

.hit { fill: transparent; pointer-events: all; }

.pin { cursor: pointer; outline: none; }
.pin:focus-visible .hit { stroke: var(--red); stroke-width: 3; }
.pin .face { transition: transform .2s var(--ease); transform-box: fill-box; transform-origin: center; }
.pin:active .face { transform: scale(.96); }
.pin.pop .face { animation: pop .36s var(--ease); }

@keyframes pop { from { transform: scale(.82); } to { transform: scale(1); } }

.pill { fill: #fff; stroke: var(--ink); stroke-width: 1.8; }
.pill.must { fill: var(--yellow); }
.pill.later { stroke-dasharray: 4 3; }
.pill.now { fill: var(--ink); }
.pill-t { font-size: 14px; font-weight: 800; fill: var(--ink); }
.pill-t.now { fill: #fff; }
.pill-now { font-size: 12px; font-weight: 700; fill: var(--yellow); }
.dot { fill: var(--red); }
.dot-t { font-size: 12px; font-weight: 800; fill: #fff; }
.plus { fill: #e9ecf8; }
.plus-t { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.start { fill: var(--teal); }
.start-t { font-size: 12px; font-weight: 800; fill: #fff; }

/* 시연 전환. 앱 화면이 아니라서 시트 위에 작게 얹는다 */

.demo {
  position: absolute;
  z-index: 1;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 7px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.demo button { pointer-events: auto; display: flex; align-items: center; height: 44px; }

.switch { display: flex; align-items: center; }

.switch button span {
  display: block;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  background: #fff;
  border: 2px solid var(--ink);
}

.switch button:first-child span { border-radius: 999px 0 0 999px; border-right-width: 0; }
.switch button:last-child span { border-radius: 0 999px 999px 0; }
.switch button[aria-pressed="true"] span { background: var(--ink); color: #fff; }

.tag-demo {
  margin-right: auto;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  white-space: nowrap;
  background: rgba(255, 255, 255, .86);
  border-radius: 999px;
}

.hint-btn span {
  display: block;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  white-space: nowrap;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
}

/* 시트 */

.sheet {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 372px;
  margin-top: -28px;
  background: #fff;
  border-top: 2px solid var(--ink);
  border-radius: 26px 26px 0 0;
}

.sheet-in {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px;
}

.meter {
  position: sticky;
  z-index: 1;
  top: 0;
  margin: 0 -16px;
  padding: 14px 16px 2px;
  background: #fff;
  border-radius: 26px 26px 0 0;
}

#meter { display: flex; flex-direction: column; gap: 8px; }

.meter p {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.sum { color: var(--red); }
.sep { font-weight: 500; color: var(--ink-3); }

.bar {
  display: flex;
  height: 14px;
  overflow: hidden;
  background: var(--soft);
  border: 2px solid var(--ink);
  border-radius: 999px;
}

.bar i {
  flex: none;
  display: block;
  background: var(--red);
  border-right: 2px solid var(--ink);
  transition: width .3s var(--ease);
}

.start-row { display: flex; align-items: center; gap: 10px; min-height: 32px; }
.start-row strong { font-size: 16px; font-weight: 800; }

.go-tag {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 24px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: var(--teal);
  border-radius: 999px;
}

.empty {
  padding: 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
}

.stops { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.stops li { display: flex; flex-direction: column; gap: 2px; }

.row { display: flex; align-items: center; gap: 10px; min-height: 46px; }

.no {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  background: var(--red);
  border-radius: 50%;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 46px;
  justify-content: center;
  text-align: left;
  border-radius: 10px;
}

.l1 { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 7px; line-height: 1.15; }
.l1 strong { font-size: 17px; font-weight: 800; }

.steps {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}

.steps.ride { color: var(--blue); }

.l2 { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-height: 19px; }

.tag {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  white-space: nowrap;
  border-radius: 999px;
}

.tag.must { background: var(--yellow); border: 1.5px solid var(--ink); }
.tag.later { background: #fff; border: 1.5px dashed var(--ink); }

.more {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-3);
}

.more svg { display: block; transition: transform .2s var(--ease); }
.more.open svg { transform: rotate(180deg); }

.ctrl { display: flex; gap: 4px; flex: none; }

.ic {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--soft);
  border-radius: 14px;
  transition: background-color .15s;
}

.ic svg { display: block; }
.ic:disabled { background: var(--soft-2); color: var(--line); }

@media (hover: hover) {
  .ic:not(:disabled):hover { background: #dfe3f5; }
  .main:hover .more { color: var(--ink); }
  .cta:not(:disabled):hover { filter: brightness(1.06); }
  .pin:hover .pill { stroke-width: 2.6; }
  .chip:hover { background-color: #dfe3f5; }
  .chip.sel:hover { background-color: var(--yellow); }
  .chip.later.sel:hover { background-color: #fff; }
  .switch button:hover span, .hint-btn:hover span { background: var(--soft); }
  .switch button[aria-pressed="true"]:hover span { background: var(--ink); }
  .ghost:not(:disabled):hover, .text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
}

.subway {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-left: 42px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  background: #e6edfd;
  border-radius: 14px;
  cursor: pointer;
}

.subway svg { display: block; flex: none; }
.subway span { flex: 1; }

.subway input {
  appearance: none;
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .2s;
}

.subway input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--ink);
  border-radius: 50%;
  transition: transform .2s var(--ease), background-color .2s;
}

.subway input:checked { background: var(--blue); }
.subway input:checked::after { transform: translateX(18px); background: #fff; }

.memo-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: 42px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink-2);
}

.memo-line svg { display: block; flex: none; }
.memo-line.flat { margin-left: 0; }

.edit { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 6px 42px; scroll-margin-bottom: 104px; }

.chips { display: flex; gap: 6px; }

.chip {
  flex: 1;
  height: 44px;
  font-size: 14px;
  font-weight: 700;
  background: var(--soft);
  border: 1.5px solid transparent;
  border-radius: 14px;
}

.chip.must.sel { background: var(--yellow); border-color: var(--ink); }
.chip.later.sel { background: #fff; border: 1.5px dashed var(--ink); }

.memo {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  font-size: 16px;
  font-weight: 500;
  caret-color: var(--red);
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}

.memo::placeholder { color: var(--mute); opacity: 1; }

.over {
  padding: 10px 13px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}

.over b { display: block; font-size: 16px; font-weight: 800; }

/* 저장 버튼은 코스가 길어져도 화면 아래에 남는다 */

.foot {
  position: sticky;
  z-index: 1;
  bottom: 0;
  margin: auto -16px 0;
  padding: 0 16px calc(26px + env(safe-area-inset-bottom));
  background: #fff;
  box-shadow: 0 -8px 0 #fff;
}

#save-box { display: flex; flex-direction: column; gap: 8px; }

.saved {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 4px 13px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  background: var(--mint);
  border-radius: 14px;
}

.text-btn {
  flex: none;
  min-height: 44px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cta {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .1s, box-shadow .1s;
}

.cta svg { display: block; flex: none; }
.cta:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.cta:disabled { color: var(--mute); background: var(--soft); border-color: var(--line); box-shadow: none; }

/* 강사 시트 */

.head { display: flex; flex-direction: column; gap: 5px; padding-top: 12px; }

.head h2, .none h2 { font-size: 24px; font-weight: 800; line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }

.star { display: flex; align-items: flex-start; gap: 5px; font-size: 14px; font-weight: 600; line-height: 1.3; }
.star svg { display: block; flex: none; }

.blk { display: flex; flex-direction: column; gap: 5px; }

.blk h3, .next h3 { font-size: 13px; font-weight: 700; line-height: 1.2; color: var(--ink-2); }

.base {
  padding: 10px 13px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  background: var(--mint);
  border-radius: 14px;
}

.q {
  padding: 9px 13px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
}

.surprise {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 13px;
  background: var(--cream);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}

.surprise h3 { font-size: 13px; font-weight: 800; line-height: 1.2; }
.surprise p { font-size: 15px; font-weight: 600; line-height: 1.35; }

.ask {
  padding: 10px 13px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  background: var(--river);
  border: 1.5px solid var(--ink);
  border-radius: 14px;
}

.ask b { display: block; margin-bottom: 2px; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }

.next { display: flex; align-items: center; gap: 10px; }
.next > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.next p { font-size: 15.5px; font-weight: 800; line-height: 1.25; }

.thumb {
  flex: none;
  display: block;
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
}

.none { display: flex; flex-direction: column; gap: 8px; padding-top: 20px; }
.none p { font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink-2); }

/* 힌트 */

.hint[hidden] { display: none; }

.dim {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(22, 26, 62, .74);
}

.ring {
  position: fixed;
  z-index: 41;
  border: 3px solid #fff;
  pointer-events: none;
}

.card {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(326px, calc(100vw - 24px));
  padding: 14px 16px 8px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  outline: none;
}

.tip {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-color: var(--ink);
  border-style: solid;
  border-width: 0;
}

.tip.up { top: -11px; border-left-width: 2px; border-top-width: 2px; transform: rotate(45deg); border-radius: 3px 0 0 0; }
.tip.dn { bottom: -11px; border-right-width: 2px; border-bottom-width: 2px; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.tip[hidden] { display: none; }

.count {
  align-self: flex-start;
  padding: 5px 9px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  background: var(--yellow);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.say { font-size: 17px; font-weight: 700; line-height: 1.4; text-wrap: balance; }
.say-note { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--ink-2); }

.card-btns { display: flex; justify-content: space-between; align-items: center; }
.card-btns > span { display: flex; align-items: center; gap: 4px; }

.ghost {
  min-width: 64px;
  height: 44px;
  padding: 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--mute);
  text-align: left;
}

.ghost.stop { min-width: 72px; font-weight: 700; color: var(--ink); text-align: right; }
.ghost:disabled { opacity: .6; }

.go {
  min-width: 72px;
  height: 44px;
  margin: 0 -6px 0 6px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: var(--ink);
  border-radius: 14px;
}

/* 지도는 폭을 따라 줄어드는데 머리 표는 그대로라, 좁은 폰에서 역 이름을 가리지 않게 줄인다 */
@media (max-width: 379px) {
  .top { top: 6px; left: 8px; right: 8px; }
  .top h1 { padding: 7px 11px; font-size: 14px; }
  .top p { padding: 7px 11px; font-size: 13px; }
}

@media (min-width: 600px) {
  .app { max-width: 390px; box-shadow: 0 0 0 2px var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
