:root {
  --bg: #f4f3ef;
  --card: #ffffff;
  --ink: #15181c;
  --ink-2: #5d636b;
  --ink-3: #9aa0a7;
  --line: #e6e4de;
  --accent: #15181c;
  --accent-ink: #ffffff;
  --hl: #d8ff3d;           /* 형광 라임 - 포인트 색 */
  --tank: #eceae4;
  --c-breakfast: #f4b33f;
  --c-lunch: #34b277;
  --c-dinner: #4a7cf0;
  --c-snack: #ea6aa6;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .05);
  /* 캐릭터 색: 화면 테마와 따로 (다크 모드에서 흰 외곽선·흰 반바지가 되지 않게) */
  --bd-line: #15181c;
  --bd-cloth: #15181c;
  --bd-shadow: rgba(0, 0, 0, .1);
  color-scheme: light;
}
/* 다크 모드: 기본은 휴대폰 설정을 따름(자동). "내 설정 → 화면"에서 라이트/다크를 고르면 그걸 우선 (html[data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1114;
    --card: #181b20;
    --ink: #f1f2f3;
    --ink-2: #a5abb3;
    --ink-3: #6b7179;
    --line: #262a31;
    --accent: #d8ff3d;
    --accent-ink: #111;
    --tank: #22262d;
    --shadow: none;
    --bd-line: #0b0d10;
    --bd-cloth: #3a4250;
    --bd-shadow: rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1114;
  --card: #181b20;
  --ink: #f1f2f3;
  --ink-2: #a5abb3;
  --ink-3: #6b7179;
  --line: #262a31;
  --accent: #d8ff3d;
  --accent-ink: #111;
  --tank: #22262d;
  --shadow: none;
  --bd-line: #0b0d10;
  --bd-cloth: #3a4250;
  --bd-shadow: rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); }
.fine { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 0; }

.brand { font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand::before {
  content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  background: var(--hl); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 0 2px var(--ink);
}

/* ---------- 버튼 ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 700;
  transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); }
.btn.small { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 시작 화면 ---------- */
.setup { padding: 0 16px; }
/* 첫 화면: 화면을 거의 채우고, 아래에 "자주 묻는 질문" 제목만 살짝 보이게 */
.setup-inner {
  width: 100%; max-width: 380px; margin: 0 auto; text-align: center;
  min-height: calc(100dvh - 64px); display: flex; flex-direction: column; justify-content: center; padding: 20px 0;
}
.setup-title { margin: 0 0 26px; display: grid; justify-items: center; gap: 6px; font-weight: inherit; }
.brand.big { font-size: 15px; }
.tagline { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: -.01em; }
.weight-form { display: grid; gap: 10px; margin: 28px 0 10px; }
.weight-label { font-size: 13px; font-weight: 700; color: var(--ink-2); text-align: left; padding-left: 4px; }
.weight-input.err, .weight-input.err:focus-within { border-color: #d64545; animation: shake .3s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.setup-preview { margin: 0 0 6px; min-height: 24px; font-size: 14px; color: var(--ink-3); }
.setup-preview.ok { color: var(--ink); font-weight: 600; }
.setup-preview.ok b { font-size: 18px; padding: 0 4px; border-radius: 6px; background: var(--hl); color: #111; }
.setup-preview.ok span { color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
.setup-preview.err { color: #d64545; font-weight: 600; }
.gender-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gender-pick.err { animation: shake .3s ease; }
.gender-pick.err button { border-color: #d64545; }
.gender-pick button {
  border: 2px solid var(--line); background: var(--card); border-radius: 18px; padding: 10px 8px 10px;
  display: grid; justify-items: center; gap: 2px; box-shadow: var(--shadow); transition: border-color .15s, transform .1s;
}
.gender-pick button:active { transform: scale(.97); }
.gender-pick svg { width: 74px; height: 111px; overflow: visible; }
.gender-pick span { font-weight: 800; font-size: 15px; color: var(--ink-2); }
.gender-pick button.on { border-color: var(--ink); background: var(--card); box-shadow: 0 0 0 3px var(--hl); }
.gender-pick button.on span { color: var(--ink); }
.seg.seg-2 { grid-template-columns: 1fr 1fr; }
.weight-input {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px 18px;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.weight-input:focus-within { border-color: var(--ink); }
.weight-input { cursor: text; } /* 칸 어디를 눌러도 입력되도록 (app.js에서 포커스 연결) */
.weight-input input {
  width: 100%; max-width: 180px; border: 0; outline: 0; background: transparent; text-align: right;
  font-size: 44px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.weight-input span { font-size: 20px; font-weight: 700; color: var(--ink-2); }
.weight-input.sm { padding: 8px 14px; justify-content: flex-start; }
.weight-input.sm input { font-size: 26px; text-align: left; }
.weight-form .btn { padding: 17px; font-size: 16px; }

/* ---------- 메인 레이아웃 ---------- */
.app { max-width: 560px; margin: 0 auto; padding: 0 16px 40px; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 12px; background: var(--bg);
}
.topbar::after {
  /* 스크롤해도 보이는 얇은 진행 막대 */
  content: ''; position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px;
  width: calc(var(--p, 0) * 100%); background: var(--bar, var(--ink)); transition: width .5s cubic-bezier(.2, .8, .2, 1), height .2s;
}
.topbar::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 3px; background: var(--line); }
/* 지난 날 수정 중 안내 띠 (상단바 두 번째 줄) */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.edit-banner {
  order: 9; flex-basis: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--ink); color: var(--card); border-radius: 12px; padding: 7px 8px 7px 12px; font-size: 13px;
  margin-bottom: 4px; animation: pop .2s ease;
}
.edit-banner button {
  border: 0; background: var(--hl); color: #111; font-weight: 800; font-size: 12.5px; border-radius: 9px; padding: 6px 10px;
  white-space: nowrap;
}
.dot.sel { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.cd-edit { width: 100%; margin-top: 4px; padding: 12px; }
/* 게이지가 안 보일 때: 브랜드 대신 요약 숫자 */
.mini-status {
  display: none; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; position: relative;
  border: 0; background: transparent; padding: 0; color: var(--ink); -webkit-tap-highlight-color: transparent;
}
.mini-buddy { width: 30px; height: 30px; margin-right: 6px; border-radius: 50%; background: var(--card); box-shadow: 0 0 0 1.5px var(--line); }
.tank-mode-on .mini-buddy { display: none; }
.mini-status b { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.mini-status span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
/* 달성: 게이지 카드의 달성 배지와 같은 라임 + 검은 글씨 (밝은/어두운 화면 모두 잘 읽힘), 은은한 라임 테두리로 강조 */
.mini-status em.done { background: var(--hl); color: #111; box-shadow: 0 0 0 3px color-mix(in srgb, var(--hl) 28%, transparent); }
.mini-status em {
  font-style: normal; margin-left: 8px; font-size: 12px; font-weight: 800; padding: 2px 7px; border-radius: 999px;
  background: var(--hl); color: #111; align-self: center;
}
.topbar.compact .brand { display: none; }
.topbar.compact::before, .topbar.compact::after { height: 5px; }
/* 접힌 상단바에서 떠오르는 +g */
.float-g.mini { left: auto; right: -6px; top: -4px; font-size: 13px; transform: none; animation-name: floatUpMini; }
@keyframes floatUpMini {
  0% { opacity: 0; transform: translateY(6px) scale(.7); }
  20% { opacity: 1; transform: translateY(0) scale(1.1); }
  100% { opacity: 0; transform: translateY(-26px) scale(1); }
}
.topbar.compact .mini-status { display: flex; animation: pop .2s ease; }
.topbar.compact.bump .mini-status { animation: mini-bump .35s ease; }
@keyframes mini-bump { 40% { transform: scale(1.08); } }
.target-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px; }

/* ---------- 탱크 게이지 ---------- */
.gauge-card { --vis-w: 120px; display: grid; grid-template-columns: var(--vis-w) minmax(0, 1fr); gap: 14px 18px; align-items: center; }
.gauge-info { min-width: 0; }
.tank-wrap { position: relative; }
.tank { width: 100%; height: auto; display: block; overflow: visible; }
.tank-body { fill: var(--tank); }
.tank-cap { fill: var(--ink); }
.tank-outline { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.tank-ticks line { stroke: var(--ink); stroke-width: 2; opacity: .18; }
#tankFill rect { transition: y .5s cubic-bezier(.2, .8, .2, 1), height .5s cubic-bezier(.2, .8, .2, 1); }
.tank-surface { fill: #fff; opacity: .55; }
.tank-pct {
  position: absolute; left: 0; right: 0; top: 56%; text-align: center; font-weight: 800; font-size: 22px;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--ink);
}
.tank-pct span { background: var(--card); border-radius: 999px; padding: 1px 9px; font-size: 18px; }
.gauge-card.done .tank-outline { stroke: var(--ink); }
.gauge-card.done .tank-cap { fill: var(--hl); stroke: var(--ink); stroke-width: 2; }
.gauge-card.bump .tank, .tank.poke { animation: bump .35s ease; }
#tankView { cursor: pointer; -webkit-tap-highlight-color: transparent; } /* 쉐이커를 눌러도 다음 이야기 */
@keyframes bump { 40% { transform: scale(1.04) rotate(-1.5deg); } }

/* ---------- 득근이 캐릭터 ---------- */
.visual { position: relative; display: grid; gap: 6px; justify-items: center; align-self: start; }
.visual > .tank-wrap, .buddy-wrap { width: 100%; }
.buddy-wrap { position: relative; display: grid; justify-items: center; }
.buddy { width: 100%; height: auto; display: block; overflow: visible; }
.gauge-card.bump .buddy, .buddy.poke { animation: hop .45s ease; }
#buddyView { cursor: pointer; -webkit-tap-highlight-color: transparent; }
@keyframes hop { 30% { transform: translateY(-6px) scale(1.03); } 60% { transform: translateY(0) scale(.99); } }
.bd-line-ink { fill: none; stroke: var(--bd-line); stroke-linecap: round; stroke-linejoin: round; }
.bd-line-skin { fill: none; stroke: #f5c7a1; stroke-linecap: round; stroke-linejoin: round; }
.bd-skin { fill: #f5c7a1; stroke: var(--bd-line); stroke-width: 2.5; stroke-linejoin: round; }
.bd-blob-ink { fill: var(--bd-line); }
.bd-blob-skin { fill: #f5c7a1; }
.bd-hair { fill: #2b2420; }
.bd-top { fill: var(--bd-cloth); stroke: var(--bd-line); stroke-width: 2; stroke-linejoin: round; }
.bd-tie { fill: var(--hl); stroke: var(--bd-line); stroke-width: 1.2; }
.bd-shorts { fill: var(--bd-cloth); stroke: var(--bd-line); stroke-width: 2.5; stroke-linejoin: round; }
.bd-shoe { fill: var(--bd-line); }
.bd-shadow { fill: var(--bd-shadow); }
.bd-detail, .bd-detail path { fill: none; stroke: #b5785a; stroke-width: 1.6; stroke-linecap: round; }
.bd-face { fill: none; stroke: #2b2420; stroke-width: 1.8; stroke-linecap: round; }
.bd-eye { fill: #2b2420; }
.bd-mouth { fill: #7a2e2e; stroke: #2b2420; stroke-width: 1.5; stroke-linejoin: round; }
.bd-blush { fill: #ff8f8f; opacity: .45; }
.bd-band { fill: var(--hl); stroke: var(--bd-line); stroke-width: 1.5; }
.bd-sweat { fill: #7cc4ff; }
.bd-aura { fill: var(--hl); opacity: .35; transform-origin: 60px 88px; animation: aura 1.8s ease-in-out infinite; }
@keyframes aura { 50% { transform: scale(1.06); opacity: .2; } }
.bd-spark { fill: var(--hl); stroke: var(--bd-line); stroke-width: 1; }
.bd-sparks { animation: twinkle 1.2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .3; } }

.buddy-level {
  font-size: 13px; color: var(--ink-2); text-align: center; line-height: 1.3; margin-top: 2px;
  display: grid; justify-items: center; max-width: 100%;
}
/* 레벨 / 이름을 항상 두 줄로 고정 → 이름 길이가 바뀌어도 카드 높이가 그대로 (담을 때 화면이 들썩이지 않게) */
.buddy-level b { color: var(--ink); }
.buddy-level .bl-name { font-style: normal; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.buddy-level span { font-weight: 800; background: var(--hl); color: #111; border-radius: 999px; padding: 0 6px; }
/* 캐릭터 말풍선: 카드 맨 위 전체 폭, 아래로 난 꼬리가 캐릭터 머리를 가리킴 */
.buddy-talk {
  grid-column: 1 / -1; position: relative; display: flex; align-items: center; width: 100%; text-align: left;
  border: 0; background: var(--bg); border-radius: 16px; padding: 10px 14px;
  min-height: 60px; color: var(--ink); cursor: pointer;
}
.buddy-talk::after {
  /* 꼬리: 캐릭터 칸 가운데(= 머리 위치) */
  content: ''; position: absolute; bottom: -9px; left: calc(var(--vis-w) / 2 - 9px);
  border: 9px solid transparent; border-bottom: 0; border-top-color: var(--bg);
}
.gauge-card.tank-mode .buddy-talk::after { display: none; } /* 쉐이커 보기일 땐 꼬리 없이 정보 상자로 */
.buddy-talk p { margin: 0; font-size: 13.5px; line-height: 1.45; font-weight: 600; word-break: keep-all; } /* 단어 중간에서 끊지 않음 */
.buddy-talk p.in { animation: talkIn .35s ease; }
@keyframes talkIn { from { opacity: 0; transform: translateY(4px); } }
.float-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.float-g {
  position: absolute; left: 50%; top: 40%; transform: translateX(-50%); font-weight: 900; font-size: 18px;
  color: #111; background: var(--hl); padding: 1px 8px; border-radius: 999px; box-shadow: 0 0 0 2px var(--ink);
  animation: floatUp 1.2s ease-out forwards; white-space: nowrap;
}
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -60px) scale(1); }
}

.eaten b { font-size: 40px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.eaten > span { font-size: 17px; font-weight: 700; color: var(--ink-2); }

/* 끼니 색 점 (끼니 선택 바 안): 누르면 색 바꾸기, 터치 영역은 넓게 */
.swatch {
  width: 11px; height: 11px; border-radius: 50%; flex: none; position: relative; background: var(--mc);
  box-shadow: 0 0 0 2px var(--card); transition: transform .1s; cursor: pointer;
}

.color-pop {
  position: absolute; z-index: 30; width: 212px; background: var(--card); border-radius: 16px; padding: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18), 0 0 0 1px var(--line); display: grid; gap: 10px;
  animation: pop .15s ease;
}
.cp-head { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.cp-head .link { font-size: 12px; color: var(--ink-2); }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.swatches button { aspect-ratio: 1; border: 0; border-radius: 8px; padding: 0; transition: transform .1s; }
.swatches button:hover { transform: scale(1.1); }
.swatches button.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.cp-custom { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.cp-custom input { width: 30px; height: 26px; border: 0; padding: 0; background: none; cursor: pointer; }

.week { margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.week-dots { display: flex; gap: 2px; flex: 1; justify-content: space-between; min-width: 0; }
.dot {
  width: 18px; height: 18px; flex: none; border-radius: 50%; position: relative; border: 0; padding: 0; cursor: pointer;
  background: conic-gradient(var(--ink) calc(var(--r) * 360deg), var(--tank) 0);
  transition: transform .1s;
}
.dot:hover { transform: scale(1.15); }
.dot::before { content: ''; position: absolute; inset: -6px -4px -18px; } /* 터치 영역 확대 */
.dot::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.dot.full { background: var(--ink); }
.dot.full::after { background: var(--hl); inset: 5px; }
.dot span { position: absolute; top: 21px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.week { padding-bottom: 16px; }

/* ---------- 장바구니 ---------- */
.cart-card { padding: 10px 8px 12px; }
/* 담은 음식: 가로 한 줄 (높이 고정 → 담아도 아래가 밀리지 않음) */
.cart-strip {
  list-style: none; margin: 0 -8px; padding: 2px 14px 4px; display: flex; gap: 6px; min-height: 52px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cart-strip::-webkit-scrollbar { display: none; }
.cart-strip li { flex: none; display: flex; }
.cart-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 46px; padding: 0 12px 0 8px; border-radius: 14px;
  border: 1.5px solid color-mix(in srgb, var(--mc, var(--ink)) 45%, transparent);
  background: color-mix(in srgb, var(--mc, var(--ink)) 12%, var(--card)); color: var(--ink); text-align: left;
  transition: transform .08s, box-shadow .15s; -webkit-tap-highlight-color: transparent;
}
.cart-chip:active { transform: scale(.96); }
.cart-chip.sel { border-color: var(--mc, var(--ink)); box-shadow: 0 0 0 2px var(--mc, var(--ink)); }
.cart-chip.flash { animation: chipFlash .5s ease; }
@keyframes chipFlash { 0% { transform: scale(.85); opacity: .3; } 60% { transform: scale(1.05); } }
.cc-ico { width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.cc-ico .emo { font-size: 21px; line-height: 1; }
.cc-ico .thumb { border-radius: 8px; }
.cc-main { display: grid; line-height: 1.2; }
.cc-main b { font-size: 13.5px; font-weight: 700; white-space: nowrap; max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.cc-main small { font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc-main small em { font-style: normal; font-weight: 800; color: var(--ink); }
/* 세트 저장 칩 (맨 끝, 작게) */
.cart-chip.save-chip {
  flex-direction: column; justify-content: center; gap: 0; padding: 0 10px; font-size: 16px; line-height: 1;
  background: transparent; border-style: dashed; border-color: var(--line);
}
.save-chip small { font-size: 11px; font-weight: 700; color: var(--ink-3); margin-top: 3px; }
/* 비어 있는 끼니: 어제 그대로 담기 (같은 높이) */
.cart-chip.copy-chip { background: var(--ink); color: var(--card); border-color: var(--ink); }
.cart-chip.copy-chip small { color: inherit; opacity: .7; }
.cart-chip.copy-chip.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.copy-chip .cc-ico {
  width: 26px; height: 26px; border-radius: 8px; background: var(--hl); color: #111; font-weight: 800; font-size: 15px;
}
.cart-empty {
  width: 64px; height: 46px; border: 1.5px dashed var(--line); border-radius: 14px; align-items: center; justify-content: center;
  font-size: 20px; opacity: .45;
}

/* 담은 음식 양 조절 팝오버 */
.cart-pop {
  position: absolute; z-index: 30; min-width: 230px; background: var(--card); border-radius: 16px; padding: 10px 12px 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18), 0 0 0 1px var(--line); display: grid; gap: 8px; animation: pop .15s ease;
}
.cart-pop .cp-head b { font-size: 14px; max-width: 12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-pop .cp-head b small { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.cp-del { border: 0; background: transparent; color: #d64545; font-size: 12.5px; font-weight: 700; padding: 4px 2px; }
.cp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cart-pop .ci-g { font-size: 16px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
 /* 단어 중간에서 줄바꿈하지 않음 */
.ci-g {
  color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; font-weight: 800; border: 0; background: transparent;
  padding: 4px 0; text-decoration: underline dotted var(--ink-3); text-underline-offset: 4px;
}
.reset-link { justify-self: center; }
.stepper { display: flex; align-items: center; background: var(--bg); border-radius: 10px; }
.stepper button { width: 32px; height: 32px; border: 0; background: transparent; font-size: 18px; font-weight: 600; }
.stepper span { min-width: 26px; text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }

.quick { margin: 10px 6px 0; display: grid; gap: 6px; }
.quick-row {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px 4px;
  -webkit-overflow-scrolling: touch;
}
/* ✏️ 기타: 빠른 담기 줄 안의 점선 칩 (옮길 수 있지만 휴지통엔 안 들어감) */
.quick-chip.etc-chip { border-style: dashed; background: transparent; color: var(--ink-2); }
/* 기타 시트: 숫자와 g를 한 덩어리로 가운데, 이름·최근 칩도 가운데 → 한 줄 축으로 정리
   두 칸은 같은 모양(이름 칸과 같은 납작한 상자)으로 맞춤. "단백질"은 칸 안 흐린 안내 글씨 */
.weight-input.etc-protein {
  justify-content: center; align-items: center; gap: 4px; padding: 12px 14px;
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 14px; box-shadow: none;
}
.weight-input.etc-protein:focus-within { border-color: var(--ink); }
#etcProtein {
  flex: none; width: 1.9em; max-width: 5.5em; font-size: 30px; text-align: center; /* 폭은 보이는 글자만큼 (app.js) */
  padding: 0 2px; -webkit-appearance: none; appearance: none; letter-spacing: 0; font-variant-numeric: normal; /* 폭 계산과 실제 글자가 어긋나지 않게 */
}
#etcProtein::placeholder { font-size: 16px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.weight-input.etc-protein span { font-size: 18px; }
/* 비어 있을 땐 g도 안내 글씨와 같은 모양 → "단백질 g"가 한 덩어리로 보임 */
#etcProtein:placeholder-shown + span { font-size: 16px; font-weight: 500; color: var(--ink-3); }
#etcName { text-align: center; }
#etcChips { justify-content: center; }
#etcChips button { flex: 0 1 auto; padding: 8px 14px; border-radius: 999px; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 5px 10px 5px 6px; font-size: 13.5px; font-weight: 600; color: var(--ink);
  transition: transform .08s, border-color .15s; white-space: nowrap;
}
.quick-chip:active { transform: scale(.95); }
.quick-chip:hover { border-color: var(--ink-3); }
.quick-chip b { font-size: 12.5px; background: var(--hl); color: #111; border-radius: 999px; padding: 1px 6px; }
.qc-ico { width: 24px; height: 24px; display: grid; place-items: center; }
.qc-ico .emo { font-size: 18px; line-height: 1; }
.qc-ico .thumb { border-radius: 50%; }


.qty-btn {
  border: 0; background: transparent; min-width: 44px; height: 32px; padding: 0 4px; font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums; text-decoration: underline dotted var(--ink-3); text-underline-offset: 4px;
}
.qty-input { justify-content: center; }
.qty-input input { text-align: right; max-width: 140px; }
.qty-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.qty-chips:empty { display: none; }
.qty-chips button small { font-size: 11px; font-weight: 600; opacity: .65; margin-left: 2px; }
.qty-chips button {
  flex: 1; border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 0;
  font-weight: 700; font-size: 13.5px; color: var(--ink-2); min-width: 52px;
}
.qty-chips button.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.qty-info { margin: 0; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-3); }
.qty-info b { color: var(--ink); white-space: nowrap; }

.install-box {
  display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px;
  box-shadow: var(--shadow); padding: 7px 8px 7px 10px; margin-bottom: 10px; position: relative;
}
.install-box img { border-radius: 8px; flex: none; width: 30px; height: 30px; }
.install-box .btn.small { padding: 6px 12px; }
.ib-text { flex: 1; display: grid; min-width: 0; }
.ib-text b { font-size: 13.5px; }
.ib-text { line-height: 1.25; }
.ib-text small { font-size: 12.5px; color: var(--ink-3); }
.ib-close { border: 0; background: transparent; color: var(--ink-3); font-size: 20px; width: 28px; height: 28px; padding: 0; }

/* ---------- 음식 고르기 ---------- */
.picker { margin-top: 22px; }
/* 음식이 적은 카테고리(세트·내 음식 등)를 눌러도 페이지 길이가 줄지 않게 → 화면이 위로 튀지 않음 */
.picker { min-height: 100vh; min-height: 100dvh; }
/* 끼니 선택 바 (하나로 통합): 게이지 아래, 스크롤해도 상단바 아래에 붙어 있음 */
.pick-bar {
  position: sticky; top: var(--topbar-h, 60px); z-index: 4;
  background: var(--bg); padding: 2px 0 8px; margin: 0 -2px 4px;
}
.pick-meals {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--card);
  padding: 4px; border-radius: 16px; box-shadow: var(--shadow); border: 1.5px solid var(--line);
}
.pick-meals button {
  border: 0; background: transparent; border-radius: 12px; padding: 7px 0 6px; color: var(--ink-2);
  display: grid; justify-items: center; gap: 1px; transition: background .15s;
}
.pick-meals .pm-top { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 15px; }
.pick-meals small { font-size: 13px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.pick-meals button.on { background: var(--mc); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.pick-meals button.on small { color: rgba(255, 255, 255, .9); }
.pick-meals button.on .swatch { background: #fff; box-shadow: none; }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 0 14px; color: var(--ink-3);
}
.search:focus-within { border-color: var(--ink); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; padding: 12px 0; font-size: 15px; color: var(--ink); min-width: 0; }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 7px 13px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.food-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.food {
  position: relative; text-align: left; border: 0; background: var(--card); border-radius: 16px; padding: 12px 12px 11px;
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'emo g' 'name name' 'unit unit';
  row-gap: 2px; box-shadow: var(--shadow); transition: transform .08s ease;
}
.food:active { transform: scale(.96); }
.food { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; }
.food:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.food .f-icon { grid-area: emo; width: 34px; height: 34px; display: grid; place-items: center; }
.food .emo { font-size: 26px; line-height: 1; }
.thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
.food .f-g {
  grid-area: g; justify-self: end; align-self: start; font-weight: 800; font-size: 13px; padding: 3px 8px;
  border-radius: 999px; background: var(--hl); color: #111; font-variant-numeric: tabular-nums;
  border: 0; position: relative; z-index: 1; transition: box-shadow .15s;
}
/* 눌러서 수정할 수 있다는 힌트 */
.food .f-g.edited::after {
  content: '✎'; position: absolute; top: -6px; right: -4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink); color: var(--card); font-size: 8px; line-height: 14px; text-align: center;
}
.food .f-name { grid-area: name; font-weight: 700; margin-top: 6px; line-height: 1.25; }
.food .f-unit { grid-area: unit; font-size: 12.5px; color: var(--ink-3); }
.food .f-name, .food .f-unit { padding-right: 30px; }
.food .f-star, .food .f-edit {
  position: absolute; width: 32px; height: 32px; border: 0; border-radius: 10px; padding: 0;
  display: grid; place-items: center; background: transparent; line-height: 1;
}
.food .f-star { right: 4px; bottom: 4px; font-size: 20px; color: var(--ink-3); }
.food .f-star:hover { background: var(--bg); }
.food.is-fav .f-star { color: #f5a400; }
.food.is-fav { box-shadow: var(--shadow), inset 0 0 0 1.5px #f5c94a; }
.food .f-edit {
  top: -7px; left: -7px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--card); font-size: 13px;
}
.grid-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 12px; padding: 28px 12px; color: var(--ink-2); text-align: center; }


/* ---------- 내 음식 아이콘 선택 ---------- */
.icon-pick { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; }
.icon-preview {
  width: 72px; height: 72px; border-radius: 18px; background: var(--bg); display: grid; place-items: center;
  font-size: 38px; overflow: hidden; border: 1.5px solid var(--line);
}
.icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.icon-tools { display: grid; gap: 8px; min-width: 0; }
.emoji-list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-list button {
  border: 0; background: transparent; border-radius: 8px; aspect-ratio: 1; padding: 0; font-size: 19px; line-height: 1;
}
.emoji-list button:hover { background: var(--bg); }
.emoji-list button.on { background: var(--bg); box-shadow: inset 0 0 0 2px var(--ink); }
.icon-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.emoji-input {
  width: 92px; border: 1.5px solid var(--line); border-radius: 11px; padding: 7px 10px; background: var(--bg);
  outline: 0; font-size: 13.5px;
}
.emoji-input:focus { border-color: var(--ink); }
.small-link { font-size: 12.5px; color: var(--ink-2); }
.link.danger { color: #d64545; font-size: 13.5px; justify-self: center; }

/* ---------- 시트(다이얼로그) ---------- */
.sheet {
  border: 0; padding: 0; width: min(440px, calc(100% - 24px)); border-radius: 22px;
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.sheet::backdrop { background: rgba(10, 12, 15, .45); backdrop-filter: blur(2px); }
.sheet form { padding: 22px 20px 18px; display: grid; gap: 16px; }
.sheet h3 { margin: 0; font-size: 19px; letter-spacing: -.02em; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field > input {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg); outline: 0;
  font-size: 16px; color: var(--ink); font-weight: 500; width: 100%;
}
.field > input:focus { border-color: var(--ink); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); padding: 4px; border-radius: 12px; gap: 4px; }
.seg button { border: 0; background: transparent; padding: 9px 0; border-radius: 9px; font-weight: 700; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.sheet-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 4px; }

/* ---------- 기록 캘린더 ---------- */
.cal-sheet { width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 32px); }
.cal-wrap { padding: 16px 16px 18px; display: grid; gap: 14px; outline: none; }
.cal-top { display: grid; grid-template-columns: 36px 1fr 36px 36px; align-items: center; text-align: center; }
.cal-top h3 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.cal-nav, .cal-x {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--bg); font-size: 20px; line-height: 1; padding: 0;
}
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-x { background: transparent; font-size: 24px; color: var(--ink-2); }
.cal-summary { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; text-align: center; } /* 칸 수에 맞춰 자동 */
.cal-summary > div { background: var(--bg); border-radius: 12px; padding: 8px 4px; display: grid; }
.cal-summary b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cal-summary span { font-size: 12.5px; color: var(--ink-3); }
.cal-summary p { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-w { text-align: center; font-size: 12.5px; color: var(--ink-3); padding-bottom: 4px; }
.cal-w.sun { color: #d64545; }
.cal-d {
  border: 0; background: transparent; border-radius: 12px; padding: 4px 0 3px; display: grid; justify-items: center; gap: 1px;
  position: relative;
}
.cal-d:not(:disabled):hover { background: var(--bg); }
.cal-d:disabled { opacity: .3; cursor: default; }
.cal-d.sel { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--ink); }
.cal-n { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.cal-d.today .cal-n { color: var(--card); background: var(--ink); border-radius: 999px; padding: 0 6px; }
.cal-ring {
  width: 22px; height: 22px; border-radius: 50%; position: relative;
  background: conic-gradient(var(--ink) calc(var(--r) * 360deg), var(--tank) 0);
}
.cal-ring::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: var(--card); }
.cal-d.sel .cal-ring::after, .cal-d:hover .cal-ring::after { background: var(--bg); }
.cal-d.full .cal-ring { background: var(--ink); }
.cal-d.full .cal-ring::after { background: var(--hl); inset: 5px; }
.cal-g { font-size: 11.5px; color: var(--ink-3); min-height: 15px; font-variant-numeric: tabular-nums; }
.cal-detail { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.cd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cd-head span { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cd-empty { margin: 0; font-size: 13.5px; }
.cd-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; gap: 2px; }
.cd-bar i.rest { background: var(--tank); }
.cd-mh { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; }
.cd-mh i { width: 9px; height: 9px; border-radius: 3px; }
.cd-mh b { margin-left: auto; }
.cd-meal ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 15px; font-size: 13px; color: var(--ink-2); }
.cd-meal li { align-items: center; }
.cd-ico { width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
.cd-ico .emo { font-size: 18px; line-height: 1; }
.cd-ico .thumb { border-radius: 6px; }
.cd-name { flex: 1; min-width: 0; }
.cd-meal li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.cd-meal small { color: var(--ink-3); }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--bg);
  padding: 12px 14px 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  max-width: calc(100% - 32px); z-index: 20; visibility: hidden;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s .25s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
.toast button { border: 0; background: transparent; color: var(--hl); font-weight: 800; padding: 4px; white-space: nowrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast button { color: #4a6b00; } }
:root[data-theme="dark"] .toast button { color: #4a6b00; }

@media (max-width: 440px) {
  .gauge-card { --vis-w: 108px; gap: 14px; padding: 14px 14px 16px; }
  .week { flex-direction: column; align-items: stretch; gap: 6px; }
}
@media (max-width: 380px) {
  .eaten b { font-size: 34px; }
  .food-grid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- 설정 창: 백업 ---------- */
.backup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- 레이아웃: 휴대폰은 한 줄, PC는 두 칸 ---------- */
.col-main { display: contents; } /* 휴대폰: 감싸는 상자 없이 그대로 (끼니 바 고정이 페이지 끝까지 유지됨) */
@media (min-width: 960px) {
  .app {
    max-width: 1120px; display: grid; grid-template-columns: 420px minmax(0, 1fr);
    column-gap: 28px; align-items: start; padding: 0 24px 40px;
  }
  .topbar, .foot { grid-column: 1 / -1; }
  /* 왼쪽(캐릭터·끼니·장바구니)은 화면에 고정, 오른쪽 음식 목록만 스크롤 */
  .col-main {
    display: block; position: sticky; top: calc(var(--topbar-h, 60px) + 4px);
    max-height: calc(100vh - var(--topbar-h, 60px) - 12px); overflow-y: auto; scrollbar-width: thin;
    padding: 2px 4px 12px; margin: 0 -4px;
  }
  .col-main .pick-bar { top: 0; }
  .picker { margin-top: 0; }
  .food-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
}

/* ---------- 연속 달성 ---------- */
.cal-summary .best b { color: #e8590c; }

/* ---------- 식단 세트 ---------- */
.save-set:hover { border-color: var(--ink-3); color: var(--ink); }
.set-ico { display: inline-flex; align-items: center; }
.set-ico span { font-size: 15px; line-height: 1; margin-left: -5px; filter: drop-shadow(0 0 1px var(--card)); }
.set-ico span:first-child { margin-left: 0; }
.set-chip { border-color: var(--ink); background: var(--bg); padding-left: 10px; }
.set-chip .qc-name { font-weight: 700; }
.set-card .f-icon { width: auto; justify-content: start; }
.set-card .set-ico span { font-size: 22px; margin-left: -8px; }
.set-card .set-ico span:first-child { margin-left: 0; }
.set-card .f-unit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-card { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--ink); }
.grid-empty small { color: var(--ink-3); }
.empty-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.set-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.set-preview li { display: flex; align-items: center; gap: 8px; }
.set-preview li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.set-preview .sp-total { border-top: 1px solid var(--line); padding-top: 8px; font-weight: 700; }

/* ---------- 카테고리 순서 바꾸기 (꾹 누르기) ---------- */
.chips .chip { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.chips.reorder { touch-action: none; } /* 순서 바꾸는 중엔 끌기가 스크롤로 바뀌지 않게 */
.chips.reorder .chip[data-cat] { animation: wiggle .28s ease-in-out infinite alternate; cursor: grab; }
.chips.reorder .chip[data-cat]:nth-child(even) { animation-direction: alternate-reverse; }
@keyframes wiggle { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
.chip.dragging {
  animation: none !important; transform: scale(1.12); position: relative; z-index: 2; cursor: grabbing;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .18); border-color: var(--ink);
}

/* ---------- 빠른 담기 줄 순서 바꾸기 (꾹 눌러 들어 올리기) ---------- */
.quick-row { position: relative; } /* 칩 위치 계산 기준 */
.quick-row.reorder { touch-action: none; }
.quick-row.reorder .quick-chip:not(.quick-hole) { animation: wiggleR .28s ease-in-out infinite alternate; }
.quick-row.reorder .quick-chip:nth-child(even) { animation-direction: alternate-reverse; }
/* 흔들림은 rotate 속성으로 (비켜나는 애니메이션의 transform과 겹치지 않게) */
@keyframes wiggleR { from { rotate: -2deg; } to { rotate: 2deg; } }
/* 들어갈 자리: 점선 빈칸 */
.quick-chip.quick-hole {
  border-style: dashed; border-color: var(--ink-3); background: transparent; box-shadow: none; transform: none !important;
  animation: holeIn .2s ease;
}
@keyframes holeIn { from { opacity: .3; } }
.quick-chip.quick-hole > * { visibility: hidden; }
/* 손가락 밑에 떠 있는 칩 */
.quick-chip.quick-ghost {
  position: fixed; z-index: 60; margin: 0; pointer-events: none; border-color: var(--ink); transition: opacity .15s;
}
.quick-chip.quick-ghost.to-trash { opacity: .55; }
/* 휴지통: 칩을 들고 있는 동안 화면 아래에 나타남 */
.quick-trash {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 59; width: 60px; height: 60px;
  margin-left: -30px; border-radius: 50%; display: grid; place-items: center; pointer-events: none;
  background: var(--card); color: var(--ink-2); box-shadow: 0 8px 24px rgba(0, 0, 0, .2), 0 0 0 1.5px var(--line);
  opacity: 0; transform: translateY(24px) scale(.8); transition: opacity .2s, transform .2s cubic-bezier(.2, .8, .2, 1), background .15s, color .15s;
}
.quick-trash.show { opacity: 1; transform: none; }
.quick-trash.over { background: #e5484d; color: #fff; transform: scale(1.18); box-shadow: 0 10px 28px rgba(229, 72, 77, .45); }
.quick-trash .lid { transform-origin: 18px 6px; transition: transform .15s; }
.quick-trash.over .lid { transform: rotate(-22deg) translateY(-1px); }

/* ---------- 글 대신 보여주는 것들 ---------- */
.eaten { cursor: pointer; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 2px; }
.streak-badge {
  margin-left: 8px; align-self: center; font-size: 14px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.streak-badge.done { background: var(--hl); color: #111; }
/* 끼니 색으로 채워지는 진행 막대 */
.day-bar { display: flex; gap: 2px; height: 10px; border-radius: 6px; overflow: hidden; background: var(--tank); margin: 8px 0 16px; }
.day-bar i { display: block; height: 100%; transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.week { margin-top: 0; }
/* 검색 + 내 음식 버튼 한 줄 */
.picker { margin-top: 18px; }
.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row .search { flex: 1; min-width: 0; }
.add-food-btn { flex: none; border-radius: 14px; white-space: nowrap; }
.reset-today { justify-self: start; margin-top: 2px; font-size: 13px; }
.app { padding-bottom: 32px; }

/* 페이지 맨 아래 자동 저장 안내 */
.foot { margin-top: 28px; text-align: center; }
.foot p { margin: 0; }
.save-note { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* ---------- 게이지 카드 배치: 오른쪽 정보를 캐릭터 머리~발 높이에 고르게 ---------- */
.gauge-card { align-items: stretch; }
.gauge-card .visual { align-self: center; }
.gauge-info { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 4px 0 0; min-width: 0; }
.gi-top { display: grid; gap: 8px; }
.eaten { line-height: 1; }
.eaten b { font-size: 46px; }
.gi-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.pct-badge, .streak-badge {
  margin: 0; font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px;
  background: var(--bg); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.pct-badge.done, .streak-badge.done { background: var(--hl); color: #111; }
.day-bar { height: 12px; margin: 0; }
.gauge-info .week { margin: 0; padding-bottom: 18px; }
/* 말풍선 글은 가운데 (짧은 말도 빈 상자처럼 보이지 않게) */
.buddy-talk { justify-content: center; text-align: center; }
@media (max-width: 380px) { .eaten b { font-size: 38px; } }

/* ---------- 꾹 누르기 = 수정 ---------- */
.food, .quick-chip, .pick-meals button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.food .f-g { pointer-events: none; } /* 단백질 알약은 표시만 — 카드 어디를 눌러도 담기 */
.swatch { cursor: inherit; }
.long-pressed { animation: longPressed .25s ease; }
@keyframes longPressed { 50% { transform: scale(.94); } }

/* ---------- 상단 오른쪽: 몸무게 칩 + 설정 ---------- */
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card);
  display: grid; place-items: center; color: var(--ink-2); padding: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }

/* 7일 줄 끝 캘린더 버튼 */
.gauge-info .week { flex-direction: row !important; align-items: flex-start; gap: 6px; }
.cal-open {
  flex: none; width: 26px; height: 26px; margin-top: -4px; border: 0; border-radius: 8px; padding: 0;
  display: grid; place-items: center; background: transparent; color: var(--ink-2);
}
.cal-open:hover { background: var(--bg); color: var(--ink); }
.qty-btn { white-space: nowrap; } /* "1스쿱", "1.5공기"가 두 줄로 깨지지 않게 */

/* ---------- 캘린더: 이 달 체중 변화 ---------- */
.cal-weight { background: var(--bg); border-radius: 12px; padding: 10px 12px 8px; }
.cw-head { display: flex; align-items: baseline; gap: 8px; }
.cw-label { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.cw-head b { font-size: 18px; }
.cw-diff { font-size: 13px; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cw-chart { position: relative; margin-top: 4px; }
.cw-chart svg { display: block; max-width: 100%; overflow: visible; touch-action: pan-y; }
.cw-grid { stroke: var(--line); stroke-width: 1; }
.cw-tick { font-size: 11px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.cw-end { font-size: 12px; font-weight: 700; fill: var(--ink); }
.cw-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cw-area { fill: var(--ink); opacity: .08; }
.cw-dot, .cw-hover { fill: var(--ink); stroke: var(--bg); stroke-width: 2; }
.cw-cross { stroke: var(--ink-3); stroke-width: 1; }
.cw-hit { fill: transparent; cursor: crosshair; }
.cw-tip {
  position: absolute; top: -6px; padding: 3px 8px; border-radius: 8px; background: var(--ink); color: var(--card);
  font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; transform: translateY(-100%);
}
.cd-w { font-weight: 600; color: var(--ink-2); font-size: 12.5px; margin-left: 4px; }

/* ---------- 오늘 인증 이미지 ---------- */
.share-btn {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0;
  display: grid; place-items: center; background: var(--bg); color: var(--ink-2);
}
.share-btn:hover { color: var(--ink); }
.gi-badges { align-items: center; }
.share-sheet { width: min(420px, calc(100% - 24px)); }
.share-wrap { padding: 16px; display: grid; gap: 12px; }
.share-img { width: 100%; height: auto; border-radius: 14px; display: block; box-shadow: 0 0 0 1px var(--line); aspect-ratio: 4 / 5; background: var(--bg); }
.share-close { justify-self: center; }

/* ---------- 검색 노출용 ---------- */
.returning #setup { display: none; } /* 다시 온 사람: 첫 화면 깜빡임 방지 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 첫 화면 아래 자주 묻는 질문 ---------- */
.faq { max-width: 420px; margin: 0 auto; padding: 8px 0 48px; display: grid; gap: 8px; }
.faq h2 { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--ink-2); text-align: center; }
.faq-item { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); }
.faq-item summary {
  list-style: none; cursor: pointer; padding: 14px 44px 14px 16px; font-size: 14.5px; font-weight: 700;
  position: relative; -webkit-tap-highlight-color: transparent;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  font-size: 20px; font-weight: 500; color: var(--ink-3); transition: transform .2s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(45deg); }
.faq-item p { margin: 0; padding: 0 16px 16px; font-size: 13.5px; line-height: 1.65; color: var(--ink-2); }
.faq-item p b { color: var(--ink); }
.faq-item summary, .faq-item p { word-break: keep-all; } /* 단어 중간에서 줄바꿈하지 않음 */
.faq-item p + .faq-table-wrap { margin-top: -6px; }
/* 몸무게별 목표 표 */
.faq-table-wrap { padding: 0 16px 16px; }
.faq-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.faq-table th, .faq-table td { padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.faq-table th:first-child { text-align: left; }
.faq-table thead th { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.faq-table tbody th { font-weight: 600; color: var(--ink-2); }
.faq-table td { color: var(--ink-2); }
.faq-table td b { color: var(--ink); }
.faq-table tbody tr:last-child > * { border-bottom: 0; }
/* 참고 자료 한 줄 */
.faq-ref { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink-3); text-align: center; word-break: keep-all; }
.faq-ref a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 닉네임 ---------- */
.nick-field { display: grid; gap: 6px; text-align: left; margin: 2px 0 8px; }
.nick-field .weight-label small { font-weight: 500; color: var(--ink-3); }
.nick-field input {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 14px; background: var(--card); outline: 0;
  font-size: 16px; font-weight: 600; color: var(--ink); width: 100%;
}
.nick-field input:focus { border-color: var(--ink); }
.nick-note { font-size: 12.5px; color: var(--ink-3); padding-left: 4px; }
/* 캐릭터 아래 이름표: 누르면 닉네임 바꾸기 */
button.buddy-level { border: 0; background: transparent; padding: 2px 3px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; }
button.buddy-level:hover { background: var(--bg); }

/* ---------- 홈 화면에 추가 안내 ---------- */
.install-steps { margin: 0; padding: 0; list-style: none; counter-reset: ig; display: grid; gap: 10px; }
.install-steps li {
  counter-increment: ig; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 15px; font-weight: 600;
  line-height: 1.5; word-break: keep-all;
}
.install-steps li::before {
  content: counter(ig); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: var(--card); font-size: 13px; font-weight: 800;
}
.ig-key { padding: 1px 8px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 800; }
.ig-ico {
  width: 28px; height: 28px; padding: 4px; border-radius: 8px; background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line);
  fill: none; stroke: #2f7cf6; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
