/* 상하이 동행 — achromatic-ledger 스타일 (design-taste-frontend, seed 776650929)
   크롬은 색이 없고, 파랑 하나(--hue)는 "함께 가능한 시간"에만 쓴다.
   그리드 계산: 화면 폭 W, 좌우 여백 16 → 카드 폭 W-32. 타임라인은 시간 눈금 56 + 두 레인 + 간격 8,
   즉 레인 폭 = (W-32-56-8)/2 (390폭에서 147, 360폭에서 132). */

@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ground: #f8f8f8;
  --surface: #ffffff;
  --raised: #eeeeee;
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --accent: #141414;
  --hue: #1d5fbf;
  --hue-fill: #e8eef8;
  --positive: #247b50;
  --negative: #c4242a;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-neutral-bg: #eeeeee;  --pill-neutral-ink: #3d3d3d;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --radius-card: 8px;
  --radius-control: 6px;
  --gap: 12px;
  --pad: 16px;
  --fs-title: 24px;
  --fs-section: 16px;
  --fs-body: 14px;
  --fs-small: 13px;
  --hr: 44px;           /* 타임라인 한 시간의 높이 */
  --gutter: 56px;       /* 타임라인 시간 눈금 폭 */
  --tabs-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --scale: 1;
}
:root[data-size="l"] { --scale: 1.14; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 calc(var(--fs-body) * var(--scale))/1.45 "Geist", system-ui, -apple-system, "Apple SD Gothic Neo",
        "Noto Sans KR", "Malgun Gothic", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-variant-numeric: tabular-nums;
  word-break: keep-all;          /* 한글을 단어 중간에서 꺾지 않는다 */
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
:lang(zh-Hans) { font-family: "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", "Geist", sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.sm { font-size: calc(var(--fs-small) * var(--scale)); }
.dash { color: var(--muted); }

/* ── 프레임 ─────────────────────────────── */
.app { max-width: 520px; margin: 0 auto; padding: 0 var(--pad) calc(var(--tabs-h) + var(--safe-b) + 24px); }
.bar { height: 48px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; min-height: 44px; }
.mark { color: var(--accent); flex: none; }
.miniclock { font-size: calc(var(--fs-small) * var(--scale)); color: var(--muted); white-space: nowrap; }
.miniclock b { font-weight: 500; color: var(--text); margin-left: 3px; }
.miniclock span + span { margin-left: 10px; }

.head { padding: 12px 0 16px; }
h1 { font-size: calc(var(--fs-title) * var(--scale)); line-height: 1.25; font-weight: 500; }
.head p { margin-top: 4px; color: var(--muted); }
.head p b { color: var(--text); font-weight: 500; }

.stack { display: grid; gap: var(--gap); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--pad); }
.card h2, .sec-title { font-size: calc(var(--fs-section) * var(--scale)); font-weight: 500; line-height: 1.3; }
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); min-height: 44px; display: inline-flex; align-items: center; margin: -12px 0; }
.link:hover { color: var(--text); }

/* ── 버튼 ─────────────────────────────── */
.primary { background: var(--accent); color: #fff; min-height: 44px; padding: 0 16px; border-radius: var(--radius-control); font-weight: 500; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.primary:active { background: #000; }
.secondary { background: var(--raised); min-height: 44px; padding: 0 14px; border-radius: var(--radius-control); display: inline-flex; align-items: center; justify-content: center; }
.secondary:active { background: #e2e2e2; }
.ghost { min-height: 44px; padding: 0 12px; border-radius: var(--radius-control); color: var(--text); font-weight: 500; }
.ghost:active { background: var(--raised); }
.ghost[disabled], .secondary[disabled] { color: var(--muted); cursor: default; }

/* ── 하단 탭 ───────────────────────────── */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--ground); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
}
.tabs a { flex: 1; max-width: 130px; height: var(--tabs-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; padding: 0; }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"] svg { background: var(--raised); border-radius: 8px; box-sizing: content-box; padding: 3px 14px; margin: -3px 0; width: 22px; }

/* ── 아바타·칩·알약 ─────────────────────── */
.av { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; flex: none; }
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; flex: none; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ── 지금 ──────────────────────────────── */
.lead-label { color: var(--muted); }
.lead-fig { font-size: calc(36px * var(--scale)); line-height: 1.15; font-weight: 500; margin-top: 6px; letter-spacing: -0.02em; }
.lead-fig i { font-style: normal; font-size: calc(16px * var(--scale)); color: var(--muted); font-weight: 400; margin: 0 8px 0 3px; letter-spacing: 0; }
.lead-sub { margin-top: 6px; }
.lead .primary { margin-top: 16px; width: 100%; }

.clocks { display: grid; grid-template-columns: 1fr 1fr; margin: 12px -16px 0; }
.clocks > div { padding: 0 16px; }
.clocks > div + div { border-left: 1px solid var(--rule); }
.clock-fig { font-size: calc(24px * var(--scale)); line-height: 1.2; font-weight: 400; margin: 2px 0; }
.clock-note { margin-top: 12px; color: var(--muted); }

.lane-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 6px 0; }
.lane-row + .lane-row { border-top: 1px solid var(--rule); }
.lane-row .grow { flex: 1; min-width: 0; }
.lane-row .t1 { font-weight: 500; }
.lane-row .t2 { color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.lane-row .rt { text-align: right; flex: none; }
.lane-row .rt .big { font-size: calc(16px * var(--scale)); font-weight: 500; }
.lane-row:active { background: var(--ground); }

.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; min-height: 36px; align-items: center; }
.kv > div + div { border-top: 1px solid var(--rule); }
.kv dt, .kv .k { color: var(--muted); }
.kv dd, .kv .v { margin: 0; text-align: right; font-weight: 400; }

.notice { background: var(--pill-warning-bg); border: 1px solid #fde68a; color: var(--pill-warning-ink); border-radius: var(--radius-control); padding: 10px 12px; font-size: calc(var(--fs-small) * var(--scale)); }

/* ── 함께 가능한 시간 (파랑은 여기에만) ───── */
.strip { margin-top: 12px; }
.strip-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; min-height: 26px; gap: 8px; }
.strip-row .nm { font-size: calc(var(--fs-small) * var(--scale)); color: var(--muted); }
.strip-track { position: relative; height: 14px; }
.strip-bar { position: absolute; top: 2px; bottom: 2px; background: #8a8a8a; }
.strip-bar.together { background: var(--hue); top: 0; bottom: 0; }
.strip-days { display: grid; margin-left: 52px; margin-top: 4px; }
.strip-days span { text-align: center; font-size: 12px; color: var(--muted); border-left: 1px solid var(--rule); line-height: 1.25; padding-top: 3px; }
.strip-grid { position: absolute; inset: 0; display: grid; pointer-events: none; }
.strip-grid span { border-left: 1px solid var(--rule); }
.strip-grid span:first-child { border-left: 0; }

/* ── 일정 ──────────────────────────────── */
.days { display: flex; gap: 6px; margin: 0 0 12px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.days::-webkit-scrollbar { display: none; }
.day { flex: 1 0 46px; min-height: 64px; border-radius: var(--radius-control); background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; }
.day .dn { font-size: calc(16px * var(--scale)); font-weight: 500; line-height: 1.2; }
.day .dw { font-size: calc(var(--fs-small) * var(--scale)); color: var(--muted); line-height: 1.2; }
.day .dt { font-size: 12px; color: var(--muted); line-height: 1.2; height: 13px; }
.day[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.day[aria-pressed="true"] .dw, .day[aria-pressed="true"] .dt { color: #d4d4d4; }

.day-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 8px; }
.empty-day { border: 1px dashed var(--control); border-radius: var(--radius-control); min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; color: var(--muted); margin-bottom: 8px; }
.empty-day .secondary { min-height: 36px; padding: 0 10px; flex: none; }

.tl { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 12px 12px 12px 12px; }
.tl-head { display: grid; grid-template-columns: var(--gutter) 1fr 1fr; column-gap: 8px; align-items: end; padding-bottom: 8px; }
.tl-head .zl { font-size: 12px; color: var(--muted); line-height: 1.25; }
.tl-head .zl b { display: block; color: var(--text); font-weight: 500; font-size: calc(var(--fs-small) * var(--scale)); }
.tl-who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tl-who span.n { font-weight: 500; }
.tl-grid { position: relative; height: calc(var(--n) * var(--hr)); }
.hl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--rule); }
.hl .lb { position: absolute; left: 0; top: 3px; width: var(--gutter); font-size: calc(var(--fs-small) * var(--scale)); line-height: 1.15; }
.hl .lb small { display: block; color: var(--muted); font-size: 12px; }
.layer { position: absolute; top: 0; bottom: 0; left: calc(var(--gutter) + 8px); right: 0; overflow: hidden; }
.lane { position: absolute; top: 0; bottom: 0; width: calc(50% - 4px); }
.lane.l { left: 0; } .lane.r { right: 0; }
.band { position: absolute; left: 0; right: 0; background: var(--hue-fill); }
.band .bl { position: absolute; top: 3px; right: 6px; font-size: 12px; color: var(--hue); }
.away { position: absolute; left: 0; right: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 2l4-4M0 8l8-8M6 10l4-4' stroke='%23d4d4d4' stroke-width='1'/%3E%3C/svg%3E"); }
.blk { position: absolute; left: 0; right: 0; min-height: 28px; padding: 4px 8px; border-radius: var(--radius-control); background: var(--surface); border: 1px solid var(--control); border-left: 3px solid var(--accent); overflow: hidden; text-align: left; font-size: calc(var(--fs-small) * var(--scale)); line-height: 1.3; }
.blk.flight { background: var(--raised); border-color: var(--control); border-left-color: var(--accent); }
.blk.sample { border-style: dashed; border-left-style: solid; }
.blk .b1 { font-weight: 500; font-size: calc(var(--fs-body) * var(--scale)); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.blk .b2 { color: var(--muted); }
.blk:active { background: var(--ground); }
.nowline { position: absolute; left: calc(var(--gutter) - 6px); right: 0; border-top: 1px solid var(--hue); z-index: 3; pointer-events: none; }
.nowline span { position: absolute; right: 0; top: -17px; font-size: 12px; color: var(--hue); padding: 0 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.legend i { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; margin-right: 6px; border: 1px solid var(--control); }
.legend i.f { background: var(--raised); border-left: 3px solid var(--accent); }
.legend i.a { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 2l4-4M0 8l8-8M6 10l4-4' stroke='%23d4d4d4' stroke-width='1'/%3E%3C/svg%3E"); }
.legend i.t { background: var(--hue-fill); border-color: var(--hue-fill); }
.legend i.s { border-style: dashed; }

/* ── 항공 ──────────────────────────────── */
.person { display: flex; align-items: center; gap: 10px; margin: 20px 0 8px; }
.person:first-of-type { margin-top: 0; }
.person .nm { font-weight: 500; font-size: calc(var(--fs-section) * var(--scale)); }
.leg { display: block; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px 16px; }
.leg + .leg { margin-top: 8px; }
.leg:active { background: var(--ground); }
.leg-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.leg-top .no { font-weight: 500; }
.leg-top .st { margin-left: auto; }
.leg-sub { color: var(--muted); margin-top: 2px; }
.route { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 12px; }
.route .tm { font-size: calc(24px * var(--scale)); line-height: 1.15; font-weight: 400; }
.route .ap { color: var(--text); font-size: calc(var(--fs-small) * var(--scale)); margin-top: 2px; }
.route .zn { color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.route .r { text-align: right; }
.route .mid { text-align: center; color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.route .mid::before { content: ""; display: block; border-top: 1px solid var(--control); margin: 0 0 6px; }
.conv { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); display: grid; gap: 2px; }
.conv b { color: var(--text); font-weight: 500; }

/* ── 도구 ──────────────────────────────── */
.group-title { margin: 20px 0 8px; font-size: calc(var(--fs-section) * var(--scale)); font-weight: 500; }
.group-title:first-child { margin-top: 0; }
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); }
.list > * + * { border-top: 1px solid var(--rule); }
.li { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 56px; padding: 8px 16px; }
button.li:active { background: var(--ground); }
.li .l1 { font-weight: 500; }
.li .l2 { color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); }
.li .zh { font-size: calc(18px * var(--scale)); }
.seg { display: inline-grid; grid-auto-flow: column; background: var(--raised); border-radius: var(--radius-control); padding: 2px; gap: 2px; }
.seg button { min-height: 40px; padding: 0 14px; border-radius: 5px; text-align: center; }
.seg button[aria-pressed="true"] { background: var(--surface); font-weight: 500; }
.switch { width: 48px; height: 28px; border-radius: 14px; background: var(--control); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.select { min-height: 44px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); padding: 0 10px; font: inherit; font-size: 16px; color: var(--text); max-width: 52vw; }
.hint { color: var(--muted); font-size: calc(var(--fs-small) * var(--scale)); margin-top: 8px; }

/* ── 시트·토스트 ─────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-width: 520px; margin: 0 auto; background: var(--surface); border-radius: 12px 12px 0 0; max-height: 88dvh; display: flex; flex-direction: column; box-shadow: 0 -4px 24px rgba(0,0,0,.12); }
.sheet[hidden], .scrim[hidden] { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 0 16px; min-height: 52px; }
.sheet-head h2 { font-size: calc(var(--fs-section) * var(--scale)); font-weight: 500; }
.sheet-body { overflow: auto; padding: 4px 16px calc(20px + var(--safe-b)); overscroll-behavior: contain; }
.sheet.show { top: 0; max-height: none; border-radius: 0; background: #fff; }
.show-zh { font-size: clamp(36px, 11vw, 56px); line-height: 1.3; font-weight: 500; margin: 12vh 0 12px; }
.show-py { color: var(--muted); font-size: calc(16px * var(--scale)); }
.show-ko { margin-top: 28px; color: var(--muted); }
.sheet .kv { margin-top: 8px; }
.sheet .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 16px; border-radius: var(--radius-control); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .15s; }
.toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) { .switch::after, .toast { transition: none; } }
@media (min-width: 521px) {
  body { padding-top: 8px; }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); width: 520px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* 일정 탭: 지도 계획 초안 시각표 */
.draft-tl{list-style:none;margin:10px 0;padding:0}.draft-tl .stop{display:grid;grid-template-columns:52px 1fr;gap:8px;padding:8px 0;border-top:1px solid var(--rule)}.draft-tl .tm{font-weight:500;font-variant-numeric:tabular-nums}
.draft-tl .nm{display:flex;gap:8px;align-items:flex-start;justify-content:space-between;font-weight:500}.draft-tl .nm a{text-decoration:none}
.draft-tl .hop{margin:2px 0 0 60px;font-size:12px;color:var(--muted)}.draft-tl .flag{color:#875315}
.draft-tl .cat{flex:none;padding:0 8px;border:1px solid var(--control);border-radius:10px;font-size:11px;font-weight:500;line-height:1.7;background:var(--ground);white-space:nowrap}
.blk.plan{display:block;left:0;right:0;border-style:dashed;border-left-style:solid;border-left-color:var(--accent);background:var(--surface);text-decoration:none;color:var(--text)}

.draft-tl .note{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.draft-tl .note.open{display:block}
