/* 디자인 토큰: 흰 바탕 + 노랑 포인트(예시 앱 느낌), 라이트/다크 */
:root {
  color-scheme: light;
  --bg:#F6F6F4; --surface:#FFFFFF; --surface-2:#F2F2EF;
  --text:#1F1F1F; --muted:#8A8A86; --line:#EBEBE7;
  --accent:#FFB300; --fab:#FDA617; --accent-soft:#FFF5D6; --accent-text:#8A5A00; --on-accent:#3A2A00;
  --danger:#D9434F; --focus:#F59E0B; --sun:#E5484D; --sat:#3B82F6;
  --scrim:rgb(0 0 0 / .4);
  --shadow:0 2px 12px rgb(0 0 0 / .05); --fab-shadow:0 6px 18px rgb(253 166 23 / .45);
  --sheet-shadow:0 -12px 48px rgb(0 0 0 / .14);
  --r-sm:10px; --r-md:14px; --r-lg:20px;
  --t-sm:.8125rem; --fast:120ms; --ease:cubic-bezier(.2,.8,.2,1);
  --tab-h:58px;
}
@media (prefers-color-scheme:dark) { :root:not([data-theme=light]) {
  color-scheme:dark;
  --bg:#121212; --surface:#1E1E1E; --surface-2:#2A2A2A;
  --text:#F1F1EF; --muted:#A3A3A0; --line:#333331;
  --accent:#FFC233; --fab:#FFB52E; --accent-soft:#3A2F12; --accent-text:#FFD36B; --on-accent:#2A1F00;
  --danger:#FF8A8F; --focus:#FFC233; --sun:#FF8A8F; --sat:#86B6FF;
  --scrim:rgb(0 0 0 / .62); --shadow:none; --fab-shadow:0 6px 18px rgb(0 0 0 / .4); --sheet-shadow:0 -12px 48px rgb(0 0 0 / .4);
} }
:root[data-theme=dark] {
  color-scheme:dark;
  --bg:#121212; --surface:#1E1E1E; --surface-2:#2A2A2A;
  --text:#F1F1EF; --muted:#A3A3A0; --line:#333331;
  --accent:#FFC233; --fab:#FFB52E; --accent-soft:#3A2F12; --accent-text:#FFD36B; --on-accent:#2A1F00;
  --danger:#FF8A8F; --focus:#FFC233; --sun:#FF8A8F; --sat:#86B6FF;
  --scrim:rgb(0 0 0 / .62); --shadow:none; --fab-shadow:0 6px 18px rgb(0 0 0 / .4); --sheet-shadow:0 -12px 48px rgb(0 0 0 / .4);
}

* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { background:var(--bg); }
body { margin:0; background:var(--bg); color:var(--text);
  font:400 1rem/1.5 -apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Noto Sans KR",sans-serif;
  -webkit-text-size-adjust:100%; }
main { max-width:600px; margin:auto; min-height:100vh; min-height:100dvh;
  padding:0 0 calc(var(--tab-h) + 90px + env(safe-area-inset-bottom)); }
main.bare { padding:calc(16px + env(safe-area-inset-top)) 20px 40px; }
.pad { padding:0 max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left)); }
h1 { margin:0; font-size:1.375rem; line-height:1.3; }
h2 { margin:0 0 12px; font-size:1.0625rem; }
a { color:var(--accent-text); }
small,.muted { color:var(--muted); font-size:var(--t-sm); }
.numeric { font-variant-numeric:tabular-nums; }
.stack > * + * { margin-top:12px; }
.spread { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.card { padding:18px; border-radius:var(--r-lg); background:var(--surface); box-shadow:var(--shadow); }
.section-title { margin:24px 0 10px; font-size:1.0625rem; font-weight:700; }
.badge { display:inline-flex; align-items:center; padding:2px 9px; border-radius:999px; background:var(--accent-soft);
  color:var(--accent-text); font-size:12px; font-weight:700; white-space:nowrap; }
.badge.pink { background:color-mix(in srgb,#F0508A 14%,var(--surface)); color:#D6336C; }
.err { color:var(--danger); font-size:var(--t-sm); }
.empty { text-align:center; padding:28px 12px; color:var(--muted); }
.empty b { display:block; color:var(--text); font-size:1.0625rem; margin:8px 0 2px; font-weight:600; }

/* 상단 앱바 */
.appbar { position:sticky; top:0; z-index:20; background:var(--surface); border-bottom:1px solid var(--line);
  padding:calc(10px + env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left)); }
.appbar .who { display:flex; align-items:center; gap:10px; }
.avatar { width:42px; height:42px; border-radius:50%; object-fit:cover; flex:none; display:grid; place-items:center;
  background:var(--accent-soft); font-size:22px; border:2px solid var(--surface); box-shadow:0 0 0 1px var(--line); }
.avatar.lg { width:72px; height:72px; font-size:36px; }
.who-name { font-size:1.25rem; font-weight:800; line-height:1.2; }
.who-sub { font-size:var(--t-sm); color:var(--muted); }
.who-sub b { color:var(--accent-text); font-weight:700; }

/* 버튼 */
button,input,select,textarea { font:inherit; }
button,a,input,select,textarea,label { -webkit-tap-highlight-color:transparent; }
button,.button { min-height:46px; padding:11px 18px; border:1px solid transparent; border-radius:var(--r-md);
  cursor:pointer; touch-action:manipulation; display:inline-flex; align-items:center; justify-content:center; gap:8px;
  text-decoration:none; font-weight:600; color:var(--text); background:var(--surface-2);
  transition:transform var(--fast),background var(--fast),opacity var(--fast); }
.primary { background:var(--accent); color:var(--on-accent); }
.soft { background:var(--accent-soft); color:var(--accent-text); }
.secondary { background:var(--surface); color:var(--text); border-color:var(--line); }
.danger { background:transparent; color:var(--danger); border-color:var(--line); }
.link { background:none; min-height:0; padding:0; color:var(--accent-text); font-weight:600; }
.icon-btn { min-height:40px; min-width:40px; padding:0 10px; background:var(--surface); border-color:var(--line); border-radius:12px; }
.block { width:100%; }
button:active,.button:active { transform:scale(.97); }
button:disabled { opacity:.5; cursor:default; transform:none; }
:focus-visible { outline:3px solid var(--focus); outline-offset:2px; }
.fab { position:fixed; z-index:25; right:max(18px,calc(50% - 300px + 18px)); bottom:calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  width:62px; height:62px; border-radius:50%; display:grid; place-items:center; background:var(--fab); color:#fff;
  box-shadow:var(--fab-shadow); font-size:34px; font-weight:300; line-height:1; cursor:pointer; }
.fab input { position:absolute; opacity:0; width:1px; height:1px; }

/* 리스트, 폼 */
.row { min-height:52px; display:flex; align-items:center; gap:12px; padding:9px 0; border-bottom:1px solid var(--line); }
.row:last-child { border-bottom:0; }
.row-main { flex:1; min-width:0; }
label { display:block; font-weight:600; margin-bottom:6px; font-size:.9375rem; }
.field + .field { margin-top:14px; }
.inline { display:flex; gap:8px; align-items:center; }
.inline input { flex:1; }
input,select,textarea { width:100%; min-width:0; min-height:46px; padding:11px 12px; font-size:16px; color:var(--text);
  background:var(--surface); border:1px solid var(--line); border-radius:var(--r-sm); }
.segmented { display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:4px; padding:4px;
  background:var(--surface-2); border-radius:var(--r-md); }
.segmented label,.segmented a { position:relative; margin:0; text-decoration:none; }
.segmented input { position:absolute; opacity:0; width:1px; min-height:0; }
.segmented span { min-height:40px; display:grid; place-items:center; padding:6px; border-radius:11px;
  font-size:var(--t-sm); font-weight:700; color:var(--muted); }
.segmented input:checked + span,.segmented [aria-current] span { background:var(--surface); color:var(--text); box-shadow:var(--shadow); }
.segmented input:focus-visible + span { outline:3px solid var(--focus); }

/* 상단 텍스트 탭 (오늘/주간, 월) */
.toptabs { display:flex; gap:22px; overflow-x:auto; scrollbar-width:none; padding:4px 0 0; }
.toptabs::-webkit-scrollbar { display:none; }
.toptabs a { flex:none; padding:8px 0 10px; color:var(--muted); text-decoration:none; font-size:1.125rem; font-weight:700;
  border-bottom:3px solid transparent; }
.toptabs a[aria-current] { color:var(--text); border-color:var(--accent); }

/* 기록 종류 아이콘 */
.kinds { display:flex; gap:14px; overflow-x:auto; scrollbar-width:none; padding:14px 16px 6px; scroll-snap-type:x proximity; }
.kinds::-webkit-scrollbar { display:none; }
.kchip { flex:none; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:6px; background:none; padding:0;
  min-height:0; border:0; color:var(--text); font-size:13px; font-weight:600; scroll-snap-align:start; }
.kchip i { width:58px; height:58px; border-radius:50%; display:grid; place-items:center; font-style:normal; font-size:28px;
  background:color-mix(in srgb,var(--c) 18%,var(--surface)); }
.kchip .tap { font-size:10px; color:var(--muted); font-weight:500; margin-top:-4px; }
.chip-btn { min-height:38px; padding:6px 14px; border-radius:999px; background:var(--surface-2); color:var(--text);
  font-size:14px; font-weight:600; border:1px solid transparent; }
.chip-btn.on { background:var(--accent-soft); color:var(--accent-text); border-color:var(--accent); }
.chip-btn.save { background:var(--accent); color:var(--on-accent); }
.kdot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--c,#999); flex:none; }
.kicon { width:34px; height:34px; border-radius:50%; display:grid; place-items:center; flex:none; font-size:17px;
  background:color-mix(in srgb,var(--c) 18%,var(--surface)); }

/* 사진 */
.photos { display:grid; grid-template-columns:repeat(4,1fr); gap:3px; }
.photos.three { grid-template-columns:repeat(3,1fr); }
.photos a { display:block; }
.photos img { width:100%; aspect-ratio:1; object-fit:cover; display:block; background:var(--surface-2); }
.strip { display:flex; gap:4px; overflow-x:auto; scrollbar-width:none; margin:12px 0 0; }
.strip img { width:76px; height:76px; object-fit:cover; border-radius:10px; flex:none; display:block; }
.photo-full { width:100%; border-radius:var(--r-md); display:block; background:var(--surface-2); }
.month-head { display:flex; align-items:center; gap:8px; margin:22px 0 10px; font-size:1.125rem; font-weight:700; }
.month-head::before { content:""; width:4px; height:18px; border-radius:2px; background:var(--accent); }
.date-head { margin:16px 0 8px; display:flex; align-items:baseline; gap:8px; font-weight:700; font-size:.9375rem; }

/* 하단 탭바 */
.tabbar { position:fixed; inset:auto 0 0; z-index:30;
  padding:6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
  background:var(--surface); border-top:1px solid var(--line); }
.tabbar-inner { max-width:600px; margin:auto; display:grid; grid-template-columns:repeat(4,1fr); }
.tabbar a { display:flex; flex-direction:column; align-items:center; gap:2px; min-height:46px; color:var(--muted);
  text-decoration:none; font-size:11px; line-height:1.2; touch-action:manipulation; }
.tabbar svg { width:28px; height:28px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; }
.tabbar [aria-current="page"] { color:var(--text); font-weight:800; }
.tabbar [aria-current="page"] svg { stroke-width:2; }
.tabbar [aria-current="page"] svg .fill { fill:var(--accent); }

/* 캘린더 */
.cal-head { display:flex; align-items:center; justify-content:space-between; padding:16px 0 10px; }
.cal-head h1 { font-size:1.25rem; }
.cal-nav { display:flex; gap:6px; }
.weekdays,.calendar { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; }
.weekdays { margin-bottom:4px; text-align:center; font-size:12px; color:var(--muted); }
.weekdays :first-child { color:var(--sun); } .weekdays :last-child { color:var(--sat); }
.day { position:relative; display:flex; flex-direction:column; align-items:center; gap:2px; min-width:0; min-height:84px;
  padding:4px 1px 3px; color:var(--text); background:var(--surface); border:0; border-radius:10px; font-weight:400; }
.day:nth-child(7n+1) .day-number { color:var(--sun); } .day:nth-child(7n) .day-number { color:var(--sat); }
.day-number { display:grid; place-items:center; width:24px; height:24px; border-radius:50%; font-size:13px; line-height:1; }
.day[aria-current="date"] .day-number { background:var(--accent); color:var(--on-accent); font-weight:800; }
.day.is-selected { outline:2px solid var(--accent); outline-offset:-2px; }
.day img { width:calc(100% - 4px); height:28px; object-fit:cover; border-radius:6px; }
.day .no-photo { height:28px; }
.day .corr { font-size:10px; line-height:1.1; color:var(--accent-text); font-weight:700; letter-spacing:-.02em; white-space:nowrap; }
.day .dots { display:flex; justify-content:center; gap:2px; height:5px; }
.day .dots .kdot { width:5px; height:5px; }
.day.outside { background:transparent; opacity:.4; }
.legend { display:flex; gap:12px; flex-wrap:wrap; justify-content:center; margin-top:10px; font-size:12px; color:var(--muted); }
.legend span { display:inline-flex; align-items:center; gap:5px; }

/* 최근 활동 타임라인 */
.timeline { position:relative; margin-left:6px; padding-left:18px; border-left:2px solid var(--line); }
.timeline > div { position:relative; padding-bottom:16px; }
.timeline > div::before { content:""; position:absolute; left:-25px; top:6px; width:12px; height:12px; border-radius:50%;
  background:var(--accent); box-shadow:0 0 0 3px var(--bg); }
.tl-date { font-weight:700; margin-bottom:8px; } .tl-date small { font-weight:600; margin-left:6px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chip { display:inline-flex; align-items:center; gap:5px; padding:4px 10px; border-radius:999px; font-size:13px; font-weight:600;
  background:color-mix(in srgb,var(--c) 14%,var(--surface)); }

/* 수유텀: 날짜 헤더, 원형 차트, 주간 */
.datebar { display:flex; align-items:center; justify-content:space-between; gap:6px; padding:12px 0; }
.datebar .title { text-align:center; flex:1; }
.datebar .title b { font-size:1.125rem; }
.radial { display:block; width:100%; max-width:340px; margin:4px auto 0; overflow:visible; }
.radial .face { fill:var(--surface-2); }
.radial .tick { stroke:var(--muted); stroke-width:1.5; }
.radial text { fill:var(--muted); font-size:12px; text-anchor:middle; dominant-baseline:middle; }
.radial .now { stroke:var(--danger); stroke-width:2; }
.stats { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.stat { background:var(--surface-2); border-radius:12px; padding:10px; text-align:center; }
.stat b { display:block; font-size:1.0625rem; }
.week { display:grid; grid-template-columns:28px repeat(7,minmax(0,1fr)); gap:3px; }
.week .wh { text-align:center; font-size:11px; color:var(--muted); line-height:1.3; }
.week .wh b { display:block; font-size:13px; color:var(--text); }
.week .wh.today b { color:var(--accent-text); }
.week .hours { position:relative; height:480px; font-size:10px; color:var(--muted); }
.week .hours span { position:absolute; right:2px; transform:translateY(-50%); }
.week .col { position:relative; height:480px; background:var(--surface-2); border-radius:8px; overflow:hidden;
  background-image:repeating-linear-gradient(to bottom,transparent 0 59px,var(--line) 59px 60px); }
.week .mk { position:absolute; left:15%; right:15%; min-height:3px; border-radius:3px; background:var(--c); opacity:.9; }
.next-feed { background:var(--accent-soft); color:var(--accent-text); border-radius:var(--r-lg); padding:14px 18px; }
.next-feed b { color:var(--text); }

/* 성장 그래프, 일기 */
.chart { display:block; width:100%; overflow:visible; }
.chart text { fill:var(--muted); font-size:10px; dominant-baseline:middle; }
.chart .grid { stroke:var(--line); }
.chart .due { stroke:var(--danger); stroke-dasharray:3 3; }
.chart .due-t { fill:var(--danger); font-weight:700; }
.chart .line { fill:none; stroke:var(--fab); stroke-width:2.5; stroke-linejoin:round; }
.chart .pt { fill:var(--surface); stroke:var(--fab); stroke-width:2; }
textarea { min-height:160px; line-height:1.6; resize:vertical; }
.diary-mark { position:absolute; top:3px; right:4px; font-size:10px; color:var(--accent-text); }

/* 리듬 */
.heat { display:grid; grid-template-columns:repeat(24,1fr); gap:2px; margin-top:4px; }
.heat span { height:22px; border-radius:3px; background:color-mix(in srgb,var(--c) var(--p),var(--surface-2)); }
.heat-axis { display:flex; justify-content:space-between; font-size:10px; color:var(--muted); }
.bars { display:grid; grid-template-columns:repeat(14,1fr); gap:3px; height:150px; align-items:end; }
.bars div { display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; gap:2px; }
.bars i { width:100%; min-height:2px; border-radius:4px 4px 2px 2px; background:var(--fab); }
.bars small { font-size:9px; color:var(--muted); line-height:1; }

/* 동영상 표시 */
.vid { position:relative; }
.vid::before { content:"▶"; position:absolute; left:6px; bottom:6px; z-index:1; width:22px; height:22px; border-radius:50%;
  display:grid; place-items:center; background:rgb(0 0 0 / .55); color:#fff; font-size:10px; }
video.photo-full { max-height:70vh; background:#000; }

/* 앨범 선택/저장 */
.sel-only, .sel-bar { display:none; }
.selecting .sel-only { display:inline-flex; min-height:30px; padding:3px 10px; font-size:12px; }
.selecting .fab { display:none; }
.selecting .sel-bar { display:block; position:fixed; z-index:31; left:0; right:0; margin:auto; max-width:600px;
  bottom:calc(var(--tab-h) + 12px + env(safe-area-inset-bottom)); background:var(--surface); padding:12px 16px;
  border-radius:var(--r-lg); box-shadow:var(--sheet-shadow); width:calc(100% - 24px); }
.pick { position:relative; }
.selecting .pick::after { content:""; position:absolute; top:6px; right:6px; width:22px; height:22px; border-radius:50%;
  border:2px solid #fff; background:rgb(0 0 0 / .25); }
.selecting .pick.picked img { opacity:.75; }
.selecting .pick.picked::after { content:"✓"; background:var(--fab); color:#fff; font-size:13px; font-weight:800;
  display:grid; place-items:center; }

/* 바텀 시트 */
.sheet { position:fixed; inset:auto 0 0; margin:0 auto; width:100%; max-width:600px; max-height:88vh; max-height:88dvh;
  padding:0; overflow:hidden; color:var(--text); background:var(--surface); border:0; border-radius:22px 22px 0 0;
  box-shadow:var(--sheet-shadow); }
.sheet::backdrop { background:var(--scrim); }
.sheet[open] { display:flex; flex-direction:column; animation:sheet-in 200ms var(--ease); }
.sheet-handle { flex:none; width:36px; height:4px; margin:10px auto 4px; border-radius:99px; background:var(--line); }
.sheet-header { flex:none; padding:6px 20px 12px; border-bottom:1px solid var(--line); }
.sheet-body { overflow-y:auto; overscroll-behavior:contain; padding:18px 20px calc(20px + env(safe-area-inset-bottom)); }
@keyframes sheet-in { from { transform:translateY(24px); opacity:0; } to { transform:translateY(0); opacity:1; } }

/* 토스트 */
.toast { position:fixed; left:50%; transform:translateX(-50%); z-index:40;
  bottom:calc(var(--tab-h) + 92px + env(safe-area-inset-bottom)); display:flex; align-items:center; gap:14px;
  padding:8px 10px 8px 18px; border-radius:999px; background:var(--text); color:var(--bg);
  font-size:var(--t-sm); white-space:nowrap; animation:toast 8s forwards; }
.toast button { min-height:34px; padding:5px 12px; background:transparent; color:var(--bg); border-color:currentColor; }
@keyframes toast { 0%{opacity:0} 4%,92%{opacity:1} 100%{opacity:0; visibility:hidden} }

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