:root {
  color-scheme: light dark;
  --bg: #f2f2f7;
  --card: #ffffff;
  --card-2: #f7f7fa;
  --text: #111114;
  --muted: #6c6c75;
  --line: rgba(60, 60, 67, 0.14);
  --accent: #b42a24;
  --accent-soft: rgba(180, 42, 36, 0.1);
  --now: #1f8f4e;
  --now-soft: rgba(31, 143, 78, 0.12);
  --todo: #8a5a00;
  --todo-soft: rgba(214, 150, 0, 0.14);
  --flight: #2563eb;
  --transfer: #0e8f8a;
  --work: #7c3aed;
  --customs: #b7791f;
  --meal: #8b8b93;
  --tabbar: rgba(249, 249, 251, 0.88);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 14px rgba(0, 0, 0, 0.04);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --card: #19191d;
    --card-2: #222227;
    --text: #ececf0;
    --muted: #9898a2;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #ff7a6e;
    --accent-soft: rgba(255, 122, 110, 0.14);
    --now: #4ade80;
    --now-soft: rgba(74, 222, 128, 0.14);
    --todo: #f5c451;
    --todo-soft: rgba(245, 196, 81, 0.13);
    --flight: #7aa7ff;
    --transfer: #4fd1c5;
    --work: #b794f6;
    --customs: #f6ad55;
    --meal: #7c7c86;
    --tabbar: rgba(22, 22, 26, 0.88);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
small { font-size: 0.8em; }

main {
  padding: calc(var(--safe-t) + 12px) calc(var(--safe-r) + 16px) calc(var(--safe-b) + 88px) calc(var(--safe-l) + 16px);
  max-width: 560px;
  margin: 0 auto;
  /* iOS 홈 화면 앱은 내용이 화면보다 짧으면 하단 탭바가 상태바 높이만큼 떠 보인다 → 항상 1px 이라도 스크롤되게 */
  min-height: calc(100vh + 1px);
  min-height: calc(100lvh + 1px);
}
.loading { padding: 40vh 0; text-align: center; color: var(--muted); }

/* 상태 표시 (구석) */
.status {
  position: fixed;
  z-index: 20;
  top: calc(var(--safe-t) + 8px);
  right: calc(var(--safe-r) + 12px);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 5px;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status .dot.on { background: var(--now); }
.status .dot.off { background: var(--customs); }
.status b { color: var(--accent); }

.banner {
  position: fixed;
  z-index: 30;
  left: 12px;
  right: 12px;
  top: calc(var(--safe-t) + 36px);
  max-width: 536px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.banner button {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-weight: 700;
}

.page-head { padding: 22px 2px 14px; }
.page-head h1 { font-size: 32px; letter-spacing: -0.02em; line-height: 1.1; }
.page-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* 카드 */
.card, .pass {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head h2 { font-size: 17px; }
.kind { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.kind svg { width: 16px; height: 16px; }
.big-title { font-size: 21px; line-height: 1.25; letter-spacing: -0.01em; }
.card.next { border: 2px solid var(--accent); }
.card.live { border: 2px solid var(--now); }
.card.live .kind { color: var(--now); }
.card.past, .pass.past { opacity: 0.55; }
.when { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; }
.huge { font-size: 46px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.xl { font-size: 28px; font-weight: 700; }
.lg { font-size: 20px; font-weight: 700; }
.countdown { margin-top: 2px; font-size: 17px; font-weight: 600; color: var(--accent); }
.kst { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.kst sup { font-size: 9px; margin-left: 1px; }
.when .kst { display: inline; font-size: 14px; }
.split { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 10px; }
.split .right { text-align: right; }
.route .iata { font-size: 30px; font-weight: 800; letter-spacing: 0.02em; }
.route .mid { text-align: center; }
.route .mid svg { width: 22px; height: 22px; transform: rotate(90deg); color: var(--muted); }
.progress { height: 8px; border-radius: 4px; background: var(--card-2); margin-top: 12px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--now); }
.addr { margin-top: 4px; font-size: 15px; }

dl.facts { margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
dl.facts > div.wide { grid-column: 1 / -1; }
dl.facts dt { font-size: 12px; color: var(--muted); }
dl.facts dd { margin: 1px 0 0; font-size: 15px; overflow-wrap: anywhere; }

.todo {
  margin-top: 6px;
  display: inline-block;
  font-size: 12.5px;
  line-height: 1.35;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--todo-soft);
  color: var(--todo);
}
.todo::before { content: "확인 필요 · "; font-weight: 700; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: 2px;
  white-space: nowrap;
}
.badge.now { background: var(--now-soft); color: var(--now); }
.badge.next { background: var(--accent-soft); color: var(--accent); }
.badge.done { background: var(--card-2); color: var(--muted); }

/* 버튼 */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.copy svg { width: 14px; height: 14px; color: var(--muted); }
.copy:active { background: var(--accent-soft); }
.copy.lg { font-size: 22px; min-height: 44px; }

/* 시계 */
.clocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.clocks.inline { margin: 6px 0 0; }
.clock { background: var(--card); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); }
.clocks.inline .clock { background: var(--card-2); box-shadow: none; }
.clock-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.clock-time { font-size: 38px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.clock.home .clock-time { font-size: 26px; color: var(--muted); }
.clock-sub { font-size: 12px; color: var(--muted); }

/* 타임라인 행 */
ol.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 78px 16px 1fr; gap: 0 8px; padding: 8px 0; position: relative; }
.row + .row { border-top: 1px solid var(--line); }
.row-time { text-align: right; line-height: 1.2; }
.row-start { font-size: 18px; font-weight: 700; }
.row-end { display: block; font-size: 13px; color: var(--muted); }
.row-end small { font-size: 10px; }
.row-dot { display: flex; justify-content: center; padding-top: 6px; }
.row-dot span { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.row-title { font-weight: 600; font-size: 15.5px; line-height: 1.3; }
.row-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.row.past { opacity: 0.42; }
.row.now { background: var(--now-soft); border-radius: 12px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.row.now .row-dot span { background: var(--now); box-shadow: 0 0 0 4px var(--now-soft); }
.row.is-next .row-start { color: var(--accent); }
.row.tbd .row-start { font-size: 14px; color: var(--muted); }
.t-flight .row-dot span { background: var(--flight); }
.t-transfer .row-dot span, .t-transit-show .row-dot span, .t-return .row-dot span, .t-transit .row-dot span { background: var(--transfer); }
.t-show .row-dot span { background: var(--accent); width: 12px; height: 12px; }
.t-show .row-title { color: var(--accent); }
.t-work .row-dot span, .t-rehearsal .row-dot span { background: var(--work); }
.t-customs .row-dot span, .t-call .row-dot span, .t-deadline .row-dot span { background: var(--customs); }
.t-deadline .row-title { color: var(--customs); }
.t-meal .row-dot span, .t-free .row-dot span { background: var(--meal); }
.t-checkin .row-dot span, .t-checkout .row-dot span { background: transparent; border: 2px solid var(--muted); }
.tzmark { padding: 8px 0; border-top: 1px solid var(--line); }
.tzmark span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--flight);
  background: color-mix(in srgb, var(--flight) 12%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
}
.tzmark svg { width: 14px; height: 14px; }

.day { background: var(--card); border-radius: 18px; padding: 6px 14px 8px; margin-bottom: 12px; box-shadow: var(--shadow); scroll-margin-top: 60px; }
.day.today { border: 2px solid var(--accent); }
.day-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 6px;
  font-size: 18px;
}
.day.past-day { opacity: 0.75; }

/* 보딩패스 */
.pass { padding: 0; overflow: hidden; position: relative; }
.pass.is-next { outline: 2px solid var(--accent); }
.pass-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--accent-soft); }
.airline { font-weight: 600; font-size: 14px; }
.flightno { font-size: 22px; font-weight: 800; letter-spacing: 0.03em; }
.pass-route { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 14px 16px 10px; align-items: start; }
.pt .iata { font-size: 36px; font-weight: 800; letter-spacing: 0.02em; line-height: 1; }
.pt .term { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pt .ptime { font-size: 26px; font-weight: 700; margin-top: 8px; line-height: 1.1; }
.pt .ptime sup { font-size: 12px; color: var(--accent); }
.pt .pdate { font-size: 13px; color: var(--muted); }
.pt.right { text-align: right; }
.pass .mid { text-align: center; padding-top: 6px; color: var(--muted); }
.pass .mid svg { width: 24px; height: 24px; transform: rotate(90deg); }
.pass .dur { font-size: 12px; margin: 2px 0 6px; }
.perf { border-top: 2px dashed var(--line); margin: 0 16px; position: relative; }
.perf::before, .perf::after { content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); }
.perf::before { left: -26px; }
.perf::after { right: -26px; }
.pass-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; padding: 12px 16px 4px; }
.pass-grid .wide { grid-column: 1 / -1; }
.pass-grid dt { font-size: 12px; color: var(--muted); }
.pass-grid dd { margin: 0; }
.pass-note, .pass > .todo, .pass > .actions { margin-left: 16px; margin-right: 16px; }
.pass-note { margin-top: 8px; }
.pass > .actions { margin-bottom: 14px; }
.pass > .todo { margin-bottom: 12px; }
.pass > :last-child:not(.actions):not(.todo) { margin-bottom: 14px; }

/* 공연 */
.show.is-today { border: 2px solid var(--accent); }
details { margin-top: 12px; }
summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; color: var(--accent); }
.src { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* 도시 · 기타 */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--card-2); border-radius: 14px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1 0 auto; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 600; color: var(--muted); padding: 0 10px; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg small { color: var(--todo); }
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 0 16px; scrollbar-width: none; }
.chip { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
ul.bullets { margin: 0; padding-left: 18px; }
ul.bullets li { margin: 4px 0; }
h3.sec { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
ul.phrases { list-style: none; margin: 0; padding: 0; }
.phrases button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 0; min-height: 44px; display: grid; gap: 1px; border-top: 1px solid var(--line); }
.phrases li:first-child button { border-top: 0; }
.phrases .ko { font-size: 13px; color: var(--muted); }
.phrases .local { font-size: 18px; font-weight: 700; }
.phrases .pron { font-size: 13px; }
ul.contacts, ul.checks { list-style: none; margin: 0; padding: 0; }
.contacts li { padding: 12px 0; border-top: 1px solid var(--line); }
.contacts li:first-child { border-top: 0; }
.contacts .btn.phone { margin-top: 8px; white-space: nowrap; overflow-wrap: normal; }
.checks label { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; min-height: 44px; border-top: 1px solid var(--line); }
.checks li:first-child label { border-top: 0; }
.checks input { width: 24px; height: 24px; flex: 0 0 24px; margin: 0; accent-color: var(--accent); }
.checks label > span { display: grid; }
.checks label.on .ck-item { text-decoration: line-through; color: var(--muted); }

/* 크게 보기 */
.sheet { position: fixed; inset: 0; z-index: 50; background: #fff; color: #000; overflow-y: auto; }
.big { min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px); }
.big-phrase { font-size: 22px; color: #555; }
.big-name { font-size: 36px; font-weight: 800; line-height: 1.15; }
.big-addr { font-size: 30px; font-weight: 600; line-height: 1.3; }
.big-phone { font-size: 28px; }
.big-close { margin-top: auto; min-height: 56px; font-size: 18px; background: #111; color: #fff; border: 0; }

.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 84px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* 하단 탭바 */
.tabbar {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 4px calc(var(--safe-r) + 4px) calc(var(--safe-b) + 4px) calc(var(--safe-l) + 4px);
  background: var(--tabbar);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.tabbar svg { width: 25px; height: 25px; }
.tabbar a.on { color: var(--accent); }

/* 크루: 프로필 · 짐 · 명단 */
body.picking .tabbar { display: none; }
.pick-seg button { min-height: 48px; font-size: 16px; }
.pick-hint { margin: 0 2px 10px; }
ul.pick-list, ul.roster { list-style: none; margin: 0; padding: 0; }
.pick-list button {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  text-align: left;
}
.pick-list button > span:last-child { display: grid; }
.pid { font-weight: 800; color: var(--accent); }
.roster li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.roster li:first-child { border-top: 0; }
.roster li.me { background: var(--accent-soft); border-radius: 10px; margin: 0 -8px; padding: 8px; }
.roster .tag { font-size: 13px; color: var(--muted); white-space: nowrap; }
.chips.inline { margin: 6px 0 0; padding: 0; flex-wrap: wrap; overflow: visible; }
.link { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; min-height: 32px; padding: 0 4px; }
.checks .del { margin-left: auto; }
.bag-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 6px; }
.tagchip { font-size: 30px; font-weight: 800; padding: 2px 12px; border-radius: 10px; background: var(--accent); color: #fff; letter-spacing: 0.02em; }
.tagchip.carried { background: transparent; color: var(--accent); border: 2px dashed var(--accent); }
.plus { color: var(--muted); font-weight: 700; }
.bag-assign { font-size: 17px; font-weight: 600; }
.notice { border: 2px solid var(--customs); }
.notice b { color: var(--customs); }
.notice p { margin-top: 4px; font-size: 14px; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin: 8px 0 4px; }

[hidden] { display: none !important; }
