/* DAYBYTE 공통 스타일. 색은 전부 토큰으로만 쓴다(밝은/어두운 모드 둘 다). */
:root {
  --bg: #FBF6EC; --surface: #FFFDF7; --surface-2: #F3EBDD;
  --text: #3B2A20; --muted: #7A6A5E; --line: #E5DACA;
  --primary: #5B7A4C; --on-primary: #FFFFFF; --primary-soft: #E3ECDC;
  --accent: #E8925A; --mustard: #C9971C; --lilac: #A994D1; --info: #4A78B8; --danger: #C0392B;
  --on-danger: #FFFFFF;
  --radius: 18px; --radius-sm: 12px;
  --tab-h: 58px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --font-px: 'NeoDunggeunmo', 'Galmuri11', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1D1713; --surface: #28201A; --surface-2: #33291F;
    --text: #F3EAD9; --muted: #B4A594; --line: #3E3328;
    --primary: #9CC088; --on-primary: #1D1713; --primary-soft: #2F3A28;
    --accent: #F0A774; --mustard: #E0B43C; --lilac: #C3B2E6; --info: #7EA6E0; --danger: #E06A5C;
    --on-danger: #1D1713;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
  min-height: 100vh; min-height: 100dvh;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }
.px { font-family: var(--font-px); font-weight: 400; letter-spacing: 0; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---- 화면 뼈대 ---- */
#app {
  max-width: 560px; margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px);
}
#app.no-tabs { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 14px; animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 2px 2px; }
.wordmark { font-family: var(--font-px); font-size: 24px; letter-spacing: .5px; color: var(--primary); }
.date { color: var(--muted); font-size: 15px; }
.page-title { font-size: 22px; font-weight: 700; padding: 4px 2px; }

/* ---- 카드 ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.card-note { color: var(--muted); font-size: 14px; margin-top: 8px; }

/* ---- 버튼 ---- */
.btn {
  min-height: 48px; padding: 10px 18px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform .15s ease, background-color .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 140px; }

/* ---- 폼 ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 600; font-size: 15px; }
.field .opt { color: var(--muted); font-weight: 400; }
.input-wrap { display: flex; align-items: center; gap: 8px; }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums;
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.unit { color: var(--muted); min-width: 28px; }
.field-error { color: var(--danger); font-size: 14px; display: flex; gap: 4px; align-items: flex-start; }
.field-error:empty { display: none; }
.field-error::before { content: '⚠'; }
.field-error:empty::before { content: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg button, .opt-card {
  min-height: 48px; border-radius: var(--radius-sm); border: 1.5px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; text-align: left; padding: 10px 14px;
}
.seg button { text-align: center; }
.seg button[aria-pressed="true"], .opt-card[aria-pressed="true"] {
  border-color: var(--primary); background: var(--primary-soft);
}
.seg button[aria-pressed="true"]::before { content: '✓ '; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt-card { display: flex; flex-direction: column; gap: 2px; position: relative; padding-right: 40px; }
.opt-card small { color: var(--muted); font-weight: 400; font-size: 14px; }
.opt-card[aria-pressed="true"]::after {
  content: '✓'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--primary); font-weight: 800;
}
.note { color: var(--muted); font-size: 14px; }
.hero { padding: 6px 2px 0; }
.hero h1 { font-size: 24px; line-height: 1.3; }
.hero p { margin-top: 6px; color: var(--muted); }

/* ---- 칼로리 카드 ---- */
.kcal-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.kcal-big { font-family: var(--font-px); font-size: 40px; line-height: 1.1; }
.kcal-sub { font-family: var(--font-px); font-size: 22px; color: var(--muted); }
.kcal-unit { color: var(--muted); }
.bar { height: 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; background: var(--primary); transition: width .4s ease; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.stat { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-family: var(--font-px); font-size: 26px; line-height: 1.2; }
.stat .v small { font-family: var(--font); font-size: 13px; color: var(--muted); }

/* ---- 캐릭터 박스(두꺼운 픽셀 테두리) · P5 ---- */
:root { --room-wall: #F2E4C9; --room-floor: #CDA777; --room-floor-2: #B98F60; --room-window: #BFE0F0; }
@media (prefers-color-scheme: dark) {
  :root { --room-wall: #3A2E24; --room-floor: #56402E; --room-floor-2: #47341F; --room-window: #2F4A63; }
}
.char-box {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 16px 14px; background: var(--surface-2); color: var(--text);
  border: 6px solid var(--text); border-radius: 0; cursor: pointer;
  box-shadow: 6px 6px 0 var(--line);
}
.char-box:focus-visible { outline: 3px solid var(--primary); outline-offset: 4px; }
.char-bubble {
  position: relative; max-width: 100%; text-align: center; overflow-wrap: anywhere;
  font-family: var(--font-px); font-size: 17px; line-height: 1.4;
  background: var(--surface); color: var(--text); border: 3px solid var(--text); padding: 8px 12px; margin-bottom: 10px;
}
.char-bubble::after { content: ''; position: absolute; left: 50%; bottom: -13px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--text); border-bottom: 0; }
.char-stage { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; min-height: 116px; }
.char-meta { display: flex; align-items: baseline; gap: 10px; font-family: var(--font-px); font-size: 19px; }
.char-lv { color: var(--primary); }
.char-bar { width: 100%; max-width: 280px; margin-top: 0; }
.char-xp { margin: 0; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.char-streak { margin: 0; font-weight: 600; font-size: 15px; text-align: center; }
.char-hint { margin: 0; font-size: 13px; color: var(--muted); }

/* 스프라이트: 문장 하나(클래스)로 동작이 정해진다. 움직임은 전부 아래 no-preference 안에서만. */
.px-sprite { display: block; flex: none; image-rendering: pixelated; shape-rendering: crispEdges; overflow: visible; }
.px-sprite .m-open, .px-sprite .crumb, .px-sprite .spk { opacity: 0; }
.px-sprite.sparkle .spk { opacity: 1; }
.eat-food { position: absolute; left: calc(50% - 112px); bottom: 36px; width: 44px; height: 44px; max-height: none; border-radius: 0; image-rendering: pixelated; background: transparent; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .px-sprite.idle { animation: px-bob 1.8s steps(1, end) infinite; }
  .px-sprite.eat .m-closed { animation: px-closed .4s steps(1, end) 3; }
  .px-sprite.eat .m-open { animation: px-open .4s steps(1, end) 3; }
  .px-sprite.eat .crumb { animation: px-crumb .4s steps(2, end) 3; }
  .px-sprite.happy { animation: px-hop .5s steps(1, end) 2; }
  .px-sprite.sparkle { animation: px-hop .5s steps(1, end) 2; }
  .px-sprite.sparkle .spk { animation: px-twinkle .6s steps(1, end) infinite; }
  .eat-food { animation: px-eaten 1s steps(8, end) forwards; }
  @keyframes px-bob { 0% { transform: translateY(0); } 50% { transform: translateY(calc(var(--px) * -1)); } 100% { transform: translateY(0); } }
  @keyframes px-hop { 0% { transform: translateY(0); } 50% { transform: translateY(calc(var(--px) * -2)); } 100% { transform: translateY(0); } }
  @keyframes px-closed { 0% { opacity: 0; } 50% { opacity: 1; } }
  @keyframes px-open { 0% { opacity: 1; } 50% { opacity: 0; } }
  @keyframes px-crumb { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(2px); } }
  @keyframes px-twinkle { 0% { opacity: 1; } 50% { opacity: .2; } }
  @keyframes px-eaten { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(84px, -14px) scale(.1); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .eat-food { display: none; } }

/* 레벨 업 시트 */
.lu-stage { position: relative; display: flex; justify-content: center; align-items: flex-end; min-height: 190px; padding: 24px 0 14px; background: var(--surface-2); border: 4px solid var(--text); overflow: hidden; }
.lu-title { margin: 0; text-align: center; font-family: var(--font-px); font-size: 24px; }
.lu-stage-line { margin: 0; text-align: center; font-family: var(--font-px); font-size: 19px; color: var(--primary); }
.lu-gift { margin: 0; text-align: center; color: var(--muted); }
.lu-spark { position: absolute; width: 8px; height: 8px; background: #E9B93A; top: calc(10% + (var(--i) * 9%)); left: calc(6% + (var(--i) * 12%)); }
.lu-spark:nth-child(even) { left: auto; right: calc(6% + (var(--i) * 6%)); background: #F2A9A0; }
@media (prefers-reduced-motion: no-preference) {
  .lu-spark { animation: px-twinkle .6s steps(1, end) infinite; animation-delay: calc(var(--i) * .07s); }
}

/* 내 방 */
.room-svg { display: block; width: 100%; max-width: 384px; height: auto; margin: 0 auto; border: 4px solid var(--text); image-rendering: pixelated; }
.room-locked { opacity: .2; }
.room-level { margin: 0; text-align: center; font-family: var(--font-px); font-size: 19px; }
.room-next { margin: 0; text-align: center; font-weight: 700; }
.room-list { list-style: none; margin: 0; padding: 0; }
.room-list li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 44px; align-items: center; }
.room-list li[data-state="locked"] { color: var(--muted); }
.room-item-state { font-size: 14px; color: var(--muted); }
.room-list li[data-state="unlocked"] .room-item-state { color: var(--primary); font-weight: 700; }

/* 나 탭: 캐릭터 · 경험치 안내 */
.me-char { display: flex; align-items: center; gap: 16px; }
.me-char-art { flex: none; width: 72px; display: flex; justify-content: center; }
.me-char-list { flex: 1; min-width: 0; }
.xp-list { list-style: none; margin: 0 0 8px; padding: 0; }
.xp-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 44px; }
.xp-list b { font-family: var(--font-px); font-size: 19px; color: var(--primary); white-space: nowrap; }

/* ---- 끼니 ---- */
.meal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.meal-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); min-height: 52px; }
.meal-list li:first-child { border-top: 0; }
.meal-name { font-weight: 600; }
.meal-time { color: var(--muted); font-size: 14px; margin-left: 6px; }
.meal-status { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.meal-status::before { content: '○'; }
.meal-edit { display: grid; grid-template-columns: 1fr auto 48px; gap: 8px; align-items: center; padding: 8px 0; }
.icon-btn { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 18px; }
.icon-btn[disabled] { opacity: .35; cursor: not-allowed; }

/* ---- 나 탭 ---- */
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.summary dt { color: var(--muted); font-size: 13px; }
.summary dd { margin: 0 0 6px; font-weight: 600; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.toggle-row button { min-height: 48px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; }
.toggle-row button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.toggle-row button[aria-pressed="true"]::before { content: '✓ '; }

/* ---- 자리표시 ---- */
.placeholder { text-align: center; padding: 40px 20px; }
.placeholder svg { width: 72px; height: 72px; margin: 0 auto 12px; display: block; shape-rendering: crispEdges; }
.placeholder h2 { font-size: 18px; margin-bottom: 6px; }

/* ---- 탭 바 ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.tab {
  min-height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--primary); }
.tab[aria-current="page"] span { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* ---- 경고 배너 · 토스트 · 대화상자 ---- */
#save-banner {
  position: sticky; top: 0; z-index: 40; background: var(--danger); color: var(--on-danger);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; font-weight: 700; text-align: center;
}
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); z-index: 80; display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; max-width: 420px; text-align: center; animation: fade .3s ease both; }
.toast.error { background: var(--danger); color: var(--on-danger); }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; padding: 20px; }
.dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; animation: fade .25s ease both; }
.dialog h2 { font-size: 18px; }
.dialog .btn-row { margin-top: 6px; }

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

/* ---- P2: 임시 보관함 · 사진 시트 · 되돌리기 토스트 ---- */
.toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding-right: 8px; }
.toast-action { min-height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; font-weight: 800; font-size: 16px; text-decoration: underline; text-underline-offset: 3px; }

.inbox-actions { display: flex; flex-direction: column; gap: 10px; }
.inbox-progress { color: var(--muted); font-size: 15px; min-height: 0; }
.inbox-progress:empty { display: none; }
.inbox-errors { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.inbox-errors:empty { display: none; }
.inbox-errors li { color: var(--danger); font-size: 14px; font-weight: 600; }
.inbox-summary { color: var(--muted); font-size: 14px; padding: 0 2px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-cell { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; min-height: 44px; }
.photo-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); display: block; }
.photo-cell .photo-time { font-size: 12px; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.inbox-empty { text-align: center; padding: 32px 20px; }
.inbox-empty p { color: var(--muted); }
.inbox-card { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 12px 16px; color: var(--text); text-decoration: none; font-weight: 600; }
.inbox-card .chev { color: var(--muted); font-size: 20px; }

.sheet-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .5); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; animation: fade .25s ease both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { font-size: 17px; }
.sheet img { width: 100%; max-height: 52dvh; object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-2); display: block; }
.sheet .sheet-time { font-weight: 600; }
.sheet .sheet-meta { color: var(--muted); font-size: 13px; }

/* ---- P3: 식단 기록 · 검색 · 기록 탭 · 앨범 · 픽셀 스타일 ---- */
.px-img { image-rendering: crisp-edges; image-rendering: pixelated; }
.kcal-remain { margin-top: 10px; font-weight: 600; }
.kcal-remain.over { color: var(--mustard); }   /* 목표보다 더 먹은 날: 경고가 아니라 겨자색 숫자 안내 */
.badge { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: 999px; background: var(--primary-soft); color: var(--text); font-size: 12px; font-weight: 600; line-height: 20px; vertical-align: middle; }
.sub-h { font-size: 15px; font-weight: 700; margin: 4px 0 6px; }
.screen.sub { animation: none; }

/* 오늘: 끼니 줄 */
.meal-list li.tap { padding: 0; }
.meal-row { width: 100%; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; background: transparent; border: 0; color: var(--text); text-align: left; }
.meal-lead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.meal-kcal { font-weight: 700; white-space: nowrap; }
.thumbs { display: inline-flex; gap: 4px; }

/* 썸네일 · 기록 줄 */
.thumb { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img, .thumb svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.thumb svg { padding: 12%; }
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.entry-list li { border-top: 1px solid var(--line); }
.entry-list li:first-child { border-top: 0; }
.entry-row { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 8px 0; background: transparent; border: 0; color: var(--text); text-align: left; }
.entry-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-names { font-weight: 600; overflow-wrap: anywhere; }
.entry-kcal { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-group h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.log-slot-kcal { color: var(--muted); font-size: 14px; font-weight: 600; }
.log-total { padding: 0 2px; font-size: 16px; }
.log-total b { font-family: var(--font-px); font-size: 26px; font-weight: 400; }
.seg button[data-seg] { text-align: center; }

/* 날짜 이동 */
.date-nav { display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center; }
.dn-mid { position: relative; min-height: 48px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--surface); border: 1.5px solid var(--line); }
.dn-label { font-weight: 700; pointer-events: none; }
.dn-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .02; border: 0; padding: 0; }
.icon-btn { font-size: 22px; }

/* 시트 안: 기록 입력 */
.mf-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.mf-photo { width: 96px !important; height: 96px; max-height: none !important; object-fit: cover !important; border-radius: var(--radius-sm); flex: none; }
.mf-when { flex: 1 1 160px; min-width: 0; }
.mf-when .field { margin-bottom: 10px; }
select.input { appearance: auto; }
.mf-items { display: flex; flex-direction: column; gap: 10px; }
.mf-item { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.mf-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mf-name { font-weight: 700; overflow-wrap: anywhere; }
.mf-amount { display: flex; align-items: center; gap: 8px; }
.mf-amount .input { width: 7.5em; flex: none; }
.mf-kcal { margin-left: auto; font-weight: 700; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 15px; }
.chip:active { background: var(--primary-soft); }
.mf-total { font-size: 18px; padding: 4px 2px 0; }
.mf-total b { font-family: var(--font-px); font-size: 30px; font-weight: 400; }
.sheet-body { display: flex; flex-direction: column; gap: 12px; }

/* 음식 검색 */
.fs-view { display: flex; flex-direction: column; gap: 10px; }
.fs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.fs-list > li { border-top: 1px solid var(--line); }
.fs-list > li:first-child { border-top: 0; }
.fs-row { width: 100%; min-height: 56px; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; justify-content: center; padding: 8px 4px; background: transparent; border: 0; text-align: left; color: var(--text); }
.fs-name { font-weight: 700; overflow-wrap: anywhere; }
.fs-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.fs-mine-row { display: grid; grid-template-columns: 1fr 48px 48px; gap: 4px; align-items: center; }
#fs-status:empty { display: none; }

/* 앨범 */
.album-month h2 { display: flex; justify-content: space-between; align-items: baseline; }
.album-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.album-tile { display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: transparent; color: var(--text); min-height: 44px; text-align: left; }
.album-tile img, .album-missing { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.album-big { width: min(100%, 52dvh) !important; max-height: none !important; aspect-ratio: 1; margin: 0 auto; object-fit: contain; background: var(--surface-2); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.album-big.is-icon { padding: 8%; box-sizing: border-box; }
.album-tile img.is-icon { padding: 12%; box-sizing: border-box; object-fit: contain; }
#album-orig-img { width: 100%; max-height: 52dvh; object-fit: contain; }
.album-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.album-items li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.album-items li:first-child { border-top: 0; }
.album-total { font-weight: 700; }

/* 픽셀 스타일 고르기 */
.style-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.style-opt { min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }
.style-opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.style-opt[disabled] { opacity: .7; cursor: progress; }
.style-prev { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; font-size: 12px; color: var(--muted); }
.style-img { width: 100%; height: 100%; display: block; }
.style-img:not([src]) { visibility: hidden; }
.style-name { font-weight: 700; font-size: 14px; }
.kind-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.kind-grid .style-img { padding: 6%; box-sizing: border-box; }
.style-opt-wide { width: 100%; margin-bottom: 8px; }
.icon-samples { display: flex; gap: 8px; justify-content: center; }
.icon-sample { width: 56px; height: 56px; display: block; background: var(--surface-2); border-radius: 8px; padding: 4px; box-sizing: border-box; }
.icon-sample:not([src]) { visibility: hidden; }

/* ---- P4: 몸 기록 · 체중 그래프 · 운동 ---- */
.seg.seg3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toggle-row.toggle3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-head h2 { margin-bottom: 10px; }
.card-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; padding: 0 4px; }
.bc-weight-btn { min-height: 48px; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; }
.chg { color: var(--muted); font-size: 14px; display: block; }   /* 체중 변화: 좋다/나쁘다 색을 쓰지 않는다 */
.bc-quick { display: flex; gap: 10px; align-items: flex-end; }
.bc-quick-field { flex: 1; min-width: 0; }
.bc-quick-field .field { margin-bottom: 0; }
.bc-quick > .btn { margin-bottom: 0; flex: none; }
.bc-activity { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.bc-box { width: 100%; }
.bc-svg { width: 100%; height: auto; display: block; }
.bc-grid { stroke: var(--line); stroke-width: 1; }
.bc-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.bc-seg { fill: none; stroke: var(--primary); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.bc-pt { fill: var(--primary); stroke: var(--surface); stroke-width: 1.5; }
.bc-goal { stroke: var(--mustard); stroke-width: 1.5; stroke-dasharray: 5 4; }
.bc-goal-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.bc-last { fill: var(--text); font-size: 12px; font-weight: 700; font-family: var(--font); }
.inbody { border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px; background: var(--surface); }
.inbody summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.inbody-body { padding-top: 4px; }
.del-slot { display: contents; }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.chip[aria-pressed="true"]::before { content: '✓ '; }
.body-day h2 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
