/* SOONwith: 모바일 우선 스타일 */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1b1f2e;
  --muted: #5f6680;
  --line: #e0e3ec;
  --primary: #3451d1;
  --primary-hover: #2a43b3;
  --primary-ink: #ffffff;
  --primary-soft: #e8ecff;
  --danger: #c92a4b;
  --danger-soft: #fdecef;
  --ok: #237a3b;
  --ok-soft: #e5f5e9;
  --warn: #9a6200;
  --warn-soft: #fff3dc;
  --heat: 52 81 209;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgb(20 28 60 / 6%), 0 6px 20px rgb(20 28 60 / 5%);
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101219;
    --surface: #191c26;
    --surface-2: #232736;
    --text: #e9ebf3;
    --muted: #9ba2ba;
    --line: #2d3245;
    --primary: #7891ff;
    --primary-hover: #8fa3ff;
    --primary-ink: #0c1124;
    --primary-soft: #232c4f;
    --danger: #ff7d95;
    --danger-soft: #3a1d26;
    --ok: #6fd28a;
    --ok-soft: #1b3324;
    --warn: #f0bb5a;
    --warn-soft: #3a2c13;
    --heat: 120 145 255;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
body.has-tabs { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--primary); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

.wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 440px; }
.center { text-align: center; }
.pad { padding: 32px 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.h1 { font-size: 22px; line-height: 1.35; margin: 0; letter-spacing: -0.01em; }
.h2 { font-size: 18px; line-height: 1.4; margin: 0; letter-spacing: -0.01em; }
.h3 { font-size: 16px; margin: 0; }
.section { margin: 20px 0; }
.section > .h2 { margin-bottom: 10px; }
.pre { white-space: pre-wrap; }

/* 상단 바 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--primary) url("/assets/icon-mark.svg") center / 16px no-repeat; }

/* 하단 탭 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 0;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1 1 0; max-width: 240px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.tabbar a[aria-current="page"] { color: var(--primary); }
.tab-ico { width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--ico) center / 24px no-repeat; mask: var(--ico) center / 24px no-repeat; }
.tab-ico-cal { --ico: url("/assets/ico-calendar.svg"); }
.tab-ico-pin { --ico: url("/assets/ico-pin.svg"); }

/* 카드 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card-list > .card + .card { margin-top: 0; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, var(--line)); }
.btn-soft { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-text { background: none; border: none; color: var(--muted); min-height: 36px; padding: 0 8px; font-weight: 600; }
.btn-text:hover { color: var(--text); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-lg { min-height: 52px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-map::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/ico-pin.svg") center / 16px no-repeat; mask: url("/assets/ico-pin.svg") center / 16px no-repeat; }
.btn-cal::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: url("/assets/ico-calendar.svg") center / 16px no-repeat; mask: url("/assets/ico-calendar.svg") center / 16px no-repeat; }

/* 입력 */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 14px; font-weight: 700; }
.hint { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], input[type="url"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  appearance: none; -webkit-appearance: none;
}
select { background-image: url("/assets/ico-chevron.svg"); background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; padding-right: 34px; }
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
input[readonly] { background: var(--surface-2); }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 선택 버튼 묶음 */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px; border-radius: 9px; font-size: 14px; font-weight: 700; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); }
.seg-vote input:checked + span.v-like { color: var(--ok); }
.seg-vote input:checked + span.v-okay { color: var(--warn); }
.seg-vote input:checked + span.v-hard { color: var(--danger); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip-count { opacity: .65; font-weight: 500; }
.chip-x { border: none; background: none; color: inherit; font: inherit; padding: 0 0 0 2px; cursor: pointer; opacity: .7; min-height: 0; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* 랜딩 */
.hero { padding: 48px 0 28px; }
.eyebrow { margin: 0 0 6px; font-size: 14px; font-weight: 700; color: var(--primary); }
.hero-title { margin: 0; font-size: 44px; line-height: 1.1; letter-spacing: -0.03em; }
.hero-lead { margin: 12px 0 0; font-size: 20px; color: var(--muted); }
.hero-actions { display: flex; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.hero-actions .btn { flex: 1 1 160px; }
.features { display: grid; gap: 12px; padding-bottom: 24px; }
.features .card + .card { margin-top: 0; }
.feature h2 { margin: 6px 0 4px; font-size: 18px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }
.feature-num { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 14px; }
.footer { padding: 16px 16px 32px; color: var(--muted); font-size: 13px; }
.footer p { margin: 0; }
.auth-card { margin-top: 28px; }

/* 일정/장소 목록 */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 20px 0 12px; }
.back { display: inline-flex; align-items: center; min-height: 40px; margin-top: 8px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.place-card .row-between { align-items: flex-start; }
.place-name { font-weight: 700; font-size: 16px; margin: 0; }
.place-memo { margin: 4px 0 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.place-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.place-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.event-card .meta { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.event-title { margin: 0; font-size: 17px; font-weight: 700; }

.confirmed {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
  background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box;
}
.confirmed .big { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 4px 0 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

details.panel > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::after { content: ""; width: 20px; height: 20px; background: var(--muted); -webkit-mask: url("/assets/ico-chevron.svg") center / 20px no-repeat; mask: url("/assets/ico-chevron.svg") center / 20px no-repeat; transition: transform .2s; }
details.panel[open] > summary::after { transform: rotate(180deg); }
details.panel[open] > summary { margin-bottom: 14px; }

.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1 1 auto; min-width: 0; font-size: 14px; }

/* 시간표 */
.grid-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); -webkit-overflow-scrolling: touch; }
.tgrid { display: grid; grid-template-columns: 54px repeat(var(--cols, 1), minmax(48px, 1fr)); min-width: min-content; }
.tg-corner, .tg-head, .tg-time { background: var(--surface); }
.tg-corner { position: sticky; left: 0; z-index: 2; border-bottom: 1px solid var(--line); }
.tg-head { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 2px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); line-height: 1.2; }
.tg-md { font-size: 14px; font-weight: 700; }
.tg-wd { font-size: 12px; color: var(--muted); }
.tg-wd.sun { color: var(--danger); }
.tg-wd.sat { color: var(--primary); }
.tg-time { position: sticky; left: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: flex-end; padding: 2px 8px 0 4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; border-top: 1px solid var(--line); }
.tg-time.half { color: transparent; border-top-style: dashed; }
.tg-cell {
  --a: 0;
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 36px; margin: 0; padding: 0; border: 0;
  border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; cursor: pointer;
}
.tg-cell.half { border-top-style: dashed; }
.is-select .tg-cell { touch-action: none; }
.is-select .tg-cell.on { background: rgb(var(--heat) / 85%); }
.is-select .tg-cell.on::after { content: ""; width: 14px; height: 14px; background: #fff; -webkit-mask: url("/assets/ico-check.svg") center / 14px no-repeat; mask: url("/assets/ico-check.svg") center / 14px no-repeat; }
.is-heat .tg-cell { background: rgb(var(--heat) / calc(var(--a) * 90%)); }
.is-heat .tg-cell.zero { color: transparent; }
.is-heat .tg-cell.ink { color: #fff; }
.is-heat .tg-cell.picked { outline: 3px solid var(--text); outline-offset: -3px; z-index: 1; }
.grid-legend { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.legend-scale { display: inline-flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.legend-scale i { width: 22px; height: 14px; display: block; }
.legend-scale i:nth-child(1) { background: var(--surface); }
.legend-scale i:nth-child(2) { background: rgb(var(--heat) / 30%); }
.legend-scale i:nth-child(3) { background: rgb(var(--heat) / 60%); }
.legend-scale i:nth-child(4) { background: rgb(var(--heat) / 90%); }

.pick-panel { border-left: 4px solid var(--primary); }
.names { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.name-tag { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--ok-soft); color: var(--ok); }
.name-tag.no { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
.tally { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.comments { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.comments li { font-size: 14px; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.comments b { margin-right: 6px; }

.step-num { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; border-radius: 999px; background: var(--primary); color: var(--primary-ink); font-size: 13px; font-weight: 800; margin-right: 6px; flex: none; }
.step-title { display: flex; align-items: center; }
.sticky-submit { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }

/* 알림 */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgb(0 0 0 / 20%); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }

@media (min-width: 640px) {
  .hero { padding: 72px 0 36px; }
  .hero-title { font-size: 56px; }
  .features { grid-template-columns: repeat(3, 1fr); }
  .h1 { font-size: 26px; }
}

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

/* 세로 묶음 안의 배지는 내용 너비만 차지 */
.stack > .badge, .stack-sm > .badge { align-self: flex-start; }
