@font-face { font-family: 'Pretendard'; font-weight: 400; font-display: swap; src: url('../assets/fonts/Pretendard-Regular.subset.woff2') format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 600; font-display: swap; src: url('../assets/fonts/Pretendard-SemiBold.subset.woff2') format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; font-display: swap; src: url('../assets/fonts/Pretendard-Bold.subset.woff2') format('woff2'); }

:root {
  --brand: #5E2751; --brand-dark: #471C3D; --tint: #F4EDF2; --tint2: #E7D9E3;
  --ink: #1F1A1E; --ink2: #5C5459; --muted: #958C92; --line: #EAE5E8; --field: #E2DCE0;
  --bg: #F7F5F4; --alert: #B4232C; --alert-tint: #FBECEC;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; font-size: 15px; line-height: 1.5;
}
h1, h2, h3, p { margin: 0; }
p { text-wrap: pretty; }
a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
.hidden { display: none !important; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; background: var(--bg); }
.page { padding: 0 20px calc(40px + var(--safe-b)); }
.page.with-tabs { padding-bottom: calc(var(--tabbar-h) + 32px + var(--safe-b)); }
.page.narrow { padding-left: 24px; padding-right: 24px; }

/* ---------- 상단 ---------- */
.brandbar { height: 56px; display: flex; align-items: center; gap: 10px; }
.brandbar img { height: 18px; width: auto; }
.wordmark { font-size: 11px; font-weight: 600; letter-spacing: 0.18em; color: var(--ink2); }
.topbar { height: 56px; display: flex; align-items: center; margin: 0 -8px; }
.topbar .icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.topbar .title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.topbar .spacer { width: 44px; }

/* ---------- 글자 ---------- */
.h1 { font-size: 24px; line-height: 1.35; font-weight: 700; letter-spacing: -0.03em; }
.h2 { font-size: 17px; font-weight: 700; }
.sub { font-size: 15px; color: var(--ink2); line-height: 1.6; }
.small { font-size: 13px; color: var(--ink2); }
.tiny { font-size: 12px; color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }

/* ---------- 입력 ---------- */
.stack { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; } .gap-32 { gap: 32px; } .gap-40 { gap: 40px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink2); }
.input { height: 52px; width: 100%; background: #fff; border: 1px solid var(--field); border-radius: 12px; padding: 0 16px; font-size: 16px; outline: none; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(94,39,81,0.12); }
.input::placeholder { color: var(--muted); }
.input-wrap { position: relative; }
.input-wrap .prefix { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--ink2); font-size: 16px; }
.input-wrap .input { padding-left: 34px; }
.err { font-size: 13px; color: var(--alert); }

.btn { height: 56px; width: 100%; border-radius: 14px; background: var(--brand); color: #fff; font-size: 16px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { background: var(--brand-dark); }
.btn[disabled] { background: #CFC4CB; cursor: default; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--tint2); }
.btn.small { height: 44px; font-size: 15px; border-radius: 12px; }
.linkrow { display: flex; justify-content: center; align-items: center; gap: 14px; font-size: 14px; color: var(--ink2); }
.linkrow .sep { width: 1px; height: 12px; background: #D8D1D5; }

/* ---------- 카드 ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.card-pad { padding: 18px; }
.row { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.row + .row { border-top: 1px solid var(--line); }
.icon-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--tint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.tint { background: var(--tint); color: var(--brand); }
.chip.solid { background: var(--brand); color: #fff; }
.chip.outline { background: #fff; color: var(--ink2); border: 1px solid var(--line); }
.chip.gray { background: #EFECEE; color: var(--ink2); }
.chip.alert { background: var(--alert-tint); color: var(--alert); }
.done { display: flex; align-items: center; gap: 6px; color: var(--brand); font-size: 13px; font-weight: 600; }
.done .dot { width: 22px; height: 22px; border-radius: 999px; background: var(--brand); display: flex; align-items: center; justify-content: center; }
.note { display: flex; gap: 10px; align-items: flex-start; background: #EFECEE; border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.55; color: var(--ink2); }
.note svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- 홈 ---------- */
.hero { background: var(--brand); color: #fff; border-radius: 20px; padding: 22px; }
.hero .label { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.72); }
.hero .big { font-size: 46px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.hero .of { font-size: 17px; color: rgba(255,255,255,0.72); }
.segs { display: flex; gap: 3px; margin-top: 18px; }
.seg { flex: 1; height: 8px; border-radius: 3px; background: rgba(255,255,255,0.16); }
.seg.S { background: #fff; } .seg.H { background: rgba(255,255,255,0.42); }
.seg.T { background: transparent; box-shadow: inset 0 0 0 1.5px #fff; }
.hero .foot { margin-top: 14px; font-size: 12.5px; line-height: 1.5; color: rgba(255,255,255,0.75); }

/* ---------- 업로드 ---------- */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.slot { position: relative; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; background: #EFECEE; }
.slot img, .slot video { width: 100%; height: 100%; object-fit: cover; }
.slot .rm { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 999px; background: rgba(31,26,30,0.62); display: flex; align-items: center; justify-content: center; }
.slot .badge { position: absolute; left: 6px; bottom: 6px; height: 20px; padding: 0 7px; border-radius: 999px; background: rgba(31,26,30,0.62); color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; }
.slot.add { background: #fff; border: 1.5px dashed #CFC7CC; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--ink2); font-size: 12px; }
.tags { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tag { position: relative; text-align: left; border-radius: 16px; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; background: #fff; border: 1px solid var(--field); }
.tag.on { background: var(--tint); border: 1.5px solid var(--brand); }
.tag .mark { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid #CFC7CC; background: #fff; display: flex; align-items: center; justify-content: center; }
.tag.on .mark { border: 0; background: var(--brand); }
.tag .t { font-size: 15px; font-weight: 600; }
.tag .s { font-size: 12.5px; color: var(--ink2); margin-top: -8px; line-height: 1.4; }
.sticky-bottom { position: sticky; bottom: 0; padding: 12px 0 calc(16px + var(--safe-b)); background: linear-gradient(to bottom, rgba(247,245,244,0), var(--bg) 30%); }

/* ---------- 기록 ---------- */
.stats { display: flex; align-items: center; padding: 14px 8px; }
.stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat .n { font-size: 22px; font-weight: 700; } .stat .u { font-size: 13px; color: var(--ink2); }
.stat .l { font-size: 12px; color: var(--muted); }
.vsep { width: 1px; height: 32px; background: var(--line); }
.days { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.day { aspect-ratio: 1 / 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; font-size: 11px; color: var(--ink2); background: #F4F1F3; }
.day b { font-size: 15px; font-weight: 700; color: var(--ink); }
.day.S { background: var(--brand); color: rgba(255,255,255,0.8); } .day.S b { color: #fff; }
.day.H { background: var(--tint2); color: var(--brand); } .day.H b { color: var(--brand); }
.day.M { background: #fff; box-shadow: inset 0 0 0 1.5px #E3A5A9; color: var(--alert); } .day.M b { color: var(--alert); }
.day.T { background: #fff; box-shadow: inset 0 0 0 2px var(--brand); } .day.T b { color: var(--brand); }
.day.F { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); } .day.F b { color: var(--muted); font-weight: 600; }
.day.sel { outline: 2px solid var(--ink); outline-offset: 2px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.media-grid .m { aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #EFECEE; }
.media-grid .m img, .media-grid .m video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 내 정보 ---------- */
.kv { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv .k { width: 96px; flex-shrink: 0; font-size: 14px; color: var(--ink2); }
.kv .v { flex: 1; text-align: right; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 56px; height: 56px; border-radius: 999px; background: var(--tint); color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; flex-shrink: 0; }

/* ---------- 가입 ---------- */
.choice { border-radius: 14px; padding: 16px; display: flex; align-items: flex-start; gap: 14px; background: #fff; border: 1px solid var(--field); text-align: left; width: 100%; }
.choice.on { border: 1.5px solid var(--brand); background: var(--tint); }
.radio { width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid #CFC7CC; background: #fff; flex-shrink: 0; margin-top: 1px; }
.choice.on .radio { border: 6px solid var(--brand); }
.mtags { display: flex; flex-wrap: wrap; gap: 6px; }
.mtag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid #CFC7CC; background: #fff; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.check.on { border: 0; background: var(--brand); }
.term { display: flex; align-items: center; gap: 12px; min-height: 36px; font-size: 14px; color: var(--ink2); width: 100%; text-align: left; }
.term .grow { flex: 1; }
.term .view { font-size: 13px; color: var(--muted); text-decoration: underline; padding: 6px 0 6px 8px; }

/* ---------- 탭바 ---------- */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--line); display: flex; z-index: 20; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; }
.tabbar a.on { color: var(--brand); font-weight: 600; }

/* ---------- 모달·토스트 ---------- */
.modal { position: fixed; inset: 0; background: rgba(31,26,30,0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 480px; max-height: 86vh; border-radius: 20px 20px 0 0; display: flex; flex-direction: column; }
.sheet .sh { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.sheet .sb { overflow-y: auto; padding: 0 20px calc(24px + var(--safe-b)); font-size: 14px; line-height: 1.7; color: var(--ink2); white-space: pre-line; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + var(--safe-b)); transform: translateX(-50%); background: rgba(31,26,30,0.92); color: #fff; font-size: 14px; padding: 12px 18px; border-radius: 12px; z-index: 60; max-width: calc(100% - 40px); text-align: center; }
.spinner { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--tint2); border-top-color: var(--brand); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.tip { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--tint2); border-radius: 14px; padding: 14px; font-size: 13px; line-height: 1.55; color: var(--ink2); }
.tip b { color: var(--ink); }
