:root {
  --bg: #F3EFFA;
  --card: #FFFFFF;
  --ink: #241F33;
  --muted: #5E5872;
  --accent: #B4491A;
  --accent-fill: #B4491A;
  --accent-press: #9A3D14;
  --accent-soft: #FBE7DB;
  --peach: #F6C4A6;
  --lav: #E9E3F4;
  --lav-2: #D6CBEC;
  --line: #ECE6F5;
  --field: #FAF8FD;
  --danger: #B3261E;
  --danger-line: #F0CFCC;
  --on-accent: #FFFFFF;
  --placeholder: #A69FB8;
  --future: #B9B2CA;
  --scrim: rgba(36, 31, 51, .38);
  --tabbar-bg: rgba(255, 255, 255, .92);
  --toast-text: #FFFFFF;
  --stage-center: #FFFFFF;
  --mood-happy: #FCE3D3;
  --mood-sleepy: #DED6F0;
  --mood-sad: #DCE6F2;
  --mood-angry: #F8DAD6;
  --pink-soft: #FDE4EB;
  --pink-text: #C2456B;
  --pill-nudge-bg: #E3F4EC;
  --pill-nudge-text: #2E7D5B;
  --r-xl: 28px;
  --r-lg: 24px;
  --r: 20px;
  --r-sm: 14px;
  --shadow: 0 1px 2px rgba(36, 31, 51, .04), 0 8px 24px rgba(36, 31, 51, .06);
  --font-head: 'Fredoka', ui-rounded, 'SF Pro Rounded', system-ui, sans-serif;
  --font-body: 'Nunito', ui-rounded, system-ui, sans-serif;
  /* the quote of the day (2026-10-20: "a bold font and aesthetically pleasing font"): Apple's New York serif on
     iPhone/Mac Safari, the same as the app; Fraunces elsewhere, only downloaded where New York isn't there */
  --font-quote: ui-serif, 'Fraunces', Georgia, serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

/* Dark: Me › Appearance › Theme, or the system when Theme is System (js/appearance.js sets data-theme). */
:root[data-theme='dark'] {
  --bg: #15121D; --card: #221E2C; --ink: #F1EDF8; --muted: #A9A2BC;
  --accent: #C5714C; --accent-soft: #432F32; --peach: #664139;
  --lav: #342E42; --lav-2: #4A4259; --line: #3A3348; --field: #1A1722;
  --danger: #F2827A; --danger-line: #5A2E2E;
  --placeholder: #6E6782; --future: #5F5872; --scrim: rgba(0, 0, 0, .55); --tabbar-bg: rgba(34, 30, 44, .92);
  --toast-text: #221E2C; --stage-center: #4A4259;
  --mood-happy: #4A3128; --mood-sleepy: #352D48; --mood-sad: #2A3444; --mood-angry: #4A2A2E;
  --pink-soft: #4A2532; --pink-text: #F49BB4; --pill-nudge-bg: #1F3B2F; --pill-nudge-text: #8FD3B5;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15121D; --card: #221E2C; --ink: #F1EDF8; --muted: #A9A2BC;
    --accent: #C5714C; --accent-soft: #432F32; --peach: #664139;
    --lav: #342E42; --lav-2: #4A4259; --line: #3A3348; --field: #1A1722;
    --danger: #F2827A; --danger-line: #5A2E2E;
    --placeholder: #6E6782; --future: #5F5872; --scrim: rgba(0, 0, 0, .55); --tabbar-bg: rgba(34, 30, 44, .92);
    --toast-text: #221E2C; --stage-center: #4A4259;
    --mood-happy: #4A3128; --mood-sleepy: #352D48; --mood-sad: #2A3444; --mood-angry: #4A2A2E;
    --pink-soft: #4A2532; --pink-text: #F49BB4; --pill-nudge-bg: #1F3B2F; --pill-nudge-text: #8FD3B5;
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
  outline: none;
}
body[data-view='welcome'] main { padding-bottom: calc(env(safe-area-inset-bottom) + 28px); }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; margin: 0; letter-spacing: -.01em; line-height: 1.15; }
h1 { font-size: 28px; }
h2 { font-size: 19px; margin-bottom: 10px; }
h3 { font-size: 17px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
code, .mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.icon { flex: none; display: block; }
p > .icon, small > .icon { display: inline-block; vertical-align: -2px; }

/* ---- layout bits ---------------------------------------------------------------------------------------------- */

.page-head { margin: 4px 4px 16px; }
.page-head .muted { margin-top: 6px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-weight: 700; font-size: 14px; }
.card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-head h2 { margin-bottom: 12px; }
.empty { text-align: center; padding: 36px 18px; }
.spinner {
  width: 32px; height: 32px; margin: 0 auto 12px; border-radius: 50%;
  border: 4px solid var(--lav); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- buttons & fields ----------------------------------------------------------------------------------------- */

button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 999px;
  background: var(--lav); color: var(--ink);
  font: 700 16px var(--font-body);
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, background .15s ease, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent-fill); color: var(--on-accent); }
.btn.primary:active:not(:disabled) { background: var(--accent-press); }
.btn.danger { background: #B3261E; color: #fff; }
.btn.danger-outline { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px var(--danger-line); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.dashed { background: transparent; box-shadow: inset 0 0 0 2px var(--lav-2); color: var(--muted); }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.big { min-height: 60px; font-size: 18px; border-radius: var(--r); }
.btn.on { background: var(--accent-soft); color: var(--accent); opacity: 1; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.link {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--accent); font: 700 15px var(--font-body); text-decoration: none;
}
.link:disabled { opacity: .5; }
.link.danger { color: var(--danger); }
.link.back { display: inline-flex; align-items: center; gap: 2px; margin-bottom: 10px; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--card); color: var(--ink); cursor: pointer; box-shadow: var(--shadow);
}
.icon-btn:disabled { opacity: .35; }
.icon-btn.small { width: 36px; height: 36px; box-shadow: none; background: var(--lav); }

label { display: block; margin: 14px 2px 6px; color: var(--muted); font-weight: 700; font-size: 14px; }
input:not([type=file]):not([type=color]):not([type=range]) {
  width: 100%; padding: 13px 16px;
  border: 2px solid var(--line); border-radius: 16px;
  background: var(--field); color: var(--ink);
  font: 600 17px var(--font-body);
  -webkit-appearance: none; appearance: none;
}
input:focus { outline: none; border-color: var(--accent); background: var(--card); }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
form .btn.block { margin-top: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 0; border-radius: 999px; padding: 8px 14px; cursor: pointer;
  background: var(--lav); font: 700 15px var(--font-body);
}
.chip.on { background: var(--accent-fill); color: var(--on-accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 18px; background: var(--lav); }
.seg button {
  border: 0; border-radius: 14px; min-height: 42px; cursor: pointer;
  background: transparent; font: 700 16px var(--font-body); color: var(--muted);
}
.seg button.on { background: var(--card); color: var(--accent); box-shadow: 0 2px 6px rgba(36, 31, 51, .08); }

/* ---- tab bar -------------------------------------------------------------------------------------------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  padding: 0 8px env(safe-area-inset-bottom);
  background: var(--tabbar-bg);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 24px rgba(36, 31, 51, .07);
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1; max-width: 110px; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 800;
}
.tab[aria-current='page'] { color: var(--accent); }
.tab[aria-current='page'] .icon { transform: translateY(-1px) scale(1.06); }

/* ---- buddy ---------------------------------------------------------------------------------------------------- */

.stage {
  position: relative; width: 170px; height: 170px; margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--stage-center) 0%, var(--lav) 70%);
}
.stage.big { width: 210px; height: 210px; }
.stage.bleed { overflow: hidden; }   /* a picture cut off at the bottom fills the circle, trimmed by it (chibifit.js BLEED) */
.stage.mood-happy, .stage.mood-cheer, .stage.mood-wave { background: radial-gradient(circle at 50% 40%, var(--stage-center) 0%, var(--mood-happy) 72%); }
.stage.mood-sleepy { background: radial-gradient(circle at 50% 40%, var(--stage-center) 0%, var(--mood-sleepy) 72%); }
.stage.mood-sad, .stage.mood-ko { background: radial-gradient(circle at 50% 40%, var(--stage-center) 0%, var(--mood-sad) 72%); }
.stage.mood-angry { background: radial-gradient(circle at 50% 40%, var(--stage-center) 0%, var(--mood-angry) 72%); }
.stage.own-bg { background: radial-gradient(circle at 50% 40%, var(--stage-glow) 0%, var(--stage-bg) 72%); }   /* Your Buddy › Background */
.buddy-svg, .buddy-img { width: 86%; height: 86%; object-fit: contain; }
.buddy-svg { overflow: visible; }   /* tall hats may poke out above the picture */
.buddy-img { border-radius: 24px; }
.stage .buddy-svg, .stage .buddy-img { animation: idle 3.2s ease-in-out infinite; transform-origin: 50% 90%; }
.stage .mood-happy, .stage .mood-wave { animation: bounce 1.1s ease-in-out infinite; }
.stage .mood-cheer { animation: bounce .7s ease-in-out infinite; }
.stage .mood-angry { animation: huff 1.6s ease-in-out infinite; }
.stage .mood-sleepy { animation: sway 4.5s ease-in-out infinite; }
.stage .mood-sad, .stage .mood-ko { animation: none; }
@keyframes idle { 50% { transform: scale(1.025, .975); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px) scale(1.02, .98); } }
@keyframes sway { 50% { transform: rotate(-3deg); } }
@keyframes huff { 0%, 60%, 100% { transform: translateX(0); } 70% { transform: translateX(-2px); } 80% { transform: translateX(2px); } 90% { transform: translateX(-1px); } }

.buddy-card { text-align: center; padding-top: 16px; }
.bubble {
  position: relative; display: inline-block; max-width: 90%;
  margin: 0 auto 14px; padding: 10px 16px;
  border-radius: 18px; background: var(--bg);
  font: 600 16px var(--font-head);
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; width: 14px; height: 14px;
  background: inherit; transform: translateX(-50%) rotate(45deg); border-radius: 3px;
}
.buddy-caption { margin: 12px 0 0; color: var(--muted); }
.buddy-caption b { color: var(--ink); }

/* ---- today ---------------------------------------------------------------------------------------------------- */

.steps-card { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 12; }
.ring-bg { stroke: var(--lav); }
.ring-fg {
  stroke: var(--accent); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 60px 60px;
  transition: stroke-dashoffset .9s cubic-bezier(.3, .8, .3, 1);
}
.ring-fg.zero { opacity: 0; }
.ring-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-text b { font: 600 26px var(--font-head); }
.ring-text span { color: var(--muted); font-size: 13px; font-weight: 700; }
.steps-side { min-width: 0; }
.steps-side h2 { margin-bottom: 2px; font-size: 17px; color: var(--muted); }
.big-line { font: 600 22px var(--font-head); margin-bottom: 6px; }

.gym-card { text-align: center; }
.gym-btn { width: 100%; }
.gym-done {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 60px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent);
  font: 600 18px var(--font-head);
}
.gym-done .link { margin-left: 6px; font-size: 14px; color: var(--muted); }
.picker-chips .act-chips { margin-top: 12px; }
.picker-footer { margin-top: 18px; }
.acts-line { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; font-weight: 800; font-size: 15px; }
.acts-line .link { font-size: 14px; }
.intake-done { display: flex; justify-content: center; margin-top: 10px; }
.intake-done { gap: 18px; }
.intake-done .link { font-size: 14px; }
.intake-amt { font-size: 11px; font-weight: 700; color: inherit; opacity: .85; white-space: nowrap; }
.small-link { display: block; margin-top: 8px; font-size: 14px; }
.amount-row { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--lav); color: var(--ink); font-weight: 700; }
.amount-row:last-of-type { border-bottom: 0; }
.amount-row > span:first-child { flex: 1; min-width: 0; }
.amount-row small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.amount-row input[type=text][inputmode=decimal] { width: 88px; flex: none; margin: 0; padding: 8px 10px; text-align: right; }
.amount-row .unit { width: 64px; flex: none; color: var(--muted); font-size: 14px; }
.amount-row select[data-water-unit] { width: 72px; flex: none; margin: 0; padding: 8px 6px; font-size: 14px; }
.goal-amounts-title { display: block; margin-top: 8px; }
.intake-table-head { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; padding-bottom: 4px; border-bottom: 1px solid var(--lav);
  color: var(--muted); font-size: 12px; font-weight: 800; }
.intake-table-head span:first-child { flex: 1; }
.intake-table-head span:nth-child(2) { width: 136px; text-align: center; }
.intake-table-head span:last-child { width: 52px; text-align: center; }
.intake-table-head small { display: block; font-size: 11px; font-weight: 700; }
.goal-amounts .switch { flex: none; }
.goal-amounts .amount-row { gap: 8px; }
.goal-amounts .amount-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.goal-amounts .amount-row input[type=text][inputmode=decimal] { width: 72px; }
.goal-amounts .amount-row .unit, .goal-amounts .amount-row select[data-water-unit] { width: 56px; }
.intake-table-head { gap: 8px; }
.amount-row.off > span:first-child, .amount-row.off input, .amount-row.off select, .amount-row.off .unit { opacity: .45; }
.goal-amounts { margin-top: 4px; }
.gym-week { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; color: var(--muted); font-weight: 700; font-size: 14px; }
.gym-dots { display: inline-flex; gap: 5px; }
.gym-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--lav); }
.gym-dots i.on { background: var(--accent-fill); }

/* protein, fiber and water check-ins: Today and the day sheet */
.intake-card .card-head { margin-bottom: 2px; }
.intake-count { color: var(--muted); font-weight: 800; font-size: 14px; }
.intake-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.intake {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px 10px;
  border: 2px solid transparent; border-radius: 18px; background: var(--bg); color: var(--muted); cursor: pointer;
  font: inherit; transition: background .15s, border-color .15s, transform .1s;
}
.intake:active { transform: scale(.96); }
.intake-emoji { font-size: 28px; line-height: 1.1; filter: grayscale(.6); opacity: .75; transition: filter .15s, opacity .15s; }
.intake b { font-size: 14px; }
.intake-tick {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-fill); color: #fff; opacity: 0; transform: scale(.5); transition: opacity .15s, transform .15s;
}
.intake.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.intake.on .intake-emoji { filter: none; opacity: 1; }
.intake.on .intake-tick { opacity: 1; transform: none; }
.intake:disabled { cursor: default; }
.day-intake { margin-top: 14px; color: var(--muted); font-weight: 700; font-size: 14px; }
.day-intake .intake-row { margin-top: 6px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 800; font-size: 13px; }
.wd-dot {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
}

.streaks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.chip-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow);
}
.chip-card .icon { color: var(--accent); }
.chip-card b { display: block; font: 600 24px var(--font-head); line-height: 1; }
.chip-card span { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
.chip-card small { color: var(--muted); font-size: 12px; }

/* ---- day colours (calendar, week strip, legend, pills) ------------------------------------------------------- */

.s-hit { background: var(--accent-fill); color: var(--on-accent); }
.s-partial { background: var(--peach); color: var(--ink); }
.s-missed { background: var(--lav); color: var(--muted); }
.s-none { background: transparent; box-shadow: inset 0 0 0 2px var(--lav-2); color: var(--muted); }
.s-today {
  background: linear-gradient(to top, var(--accent-soft) var(--p, 0%), var(--card) var(--p, 0%));
  box-shadow: inset 0 0 0 2.5px var(--accent); color: var(--accent);
}
.s-future { background: transparent; color: var(--future); }

/* ---- calendar ------------------------------------------------------------------------------------------------- */

.month-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: center; }
.month-head .link { font-size: 14px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-names { margin-bottom: 8px; text-align: center; color: var(--muted); font-weight: 800; font-size: 13px; }
.cal-day {
  position: relative; aspect-ratio: 1; min-width: 0;
  border: 0; border-radius: 14px; cursor: pointer;
  font: 800 15px var(--font-body);
  display: grid; place-items: center;
  transition: transform .12s ease;
}
.cal-day:active:not(:disabled) { transform: scale(.92); }
.cal-day:disabled { cursor: default; }
.gym-badge {
  position: absolute; right: 2px; bottom: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgba(36, 31, 51, .15);
}
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 5px; display: inline-grid; place-items: center; }
.legend .gym-badge { position: static; width: 16px; height: 16px; border-radius: 50%; }
.totals { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.totals b { display: block; font: 600 22px var(--font-head); }
.totals span { color: var(--muted); font-size: 13px; font-weight: 700; }

/* ---- sheets, toasts, confetti --------------------------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--scrim);
  animation: fade .2s ease;
}
.sheet-backdrop.out { animation: fade .2s ease reverse forwards; }
.sheet {
  width: 100%; max-width: 560px; max-height: 90dvh; overflow: auto;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 20px);
  border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--card);
  animation: rise .28s cubic-bezier(.2, .9, .3, 1);
}
.sheet-backdrop.out .sheet { animation: rise .2s ease reverse forwards; }
.grabber { width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--lav-2); }
.sheet { position: relative; }
.sheet-x {
  position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--lav); color: var(--muted); font: 800 22px/34px var(--font-body);
}
.sheet > h2 { padding-right: 44px; }
.sheet-extra { display: flex; justify-content: center; margin-top: 12px; }
.sheet h2 { margin-bottom: 8px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
/* the What Did You Do? pop-up: in the middle of the screen, so nothing at the bottom covers it */
.sheet-backdrop.center { align-items: center; padding: 16px; }
.sheet-backdrop.center .sheet {
  max-width: 440px; max-height: calc(100dvh - 32px); border-radius: var(--r-xl); padding: 20px;
  animation: pop .22s cubic-bezier(.2, .9, .3, 1);
}
.sheet-backdrop.center .grabber { display: none; }
.sheet-backdrop.center.out .sheet { animation: pop .18s ease reverse forwards; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.picker-logged { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }

.day-stat { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.day-stat b { font: 600 34px var(--font-head); }
.day-stat > span:not(.pill) { color: var(--muted); font-weight: 700; }
.pill { margin-left: auto; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.day-gym {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 10px 10px 14px;
  border-radius: 18px; background: var(--bg); color: var(--muted); font-weight: 700;
}
.day-gym.on { background: var(--accent-soft); color: var(--accent); }
.day-gym .btn { margin-left: auto; }
.day-weight { margin-top: 10px; }
.day-weight label { margin: 0; color: inherit; font-weight: 700; white-space: nowrap; }
.day-weight label small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; }
.day-weight input { width: 84px; min-width: 0; margin: 0 0 0 auto; padding: 8px 10px; text-align: right; }
.day-weight .unit { font-size: 13px; }
.day-weight .btn { margin-left: 0; }
.sheet-extra.left { text-align: left; margin-top: 6px; }
.w-badge {
  position: absolute; left: 2px; bottom: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); color: #2E7D5B; box-shadow: 0 1px 3px rgba(36, 31, 51, .15);
}
.legend .w-badge { position: static; width: 16px; height: 16px; border-radius: 50%; }
.cal-hint { margin: 10px 0 0; }

/* what you did at the gym (emoji badge), check-in dots, days lit up from the stats table */
.act-badge { font-size: 11px; line-height: 17px; }
.legend .act-badge { position: static; height: 16px; width: 16px; font-size: 10px; }
.ck-dots { position: absolute; left: 4px; top: 4px; display: flex; gap: 2px; pointer-events: none; }
.ck-dots i, .ck-key { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--card); }
.legend i.ck-key { width: 9px; height: 9px; border-radius: 50%; margin: 0 2px; }
.ck-protein { background: #C2553A; }
.ck-fiber { background: #3E9B5A; }
.ck-water { background: #3D8BD9; }
.ck-creatine { background: #8E6AD8; }
.cal-day.dim { opacity: .28; }
.mark-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 8px 12px;
  border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: 14px; }

/* the stats table */
.stats-card .card-head { align-items: center; margin-bottom: 4px; }
.stats-card .card-head h2 { margin-bottom: 0; }
.stats-card .seg { margin-top: 8px; }
.stats-card .seg button { font-size: 14px; min-height: 36px; padding: 0 2px; }
.stats-kinds { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.stats-kinds .chip { flex: none; padding: 6px 10px; font-size: 13px; }
.stats-range-note { margin: 12px 0 4px; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.stats-table th, .stats-table td { padding: 9px 4px; text-align: left; border-bottom: 1px solid var(--lav); vertical-align: middle; }
.stats-table td { text-align: right; font-weight: 800; white-space: nowrap; }
.stats-table th { font-weight: 700; }
.stats-table th .icon { display: inline-block; vertical-align: -2px; width: 1.4em; color: var(--accent); }
.stats-table td small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stats-table tr.group th { padding: 16px 4px 6px; border-bottom: 0; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.stats-table tr:last-child th, .stats-table tr:last-child td { border-bottom: 0; }
.stats-table td.muted { text-align: left; white-space: normal; font-weight: 600; }
.stats-table tr.markable { cursor: pointer; }
.stats-table tr.markable th::after { content: '›'; margin-left: 6px; color: var(--muted); }
.stats-table tr.markable.on { background: var(--accent-soft); color: var(--accent); }
.stats-table tr.markable.on th, .stats-table tr.markable.on td { border-bottom-color: transparent; }
.stats-table tr.markable.on th:first-child { border-radius: 12px 0 0 12px; }
.stats-table tr.markable.on td:last-child { border-radius: 0 12px 12px 0; }
.emo { display: inline-block; width: 1.4em; text-align: center; }
.spinner.small { width: 22px; height: 22px; margin: 16px auto; border-width: 3px; }

/* gym activity chips: Today's gym card and the day sheet */
.gym-acts, .day-acts { margin-top: 14px; color: var(--muted); font-weight: 700; font-size: 14px; }
.act-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.act-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 9px; cursor: pointer;
  border: 2px solid transparent; border-radius: 999px; background: var(--bg); color: var(--ink); font: 700 14px var(--font-body);
  transition: background .15s, border-color .15s, transform .1s;
}
.act-chip span { font-size: 17px; line-height: 1; }
.act-chip:active { transform: scale(.95); }
.act-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.act-chip.add { background: transparent; border: 2px dashed var(--lav-2); color: var(--muted); padding-left: 10px; }
.act-chip:disabled { cursor: default; }
.act-form label { display: block; margin-top: 10px; }
.act-emoji-row { display: flex; align-items: center; gap: 12px; }
.act-emoji-row small { min-width: 0; }
.act-emoji-row input#actEmoji { width: 64px; flex: none; text-align: center; font-size: 24px; padding: 6px; margin: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; margin-top: 10px; }
.emoji-grid button { aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; background: var(--bg); font-size: 22px; cursor: pointer; padding: 0; }
.emoji-grid button.on { border-color: var(--accent); background: var(--accent-soft); }
.acts-card .acts-list { margin: 6px 0 12px; }
.act-row { border-bottom: 1px solid var(--lav); padding: 8px 0; }
.act-row:last-child { border-bottom: 0; }
.act-row-btns { display: inline-flex; gap: 14px; flex: none; }
.intake-pick { margin-top: 4px; }
.intake-pick.dim, .acts-body.dim { opacity: .5; pointer-events: none; }
.intake-row.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.intake-row.n4 .intake-emoji { font-size: 24px; }
.intake-row.n4 .intake b { font-size: 13px; }
.intake-row.n1 { grid-template-columns: minmax(0, 1fr); }
.intake-row.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

#toasts {
  position: fixed; left: 0; right: 0; z-index: 60; pointer-events: none;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
  display: flex; justify-content: center; padding: 0 16px;
}
body[data-view='welcome'] #toasts { bottom: calc(env(safe-area-inset-bottom) + 16px); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  max-width: 520px; padding: 12px 18px; border-radius: 18px;
  background: var(--ink); color: var(--toast-text); font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 30px rgba(36, 31, 51, .25);
  animation: pop .25s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
.toast button { border: 0; background: none; color: var(--peach); font-weight: 800; cursor: pointer; padding: 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.96); } }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

/* ---- goals ---------------------------------------------------------------------------------------------------- */

.save-goals { margin: 4px 0 14px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .icon-btn { background: var(--lav); box-shadow: none; width: 52px; height: 52px; }
.stepper input { text-align: center; font: 600 30px var(--font-head); padding: 8px; }
.streak-card .streak-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 2px solid var(--line); }
.streak-card .streak-row:last-of-type { border-bottom: 0; margin-bottom: 6px; }
.streak-row .icon { color: var(--accent); }
.streak-row span { font-weight: 700; }
.streak-row b { margin-left: auto; font: 600 18px var(--font-head); }
.streak-row small { color: var(--muted); width: 56px; text-align: right; }

/* ---- buddy picker --------------------------------------------------------------------------------------------- */

.preview-card { text-align: center; }
.preview-card label, .preview-card input { text-align: left; }
.mood-picker { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 16px 0 4px; }
.mood-btn {
  border: 0; border-radius: 999px; padding: 7px 13px; cursor: pointer;
  background: var(--lav); font: 700 14px var(--font-body); color: var(--muted);
}
.mood-btn.on { background: var(--ink); color: var(--card); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 20px; background: var(--lav); }
.tabs button {
  border: 0; border-radius: 16px; min-height: 44px; cursor: pointer;
  background: transparent; font: 600 16px var(--font-head); color: var(--muted);
}
.tabs button[aria-selected='true'] { background: var(--card); color: var(--ink); box-shadow: 0 2px 6px rgba(36, 31, 51, .08); }
.animal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.animal-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 6px 12px; border: 0; border-radius: var(--r); cursor: pointer;
  background: var(--card); box-shadow: var(--shadow);
  font: 700 13px var(--font-body); color: var(--muted); line-height: 1.2;
  transition: transform .12s ease;
}
.animal-card:active { transform: scale(.96); }
.animal-card .buddy-svg { width: 100%; height: auto; aspect-ratio: 1; }
.animal-card.on { box-shadow: inset 0 0 0 3px var(--accent), var(--shadow); color: var(--accent); }
/* Me › Buddy › Rival Buddy: a small picker, the Rival tab's stand-in for you */
.rival-picks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.rival-pick {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0;
  padding: 6px 4px 8px; border: 0; border-radius: 14px; cursor: pointer; background: var(--bg);
  font: 700 11px var(--font-body); color: var(--muted); line-height: 1.2;
}
.rival-pick span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rival-pick .buddy-svg, .rival-same, .rival-chibi { width: 100%; aspect-ratio: 1; display: block; }
.rival-same > *, .rival-same .buddy-svg { width: 100%; height: 100%; }
.rival-chibi img { width: 100%; height: 100%; object-fit: contain; }
.rival-pick.on { box-shadow: inset 0 0 0 3px var(--accent); color: var(--accent); }
.chibi-card.on { box-shadow: inset 0 0 0 3px var(--accent), var(--shadow); }
.chibi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.chibi-card.folded { padding-block: 12px; }
.chibi-card.folded .chibi-top { margin-bottom: 4px; }
.chibi-card.folded .chibi-actions { margin-top: 4px; }
.chibi-thumb { width: 48px; height: 48px; flex: none; object-fit: cover; object-position: top; border-radius: 12px; background: var(--bg); }
.grow1 { flex: 1; }
.line-list { display: grid; gap: 6px; margin: 10px 0 4px; max-height: 40vh; overflow: auto; }
.line-row { display: flex; align-items: center; gap: 8px; }
.line-text { flex: 1; text-align: left; padding: 9px 12px; border: 0; border-radius: 14px; background: var(--bg); color: var(--ink); font: 600 14px var(--font-body); cursor: pointer; }
.line-edit { flex: 1; margin: 0; }
.slot-x.static { position: static; flex: none; }
#lineGroup { width: 100%; }
.slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.slot-pick {
  width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden; cursor: pointer;
  display: grid; place-items: center;
  border: 0; border-radius: 16px; background: var(--bg); color: var(--muted);
  box-shadow: inset 0 0 0 2px var(--lav-2);
}
.slot.has .slot-pick { box-shadow: none; }
.slot-pick img { width: 100%; height: 100%; object-fit: contain; }
.slot-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--ink); color: var(--card); font: 800 14px/22px var(--font-body);
}
.chibi-actions { display: flex; gap: 18px; margin-top: 12px; }
.chibi-list .btn.dashed { margin: 0 0 12px; }

/* ---- me & shortcut guide -------------------------------------------------------------------------------------- */

.kv { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.kv span { color: var(--muted); font-weight: 700; font-size: 14px; }
.kv b { margin-left: auto; text-align: right; overflow-wrap: anywhere; }
.token {
  display: block; margin: 12px 0 4px; padding: 12px 14px;
  border-radius: 14px; background: var(--bg);
  overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.copy-field { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--line); }
.copy-field:last-child { border-bottom: 0; }
.copy-field span { grid-column: 1 / -1; color: var(--muted); font-weight: 700; font-size: 14px; }
.copy-field code { overflow-wrap: anywhere; }
.guide ol, .guide ul { margin: 0; padding-left: 22px; }
.guide li { margin: 8px 0; }
.guide li::marker { color: var(--accent); font-weight: 800; }
.guide code { padding: 1px 6px; border-radius: 6px; background: var(--bg); }

/* ---- welcome -------------------------------------------------------------------------------------------------- */

.welcome .hero { text-align: center; margin: 12px 0 22px; }
.welcome .hero h1 { margin-top: 14px; font-size: 38px; }
.hint { background: var(--accent-soft); box-shadow: none; }
.hint p { margin: 6px 0 0; }
[data-install-box]:empty { display: none; }
[data-install-box] .btn { margin-top: 10px; }

/* ---- phase 2: the buddy, stickers ------------------------------------------------------------------------------ */

.grow { display: grid; place-items: center; width: 100%; height: 100%; }
.stage.small { width: 96px; height: 96px; }
textarea {
  width: 100%; padding: 13px 16px; resize: vertical;
  border: 2px solid var(--line); border-radius: 16px; background: var(--field); color: var(--ink);
  font: 600 16px/1.4 var(--font-body);
}
textarea:focus { outline: none; border-color: var(--accent); background: var(--card); }
select {
  width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px;
  background: var(--field); color: var(--ink); font: 700 16px var(--font-body); -webkit-appearance: none; appearance: none;
}
.lvl {
  display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; text-decoration: none;
}
.sticker, .wd-sticker, .sheet-sticker, .mini-sticker {
  transform: rotate(var(--tilt, 0deg)); line-height: 1;
  filter: drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff) drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff) drop-shadow(0 2px 2px rgba(36, 31, 51, .2));
}
.sticker { position: absolute; top: -7px; right: -6px; font-size: 17px; pointer-events: none; }
.wd-dot { position: relative; }
.wd-sticker { font-size: 20px; }
.wd-dot .gym-badge { right: -4px; bottom: -4px; }
.sheet-sticker { font-size: 30px; }
.mini-sticker { font-size: 13px; margin-left: 2px; }

/* ---- today: quote + friend cards ------------------------------------------------------------------------------ */

.quote-card { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: var(--ink); background: var(--accent-soft); box-shadow: none; }
.quote-card .icon { color: var(--accent); margin-top: 2px; }
/* the second mark is the first one turned round, closing the quote at the bottom right */
.quote-card .icon:last-child { align-self: flex-end; margin: 0 0 2px; transform: rotate(180deg); }
.quote-card p { flex: 1; margin: 0; font: 700 20px/1.3 var(--font-quote); letter-spacing: -.005em; }
.quote-card.empty-quote p { font: 600 15px var(--font-body); color: var(--muted); }
.friend-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.friend-card > div { flex: 1; min-width: 0; }
.friend-card .eyebrow { margin: 0; }
.friend-card b { display: block; font: 600 20px var(--font-head); }
.friend-card small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.friend-card.invite .icon:first-child { color: var(--accent); }
.friend-card .icon:last-child { color: var(--muted); }

/* ---- friend screen -------------------------------------------------------------------------------------------- */

.code-big { margin: 6px 0 12px; font-size: 30px; font-weight: 800; letter-spacing: .06em; color: var(--accent); }
.center-row { justify-content: center; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vs-name { font-weight: 800; color: var(--muted); font-size: 14px; }
.vs-score { font: 600 40px var(--font-head); line-height: 1; }
.vs-mid { font: 600 18px var(--font-head); color: var(--muted); }
.vs-line { grid-column: 1 / -1; margin: 8px 0 0; font: 600 18px var(--font-head); }
.versus .muted { grid-column: 1 / -1; margin: 0; }
.both-pill {
  grid-column: 1 / -1; justify-self: center; display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 7px 14px; border-radius: 999px; background: var(--pink-soft); color: var(--pink-text); font-weight: 800; font-size: 13px;
}
.rc-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rc-side { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; border-radius: 18px; background: var(--bg); }
.rc-side > span { font-weight: 800; color: var(--muted); font-size: 14px; }
.rc-side b { display: inline-flex; align-items: center; gap: 6px; font: 600 32px var(--font-head); line-height: 1.1; }
.rc-side b .icon { color: #9C88D9; }
.rc-side small { color: var(--muted); font-weight: 700; }
.rival-coins .vs-line { margin: 10px 0 2px; }
/* a rival message: the buddy says it, the bubble's tail pointing down at it */
.say { align-self: end; display: flex; justify-content: center; min-width: 0; }
.say-bubble { max-width: 100%; margin: 0 0 6px; padding: 8px 12px; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; }
.faceoff .say-btn { grid-column: 1 / -1; justify-self: center; margin-top: 10px; }
.msg-left { margin: 4px 0 0; text-align: right; }
/* the buddies face to face across a VS (standing straight), the leader celebrating and the trailer grumpy */
.faceoff { row-gap: 4px; }
.faceoff-stage.stage { width: clamp(112px, 34vw, 150px); height: clamp(112px, 34vw, 150px); }
.lean { display: grid; place-items: center; width: 100%; height: 100%; transition: transform .4s ease; }
/* centred in their circles, facing each other (no tilt or sideways nudge since 2026-10-20) */
.lean-left.flip { transform: scaleX(-1); }
.faceoff .vs-mid { align-self: start; margin-top: clamp(40px, 12vw, 56px); }
.vs-badge {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-fill); color: var(--on-accent); font: 700 17px var(--font-head); letter-spacing: .02em;
  transform: rotate(-8deg); box-shadow: 0 0 0 5px var(--accent-soft);
}

.invite-note { margin: 0 0 12px; padding: 10px 14px; border-radius: 14px; background: var(--accent-soft); font-weight: 700; }

/* weight */
.w-row small.down { color: #2E7D5B; }
.w-row small.up { color: var(--accent); }
.w-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-bottom: 10px; }
.w-trio small { display: block; color: var(--muted); font-weight: 700; font-size: 12px; }
.w-trio b { font: 600 24px var(--font-head); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; min-width: 0; margin: 0; }
.weight-goal .seg { margin-top: 4px; }
.weight-chart { width: 100%; height: auto; display: block; overflow: visible; }
.weight-chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.weight-chart circle { fill: var(--card); stroke: var(--accent); stroke-width: 2.5; }
.weight-chart .goal { stroke: #2E7D5B; stroke-width: 2; stroke-dasharray: 5 5; }
.weight-chart text { font: 700 10px var(--font-body); fill: var(--muted); }
.weight-chart .goal-label { fill: #2E7D5B; }
.w-list { display: grid; }
.w-row { display: grid; grid-template-columns: 1fr auto 52px; align-items: baseline; gap: 10px; padding: 10px 2px; border: 0; border-bottom: 2px solid var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.w-row:last-child { border-bottom: 0; }
.w-row b { font: 600 17px var(--font-head); }
.w-row small { text-align: right; font-weight: 800; color: var(--muted); }

/* backups */
.backup-status { margin: 12px 0; padding: 10px 14px; border-radius: 16px; background: var(--bg); }
.backup-status p { margin: 2px 0; font-size: 14px; }
.backup-list { display: grid; }
.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 2px solid var(--line); }
.backup-row:last-child { border-bottom: 0; }
.backup-row b { display: block; font-size: 15px; }
.backup-row small { color: var(--muted); font-weight: 700; }
.backup-acts { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
label.btn { display: inline-flex; align-items: center; justify-content: center; margin: 0; cursor: pointer; }

/* bets */
.bet-list { display: grid; gap: 10px; }
.bet { border-radius: 18px; padding: 12px 14px; background: var(--bg); }
.bet.s-proposed { background: var(--accent-soft); }
.bet.s-finished.w-me { background: #FFF1C9; }
.bet.s-declined, .bet.s-cancelled, .bet.s-expired { opacity: .7; }
.bet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.bet-stake { font: 600 17px var(--font-head); line-height: 1.25; }
.bet-pill { flex: none; padding: 3px 10px; border-radius: 999px; background: var(--card); font-size: 12px; font-weight: 800; color: var(--muted); }
.s-proposed .bet-pill, .s-active .bet-pill { color: var(--accent); }
.w-me .bet-pill { color: #B57A0B; }
.bet-terms { margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.bet-totals { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; padding: 6px 10px; border-radius: 12px; background: var(--card); font-size: 14px; }
.bet-totals b { font: 600 18px var(--font-head); margin-left: 4px; }
.bet-line { margin: 8px 0 0; font-size: 14px; }
.bet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }
.bet-choice { display: flex; gap: 8px; flex: 1 1 100%; }
.bet-choice input { flex: 1; min-width: 0; margin: 0; }
.chips.tight { margin-top: 4px; }
#betStake { margin-top: 8px; }
.legend-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.legend-inline i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; margin-left: 6px; }
.legend-inline i.me, .vs-bar.me i { background: var(--accent); }
.legend-inline i.friend, .vs-bar.friend i { background: #9C88D9; }
.vs-rows { display: grid; gap: 8px; }
.vs-row { display: grid; grid-template-columns: 38px 1fr 20px; align-items: center; gap: 8px; }
.vs-row.both { color: var(--pink-text); }
.vs-day { font-weight: 800; font-size: 13px; color: var(--muted); }
.vs-bars { display: grid; gap: 3px; }
.vs-bar {
  position: relative; display: flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px;
  border-radius: 8px; background: var(--bg); overflow: hidden; font-size: 12px; font-weight: 800; color: var(--ink);
}
.vs-bar i { position: absolute; inset: 0 auto 0 0; opacity: .28; border-radius: 8px; }
.vs-bar em { position: relative; font-style: normal; }
.vs-bar .icon { position: relative; color: var(--accent); }
.vs-flag { color: #E05A80; }
.month-mini { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-mini h2 { margin: 0; }
.split-day { position: relative; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; border-radius: 12px; overflow: hidden; gap: 2px; }
.split-day .half { display: block; border-radius: 0; }
.split-day .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--ink); text-shadow: 0 0 3px var(--card), 0 0 3px var(--card); }
.split-day.both { box-shadow: 0 0 0 2px #F49BB4; }
.both-heart { position: absolute; top: 1px; right: 2px; color: #E05A80; }

/* ---- rewards screen ------------------------------------------------------------------------------------------- */

.level-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.level-card .stage { width: 120px; height: 120px; }
.level-info h2 { margin-bottom: 8px; }
.level-info .eyebrow { margin-bottom: 2px; }
.progress { height: 10px; border-radius: 999px; background: var(--lav); overflow: hidden; margin-bottom: 6px; }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress.small { height: 6px; margin: 6px 0 0; }
.goal-week { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 16px; background: var(--bg); font-weight: 700; font-size: 14px; color: var(--muted); }
.goal-week.met { background: var(--accent-soft); color: var(--accent); }
.coin-balance { display: flex; align-items: baseline; gap: 8px; color: #D99A1E; }
.coin-balance .icon { align-self: center; }
.coin-balance b { font: 600 40px var(--font-head); color: var(--ink); }
.coin-balance span { font-weight: 800; color: var(--muted); }
.coin-rows { display: grid; gap: 6px; margin-top: 10px; font-size: 14px; }
.coin-rows div { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.coin-rows small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.coin-rows div:last-child { border-bottom: 0; }
.coin-rows span:last-child { font-weight: 800; white-space: nowrap; }
.jar { display: grid; gap: 10px; }
.jar-item { display: flex; align-items: center; gap: 10px; }
.jar-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.jar-emoji { font-size: 30px; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 16px; background: var(--bg); flex: none; }
.jar-text { flex: 1; min-width: 0; }
.jar-text b { display: block; }
.jar-text small { color: var(--muted); font-weight: 700; }
.jar-item .btn { flex: none; }
.acc-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.acc {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 8px;
  border: 0; border-radius: 16px; background: var(--bg); cursor: pointer;
  font: 700 10px/1.2 var(--font-body); color: var(--muted); text-align: center; letter-spacing: -.01em; overflow-wrap: break-word;
}
.acc .buddy-svg { width: 100%; height: auto; aspect-ratio: 1; }
.acc.on { box-shadow: inset 0 0 0 3px var(--accent); color: var(--accent); background: var(--card); }
.acc.locked { cursor: default; }
.acc.locked .buddy-svg { filter: grayscale(1); opacity: .35; }
.acc.locked span { display: inline-flex; align-items: center; gap: 2px; }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badge { position: relative; padding: 12px; border-radius: 18px; background: var(--bg); opacity: .55; }
.badge.earned { opacity: 1; background: var(--accent-soft); }
.badge-emoji { display: block; font-size: 28px; filter: grayscale(1); }
.badge.earned .badge-emoji { filter: none; }
.badge b { display: block; margin-top: 4px; font: 600 15px var(--font-head); }
.badge small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.badge em { position: absolute; top: 10px; right: 12px; font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent); }
.history div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 2px solid var(--line); }
.history div:last-child { border-bottom: 0; }
.history small { color: var(--muted); font-weight: 700; white-space: nowrap; }
.reward-fields { display: grid; grid-template-columns: 80px 1fr; gap: 10px; }
.reward-fields input#rEmoji { text-align: center; font-size: 24px; padding: 9px; }

/* ---- quote bank ----------------------------------------------------------------------------------------------- */

.add-quotes { margin: 0 0 12px; }
.filter-chips { margin: 0 0 14px; }
.quote-item { display: block; width: 100%; border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.quote-item p { margin: 0 0 10px; font: 700 17px/1.35 var(--font-quote); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills .pill { margin: 0; }
.pill.i-nudge { background: var(--pill-nudge-bg); color: var(--pill-nudge-text); }
.pill.i-push { background: var(--peach); color: var(--ink); }
.pill.i-goggins { background: var(--ink); color: var(--card); }
.pill.cat { background: var(--lav); color: var(--muted); }
.sheet .seg button { font-size: 14px; min-height: 40px; }

/* ---- me: settings --------------------------------------------------------------------------------------------- */

.nav-list { padding: 6px 18px; }
.nav-list a { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 2px solid var(--line); color: var(--ink); text-decoration: none; }
.nav-list a:last-child { border-bottom: 0; }
.nav-list a > .icon:first-child { color: var(--accent); }
.nav-list span { font-weight: 800; }
.nav-list small { margin-left: auto; color: var(--muted); font-weight: 700; font-size: 13px; text-align: right; }
.nav-list a > .icon:last-child { color: var(--muted); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; }
.setting > div { min-width: 0; }
.setting b { display: block; }
.setting small { display: block; color: var(--muted); font-size: 13px; line-height: 1.35; }
.setting label { margin: 0; flex: none; }
.setting select { max-width: 160px; }
.setting.dim { opacity: .5; }
.switch {
  flex: none; position: relative; width: 52px; height: 32px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--lav-2); transition: background .2s;
}
.switch i { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(36, 31, 51, .2); transition: transform .2s; }
.switch[aria-checked='true'] { background: var(--accent-fill); }
.switch[aria-checked='true'] i { transform: translateX(20px); }
.push-box { margin: 8px 0 6px; padding: 12px 14px; border-radius: 16px; background: var(--bg); }
.push-box p { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.push-box p .icon { flex: none; color: var(--accent); margin-top: 1px; }
.push-box p:last-child { margin-bottom: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 360px) {
  .acc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .level-card { grid-template-columns: 1fr; text-align: center; }
  .level-card .stage { margin: 0 auto; }
  .steps-card { flex-direction: column; text-align: center; }
  .streaks { grid-template-columns: 1fr; }
  .slots { grid-template-columns: repeat(3, 1fr); }
}

/* ---- Me › Appearance ------------------------------------------------------------------------------------------ */

.appearance h2 { margin-bottom: 2px; }
.appearance .seg button { padding: 0 2px; font-size: 15px; }
.appearance .seg.disabled { opacity: .5; pointer-events: none; }
.presets { display: flex; gap: 8px; overflow-x: auto; margin: 14px -18px 4px; padding: 2px 18px 6px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.preset {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 5px; cursor: pointer;
  border: 0; border-radius: 999px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--ink); font: 700 14px var(--font-body);
}
.preset[aria-pressed='true'] { box-shadow: inset 0 0 0 2px var(--accent); }
.preset i { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--pb); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.preset i::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--pa); }
.color-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 2px solid var(--line); }
.color-row label { flex: 1; margin: 0; color: var(--ink); font-size: 16px; }
.color-row .link { padding: 0; font-size: 14px; }
.color-row input[type=color] { width: 48px; height: 34px; padding: 0; border: 2px solid var(--line); border-radius: 10px; background: var(--field); cursor: pointer; }
.appearance .btn.reset-all { margin-top: 8px; }

/* ---- Your Buddy › Background ---------------------------------------------------------------------------------- */

.stage-colors { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px 6px; margin-top: 12px; }
.stage-color { display: grid; justify-items: center; gap: 5px; margin: 0; padding: 0; border: 0; background: none; color: var(--muted); font: 700 12px var(--font-body, inherit); cursor: pointer; }
.stage-color i { position: relative; width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
  background: radial-gradient(circle at 50% 40%, var(--glow, #FFFFFF) 0%, var(--sw) 72%); }
.stage-color.mood i { background: conic-gradient(var(--mood-happy), var(--mood-sleepy), var(--mood-sad), var(--mood-angry), var(--mood-happy)); }
.stage-color.custom i { background: conic-gradient(#F49BB4, #FFC857, #8FD3B5, #8EC5F0, #C9B8EC, #F49BB4); }
.stage-color.custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.stage-color[aria-pressed='true'] { color: var(--accent); }
.stage-color[aria-pressed='true'] i { box-shadow: 0 0 0 3px var(--card), 0 0 0 5.5px var(--accent); }

/* ---- Step Sync › Set Up Automatically ---------------------------------------------------------------------------- */

.auto-setup .auto-steps { margin: 6px 0 14px; padding-left: 20px; display: grid; gap: 8px; line-height: 1.45; }
.auto-setup .btn { display: flex; justify-content: center; align-items: center; gap: 8px; text-decoration: none; }
.section-title { margin: 22px 4px 8px; font-size: 17px; color: var(--muted); }
