:root {
  --coral: #ff6a55;
  --coral-2: #ff8a6c;
  --coral-soft: #fff0ec;
  --coral-ink: #e2492f;
  --bg: #f4f4f6;
  --card: #ffffff;
  --ink: #1c1c21;
  --ink-2: #5f5f6b;
  --muted: #9a9aa6;
  --line: #ececf0;
  --track: #efeff3;
  --good: #1a9e5c;
  --danger: #e0412b;
  --radius: 26px;
  --radius-sm: 16px;
  --shadow: 0 1px 2px rgba(20, 20, 30, 0.04), 0 8px 24px rgba(20, 20, 30, 0.05);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
  --font-round: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
body { overscroll-behavior-y: none; }
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { opacity: 0.5; cursor: default; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-family: var(--font-round); letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 650; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.grow { flex: 1; }
.icon { flex-shrink: 0; display: block; }

/* ---------- layout ---------- */
.app { min-height: 100vh; padding-bottom: calc(96px + var(--safe-bottom)); }
.page { max-width: 560px; margin: 0 auto; }
.content { padding: 0 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 22px) 20px 16px; }
.boot { min-height: 100vh; display: grid; place-items: center; }

.card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-title { margin-bottom: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h3 { display: flex; align-items: center; gap: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.field, .field-input { min-width: 0; }
.field-input input { width: 100%; }
.row-gap { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--coral) 0%, var(--coral-2) 100%);
  color: #fff;
  padding: calc(var(--safe-top) + 18px) 16px 64px;
  border-radius: 0 0 34px 34px;
  margin-bottom: -46px;
}
.hero-top { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 18px; max-width: 528px; margin: 0 auto; }
.hero-hello { font-size: 16px; opacity: 0.88; }
.hero-name { font-family: var(--font-round); font-size: 27px; font-weight: 700; line-height: 1.15; }
.date-nav { display: flex; align-items: center; background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 3px; }
.date-nav button { height: 34px; min-width: 34px; display: grid; place-items: center; border-radius: 999px; color: #fff; }
.date-nav .date-label { padding: 0 8px; font-weight: 600; font-size: 14.5px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-nav button:disabled { opacity: 0.35; }

.kcal-card { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.22); border-radius: var(--radius); padding: 20px 20px 16px; max-width: 528px; margin: 0 auto; }
.kcal-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kcal-caption { font-size: 15px; opacity: 0.9; }
.kcal-big { font-family: var(--font-round); font-size: 52px; font-weight: 750; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kcal-big span { font-size: 18px; font-weight: 500; opacity: 0.85; margin-left: 6px; letter-spacing: 0; }
.kcal-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.22); }
.kcal-stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.kcal-stats div + div { border-left: 1px solid rgba(255, 255, 255, 0.22); }
.kcal-stats span { font-size: 13px; opacity: 0.85; }
.kcal-stats b { font-family: var(--font-round); font-size: 20px; font-variant-numeric: tabular-nums; }

.ring { position: relative; flex-shrink: 0; }
.ring svg { display: block; }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-round); font-size: 22px; }

/* ---------- coach & banners ---------- */
.home .content { position: relative; z-index: 1; padding-bottom: 72px; }
.coach-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; }
.coach-card p { margin: 0; color: var(--ink); font-size: 15.5px; }
.coach-icon { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--coral-soft); color: var(--coral); flex-shrink: 0; }
.shimmer-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.shimmer-lines span { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--track) 0%, #f8f8fa 50%, var(--track) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.shimmer-lines span:last-child { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.banner { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; padding: 16px 18px; }
.banner b { display: block; font-size: 15.5px; }
.banner span { color: var(--muted); font-size: 14px; }
.banner-icon { width: 42px; height: 42px; border-radius: 14px; background: var(--coral); color: #fff; display: grid; place-items: center; }

.streak { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--coral-ink); font-weight: 600; font-size: 14.5px; }

/* ---------- progress bars ---------- */
.progress { margin-bottom: 16px; }
.progress:last-child { margin-bottom: 0; }
.progress-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.progress-label { display: flex; align-items: center; gap: 9px; font-size: 16px; }
.progress-dot { width: 10px; height: 10px; border-radius: 50%; }
.progress-val { font-variant-numeric: tabular-nums; font-size: 15px; }
.progress-val span { color: var(--muted); }
.bar { height: 10px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar-lg { height: 12px; margin: 14px 0 8px; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.steps-row { display: block; width: 100%; text-align: left; margin-top: 16px; }
.steps-row .progress { margin: 0; }

/* ---------- meals ---------- */
.meal-card { padding: 16px 18px; }
.meal-head { display: flex; justify-content: space-between; align-items: center; }
.meal-title { display: flex; align-items: center; gap: 10px; }
.meal-emoji { width: 38px; height: 38px; border-radius: 13px; background: var(--bg); display: grid; place-items: center; font-size: 19px; }
.meal-right { display: flex; align-items: center; gap: 10px; }
.meal-kcal { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 15px; }
.meal-group { display: flex; gap: 12px; margin-top: 14px; }
.meal-group + .meal-group { padding-top: 14px; border-top: 1px solid var(--line); }
.meal-photo { width: 62px; height: 62px; border-radius: 18px; object-fit: cover; flex-shrink: 0; }
.meal-items { flex: 1; min-width: 0; }
.meal-item { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 5px 0; }
.meal-item-name { display: flex; flex-direction: column; min-width: 0; font-weight: 550; font-size: 15.5px; }
.meal-item-name small { font-weight: 400; color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-item-kcal { color: var(--coral-ink); font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; }

.run-today { border: 2px solid var(--coral); }
.run-today.is-done { border-color: transparent; }
.run-today-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.run-today h3 { font-size: 19px; margin-bottom: 4px; }
.run-today p { color: var(--ink-2); }

/* ---------- lists ---------- */
.list-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; }
.card-title + .list-row { border-top: 0; }
.list-row > span:first-child { display: flex; flex-direction: column; min-width: 0; font-weight: 550; }
.list-row small { font-weight: 400; color: var(--muted); font-size: 13.5px; }
.list-row b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.row-end { display: flex; align-items: center; gap: 4px; }
.list-btn { width: 100%; text-align: left; }
.list-btn > span:first-child { flex-direction: row !important; align-items: center; gap: 10px; flex-wrap: wrap; }
.list-btn small { width: 100%; padding-left: 28px; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 20px; border-radius: 16px; font-weight: 600; font-size: 16px; transition: transform 0.12s, background 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 16px rgba(255, 106, 85, 0.28); }
.btn-soft { background: var(--coral-soft); color: var(--coral-ink); }
.btn-ghost { color: var(--ink-2); background: var(--card); }
.btn-ghost-danger { color: var(--danger); background: #fdeeec; }
.btn-block { width: 100%; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14.5px; border-radius: 12px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: var(--muted); }
.icon-btn-soft { background: var(--coral-soft); color: var(--coral); }
.icon-btn-coral { background: var(--coral); color: #fff; width: 44px; height: 44px; border-radius: 14px; }
.link { color: var(--coral-ink); font-weight: 600; }
.link.danger { color: var(--danger); }
.link.small { font-size: 14px; margin-top: 10px; }

.fab {
  position: fixed; right: max(20px, calc(50vw - 260px)); bottom: calc(92px + var(--safe-bottom));
  width: 64px; height: 64px; border-radius: 50%; background: var(--coral); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 26px rgba(255, 106, 85, 0.45); z-index: 20;
  transition: transform 0.15s;
}
.fab:active { transform: scale(0.94); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-bottom));
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; color: #a6a6b0; font-size: 11.5px; font-weight: 600; padding: 4px 0; }
.tabbar button.active { color: var(--coral); }

/* ---------- pills, chips, segmented ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pill-coral { background: var(--coral-soft); color: var(--coral-ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; margin-left: -20px; margin-right: -20px; padding: 0 20px 2px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 14.5px; font-weight: 550; white-space: nowrap; }
.chip.active { background: var(--coral); color: #fff; }
.segmented { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; }
.segmented button { flex: 1; height: 34px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field > span { font-size: 14px; color: var(--ink-2); font-weight: 550; }
.field-input { display: flex; align-items: center; background: var(--bg); border-radius: 14px; padding: 0 14px; min-height: 50px; border: 1.5px solid transparent; transition: border-color 0.15s; }
.field-input:focus-within { border-color: var(--coral); background: #fff; }
.field-input input { flex: 1; min-width: 0; border: 0; background: none; outline: none; height: 48px; font-size: 16.5px; }
.field-input em { font-style: normal; color: var(--muted); font-size: 14.5px; margin-left: 6px; }
textarea { width: 100%; border: 1.5px solid transparent; background: var(--bg); border-radius: 18px; padding: 14px 16px; resize: none; outline: none; font-size: 16.5px; line-height: 1.45; margin-bottom: 12px; }
textarea:focus { border-color: var(--coral); background: #fff; }
input.plain { width: 100%; border: 0; background: var(--bg); border-radius: 12px; height: 44px; padding: 0 12px; outline: none; font-size: 16px; margin-bottom: 8px; }

.choice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice-col { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 12px 14px; border-radius: 16px; background: var(--bg); border: 1.5px solid transparent; }
.choice small { color: var(--muted); font-size: 13px; }
.choice.active { border-color: var(--coral); background: var(--coral-soft); }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 8px 0 14px; font-weight: 550; cursor: pointer; }
.toggle-row input { display: none; }
.toggle { width: 50px; height: 30px; border-radius: 999px; background: #dcdce2; position: relative; flex-shrink: 0; transition: background 0.2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.toggle-row input:checked + .toggle { background: var(--coral); }
.toggle-row input:checked + .toggle::after { transform: translateX(20px); }

/* ---------- sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 15, 25, 0.38); opacity: 0; transition: opacity 0.28s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 560px;
  background: var(--card); border-radius: 30px 30px 0 0; max-height: calc(100vh - var(--safe-top) - 24px);
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.85, 0.25, 1);
}
.sheet-tall { height: calc(100vh - var(--safe-top) - 24px); }
.sheet-wrap.shown .sheet-backdrop { opacity: 1; }
.sheet-wrap.shown .sheet { transform: translateY(0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: #dedee4; margin: 9px auto 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 10px 20px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px calc(24px + var(--safe-bottom)); flex: 1; }

/* ---------- add food ---------- */
.meal-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0 14px; }
.meal-pick button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 14px; background: var(--bg); font-size: 13px; font-weight: 600; color: var(--ink-2); border: 1.5px solid transparent; }
.meal-pick button span { font-size: 18px; }
.meal-pick button.active { background: var(--coral-soft); border-color: var(--coral); color: var(--coral-ink); }
.compose-actions { display: flex; gap: 10px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }
.photo-preview { position: relative; margin-bottom: 12px; }
.photo-preview img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 20px; display: block; }
.photo-remove { position: absolute; top: 10px; right: 10px; background: rgba(0, 0, 0, 0.5); color: #fff; }
.compose + .section-head { margin-top: 26px; }
.fav-list { display: flex; flex-direction: column; }
.fav { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 0; border-top: 1px solid var(--line); }
.fav:first-child { border-top: 0; }
.fav b { display: block; font-weight: 600; }
.fav small { color: var(--muted); font-size: 13.5px; }
.fav-star { width: 34px; height: 34px; border-radius: 11px; background: #fff7e0; color: #e9a800; display: grid; place-items: center; }

.thinking { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 10px; gap: 10px; }
.thinking p { margin: 6px 0 0; font-weight: 600; font-size: 17px; }
.thinking small { color: var(--muted); }
.thinking-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 26px; margin-bottom: 8px; }
.thinking-orb { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(140deg, var(--coral), var(--coral-2)); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 106, 85, 0.35); } 50% { transform: scale(1.06); box-shadow: 0 0 0 16px rgba(255, 106, 85, 0); } }

.note { display: flex; gap: 8px; background: var(--coral-soft); color: var(--coral-ink); padding: 12px 14px; border-radius: 16px; font-size: 14px; align-items: flex-start; }
.note .icon { margin-top: 2px; }
.review-list { display: flex; flex-direction: column; }
.review-item { border-top: 1px solid var(--line); padding: 10px 0; }
.review-item:first-child { border-top: 0; }
.review-item-main { display: flex; align-items: center; gap: 12px; }
.review-item-text { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; }
.review-item-text b { font-weight: 600; }
.review-item-text small { color: var(--muted); font-size: 13.5px; }
.kcal-input { display: flex; align-items: center; background: var(--bg); border-radius: 12px; padding: 0 10px; height: 42px; }
.kcal-input input { width: 54px; border: 0; background: none; outline: none; text-align: right; font-weight: 650; font-size: 16px; font-variant-numeric: tabular-nums; }
.kcal-input em { font-style: normal; color: var(--muted); font-size: 13px; margin-left: 4px; }
.review-item-more { padding: 10px 0 2px; }
.macro-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.macro-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.macro-inputs input { border: 0; background: var(--bg); border-radius: 10px; height: 40px; padding: 0 10px; outline: none; font-size: 16px; width: 100%; }
.portion { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.portion > span { font-weight: 600; color: var(--ink-2); }
.portion .chips { margin: 0; flex-wrap: nowrap; }
.portion .chip { padding: 0 11px; }
.review-total { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--bg); border-radius: 18px; padding: 14px 6px; margin: 8px 0 14px; text-align: center; }
.review-total b { display: block; font-family: var(--font-round); font-size: 19px; font-variant-numeric: tabular-nums; }
.review-total div:first-child b { color: var(--coral-ink); }
.review-total span { color: var(--muted); font-size: 12.5px; }
.sticky-actions { position: sticky; bottom: 0; background: var(--card); padding: 10px 0 4px; }

/* ---------- progress page ---------- */
.big-num { font-family: var(--font-round); font-size: 44px; font-weight: 750; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.big-num span { font-size: 17px; font-weight: 500; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.big-num.coral { color: var(--coral); }
.weight-hero-top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 4px; }
.weight-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.delta { font-weight: 650; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.delta.good { color: var(--good); }
.goal-track { margin: 6px 0 16px; }
.goal-track .bar { margin: 10px 0 8px; }
.goal-track-labels { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--ink-2); gap: 10px; margin-bottom: 8px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.stat-row b { display: block; font-family: var(--font-round); font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: 12.5px; color: var(--muted); }

.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .goal-line { stroke: var(--ink-2); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: 0.55; }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; opacity: 0.35; }
.chart-tip { min-height: 22px; text-align: center; font-size: 13.5px; color: var(--ink-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.chart-tip b { color: var(--ink); }
.goal-key { display: inline-block; width: 16px; border-top: 1.5px dashed var(--ink-2); vertical-align: middle; margin-right: 4px; opacity: 0.7; }
.chart-empty { padding: 40px 0; text-align: center; color: var(--muted); }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 6px; border-radius: 18px; background: var(--bg); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.badge-icon { font-size: 26px; filter: grayscale(1); opacity: 0.35; }
.badge.done { background: var(--coral-soft); color: var(--coral-ink); }
.badge.done .badge-icon { filter: none; opacity: 1; }

/* ---------- sport ---------- */
.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; }
.tile b { font-family: var(--font-round); font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.coach-ask .section-head h3 .icon { color: var(--coral); }
.coach-answer { background: var(--coral-soft); border-radius: 18px 18px 18px 6px; padding: 14px 16px; margin-bottom: 12px; font-size: 15.5px; white-space: pre-wrap; }
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1; min-width: 0; border: 1.5px solid transparent; background: var(--bg); border-radius: 14px; height: 44px; padding: 0 14px; outline: none; font-size: 16px; }
.ask-row input:focus { border-color: var(--coral); background: #fff; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.weekdays button { height: 42px; border-radius: 12px; background: var(--bg); font-weight: 600; font-size: 14px; color: var(--ink-2); }
.weekdays button.active { background: var(--coral); color: #fff; }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-goal { margin-top: 10px; font-size: 24px; }
.nowrap { white-space: nowrap; }
.plan-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 6px 0 0; cursor: pointer; }
.plan-summary.open { display: block; }
.session { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.section-head + .session { border-top: 0; padding-top: 2px; }
.session p { margin: 2px 0 4px; color: var(--ink-2); font-size: 14.5px; }
.session-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.session-meta { font-size: 12.5px; color: var(--muted); }
.session-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #d4d4dc; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; color: #fff; }
.session-check:disabled { opacity: 1; border-style: dashed; }
.session.today .session-check { border-color: var(--coral); }
.session.done .session-check { background: var(--coral); border-color: var(--coral); border-style: solid; }
.session.done b, .session.done p { color: var(--muted); }
.session.done b { text-decoration: line-through; }
.session.missed .session-top .muted { color: var(--danger); }

/* ---------- profile ---------- */
.goal-summary { text-align: center; }
.goal-summary .big-num { color: var(--coral); margin: 2px 0 10px; }
.macro-pills { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.macro-pills span { background: var(--bg); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--ink-2); }
.macro-pills b { color: var(--ink); }
.save-bar { position: sticky; bottom: calc(84px + var(--safe-bottom)); z-index: 5; }
.copy-box { display: flex; flex-direction: column; gap: 6px; background: var(--bg); border-radius: 16px; padding: 12px 14px; margin-bottom: 10px; }
.copy-box > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.copy-box code { font-size: 13.5px; word-break: break-all; }
.copy-box .btn { align-self: flex-start; }
.howto { padding-left: 20px; margin: 16px 0 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; color: var(--ink-2); }
.howto b { color: var(--ink); }
.howto code { background: var(--bg); padding: 1px 6px; border-radius: 6px; }

/* ---------- login & onboarding ---------- */
.login, .onboarding { min-height: 100vh; max-width: 480px; margin: 0 auto; padding: calc(var(--safe-top) + 40px) 20px calc(30px + var(--safe-bottom)); display: flex; flex-direction: column; }
.login-hero, .onb-hero { text-align: center; padding: 30px 0 30px; }
.login-hero h1, .onb-hero h1 { margin-top: 18px; }
.login-hero p, .onb-hero p { color: var(--ink-2); margin-top: 6px; font-size: 17px; }
.logo-mark { width: 84px; height: 84px; border-radius: 26px; margin: 0 auto; overflow: hidden; box-shadow: 0 12px 30px rgba(255, 106, 85, 0.35); }
.logo-mark.big { width: 104px; height: 104px; border-radius: 32px; }
.logo-mark img { width: 100%; height: 100%; display: block; }
.login-card .btn { margin-top: 6px; }
.onb-progress { display: flex; gap: 6px; margin-bottom: 18px; }
.onb-progress span { flex: 1; height: 5px; border-radius: 3px; background: #e2e2e8; transition: background 0.3s; }
.onb-progress span.on { background: var(--coral); }
.onboarding .card h2 { margin-bottom: 16px; }
.onb-result { text-align: center; }
.onb-result .big-num { margin: 4px 0 12px; }
.onb-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 20px; }

/* ---------- toast, spinner, misc ---------- */
.toasts { position: fixed; top: calc(var(--safe-top) + 12px); left: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: 440px; background: rgba(28, 28, 33, 0.94); color: #fff; padding: 12px 18px; border-radius: 16px; font-size: 15px; font-weight: 550; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); animation: toast-in 0.25s ease-out; text-align: center; }
.toast-success { background: var(--coral); }
.toast-error { background: #b3261e; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
.spinner-row { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 10px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--track); border-top-color: var(--coral); animation: spin 0.8s linear infinite; display: inline-block; }
.spinner-white { width: 18px; height: 18px; border-color: rgba(255, 255, 255, 0.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { color: var(--danger); }

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