:root {
  --bg: #F3EFFA;
  --card: #FFFFFF;
  --ink: #241F33;
  --muted: #5E5872;
  --accent: #B4491A;
  --accent-press: #9A3D14;
  --accent-soft: #FBE7DB;
  --peach: #F6C4A6;
  --lav: #E9E3F4;
  --lav-2: #D6CBEC;
  --line: #ECE6F5;
  --field: #FAF8FD;
  --danger: #B3261E;
  --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;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { 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); color: #fff; }
.btn.primary:active:not(:disabled) { background: var(--accent-press); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-outline { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 2px #F0CFCC; }
.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]) {
  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: #fff; }
input::placeholder { color: #A69FB8; }
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); color: #fff; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 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: #fff; 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: rgba(255, 255, 255, .92);
  -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%, #FFFFFF 0%, var(--lav) 70%);
}
.stage.big { width: 210px; height: 210px; }
.stage.mood-happy { background: radial-gradient(circle at 50% 40%, #FFFFFF 0%, #FCE3D3 72%); }
.stage.mood-sleepy { background: radial-gradient(circle at 50% 40%, #FFFFFF 0%, #DED6F0 72%); }
.stage.mood-sad { background: radial-gradient(circle at 50% 40%, #FFFFFF 0%, #DCE6F2 72%); }
.buddy-svg, .buddy-img { width: 86%; height: 86%; object-fit: contain; }
.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 { animation: bounce 1.1s ease-in-out infinite; }
.stage .mood-sleepy { animation: sway 4.5s ease-in-out infinite; }
.stage .mood-sad { 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); } }

.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); }
.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); }

.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); color: #fff; }
.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%), #fff var(--p, 0%));
  box-shadow: inset 0 0 0 2.5px var(--accent); color: var(--accent);
}
.s-future { background: transparent; color: #B9B2CA; }

/* ---- 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: #fff; 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: rgba(36, 31, 51, .38);
  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: #fff;
  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 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%); } }

.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; }

#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: #fff; 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: #fff; }
.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: #fff; 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); }
.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; }
.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: #fff; 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; }

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

.grow { display: grid; place-items: center; width: 100%; height: 100%; transition: transform .4s ease; }
.grow-baby { transform: scale(.74); }
.grow-teen { transform: scale(.87); }
.grow-adult, .grow-legendary { transform: scale(1); }
.stage:has(.grow-legendary) { box-shadow: 0 0 0 4px #FFE29A, 0 0 28px 6px rgba(255, 200, 87, .55); }
.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: #fff; }
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); }
.quote-card .icon { color: var(--accent); margin-top: 2px; }
.quote-card p { margin: 0; font: 500 18px/1.35 var(--font-head); }
.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: #FDE4EB; color: #C2456B; font-weight: 800; font-size: 13px;
}
.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: #C2456B; }
.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 #fff, 0 0 3px #fff; }
.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; gap: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line); }
.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: #fff; }
.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: 500 17px/1.4 var(--font-head); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills .pill { margin: 0; }
.pill.i-nudge { background: #E3F4EC; color: #2E7D5B; }
.pill.i-push { background: var(--peach); color: #7A3412; }
.pill.i-goggins { background: var(--ink); color: #fff; }
.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); }
.switch[aria-checked='true'] i { transform: translateX(20px); }
.push-box { margin-top: 8px; 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); }
}
