/* ═════════ 토큰 ═════════ */
:root {
  color-scheme: light;
  --bg: #fff6ec;
  --surface: #fffdf9;
  --surface-2: #f7eee3;
  --glass: rgba(255, 253, 249, .78);
  --line: #f0e3d3;
  --text: #3a302a;
  --text-2: #6e6158;
  --text-3: #a39588;
  --accent: #f2795a;
  --accent-soft: #ffe1d6;
  --accent-ink: #ffffff;
  --danger: #d8524a;
  --focus: #f2795a;
  --grid: #f1e6d9;
  /* 기분: 비(파랑) ← 구름(베이지) → 햇살(주황) */
  --m1: #7ea3dc;
  --m2: #b3cdee;
  --m3: #e9dfd1;
  --m4: #ffd98a;
  --m5: #ffb547;
  --warm: #fff0cc;
  --cool: #e3eefb;
  --tint: transparent;
  --sky: #ffd9c2;
  --sky-2: #ffe9d6;
  --radius: 24px;
  --shadow: 0 1px 2px rgba(120, 90, 60, .05), 0 8px 28px rgba(120, 90, 60, .08);
  --hand: 'Gaegu', 'Pretendard Variable', cursive;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}
:root[data-time="morning"] { --sky: #ffd6bd; --sky-2: #fff0c9; }
:root[data-time="day"] { --sky: #cfe5ff; --sky-2: #fff0d6; }
:root[data-time="evening"] { --sky: #e7d3ff; --sky-2: #ffd9cf; }
:root[data-time="night"] { --sky: #cdd2f7; --sky-2: #e9dcff; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1c1a26;
    --surface: #26232f;
    --surface-2: #322e3d;
    --glass: rgba(38, 35, 47, .78);
    --line: #3b3647;
    --text: #f5efe7;
    --text-2: #cbc1b6;
    --text-3: #8f879b;
    --accent: #ff9b7a;
    --accent-soft: #4a3237;
    --accent-ink: #2a1d18;
    --danger: #ff8a80;
    --focus: #ff9b7a;
    --grid: #34303f;
    --m1: #6f93d1;
    --m2: #9db8df;
    --m3: #bfb3a3;
    --m4: #f0cb7c;
    --m5: #f5a93a;
    --warm: #4a3d2b;
    --cool: #2c3650;
    --sky: #3a3172;
    --sky-2: #2a2f5c;
    --shadow: 0 8px 28px rgba(0, 0, 0, .25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1c1a26;
  --surface: #26232f;
  --surface-2: #322e3d;
  --glass: rgba(38, 35, 47, .78);
  --line: #3b3647;
  --text: #f5efe7;
  --text-2: #cbc1b6;
  --text-3: #8f879b;
  --accent: #ff9b7a;
  --accent-soft: #4a3237;
  --accent-ink: #2a1d18;
  --danger: #ff8a80;
  --focus: #ff9b7a;
  --grid: #34303f;
  --m1: #6f93d1;
  --m2: #9db8df;
  --m3: #bfb3a3;
  --m4: #f0cb7c;
  --m5: #f5a93a;
  --warm: #4a3d2b;
  --cool: #2c3650;
  --sky: #3a3172;
  --sky-2: #2a2f5c;
  --shadow: 0 8px 28px rgba(0, 0, 0, .25);
}

/* ═════════ 기본 ═════════ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.hand { font-family: var(--hand); font-weight: 700; letter-spacing: -.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 배경: 시간대 하늘 + 오늘 기분 색이 몽글몽글 번진다 */
#ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
#ambient::before, #ambient::after, #ambient i {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
}
#ambient::before { width: 110vw; height: 55vh; left: -35vw; top: -22vh; background: var(--sky); opacity: .75; }
#ambient::after { width: 80vw; height: 45vh; right: -35vw; bottom: -18vh; background: var(--sky-2); opacity: .6; }
#ambient i {
  display: block; width: 90vw; height: 50vh; right: -30vw; top: -8vh;
  background-color: var(--tint); opacity: .55; transition: background-color 1s ease;
  animation: drift 16s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(-8vw, 6vh) scale(1.1); } }

#view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom));
  outline: none;
  animation: fadeIn .35s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

h1 { font-family: var(--hand); font-weight: 700; font-size: 2.1rem; line-height: 1.15; margin: 2px 0 6px; letter-spacing: -.02em; }
h2 { font-family: var(--hand); font-weight: 700; font-size: 1.45rem; line-height: 1.2; margin: 0 0 12px; }
.sub { color: var(--text-2); font-size: .92rem; margin: 0 0 18px; }
.muted { color: var(--text-3); }
.small { font-size: .85rem; }

.card {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card > h2 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card > h2 .opt { font-family: var(--sans); font-weight: 500; font-size: .8rem; color: var(--text-3); text-decoration: none; }
a.opt { color: var(--accent) !important; }

.chip-date {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line);
  font-size: .82rem; color: var(--text-2); font-weight: 600;
}

/* ═════════ 탭바: 떠 있는 알약 ═════════ */
.tabbar {
  position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex; gap: 4px;
  width: min(420px, calc(100vw - 32px));
  padding: 6px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(90, 60, 40, .14);
  z-index: 10;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: 54px; border-radius: 999px;
  color: var(--text-3); text-decoration: none; font-size: .72rem; font-weight: 600;
  transition: background .2s, color .2s;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar svg .fillme { fill: currentColor; stroke: none; }
.tabbar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.tabbar a[aria-current="page"] svg { animation: hop .4s ease; }
@keyframes hop { 40% { transform: translateY(-3px); } }

/* ═════════ 버튼 ═════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; text-decoration: none; color: var(--text);
  transition: transform .1s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .82rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }

/* ═════════ 오늘: 인사 + 캐릭터 ═════════ */
.greet { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.greet h1 { margin-top: 10px; }
.save-pill {
  flex: none; margin-top: 4px;
  padding: 5px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  background: var(--glass); border: 1px solid var(--line); color: var(--text-3);
  transition: opacity .3s;
}
.save-pill.ok { color: var(--accent); }
.back { display: inline-flex; align-items: center; gap: 2px; color: var(--text-2); text-decoration: none; font-size: .9rem; font-weight: 600; }

.hero { text-align: center; padding-top: 22px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; left: 50%; top: 18px; width: 170px; height: 170px; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle, var(--hero-glow, var(--surface-2)) 0%, transparent 70%);
  opacity: .9; transition: background .6s;
}
.hero-face { position: relative; height: 128px; display: grid; place-items: center; }
.hero-face .face { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.hero-face.pop .face { animation: pop .5s cubic-bezier(.3, 1.6, .5, 1), breathe 3.2s ease-in-out .5s infinite; }
@keyframes breathe { 50% { transform: translateY(-3px) scale(1.03, .97); } }
@keyframes pop { 0% { transform: scale(.5) rotate(-8deg); } 60% { transform: scale(1.12) rotate(3deg); } 100% { transform: scale(1); } }

.bubble {
  position: relative; display: inline-block; margin: 10px auto 18px; max-width: 90%;
  padding: 8px 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--hand); font-weight: 700; font-size: 1.25rem; line-height: 1.3; color: var(--text);
  box-shadow: 0 2px 8px rgba(120, 90, 60, .06);
}
.bubble::before {
  content: ""; position: absolute; left: 50%; top: -7px; width: 12px; height: 12px;
  background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.bubble.swap { animation: bubbleIn .35s ease; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px) scale(.96); } }

.moods { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; }
.mood-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; border: 0; background: transparent; border-radius: 18px;
  font-size: .78rem; font-weight: 600; color: var(--text-3);
}
.mood-btn::before {
  content: ""; position: absolute; top: 6px; left: 50%; width: 54px; height: 54px; transform: translateX(-50%) scale(.4);
  border-radius: 50%; background: var(--mc); opacity: 0; transition: transform .25s, opacity .25s;
}
.mood-btn .face { position: relative; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), filter .25s; filter: saturate(.85); }
.mood-btn:hover .face { transform: translateY(-2px); }
.mood-btn[aria-pressed="true"] { color: var(--text); }
.mood-btn[aria-pressed="true"]::before { opacity: .35; transform: translateX(-50%) scale(1.15); }
.mood-btn[aria-pressed="true"] .face { transform: scale(1.18); filter: none; animation: wiggle .6s ease; }
.has-mood .mood-btn[aria-pressed="false"] .face { filter: saturate(.5); opacity: .6; }
@keyframes wiggle { 25% { rotate: -8deg; } 50% { rotate: 6deg; } 75% { rotate: -3deg; } }

/* 반짝이 */
.spark {
  position: fixed; z-index: 50; pointer-events: none; font-size: 18px; line-height: 1;
  animation: rise 1s ease-out forwards;
}
@keyframes rise {
  0% { opacity: 0; transform: translate(0, 0) scale(.4); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), -90px) scale(1.1) rotate(var(--rot)); }
}

/* ═════════ 칩 ═════════ */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-size: .9rem; font-weight: 600; color: var(--text-2);
  transition: transform .15s, background .2s, border-color .2s;
}
.chip:active { transform: scale(.94); }
.chip .ic { font-size: 1rem; }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--text); background: var(--surface-2); }
.chip.warm[aria-pressed="true"] { background: var(--warm); border-color: var(--m5); }
.chip.cool[aria-pressed="true"] { background: var(--cool); border-color: var(--m1); }
.chip[aria-pressed="true"]::after { content: "✓"; font-size: .8rem; margin-left: 1px; }
.chip-group-label { font-size: .78rem; font-weight: 600; color: var(--text-3); margin: 12px 0 6px; }
.chip-group-label:first-of-type { margin-top: 0; }

/* ═════════ 줄노트 ═════════ */
.note-card { padding-top: 24px; }
.tape {
  position: absolute; top: -11px; left: 50%; width: 96px; height: 24px;
  transform: translateX(-50%) rotate(-2.5deg);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--m4) 85%, transparent) 0 8px, color-mix(in srgb, var(--m4) 65%, transparent) 8px 16px);
  border-radius: 3px; opacity: .9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
}
.prompt .btn { flex: none; white-space: nowrap; }
.prompt { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.prompt label { font-family: var(--hand); font-weight: 700; font-size: 1.35rem; line-height: 1.3; color: var(--text); }
.prompt label::before { content: "Q. "; color: var(--accent); }
.lined {
  display: block; width: 100%; min-height: 224px; resize: vertical;
  border: 0; outline: none; padding: 2px 4px 0;
  background: repeating-linear-gradient(to bottom, transparent 0 33px, var(--line) 33px 34px);
  background-attachment: local;
  line-height: 34px; font-size: 1.02rem; color: var(--text);
}
.lined::placeholder { color: var(--text-3); }
.lined:focus-visible { outline: none; }
.note-card:focus-within { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ═════════ 작은 기록들 (타일) ═════════ */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line);
}
.tile.wide { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 8px; }
.tile .t-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: .95rem; line-height: 1.3; overflow-wrap: break-word; }
.tile .t-ic { flex: none; }
.tile.wide .t-name { flex: 1 1 auto; }
.tile.wide .num-ctl, .tile.wide .dots5 { flex: none; margin-left: auto; }
button.tile { min-width: 0; }
.tile .t-ic { font-size: 1.35rem; }
button.tile { transition: transform .15s, background .2s, border-color .2s; }
button.tile:active { transform: scale(.97); }
button.tile .t-state { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--text-3); }
button.tile .t-state::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--line);
}
button.tile[aria-checked="true"] { background: var(--warm); border-color: var(--m5); }
button.tile[aria-checked="true"] .t-state { color: var(--text); font-weight: 800; }
button.tile[aria-checked="true"] .t-state::before {
  content: "✓"; background: var(--m5); box-shadow: none;
  color: #3a302a; font-size: .75rem; font-weight: 800;
  animation: pop .4s cubic-bezier(.3, 1.6, .5, 1);
}
.num-ctl { display: flex; align-items: center; gap: 4px; }
.num-ctl button {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--surface-2); font-size: 1.1rem; font-weight: 700; line-height: 1;
}
.num-ctl input[type="number"] {
  width: 52px; padding: 4px 0; border-radius: 10px; text-align: center; border: 0; background: transparent; font-weight: 800; font-size: 1.1rem;
  -moz-appearance: textfield; appearance: textfield;
}
.num-ctl input::-webkit-outer-spin-button, .num-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-ctl .unit { font-size: .8rem; color: var(--text-3); white-space: nowrap; }
.num-ctl .unit:empty { display: none; }
@media (max-width: 380px) {
  .tile { padding: 12px; }
  .num-ctl { gap: 2px; }
  .num-ctl button, .dots5 button { width: 32px; height: 32px; }
  .num-ctl input[type="number"] { width: 44px; }
  .dots5 { gap: 4px; }
}
.dots5 { display: flex; gap: 6px; }
.dots5 button {
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--surface-2); font-size: .8rem; font-weight: 700; color: var(--text-3);
}
.dots5 button.on { background: var(--m4); border-color: var(--m5); color: #3a302a; }

.foot-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; padding: 0 4px; font-size: .82rem; color: var(--text-3); }

/* ═════════ 입력 공통 ═════════ */
input[type="text"], input[type="number"], select {
  width: 100%;
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); padding: 11px 13px;
}
input:focus-visible, select:focus-visible { outline: 2.5px solid var(--focus); outline-offset: -1px; }
label.field { display: block; }
label.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }

.switch { position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: transform .2s cubic-bezier(.3, 1.5, .5, 1); }
.switch[aria-checked="true"] { background: var(--accent); box-shadow: none; }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ═════════ 달력 ═════════ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.cal-head h1 { margin: 0; font-size: 1.9rem; }
.cal-nav {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); color: var(--text); text-decoration: none; font-size: 1.3rem;
  display: inline-grid; place-items: center;
}
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 6px; }
.cal .wd { text-align: center; font-size: .75rem; font-weight: 700; color: var(--text-3); padding-bottom: 4px; }
.cal .wd.sun { color: var(--danger); opacity: .8; }
.day {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 4px 0 2px; border-radius: 14px; text-decoration: none;
  color: var(--text-2); font-size: .72rem; font-weight: 600;
}
.day .slot { width: 38px; height: 38px; display: grid; place-items: center; }
.day .bean { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.day.has .face { transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.day:hover .face { transform: scale(1.12) rotate(-4deg); }
.day.today { color: var(--accent); font-weight: 800; }
.day.today .bean { width: 30px; height: 30px; background: transparent; border: 2px dashed var(--accent); opacity: .7; }
.day.future { opacity: .35; pointer-events: none; }

.jelly-bar { display: flex; gap: 3px; height: 18px; margin: 14px 0 12px; }
.jelly-bar span { border-radius: 6px; min-width: 6px; }
.jelly-bar span:first-child { border-radius: 9px 6px 6px 9px; }
.jelly-bar span:last-child { border-radius: 6px 9px 9px 6px; }
.mood-legend { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; text-align: center; font-size: .75rem; color: var(--text-2); }
.mood-legend b { display: block; font-size: .9rem; color: var(--text); }

.month-sum { display: flex; align-items: center; gap: 14px; }
.month-sum .face { flex: none; }
.month-sum p { margin: 0; }
.month-sum .big { font-family: var(--hand); font-weight: 700; font-size: 1.35rem; line-height: 1.25; }

.diary { display: flex; gap: 12px; text-decoration: none; color: inherit; padding: 16px; }
.diary .face { flex: none; }
.diary .d-body { min-width: 0; flex: 1; }
.diary .d-date { font-weight: 800; font-size: .92rem; }
.diary .d-mood { font-size: .78rem; color: var(--text-3); font-weight: 600; margin-left: 6px; }
.diary p { margin: 4px 0 0; color: var(--text-2); font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mini-chips span { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 24px 4px 10px; }

/* ═════════ 흐름 ═════════ */
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); gap: 2px; margin-bottom: 16px; }
.seg button { min-height: 36px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--text-2); font-size: .88rem; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

.summary { display: flex; align-items: center; gap: 16px; }
.summary .face { flex: none; animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.summary .big { font-family: var(--hand); font-weight: 700; font-size: 1.45rem; line-height: 1.25; margin: 0 0 4px; }
.summary p { margin: 0; }
.stat-row { display: flex; gap: 8px; margin-top: 14px; }
.stat { flex: 1; text-align: center; padding: 10px 6px; border-radius: 16px; background: var(--surface-2); }
.stat b { display: block; font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--text-3); font-weight: 600; }

.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-3); font-size: 11px; font-family: var(--sans); }
.chart .grid line { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 2 4; }
.chart .series { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { stroke: var(--surface); stroke-width: 2.5; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: color-mix(in srgb, var(--text) 5%, transparent); }

.insight { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px dashed var(--line); }
.insight:first-of-type { border-top: 0; padding-top: 0; }
.insight .ins-ic { flex: none; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem; }
.insight .ins-ic.up { background: var(--warm); }
.insight .ins-ic.down { background: var(--cool); }
.insight .t { font-weight: 700; line-height: 1.45; }
.insight .d { font-size: .8rem; color: var(--text-3); margin-top: 2px; font-variant-numeric: tabular-nums; }
.note { font-size: .84rem; color: var(--text-2); background: var(--surface-2); border-radius: 14px; padding: 11px 14px; }

.week-faces { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; gap: 2px; }
.week-faces .wf { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; border-radius: 14px; }
.week-faces .wf.best { background: var(--warm); }
.week-faces .v { font-size: .78rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.week-faces .l { font-size: .72rem; color: var(--text-3); font-weight: 700; }
.week-faces .none { width: 34px; height: 34px; display: grid; place-items: center; color: var(--text-3); }

.cloud { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; padding: 6px 0; }
.cloud span { padding: 6px 14px; border-radius: 999px; font-weight: 700; color: var(--text); white-space: nowrap; }
.cloud .warm { background: var(--warm); }
.cloud .cool { background: var(--cool); }
.cloud small { font-size: .7em; color: var(--text-3); margin-left: 3px; }

.pixels { display: grid; grid-template-columns: 18px repeat(31, minmax(0, 1fr)); gap: 2px; align-items: center; }
.pixels .ml { font-size: .62rem; color: var(--text-3); font-weight: 700; text-align: right; padding-right: 4px; }
.pixels i { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.pixels i.x { background: transparent; }
.pixels i.f { opacity: .35; }

.trk-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.trk-tiles div { padding: 14px; border-radius: 18px; background: var(--surface-2); }
.trk-tiles .ic { font-size: 1.3rem; }
.trk-tiles b { display: block; font-size: 1.25rem; font-weight: 800; margin-top: 4px; }
.trk-tiles span { font-size: .78rem; color: var(--text-3); font-weight: 600; }

.empty-state { text-align: center; padding: 30px 12px 26px; color: var(--text-2); }
.empty-state .face { margin-bottom: 6px; }
.empty-state .big { font-family: var(--hand); font-weight: 700; font-size: 1.4rem; color: var(--text); margin: 0 0 6px; }
details.table summary { cursor: pointer; color: var(--text-3); font-size: .8rem; margin-top: 10px; font-weight: 600; }
details.table table { width: 100%; border-collapse: collapse; font-size: .82rem; margin-top: 8px; }
details.table th, details.table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }

/* ═════════ 설정 ═════════ */
.set-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); }
h2 + .set-row, .set-row:first-child { border-top: 0; padding-top: 0; }
.set-row .s-ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 1.15rem; background: var(--surface-2); }
.set-row .s-body { flex: 1; min-width: 0; }
.set-row .s-body div:first-child { font-weight: 700; }
.set-row .meta { font-size: .78rem; color: var(--text-3); }
.icon-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.form-grid .full { grid-column: 1 / -1; }
.icon-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-pick label { position: relative; }
.icon-pick input { position: absolute; opacity: 0; pointer-events: none; }
.icon-pick span { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--surface-2); border: 1.5px solid transparent; cursor: pointer; }
.icon-pick input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.icon-pick input:focus-visible + span { outline: 2.5px solid var(--focus); }
.about { text-align: center; padding: 10px 0 0; }
.about p { margin: 4px 0 0; }

/* ═════════ 잠금 화면 ═════════ */
#lock-root {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px; text-align: center;
}
#lock-root .face { animation: peek 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes peek { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px) rotate(-3deg); } }
#lock-root h1 { margin: 8px 0 2px; }
.pin-dots { display: flex; gap: 16px; margin: 24px 0 30px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line); transition: transform .15s, background .15s; }
.pin-dots i.on { background: var(--m5); box-shadow: none; transform: scale(1.15); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 14px; }
.keypad button {
  width: 74px; height: 74px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); font-size: 1.6rem; font-weight: 600;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .1s, background .1s;
}
.keypad button:active { transform: scale(.92); background: var(--accent-soft); }
.keypad button.txt { font-size: .85rem; border-color: transparent; background: transparent; color: var(--text-2); backdrop-filter: none; }

/* ═════════ 토스트 / 툴팁 ═════════ */
#toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  background: var(--text); color: var(--bg);
  padding: 11px 20px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s cubic-bezier(.3, 1.5, .5, 1); z-index: 30;
  max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#tip {
  position: fixed; z-index: 40; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 7px 11px; border-radius: 12px; font-size: .8rem; font-weight: 600; line-height: 1.45;
  max-width: 220px; white-space: pre-line;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ═════════ 공유 ═════════ */
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 0; font-weight: 800; font-size: .9rem;
  background: linear-gradient(135deg, var(--m4), var(--m5));
  color: #3a302a; box-shadow: 0 6px 18px color-mix(in srgb, var(--m5) 35%, transparent);
  animation: pop .45s cubic-bezier(.3, 1.6, .5, 1);
}
.share-btn:active { transform: scale(.96); }
.share-btn.soft { background: var(--surface); border: 1.5px solid var(--line); color: var(--text); box-shadow: none; animation: none; }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(30, 20, 15, 0); transition: background .25s;
}
.sheet-backdrop.open { background: rgba(30, 20, 15, .45); }
.sheet {
  width: min(560px, 100vw); max-height: 94dvh; overflow-y: auto;
  background: var(--bg); border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .3s cubic-bezier(.2, 1.2, .4, 1);
}
.sheet-backdrop.open .sheet { transform: translateY(0); }
.sheet .grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px; }
.sheet h2 { text-align: center; }
.sheet-preview {
  position: relative; display: grid; place-items: center; margin: 0 auto 14px;
  width: min(100%, 46dvh); aspect-ratio: 4 / 5; border-radius: 20px; overflow: hidden;
  background: var(--surface-2); box-shadow: 0 12px 34px rgba(90, 60, 40, .2);
}
.sheet-preview img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadeIn .3s ease; }
.sheet-preview .loading { font-size: 2rem; color: var(--m5); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lock-note { text-align: center; font-size: .8rem; color: var(--text-3); margin: 10px 0 12px; }
.sheet-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-bottom: 4px; }
