:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --ink: #16243b;
  --muted: #455771;
  --line: #dbe5f0;
  --accent: #1459bc;
  --accent-on: #ffffff;
  --tint: #eff6ff;
  --hover: #84aeee;
  --cover: #133766;
  --scrim: #0c1b35a8;
  font-family: Pretendard, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #101216;
  --surface: #191d24;
  --ink: #edf0f5;
  --muted: #aab3c1;
  --line: #343b46;
  --accent: #8abaff;
  --accent-on: #101926;
  --tint: #212732;
  --hover: #5e86b6;
  --cover: #1a2432;
  --scrim: #06080bc9;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.55; word-break: keep-all; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); text-underline-offset: 4px; }
p, h1, h2, h3, figure { margin: 0; }
small, .note { color: var(--muted); }
[hidden] { display: none !important; }

.masthead { background: var(--page); border-bottom: 1px solid var(--line); }
.mast-inner, main { max-width: 1128px; margin: auto; padding-inline: 28px; }
.mast-inner { height: 66px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 0; font-size: 1.55rem; letter-spacing: -.07em; }
.brand i { display: grid; place-items: center; width: 31px; height: 31px; margin-right: 9px; border-radius: 9px; background: var(--accent); color: var(--accent-on); font-style: normal; font-size: 1rem; }
.brand span { color: var(--accent); }
.quiet, #close, .sheet-actions a, #clockEdit {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px;
  padding: 8px 12px; text-decoration: none; font-size: .875rem; font-weight: 650;
}
main { padding-bottom: 36px; }
.trip-overview { margin-top: 20px; }
.cover { display: grid; align-items: end; min-height: 220px; position: relative; isolation: isolate; overflow: hidden; background: var(--cover); color: white; border-radius: 20px; }
.land { position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(90deg,#0d2a52ed 0%,#153153ab 38%,#14243919 84%), var(--cover-photo); background-size: cover; background-position: center 53%; }
.title { padding: 26px 30px; }
.title small { display: block; color: #e5efff; font-size: .875rem; font-weight: 700; }
.title h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.065em; line-height: 1.1; margin: 6px 0 9px; }
.title em { display: none; }
.title p { color: #eaf1ff; font-size: .9rem; }
.clocks { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin: 12px 0 0; }
.clock-card { position: relative; min-width: 0; border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; background: var(--surface); }
.destination-clock { background: var(--tint); }
.clock-card small, .clock-card b, .clock-card span { display: block; }
.clock-card small, .clock-card span { color: var(--muted); font-size: .84rem; }
.clock-card b { color: var(--accent); font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.05em; font-variant-numeric: tabular-nums; line-height: 1.16; margin: 3px 0; }
#clockEdit { position: absolute; right: 10px; bottom: 10px; min-width: 39px; min-height: 39px; padding: 2px 8px; font-size: 1.1rem; }
.destination-clock #ldate { padding-right: 42px; }

nav { display: flex; gap: 5px; margin: 18px 0 22px; border-bottom: 1px solid var(--line); }
nav button { min-height: 48px; padding: 8px 15px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font-weight: 630; }
nav button[aria-current=true] { border-bottom-color: var(--accent); color: var(--accent); }
.tab-icon { font-size: 1.05rem; margin-right: 6px; }
.dates { display: flex; gap: 8px; overflow: auto; padding: 3px 3px 9px; scroll-padding-inline: 3px; scrollbar-width: thin; }
.dates button { flex: 1; min-width: 65px; padding: 8px 5px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: center; }
.dates span { display: block; color: var(--muted); font-size: .81rem; }
.dates button[aria-pressed=true] { background: var(--accent); color: var(--accent-on); border-color: var(--accent); }
.dates button[aria-pressed=true] span { color: var(--accent-on); }
.day-head { margin: 13px 0; }
.day-head h2, #content > h2 { font-size: 1.55rem; line-height: 1.25; letter-spacing: -.046em; }
.day-head p { margin-top: 4px; color: var(--muted); font-size: .9rem; }
#content > h2 { margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.itinerary-only { grid-template-columns: minmax(0,1fr); }
.stack { display: grid; gap: 13px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 16px; min-width: 0; }
.card h3 { font-size: 1.06rem; letter-spacing: -.025em; }
.kicker { color: var(--accent); font-size: .875rem; font-weight: 700; }
.timeline { display: grid; gap: 0; }
.city-group { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 5px 12px; }
.city-group h3 { color: var(--accent); font-size: .95rem; padding: 5px 4px 3px; }
.city-group + .city-group { margin-top: 9px; }
.city-group .transfer { margin: 2px 0 2px 12px; }
.city-group .option-row { margin: 3px 2px 6px 4px; width: calc(100% - 6px); }
.stop { width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 12px; text-align: left; background: transparent; border: 0; padding: 10px 4px; }
.stop:not(:first-of-type) { border-top: 1px solid var(--line); }
.stop:hover { background: var(--tint); }
.stay-row:hover { border-color: var(--hover); }
.stop-time { color: var(--accent); font-size: .9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stop b, .stop-time i { display: block; }
.stop-time i { font-weight: 500; font-size: .76rem; font-style: normal; color: var(--muted); }
.stop b { font-size: 1rem; }
.stop .preview-detail { font-size: .84rem; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.stop img { width: 69px; height: 64px; border-radius: 8px; object-fit: cover; }
.stop .chevron { color: var(--accent); font-size: 1.4rem; }
.transfer { margin: 0 0 0 28px; padding: 5px 0 5px 12px; border-left: 2px dashed var(--line); min-height: 35px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .84rem; }
.transfer-copy { flex: 1 1 110px; }
.transfer-copy b, .transfer-copy small { display: block; }
.transfer button { border: 0; background: transparent; color: var(--accent); padding: 6px 4px; font-weight: 650; }
.transfer button:hover { text-decoration: underline; }
.add-stop { align-self: start; justify-self: start; }

.weather { background: var(--tint); }
.weather > h3 { margin-bottom: 8px; }
.wx { padding: 10px 0; border-bottom: 1px solid var(--line); }
.wx:last-of-type { margin-bottom: 7px; }
.wx-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wx-head strong { font-size: .9rem; }
.wx-head .quiet { padding: 4px 8px; }
.reading { margin-top: 2px; font-size: .9rem; }
.metric { display: flex; align-items: center; gap: 6px; }
.metric span { font-size: 1.35rem; }
.metric b { font-size: 1.3rem; }
.weather small { display: block; }
.weather .wx-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(235px,100%),1fr)); gap: 10px; }
.weather .wx { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0 0 7px; }

.stay { padding: 14px; }
.stay h3 { margin-bottom: 8px; }
.stay-row { width: 100%; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); background: var(--surface); text-align: left; border-radius: 11px; padding: 7px; margin-top: 6px; }
.stay-row img, .stay-symbol { width: 55px; height: 50px; border-radius: 7px; object-fit: cover; flex: none; }
.stay-symbol { display: grid; place-items: center; background: var(--tint); font-size: 1.25rem; }
.stay-row b, .stay-row small { display: block; }
.stay-row b { overflow-wrap: anywhere; line-height: 1.3; }
.stay-row .chevron { margin-left: auto; padding: 0 5px; font-size: 1.25rem; }
.note { font-size: .84rem; margin-top: 14px; }
progress { accent-color: var(--accent); width: 100%; }
.packrow, details { padding: 10px 0; border-bottom: 1px solid var(--line); }
.packrow { display: flex; gap: 10px; align-items: center; }
.check { flex: 1; display: flex; align-items: center; gap: 8px; }
.check input { accent-color: var(--accent); width: 20px; height: 20px; }
.check:has(:checked) { color: var(--muted); text-decoration: line-through; }
summary { cursor: pointer; font-weight: 740; }
details p { margin: 7px 0; }

dialog { width: min(520px, 94vw); max-height: 88dvh; padding: 19px; border: 1px solid var(--line); border-radius: 19px; background: var(--surface); color: var(--ink); overflow: auto; }
dialog::backdrop { background: var(--scrim); }
dialog h2 { font-size: 1.38rem; line-height: 1.2; margin: 3px 45px 13px 0; overflow-wrap: anywhere; }
#close { float: right; line-height: 1; font-size: 1.3rem; height: 38px; }
dialog form label, dialog form input:not([type=checkbox]), dialog textarea, dialog select { display: block; width: 100%; }
dialog form input:not([type=checkbox]), dialog textarea, dialog select { padding: 8px; margin: 3px 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--page); }
dialog .inline { display: flex; gap: 7px; margin-bottom: 9px; align-items: center; }
dialog form button[type=submit], dialog form button:last-child, #add { background: var(--accent); color: var(--accent-on); border: 0; border-radius: 9px; padding: 8px 13px; }
.tripChoice { display: block; width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.tripChoice small { display: block; }
.description { margin: 9px 0; white-space: pre-line; }
figure { margin: 12px 0; }
figure img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 11px; }
figcaption { color: var(--muted); font-size: .83rem; margin-top: 4px; }
.sheet-actions { display: flex; gap: 7px; flex-wrap: wrap; margin: 10px 0; }

@media (max-width: 760px) {
  .mast-inner, main { padding-inline: 15px; }
  .mast-inner { height: 52px; }
  .trip-overview { margin-top: 12px; }
  .cover { min-height: 145px; border-radius: 15px; }
  .title { padding: 15px; }
  .title h1 { font-size: 2rem; }
  .title small, .title p { font-size: .81rem; }
  .clocks { gap: 8px; margin-bottom: 11px; }
  .clock-card { padding: 9px 10px; }
  #clockEdit { right: 6px; bottom: 6px; min-width: 33px; min-height: 33px; }
  nav { position: fixed; z-index: 3; inset: auto 0 0; margin: 0; padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; border: 0; border-top: 1px solid var(--line); background: var(--surface); }
  nav button { padding: 3px 5px; display: grid; place-items: center; gap: 0; font-size: .81rem; border: 0; border-radius: 9px; flex: 1; }
  nav button[aria-current=true] { background: var(--tint); }
  .tab-icon { margin: 0; }
  main { padding-bottom: calc(75px + env(safe-area-inset-bottom)); }
  .dates button { min-width: 53px; padding: 6px 3px; }
  .day-head { margin: 8px 0 11px; }
  .grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .city-group { padding-inline: 8px; }
  .stop { grid-template-columns: 47px minmax(0,1fr) auto; gap: 8px; }
  .stop img { width: 56px; height: 51px; }
  .transfer { margin-left: 18px; }
  dialog { max-height: 88dvh; }
}
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day-head .quiet { flex: none; min-height: 44px; }
.stay { scroll-margin-top: 14px; }
@media (max-width: 760px) {
  .dates { scrollbar-width: none; }
  .day-head h2 { font-size: 1.36rem; }
}
.option-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 1px 8px; text-align: left; padding: 8px 11px; margin: 4px 0 4px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--tint); }
.option-row small { grid-column: 1; font-size: .81rem; }
.option-row b { grid-column: 1; font-size: .9rem; }
.option-row span { grid-area: 1 / 2 / span 2; align-self: center; font-size: 1.2rem; }
.budget .total { font-size: 2.1rem; font-weight: 750; letter-spacing: -.05em; }
.budget dl { margin: 0 0 12px; }
.budget dl div, .budget-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.budget dd { margin: 0; font-weight: 700; }
.budget-row { background: transparent; border-width: 0 0 1px; width: 100%; text-align: left; }
.budget-row small { display: block; }
.budget-row strong { flex: none; }
.budget-grid { grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); }
.guide-card { margin-bottom: 12px; }
.library-tools { margin-top: 10px; }
.backup-section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.backup-section input { display: block; width: 100%; margin: 8px 0; }
@media (max-width: 760px) {
 .budget-grid { grid-template-columns: minmax(0,1fr); }
 nav button { font-size: .74rem; padding-inline: 2px; }
}
.clothing h3 { color: var(--accent); margin-bottom: 4px; }
.clothing-range { color: var(--muted); font-size: .9rem; }
.clothing dl { display: grid; gap: 6px; margin: 10px 0 0; }
.clothing dl > div { padding: 7px 9px; border-radius: 9px; border: 1px solid var(--line); }
.clothing dt { font-weight: 720; }
.clothing dd { margin: 0; color: var(--muted); font-size: .9rem; }
.clothing .matching-band { background: var(--tint); border-color: var(--hover); }
.rain-advice, .clothing-notes { font-size: .9rem; margin: 8px 0 0; }
.day-actions { display: flex; gap: 6px; flex: none; }
dialog:has(.itinerary-map) { width: min(780px, 95vw); }
.itinerary-map { width: 100%; height: clamp(240px, 43dvh, 430px); border: 1px solid var(--line); border-radius: 12px; background: var(--tint); isolation: isolate; }
.itinerary-map .leaflet-tile-pane { opacity: .97; }
:root[data-theme="dark"] .itinerary-map .leaflet-tile-pane { filter: brightness(.68) saturate(.8); }
.route-flag { display: grid; place-items: center; border: 2px solid white; background: #1459bc; color: white; box-shadow: 0 2px 5px #13254280; border-radius: 50%; font-size: 1.05rem; }
.map-destinations { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 7px; }
.map-destinations button[aria-pressed="true"] { background: var(--tint); border-color: var(--accent); color: var(--accent); }
.route-details p { margin-top: 6px; }
.route-status { margin: 8px 0; }
@media (max-width: 420px) {
 .day-head { align-items: flex-start; flex-direction: column; }
 .day-actions .quiet { min-height: 35px; padding: 5px 9px; }
 .transfer { gap: 5px; }
 .transfer-copy { flex-basis: 90px; }
}

#tripPlayback {
  margin-top: 10px;
  padding: 6px 11px;
  border-radius: 9px;
  border: 1px solid #edf4ffaa;
  background: #14294cbd;
  color: white;
  font-size: .875rem;
  font-weight: 700;
}
dialog:has(.outline-stage) { width: min(760px, 95vw); }
.outline-stage {
  --outline-stroke: #758ba7;
  overflow: hidden;
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 14px;
}
:root[data-theme="dark"] .outline-stage { --outline-stroke: #7d899b; }
.outline-stage[data-playing="true"] { cursor: pointer; }
.outline-caption {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  padding: 8px 12px 0;
}
.playback-stop { font-size: 1rem; }
.playback-skip { color: var(--accent); min-height: 39px; flex: none; }
.outline-map { position: relative; height: clamp(175px, 37vw, 300px); }
.outline-map canvas, .outline-markers { position: absolute; inset: 0; width: 100%; height: 100%; }
.outline-markers { pointer-events: none; }
.outline-flag {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 1px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  pointer-events: auto;
  font-size: .78rem;
  line-height: 1;
}
.outline-flag[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.playback-meter { height: 3px; background: var(--line); }
.playback-meter i { display: block; height: 100%; background: var(--accent); transform-origin: left; }
.weather-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.clothing-trigger { display: inline-grid; place-items: center; padding: 0; width: 44px; height: 44px; font-size: 1.25rem; }
.wx-head .quiet { flex: none; }

.mast-actions { position: relative; }
#headerMenuToggle {
  display: grid; align-content: center; gap: 4px;
  min-width: 43px; min-height: 43px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink);
}
#headerMenuToggle span { display: block; width: 19px; height: 2px; border-radius: 3px; background: currentColor; }
#headerMenuToggle[aria-expanded="true"] { color: var(--accent); border-color: var(--hover); background: var(--tint); }

.header-menu {
  position: absolute; top: calc(100% + 7px); right: 0; z-index: 10;
  width: min(218px, calc(100vw - 30px)); padding: 6px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface); box-shadow: 0 10px 28px #142c4a26;
}
.header-theme {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 7px 7px 10px 9px; margin-bottom: 3px;
  border-bottom: 1px solid var(--line); font-size: .875rem; font-weight: 700;
}
#themeToggle {
  position: relative; isolation: isolate; display: grid; grid-template-columns: repeat(2, 1fr);
  place-items: center; padding: 3px; width: 64px; height: 35px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--tint); color: var(--muted);
  font-family: system-ui, sans-serif; font-size: 1rem; line-height: 1;
}
#themeToggle::before {
  position: absolute; inset: 3px auto 3px 3px; z-index: -1; width: 28px;
  border-radius: 50%; background: var(--accent); content: "";
}
#themeToggle[aria-checked="true"]::before { transform: translateX(28px); }
#themeToggle[aria-checked="false"] .theme-sun,
#themeToggle[aria-checked="true"] .theme-moon { color: var(--accent-on); }
@media (prefers-reduced-motion: no-preference) {
  #themeToggle::before { transition: transform .16s ease; }
}
.header-menu > button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 42px;
  padding: 7px 9px; border: 0; border-radius: 7px; text-align: left;
  background: var(--surface); font-size: .9rem; font-weight: 670;
}
.header-menu > button:hover { background: var(--tint); }
.header-menu > button span { color: var(--accent); font-size: 1rem; }
.settings-choices { display: grid; gap: 8px; }
.settings-choices button { text-align: left; min-height: 42px; }

:root[data-theme="dark"] .land {
  background-image: linear-gradient(90deg, #0b1017e8 0%, #10151eac 37%, #10151e29 87%), var(--cover-photo);
}
:root[data-theme="dark"] .destination-clock { background: var(--surface); }
:root[data-theme="dark"] .weather { background: var(--surface); }
:root[data-theme="dark"] .weather .wx { background: var(--page); }
:root[data-theme="dark"] .dates button[aria-pressed="true"] {
  border-color: var(--hover); background: #25344a; color: var(--accent);
}
:root[data-theme="dark"] .dates button[aria-pressed="true"] span { color: var(--muted); }
:root[data-theme="dark"] .option-row { background: #1e232d; }
:root[data-theme="dark"] .header-menu { box-shadow: 0 14px 32px #0007; }
.outline-map { overflow: hidden; touch-action: none; }
.outline-stage[data-playing="false"] .outline-map { cursor: grab; }
.outline-stage[data-playing="false"] .outline-map:active { cursor: grabbing; }
.outline-zoom { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.outline-zoom button { min-height: 36px; padding: 6px 9px; }
.route-legend { margin-top: 10px; }
.route-legend ol { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(186px,100%),1fr)); gap: 6px 12px; padding-left: 20px; margin-bottom: 0; }
.route-legend li { font-size: .875rem; }
.route-legend li span { display: inline-block; width: 12px; height: 4px; margin: 0 6px 3px 0; border-radius: 2px; }
.outline-stage { --outline-land: #dce9f7; background: #f5f8fc; }
:root[data-theme="dark"] .outline-stage { --outline-land: #354153; background: #1b212a; }
.outline-picker {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 12px 0 7px; padding: 0 1px; font-size: .875rem; font-weight: 700;
}
.outline-picker select {
  flex: 1; max-width: 78%; min-height: 41px; margin: 0; padding: 6px 9px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
}
.outline-details { padding: 10px 13px; }
.outline-details details { padding: 8px 0; }
.outline-details details:last-child { border-bottom: 0; }
.outline-activity-date { display: block; font-weight: 650; }
.outline-activity { margin-top: 6px; }
.outline-activity + .outline-activity { padding-top: 7px; border-top: 1px solid var(--line); }
.outline-activity p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }

.offline-banner {
 margin-top: 12px; padding: 8px 12px; border: 1px solid var(--line);
 border-radius: 10px; background: var(--tint); color: var(--ink); font-size: .875rem;
}
.saved-forecast { display: block; margin-top: 3px; color: var(--accent); }
