/* ===== Tokens ===== */
:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f1eee8;
  --text: #171b26;
  --muted: #4f5667;
  --line: #e0dcd3;
  --navy: #14213d;
  --navy-2: #1d2d52;
  --red: #cd2e3a;
  --blue: #0047a0;
  --accent: #0047a0;
  --frost: #dde8fb;
  --cold: #e4edf9;
  --cool: #e6f1ec;
  --mild: #f6efdc;
  --warm: #fbe6d6;
  --good: #1a7f45;
  --ok: #8a6600;
  --warn: #b35200;
  --bad: #b3261e;
  --selected: #14213d;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(20 33 61 / 6%), 0 6px 20px rgb(20 33 61 / 6%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131e; --surface: #161d2b; --surface-2: #1f2839; --text: #edf0f6; --muted: #b3bbcc;
    --line: #2b3549; --accent: #8db8ff; --frost: #1d2c4b; --cold: #1c2a42; --cool: #1b2e2a;
    --mild: #2e2a1c; --warm: #3a271b; --good: #6fd99b; --ok: #ecc95a; --warn: #ffab6b; --bad: #ff8f86;
    --shadow: 0 1px 0 rgb(255 255 255 / 3%) inset;
    --selected: #2e4f99;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131e; --surface: #161d2b; --surface-2: #1f2839; --text: #edf0f6; --muted: #b3bbcc;
  --line: #2b3549; --accent: #8db8ff; --frost: #1d2c4b; --cold: #1c2a42; --cool: #1b2e2a;
  --mild: #2e2a1c; --warm: #3a271b; --good: #6fd99b; --ok: #ecc95a; --warn: #ffab6b; --bad: #ff8f86;
  --shadow: 0 1px 0 rgb(255 255 255 / 3%) inset;
  --selected: #2e4f99;
}

/* ===== Base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a, button, label, input { touch-action: manipulation; }
.ko, [lang="ko"] { font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif; word-break: keep-all; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .6em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.12rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1.1em 0 .5em; }
h2 .icon, h3 .icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: .3em; color: var(--red); }
p { margin: 0 0 .8em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 50; background: var(--surface); padding: 8px 12px; }
.big { font-size: 1.6em; font-weight: 700; letter-spacing: -.01em; }
.icon { width: 1.25em; height: 1.25em; flex: none; display: inline-block; }
.lo { color: var(--muted); font-weight: 500; }
.page { flex: 1; width: 100%; min-width: 0; padding-top: 28px; padding-bottom: 32px; }
.strip, .day-picker { max-width: 100%; min-width: 0; }

/* ===== Header and nav ===== */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top); box-shadow: 0 1px 0 rgb(255 255 255 / 6%); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.logo-mark { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 2px 6px rgb(0 0 0 / 30%)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em; }
.brand-year { font-weight: 500; color: #ff8a92; margin-left: 2px; }
.brand-sub { font-size: .72rem; color: rgb(255 255 255 / 65%); letter-spacing: .12em; margin-top: 3px; }
.nav { display: flex; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 7px; color: rgb(255 255 255 / 75%); text-decoration: none; font-weight: 500; font-size: .95rem; padding: 8px 13px; border-radius: 999px; }
.nav a .icon { width: 18px; height: 18px; }
.nav a:hover { color: #fff; background: rgb(255 255 255 / 8%); }
.nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / 15%); }
@media (max-width: 800px) {
  .topbar-inner { justify-content: center; min-height: 56px; }
  .logo-mark { width: 32px; height: 32px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(6, 1fr);
    box-shadow: 0 -4px 20px rgb(0 0 0 / 10%);
  }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 2px; border-radius: 12px; color: var(--muted); font-size: .7rem; font-weight: 600; }
  .nav a .icon { width: 22px; height: 22px; }
  .nav a:hover { background: none; color: var(--text); }
  .nav a[aria-current="page"] { color: var(--red); background: color-mix(in srgb, var(--red) 11%, transparent); }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  html { scroll-padding-top: 68px; }
}

/* ===== Hero (home) ===== */
.hero {
  background:
    radial-gradient(1100px 380px at 110% -20%, rgb(205 46 58 / 38%), transparent 60%),
    radial-gradient(900px 380px at -10% 120%, rgb(0 71 160 / 48%), transparent 60%),
    var(--navy);
  color: #fff; padding: 40px 0 72px;
}
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; margin-bottom: .5em; }
.hero .eyebrow { opacity: .75; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.3rem); letter-spacing: -.025em; margin-bottom: .3em; }
.hero h1 .ko { font-size: .48em; font-weight: 500; opacity: .7; vertical-align: middle; margin-left: .25em; }
.hero .lede { opacity: .88; }
.hero-row { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-end; justify-content: space-between; margin-top: 22px; }
.status small { display: block; opacity: .75; font-size: .88rem; }
.clocks { display: flex; gap: 22px; align-items: flex-end; }
.clocks div { display: flex; flex-direction: column; }
.clocks small { opacity: .7; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.clocks span { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.clock-note { font-size: .82rem; opacity: .7; align-self: center; }

/* ===== Page header ===== */
.page-head { margin: 4px 0 24px; }
.page-head .eyebrow { color: var(--red); }
.page-head h1 { font-size: clamp(1.8rem, 5vw, 2.5rem); letter-spacing: -.02em; margin-bottom: .3em; }
.page-head .lede { color: var(--muted); max-width: 62ch; font-size: 1.02rem; }
.section-title { font-size: 1.25rem; margin: 36px 0 14px; }

/* ===== Building blocks ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); margin-top: 18px; }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); margin-top: 18px; }
.btn {
  font: inherit; font-size: .92rem; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 9px 16px; cursor: pointer; text-decoration: none;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn:disabled:hover { border-color: var(--line); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { border-color: var(--red); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.pill { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; background: var(--red); color: #fff; border-radius: 999px; padding: 2px 9px; vertical-align: middle; }
.badge { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 6px 14px; font-size: .95rem; margin: 8px 0 4px; }
.badge .icon { color: var(--accent); }
.livebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 0; }
.livebar p { margin: 0; font-size: .88rem; }
.icon-list { list-style: none; padding: 0; margin: 0 0 .8em; }
.icon-list li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.icon-list li:last-child { border-bottom: 0; }
.icon-list .icon { color: var(--accent); margin-top: 2px; }
.plain-list { margin: 0 0 .8em; padding-left: 1.2em; }
.plain-list li { margin-bottom: .35em; }

/* ===== Home ===== */
.next { margin-top: -72px; }
.next-card { border-top: 4px solid var(--red); padding: 24px 26px; }
.eyebrow-dark { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--red); margin-bottom: .4em; }
.next-card h2 { font-size: 1.6rem; margin-bottom: .2em; }
.mini-timeline { list-style: none; padding: 0; margin: 14px 0; }
.mini-timeline li { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-timeline .t { min-width: 76px; font-size: .85rem; font-weight: 700; color: var(--accent); padding-top: 1px; }
.next-wear { display: flex; gap: 10px; align-items: flex-start; background: var(--cold); border-radius: 12px; padding: 12px 14px; }
.next-wear .icon { color: var(--accent); margin-top: 2px; }
.next-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.strip { scroll-snap-type: x proximity; display: grid; grid-template-columns: repeat(6, minmax(92px, 1fr)); gap: 10px; overflow-x: auto; padding: 2px 2px 8px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 6px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--accent); }
.tile.is-today { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.tile-day { font-size: .82rem; font-weight: 600; color: var(--muted); }
.tile-icon .icon { width: 30px; height: 30px; color: var(--accent); margin: 4px 0; }
.tile-temp { font-weight: 700; font-size: 1.05rem; }
.tile-temp .lo { margin-left: 5px; }
.tile-place { font-size: .75rem; color: var(--muted); }
.shortcuts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 24px; }
.shortcut { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; padding: 18px; }
.shortcut:hover { border-color: var(--accent); }
.shortcut-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); flex: none; }
.shortcut-icon .icon { width: 24px; height: 24px; }
.shortcut small { display: block; color: var(--muted); font-size: .88rem; margin-top: 2px; }
.shortcut-go { margin-left: auto; color: var(--muted); }

/* ===== Day picker (Days + Weather) ===== */
.day-picker { scroll-snap-type: x proximity; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(92px, 1fr); gap: 10px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; }
.day-picker::-webkit-scrollbar { display: none; }
.chip { font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip-day { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.chip-date { font-weight: 600; font-size: .95rem; }
.chip-icon { min-height: 30px; display: grid; place-items: center; }
.chip-icon .icon { width: 24px; height: 24px; color: var(--accent); }
.chip-temp { font-size: .82rem; font-weight: 600; min-height: 1.3em; }
.chip.is-today { border-color: var(--red); }
.chip[aria-selected="true"] { background: var(--selected); border-color: var(--selected); color: #fff; }
.chip[aria-selected="true"] .chip-day, .chip[aria-selected="true"] .lo { color: rgb(255 255 255 / 70%); }
.chip[aria-selected="true"] .chip-icon .icon { color: #fff; }
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }

.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.day-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.day-num { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--red); }
.day-head h2 { font-size: 1.55rem; margin: 4px 0 2px; }
.day-date { margin: 0; color: var(--muted); }
.day-head .muted.small { margin: 6px 0 0; }
.timeline { list-style: none; margin: 0; padding: 20px 24px 6px; }
.timeline li { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 0 0 18px; }
.timeline li + li { border-top: 1px solid var(--line); padding-top: 16px; }
.timeline .t { font-size: .85rem; font-weight: 700; color: var(--accent); padding-top: 2px; font-variant-numeric: tabular-nums; }
.timeline strong { font-size: 1.05rem; }
.timeline p { margin: 4px 0 0; color: var(--muted); }
.meal { display: flex; gap: 10px; align-items: center; margin: 0 24px 18px; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; font-weight: 500; }
.meal .icon { color: var(--accent); }
.wear-link { display: flex; align-items: center; gap: 14px; margin: 0 24px 24px; padding: 16px 18px; border-radius: 14px; text-decoration: none; color: var(--text); background: var(--cold); }
.wear-link.tone-frost { background: var(--frost); } .wear-link.tone-cool { background: var(--cool); }
.wear-link.tone-mild { background: var(--mild); } .wear-link.tone-warm { background: var(--warm); }
.wear-link-icon { color: var(--accent); }
.wear-link small { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.wear-link-go { margin-left: auto; color: var(--muted); }

/* ===== Weather ===== */
.wx-day-body { display: grid; gap: 18px; padding: 20px 24px 24px; }
@media (min-width: 860px) { .wx-day-body { grid-template-columns: 1fr 1.1fr; align-items: start; } }
.wx.card { background: var(--surface-2); border: 0; box-shadow: none; }
.wx-main { display: flex; align-items: center; gap: 16px; }
.wx-icon .icon { width: 56px; height: 56px; color: var(--accent); stroke-width: 1.6; }
.wx-temp { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.wx-text { color: var(--muted); }
.wx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 18px; margin: 20px 0 14px; }
.stat { display: flex; gap: 10px; align-items: flex-start; }
.stat-icon { color: var(--muted); padding-top: 2px; }
.stat dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.stat dd { margin: 0; font-weight: 600; }
.wx-kind { font-size: .85rem; color: var(--muted); margin: 0; border-top: 1px solid var(--line); padding-top: 12px; }
.wear { border-radius: var(--radius); padding: 20px 22px; background: var(--cold); }
.wear.tone-frost { background: var(--frost); } .wear.tone-cool { background: var(--cool); }
.wear.tone-mild { background: var(--mild); } .wear.tone-warm { background: var(--warm); }
.wear h3 { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wear h3 .icon { color: var(--accent); }
.band { margin-left: auto; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; background: var(--surface); border-radius: 999px; padding: 4px 10px; }
.wear ul { margin: 0; padding: 0; list-style: none; }
.wear .layers li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-weight: 500; }
.wear .layers .icon { color: var(--good); margin-top: 3px; width: 1.1em; height: 1.1em; }
.wear .extras li, .wear .tips li { position: relative; padding: 5px 0 5px 18px; }
.wear .extras li::before, .wear .tips li::before { content: ""; position: absolute; left: 2px; top: 15px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.air-card { margin-top: 28px; }
.air { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-bottom: 14px; }
.air-chip { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border-left: 5px solid currentColor; }
.air-chip strong { color: var(--text); font-size: 1.05rem; }
.air-chip small { display: block; color: var(--muted); font-size: .85rem; }
.air-val { text-align: right; }
.air-val span { font-size: 1.6rem; font-weight: 700; }
.aq-good { color: var(--good); } .aq-ok { color: var(--ok); } .aq-warn { color: var(--warn); } .aq-bad { color: var(--bad); }

/* ===== Packing ===== */
.pack-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; position: sticky; top: 76px; z-index: 5; }
.pack-meta { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pack-count { font-weight: 700; font-size: 1.05rem; }
progress { width: 100%; max-width: 380px; height: 10px; accent-color: var(--red); }
.pack-weather { margin: 18px 0 4px; }
.packing { columns: 3 290px; column-gap: 18px; margin-top: 18px; }
.pack-group { break-inside: avoid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px 18px; margin: 0 0 18px; box-shadow: var(--shadow); }
.pack-group legend { font-weight: 700; font-size: 1.05rem; padding: 0; float: left; width: 100%; margin-bottom: 6px; }
.pack-group legend { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.group-count { font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
.group-count.is-done { color: #fff; background: var(--good); }
.check {
  display: flex; gap: 14px; align-items: center; min-height: 48px;
  padding: 10px 10px; margin: 0 -10px; border-radius: 12px; cursor: pointer; clear: both;
  transition: background-color .15s;
}
.check + .check { border-top: 1px solid var(--line); }
.check:hover { background: var(--surface-2); }
.check input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 26px; height: 26px; border-radius: 8px;
  border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent); background: var(--surface);
  display: grid; place-content: center; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.check input::before {
  content: ""; width: 14px; height: 14px; background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0); transition: transform .15s cubic-bezier(.3, 1.6, .5, 1);
}
.check input:checked { background: var(--red); border-color: var(--red); }
.check input:checked::before { transform: scale(1); }
.check:active input { transform: scale(.92); }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check span { transition: color .15s; }
.check input:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 70%, transparent); }
@media (max-width: 800px) { .pack-bar { top: calc(56px + env(safe-area-inset-top)); } }

/* ===== Money ===== */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 0; padding: 4px; margin: 0 0 18px; background: var(--surface-2); border-radius: 16px; }
.seg { position: relative; display: flex; flex-direction: column; align-items: center; padding: 10px 6px; border-radius: 12px; cursor: pointer; color: var(--muted); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg-code { font-weight: 800; font-size: 1.1rem; color: var(--text); }
.seg-name { font-size: .78rem; text-align: center; }
.seg.is-on { background: var(--surface); box-shadow: var(--shadow); }
.seg.is-on .seg-code { color: var(--red); }
.seg:has(input:focus-visible) { outline: 2px solid var(--accent); }
.rate-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.rate-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.rate-tile:first-child { border-top: 4px solid var(--blue); }
.rate-tile:last-child { border-top: 4px solid var(--red); }
.rate-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .3em; }
.rate-value { font-size: 1.15rem; margin-bottom: .2em; }
.rate-value strong { font-size: 1.6em; letter-spacing: -.01em; }
.rate-sub { color: var(--muted); margin-bottom: .6em; }
.rate-src { font-size: .85rem; color: var(--muted); margin-bottom: .6em; }
.rate-note { font-size: .9rem; margin: 0; background: var(--surface-2); padding: 8px 12px; border-radius: 10px; }
.converter-card { margin-top: 18px; }
.converter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.converter label { display: flex; flex-direction: column; font-size: .85rem; font-weight: 700; color: var(--muted); flex: 1 1 140px; }
.converter input { font: inherit; font-size: 1.3rem; font-weight: 600; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); margin-top: 6px; width: 100%; }
.converter input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.conv-swap { padding-bottom: 16px; color: var(--muted); }
#conv-note { margin: 12px 0 0; }
.rates-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.rates-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.rates-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rates-table td .muted { display: block; font-size: .8rem; }
.rates-table tr.is-on td { background: color-mix(in srgb, var(--red) 8%, transparent); }
.price-list { list-style: none; padding: 0; margin: 0 0 8px; }
.price-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.price-list li > span:last-child { text-align: right; }

/* ===== Info ===== */
.flights { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.flight { background: linear-gradient(135deg, var(--navy), var(--navy-2)); color: #fff; border-radius: var(--radius); padding: 20px 22px; }
.flight-top { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.flight-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.flight-route > div:last-child { text-align: right; }
.flight-route small { display: block; opacity: .78; font-size: .85rem; }
.flight-route .big { font-size: 1.55rem; }
.arrow .icon { width: 26px; height: 26px; opacity: .8; transform: rotate(45deg); }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.facts dt { font-weight: 700; color: var(--muted); font-size: .9rem; padding-top: 1px; }
.facts dd { margin: 0; }
.stays { list-style: none; padding: 0; margin: 0 0 12px; }
.stays li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stays li:last-child { border-bottom: 0; }
.stays .muted { font-size: .9rem; }
.emergency { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.emergency li { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.call { display: inline-flex; align-items: center; gap: 8px; background: var(--red); color: #fff; text-decoration: none; font-weight: 800; font-size: 1.25rem; padding: 6px 14px; border-radius: 999px; }
.call .icon { width: 18px; height: 18px; }
.tips-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.tip h3 { font-size: 1.02rem; }
.tip p { color: var(--muted); }
.phrases { width: 100%; border-collapse: collapse; }
.phrases td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.phrases tr:last-child td { border-bottom: 0; }
.phrases td:first-child { width: 40%; font-weight: 500; }
.phrases .ko { display: block; font-weight: 700; font-size: 1.05rem; }
.phrases .rom { display: block; color: var(--muted); font-style: italic; font-size: .88rem; }
.learn { list-style: none; padding: 0; margin: 0; }
.learn li { padding: 12px 0; border-top: 1px solid var(--line); }
.learn a { display: inline-flex; align-items: center; gap: 6px; font-size: 1.05rem; text-decoration: none; }
.learn a:hover strong { text-decoration: underline; }
.learn .ext { width: 16px; height: 16px; }
.learn p { margin: 4px 0 0; color: var(--muted); }

.footer { margin-top: 40px; padding: 24px 0 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }

.chip, .tile { scroll-snap-align: center; }

@media (max-width: 600px) {
  body { font-size: 16px; }
  .btn { min-height: 44px; }
  .next-actions .btn { flex: 1 1 100%; justify-content: center; }
  .pager .btn { flex: 1; justify-content: center; }
  .page-head h1 { font-size: 1.75rem; }
  .next-card { padding: 20px; }
  .rate-value strong { font-size: 1.4em; }
  .converter { flex-wrap: nowrap; }
  .converter label { min-width: 0; }
  .conv-swap { padding-bottom: 14px; }
  .rates-table td, .rates-table th { padding-left: 4px; padding-right: 4px; }
  .facts { grid-template-columns: 1fr; gap: 2px 0; }
  .facts dd { margin-bottom: 10px; }
  .wx-grid { grid-template-columns: 1fr 1fr; }
  .shortcut { padding: 14px 16px; }
  .hero { padding-top: 28px; }
  .strip { grid-template-columns: repeat(6, 92px); }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .clock-note { display: none; }
  .card { padding: 18px; }
  .day-head, .timeline { padding-left: 18px; padding-right: 18px; }
  .wx-day-body { padding: 16px 18px 18px; }
  .meal, .wear-link { margin-left: 18px; margin-right: 18px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  .topbar, .btn, .pack-bar, .converter, .day-picker, .pager { display: none; }
  .hero { background: none; color: #000; }
  .card, .day { break-inside: avoid; }
}

/* Hostels */
.meeting-card { margin-top: 18px; }
.stays-grid { margin-top: 0; margin-bottom: 12px; }
.stay h3 { font-size: 1.25rem; margin-bottom: .15em; }
.stay-city { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); margin-bottom: .4em; }
.stay-city .icon { width: 16px; height: 16px; }
.stay .facts { margin-bottom: 4px; }
.ko-address { display: block; font-weight: 700; margin-top: 4px; }
.facility-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.facility-list li { display: flex; gap: 8px; align-items: flex-start; font-size: .95rem; }
.facility-list .icon { width: 16px; height: 16px; color: var(--good); margin-top: 4px; }

/* ===== Map ===== */
.map-filter { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; scrollbar-width: none; scroll-snap-type: x proximity; }
.map-filter::-webkit-scrollbar { display: none; }
.map-filter .chip { flex: none; min-width: 84px; padding: 8px 12px; }
.map-filter .chip-wide { justify-content: center; font-weight: 700; }
.map-wrap { position: relative; }
.map {
  height: min(60vh, 520px); min-height: 320px; border-radius: var(--radius);
  border: 1px solid var(--line); overflow: hidden; background: var(--surface-2); z-index: 0;
}
.map-fit { position: absolute; right: 12px; bottom: 28px; z-index: 500; box-shadow: var(--shadow); }
.map-fallback { padding: 24px; color: var(--muted); }
.map-note { margin: 12px 0 0; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; }

.pin { background: none; border: 0; }
.pin-dot {
  display: grid; place-items: center; width: 32px; height: 32px; margin: 0 auto;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--red); border: 2px solid #fff; box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  color: #fff; font-weight: 800; font-size: 13px;
}
.pin-dot { line-height: 1; }
.pin-dot::after { content: none; }
.pin .pin-dot { font-variant-numeric: tabular-nums; }
.pin .pin-dot > * { transform: rotate(45deg); }
.leaflet-popup-content-wrapper { border-radius: 14px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); box-shadow: 0 4px 18px rgb(0 0 0 / 25%); }
.leaflet-popup-content { margin: 14px 16px; line-height: 1.45; color: var(--text); }
.popup strong { display: block; font-size: 1rem; }
.popup .ko { display: block; color: var(--muted); font-size: .9rem; }
.popup p { margin: 6px 0 10px; font-size: .9rem; }
.popup .popup-day { margin: 0 0 2px; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); }
.popup .open-in { flex-direction: column; }
.popup .btn { color: var(--text); background: var(--surface); border-color: var(--line); justify-content: center; }

.places .section-title { display: flex; flex-direction: column; gap: 2px; }
.places .section-title .day-num { font-size: .78rem; }
.place-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.place { display: flex; flex-direction: column; padding: 18px 20px; transition: border-color .15s, box-shadow .15s; }
.place.is-on { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.place-head { all: unset; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.place-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.pin-badge { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--red); color: #fff; font-weight: 800; font-size: .85rem; }
.place-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.place-title strong { font-size: 1.05rem; line-height: 1.3; }
.place-title .ko { color: var(--muted); font-size: .9rem; }
.place-kind { color: var(--accent); }
.place-note { color: var(--muted); margin: 10px 0 14px; flex: 1; }
.open-in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.open-in .btn-small { justify-content: center; padding-left: 6px; padding-right: 6px; white-space: nowrap; }
.popup .open-in { display: flex; }
.btn-small { font-size: .85rem; padding: 7px 12px; min-height: 0; }
.btn-small .icon { width: 15px; height: 15px; }
@media (max-width: 600px) {
  .map { height: 52vh; min-height: 280px; border-radius: 14px; }
  .open-in .btn-small { min-height: 42px; font-size: .8rem; }
}
@media (max-width: 800px) {
  .nav { grid-template-columns: repeat(7, 1fr); padding-left: 2px; padding-right: 2px; }
  .nav a { font-size: .64rem; padding-left: 0; padding-right: 0; }
}

@media (max-width: 400px) { .open-in .btn-small .icon { display: none; } }

/* ===== Map controls (themed) ===== */
.leaflet-touch .leaflet-bar, .leaflet-bar {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%); background: var(--surface);
}
.leaflet-touch .leaflet-bar a, .leaflet-bar a {
  width: 40px; height: 40px; line-height: 40px; display: grid; place-items: center;
  background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line);
  font: 300 22px/1 system-ui, -apple-system, sans-serif; text-indent: 0;
}
.leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-bar a:hover, .leaflet-bar a:focus-visible { background: var(--surface-2); color: var(--accent); }
.leaflet-bar a.leaflet-disabled { color: var(--muted); opacity: .45; background: var(--surface); }
.leaflet-control-zoom-in span, .leaflet-control-zoom-out span { margin-top: -2px; }
.leaflet-top.leaflet-left .leaflet-control { margin: 12px 0 0 12px; }

.map-fit {
  top: auto; right: auto; left: 12px; bottom: 12px; height: 40px; padding: 0 14px;
  border-radius: 12px; font-size: .88rem; box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
}
.map-fit .icon { width: 17px; height: 17px; color: var(--accent); }

/* Popup close button: a small round button with a drawn cross. */
.leaflet-container a.leaflet-popup-close-button {
  top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); color: var(--muted); font: 0/0 a; display: grid; place-items: center;
}
.leaflet-container a.leaflet-popup-close-button span { display: none; }
.leaflet-container a.leaflet-popup-close-button::before,
.leaflet-container a.leaflet-popup-close-button::after {
  content: ""; grid-area: 1 / 1; width: 12px; height: 2px; border-radius: 2px; background: currentColor;
  transform: rotate(45deg);
}
.leaflet-container a.leaflet-popup-close-button::after { transform: rotate(-45deg); }
.leaflet-container a.leaflet-popup-close-button:hover { background: var(--line); color: var(--text); }
.popup { padding-right: 26px; }
.popup .open-in { gap: 6px; }
.popup .btn-small { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }

.places[hidden] { display: none; }

/* ===== Home: pre-trip card ===== */
.pre-card h2 { margin-bottom: .1em; }
.pre-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 16px 0 6px; }
.pre-fact { display: flex; gap: 12px; align-items: flex-start; background: var(--surface-2); border-radius: 14px; padding: 14px 16px; }
.pre-fact p { margin: 0 0 2px; }
.pre-fact progress { margin-top: 8px; max-width: none; }
.pre-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 10px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pre-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px !important; }
.pre-sub { margin: 18px 0 8px; font-size: 1.02rem; }
.pre-essentials { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.pre-essentials li { display: flex; gap: 10px; align-items: flex-start; padding: 4px 0; }
.pre-essentials .icon { width: 1.05em; height: 1.05em; color: var(--good); margin-top: 4px; }
.alert-strip { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--red) 13%, transparent); border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }
.alert-strip .icon { color: var(--red); margin-top: 2px; }

/* ===== Info: SIMs ===== */
.sims { margin-top: 0; }
.sim-card h3 .icon { color: var(--accent); }
.sim-list { list-style: none; padding: 0; margin: 4px 0 0; }
.sim-list li { padding: 14px 0; border-top: 1px solid var(--line); }
.sim-list a { display: inline-flex; align-items: center; gap: 6px; font-size: 1.05rem; text-decoration: none; }
.sim-list a:hover strong { text-decoration: underline; }
.sim-list .ext { width: 16px; height: 16px; }
.sim-where { display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 2px; }
.sim-list p { margin: 6px 0 0; }
.sim-tips-card { margin-top: 18px; }

.leaflet-container .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); }
.leaflet-container .leaflet-control-attribution a { color: var(--accent); }

/* ===== Offline notice ===== */
.offline-bar {
  position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 15;
  display: flex; gap: 10px; align-items: center; justify-content: center;
  padding: 8px 16px; font-size: .88rem; text-align: left;
  background: #fff4d6; color: #5c4300; border-bottom: 1px solid #f0d58a;
}
.offline-bar .icon { width: 18px; height: 18px; flex: none; }
@media (min-width: 801px) { .offline-bar { top: 64px; } }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .offline-bar { background: #3a2f12; color: #f3d98b; border-color: #5a4a1c; }
}

/* ===== Info: tabs ===== */
.emergency-strip { list-style: none; padding: 10px 14px; margin: 0 0 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 14px; }
.emergency-strip li { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.emergency-label { font-weight: 700; color: var(--red); width: 100%; }
.emergency-label .icon { width: 18px; height: 18px; }
.emergency-strip .call { font-size: 1rem; padding: 3px 12px; }
.info-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: none; position: sticky; top: calc(56px + env(safe-area-inset-top)); z-index: 6; background: var(--bg); margin: 0 -16px; padding-left: 16px; padding-right: 16px; padding-top: 8px; }
@media (min-width: 801px) { .info-tabs { top: 64px; } }
.info-tabs::-webkit-scrollbar { display: none; }
.info-tab { font: inherit; flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: .92rem; cursor: pointer; }
.info-tab .icon { width: 18px; height: 18px; color: var(--accent); }
.info-tab:hover { border-color: var(--accent); }
.info-tab[aria-selected="true"] { background: var(--selected); border-color: var(--selected); color: #fff; }
.info-tab[aria-selected="true"] .icon { color: #fff; }
.info-panel { animation: panel-in .18s ease-out; }
.info-panel > .grid-2:first-child, .info-panel > .flights:first-child { margin-top: 0; }
@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .info-panel { animation: none; } }

/* Cleaner map: quieter controls and pins that pop against the plain basemap. */
.leaflet-container { background: var(--surface-2); }
.leaflet-control-attribution { font-size: 9px; padding: 0 6px; border-top-left-radius: 8px; }
.map .tiles-osm .leaflet-tile { filter: saturate(.12) contrast(.86) brightness(1.06); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .map .tiles-osm .leaflet-tile { filter: invert(1) hue-rotate(180deg) saturate(.12) brightness(.82) contrast(.88); }
}
