/* =============================================================================
   Mochi Moola design system
   Flat, chunky and friendly: thick light borders, bright fills, buttons that
   press down with a hard edge, and Fredoka's rounded lettering throughout.
   Backgrounds stay completely plain: solid colours only, no patterns or
   gradients anywhere.
   ========================================================================== */

:root {
  --ink: #3c3c3c;
  --ink-soft: #737373;
  --ink-faint: #afafaf;
  --line: #e5e5e5;
  --line-soft: #f2f2f2;
  --bg: #ffffff;
  --card: #ffffff;

  /* the Duolingo greens: bright fill, darker edge for the press-down shadow */
  --primary: #58cc02;
  --primary-dark: #46a302;

  --out: #d33b3b;
  --in: #1899d6;
  --good: #58a700;

  --mint: #d7ffb8;
  --mint-deep: #4b9e00;
  --sun: #fff0b8;
  --sun-deep: #8f6b00;
  --sky: #ddf4ff;
  --sky-deep: #1899d6;
  --coral: #ffe5e5;
  --coral-deep: #d33b3b;
  --lilac: #f0e8ff;
  --lilac-deep: #7d5cd6;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.1);

  --ease-out: cubic-bezier(0.2, 0.9, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.5, 1);

  --t-screen: 320ms;
  --t-fast: 160ms;

  --pad: 20px;
  --tabbar-h: 74px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: Fredoka, ui-rounded, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; }

/* ---------- app shell ----------------------------------------------------- */

/* One shell for every device. Phones get the whole viewport; tablets and
   desktops get a centred column with a readable max width and a hairline
   edge, instead of a phone-shaped card floating in the middle of the page.
   Nothing is scaled or zoomed, so type stays the same size everywhere. */

.device {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: stretch center;
  padding: 0;
  background: var(--bg);
}

.phone {
  position: relative;
  width: min(100%, 720px);
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  isolation: isolate;
}

@media (min-width: 720px) {
  .phone { border-left: 2px solid var(--line-soft); border-right: 2px solid var(--line-soft); }
  :root { --pad: 28px; }
}

@media (min-width: 1100px) {
  :root { --pad: 32px; }
}

/* ---------- top bar ------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top))
    max(var(--pad), env(safe-area-inset-right))
    8px
    max(var(--pad), env(safe-area-inset-left));
  min-height: 60px;
  transition: opacity 240ms var(--ease-soft), transform 240ms var(--ease-soft);
}
.topbar[hidden] { display: none; }
.topbar .hello { min-width: 0; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .mochi { width: 32px; height: 32px; }
.brand strong {
  font-size: 21px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1;
  white-space: nowrap;
}

.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--mint); color: var(--mint-deep);
  font-weight: 700; font-size: 16px;
  border: 2px solid #b8ec8f;
  transition: transform var(--t-fast) var(--ease-bounce), background 240ms;
}
.avatar:active { transform: scale(0.94); }
.avatar--sky { background: var(--sky); color: var(--sky-deep); border-color: #b8e6ff; }
.avatar--sun { background: var(--sun); color: var(--sun-deep); border-color: #ffe08a; }
.avatar--lilac { background: var(--lilac); color: var(--lilac-deep); border-color: #ded0ff; }

/* ---------- scrolling content -------------------------------------------- */

.app {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 6px
    max(var(--pad), env(safe-area-inset-right))
    calc(var(--tabbar-h) + 28px)
    max(var(--pad), env(safe-area-inset-left));
  scrollbar-width: none;
  view-transition-name: content;
}
.app::-webkit-scrollbar { display: none; }
/* the router focuses the screen container for screen readers; browsers would
   otherwise paint a focus ring across the whole top of the content */
.app:focus, .app:focus-visible { outline: none; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack--tight { gap: 10px; }
.stack--loose { gap: 22px; }

/* ---------- route transitions -------------------------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sink {
  to { opacity: 0; transform: translateY(-4px); }
}

/* fallback for browsers without the View Transitions API */
.app.is-leaving { animation: sink 150ms var(--ease-soft) forwards; }
.app.is-entering { animation: rise var(--t-screen) var(--ease-out) both; }

::view-transition-old(content) { animation: sink 180ms var(--ease-soft) both; }
::view-transition-new(content) { animation: fade 240ms var(--ease-out) both; }

/* children drift in one after another, with a small springy lift */
.rise > * { animation: rise 360ms var(--ease-out) both; }
.rise > *:nth-child(1) { animation-delay: 10ms; }
.rise > *:nth-child(2) { animation-delay: 45ms; }
.rise > *:nth-child(3) { animation-delay: 75ms; }
.rise > *:nth-child(4) { animation-delay: 100ms; }
.rise > *:nth-child(5) { animation-delay: 120ms; }
.rise > *:nth-child(6) { animation-delay: 138ms; }
.rise > *:nth-child(7) { animation-delay: 152ms; }
.rise > *:nth-child(n + 8) { animation-delay: 165ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .app { scroll-behavior: auto; }
}

/* ---------- typography --------------------------------------------------- */

.h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
.h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.h3 { font-size: 16.5px; font-weight: 700; }
.muted { color: var(--ink-soft); font-size: 15px; line-height: 1.45; }
.tiny { color: var(--ink-faint); font-size: 12.5px; font-weight: 700; line-height: 1.4; }
.balance { font-size: 48px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.balance--sm { font-size: 30px; }
.money-in { color: var(--in); font-weight: 700; }
.money-out { color: var(--out); font-weight: 700; }

/* ---------- cards -------------------------------------------------------- */

.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: none;
}
.card--flat { border-color: var(--line-soft); }
.card--pad-sm { padding: 14px; }
.card--hero { border-radius: var(--r-xl); padding: 20px; }
.card--mint { background: var(--mint); border-color: #b8ec8f; }
.card--sky { background: var(--sky); border-color: #b8e6ff; }
.card--sun { background: var(--sun); border-color: #ffe08a; }
.card--coral { background: var(--coral); border-color: #ffc9c9; }
.card--lilac { background: var(--lilac); border-color: #ded0ff; }
.card--ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.card--ink .muted, .card--ink .tiny { color: rgba(255, 255, 255, 0.72); }

.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.grid { display: grid; gap: 12px; }

/* ---------- mascot ------------------------------------------------------- */

.mochi { width: 96px; height: 96px; flex: none; }
.mochi--xs { width: 32px; height: 32px; }
.mochi--sm { width: 64px; height: 64px; }
.mochi--lg { width: 120px; height: 120px; }
.mochi-bob { animation: bob 4.6s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

/* ---------- buttons ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border-radius: var(--r-md); border: 0;
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 700; letter-spacing: 0.045em; text-transform: uppercase;
  cursor: pointer;
  transition: transform 90ms var(--ease-soft), box-shadow 90ms var(--ease-soft),
    background 160ms var(--ease-soft), opacity 160ms;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 0 var(--primary-dark);
  user-select: none;
}
.btn:hover { background: #5edb05; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--primary-dark); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: 0 4px 0 #dcdcdc; }
.btn--wide { width: 100%; }
.btn--ghost {
  background: #fff; color: var(--ink); border: 2px solid var(--line);
  box-shadow: 0 4px 0 var(--line);
}
.btn--ghost:hover { background: #fafafa; }
.btn--ghost:active { box-shadow: 0 0 0 var(--line); }
.btn--soft {
  background: var(--line-soft); color: var(--ink-soft);
  box-shadow: 0 4px 0 #e2e2e2;
}
.btn--soft:hover { background: #ececec; }
.btn--soft:active { box-shadow: 0 0 0 #e2e2e2; }
.btn--danger {
  background: #fff; color: var(--coral-deep); border: 2px solid #ffc9c9;
  box-shadow: 0 4px 0 #ffc9c9;
}
.btn--danger:hover { background: #fff6f6; }
.btn--danger:active { box-shadow: 0 0 0 #ffc9c9; }
.btn--sm { min-height: 42px; padding: 0 15px; font-size: 13px; border-radius: 14px; }
.btn--icon { width: 50px; min-height: 50px; padding: 0; border-radius: 16px; }

.press { transition: transform 110ms var(--ease-soft); }
.press:active { transform: translateY(2px) scale(0.985); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border-radius: 999px; border: 2px solid var(--line);
  background: #fff; color: var(--ink-soft);
  font-size: 13px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms var(--ease-bounce), background 160ms, border-color 160ms, color 160ms;
  white-space: nowrap;
}
.chip:active { transform: scale(0.95); }
.chip--on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip--mint { background: var(--mint); border-color: #b8ec8f; color: var(--mint-deep); }
.chip--sun { background: var(--sun); border-color: #ffe08a; color: var(--sun-deep); }

.segmented { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }

/* ---------- forms -------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 7px; }
.label {
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-soft);
}
.input, .select {
  width: 100%; min-height: 54px; padding: 0 15px;
  font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: 16px;
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
  appearance: none;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus {
  outline: none; border-color: #84d8ff;
  box-shadow: 0 0 0 3px rgba(132, 216, 255, 0.35);
}
.input--money { font-size: 22px; font-weight: 700; padding-left: 36px; }
.money-wrap { position: relative; }
.money-wrap .sign {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-size: 19px; font-weight: 700; color: var(--ink-soft);
}
textarea.input { min-height: 88px; padding: 14px 15px; resize: vertical; line-height: 1.45; }
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.6' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 16px center;
  padding-right: 42px;
}
.form-error {
  font-size: 14.5px; color: var(--coral-deep); background: #fff1f1;
  border: 2px solid #ffc9c9; border-radius: 14px; padding: 10px 12px;
}
.form-note { font-size: 13px; font-weight: 700; color: var(--ink-faint); line-height: 1.45; }

.switch {
  position: relative; width: 50px; height: 30px; flex: none;
  border-radius: 999px; background: #dcdcdc; border: none; cursor: pointer;
  transition: background 200ms var(--ease-soft);
}
.switch::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.22);
  transition: transform 220ms var(--ease-bounce);
}
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- lists -------------------------------------------------------- */

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0; border-top: 2px solid var(--line-soft);
  background: none; border-left: 0; border-right: 0; border-bottom: 0;
  width: 100%; text-align: left; cursor: default;
}
.list-row:first-child { border-top: none; }
.list-row--tap { cursor: pointer; }
.list-row--tap:active { background: #fafafa; }
.list-row .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.list-row .name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .sub { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); }
.list-row .amount { font-size: 16.5px; font-weight: 700; white-space: nowrap; }

.cat-dot {
  width: 42px; height: 42px; border-radius: 14px; flex: none;
  display: grid; place-items: center; font-size: 19px;
  background: var(--line-soft);
  border: 2px solid var(--line-soft);
}

/* ---------- progress ----------------------------------------------------- */

.progress {
  height: 16px; border-radius: 999px; background: #e5e5e5; overflow: hidden;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--primary);
  position: relative;
  transform-origin: left center;
  animation: grow 800ms var(--ease-out) both;
}
.progress > span::after {
  content: ""; position: absolute; left: 6px; right: 6px; top: 4px; height: 4px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.4);
}
.progress--sun > span { background: #ffc800; }
.progress--sky > span { background: #1cb0f6; }
.progress--lilac > span { background: #a78bfa; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

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

.tabbar {
  display: flex; align-items: stretch; justify-content: space-around; gap: 2px;
  padding: 6px
    max(10px, env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
  background: var(--card);
  border-top: 2px solid var(--line-soft);
  z-index: 4;
}
.tabbar[hidden] { display: none; }

.tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px;
  background: none; border: none; border-radius: 14px;
  color: var(--ink-faint); cursor: pointer;
  /* No background transition: the active pill should jump to the new tab at
     once, even when the browser is throttling frames. */
  transition: color 160ms var(--ease-soft), transform 120ms var(--ease-soft);
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 24px; height: 24px; }
.tab span {
  font-size: 10px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  white-space: nowrap;
}
.tab:active { transform: translateY(2px); }
.tab[aria-current="page"] { color: var(--primary-dark); }
.tab[aria-current="page"] svg { animation: pop 340ms var(--ease-bounce); }
@keyframes pop {
  0% { transform: scale(0.82); }
  60% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

/* Desktop: a compact dock of tabs instead of five stretched ones, with the
   current tab on a soft green pill. */
@media (min-width: 768px) {
  .tabbar { justify-content: center; gap: 6px; padding-top: 8px; }
  .tab { flex: 0 1 104px; }
  .tab[aria-current="page"] { background: var(--mint); }
  .sheet-layer .sheet { left: 72px; right: 72px; }
}

/* Sign-up and log-in forms stay a comfortable width on tablets and desktops
   instead of stretching across the whole column. */
@media (min-width: 768px) {
  .auth-shell { max-width: 520px; margin-left: auto; margin-right: auto; }
}

/* Short screens (landscape phones, small laptop windows): shave the chrome
   down to icons so the content still has room to breathe. */
@media (max-height: 560px) and (orientation: landscape) {
  :root { --tabbar-h: 44px; }
  .topbar { padding-top: 8px; min-height: 50px; }
  .brand .mochi { width: 26px; height: 26px; }
  .brand strong { font-size: 18px; }
  .avatar { width: 36px; height: 36px; font-size: 14px; }
  .tabbar { padding-top: 2px; padding-bottom: 2px; }
  .tab { padding: 5px 4px; }
  .tab span { display: none; }
  .sheet-layer .sheet { max-height: 94%; }
}

/* ---------- sheets (popups) ---------------------------------------------- */

.sheet-layer {
  position: absolute; inset: 0; z-index: 20;
  display: none;
}
.sheet-layer.is-open { display: block; }

.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(60, 60, 60, 0.5);
  animation: fade 200ms var(--ease-soft) both;
}

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 88%;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 24px 24px 0 0;
  border-top: 2px solid var(--line-soft);
  animation: sheet-in 340ms var(--ease-out) both;
  padding-bottom: env(safe-area-inset-bottom);
}
@keyframes sheet-in {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.sheet-layer.is-closing .sheet { animation: sheet-out 200ms var(--ease-soft) both; }
.sheet-layer.is-closing .sheet-backdrop { animation: fade 200ms var(--ease-soft) reverse both; }
@keyframes sheet-out { to { transform: translateY(24px); opacity: 0; } }

.sheet-grip { width: 46px; height: 5px; border-radius: 999px; background: #e5e5e5; margin: 10px auto 2px; }
.sheet-body { padding: 12px 20px 8px; overflow-y: auto; }
.sheet-foot {
  padding: 12px 20px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px;
  border-top: 2px solid var(--line-soft); background: var(--bg);
}
.sheet-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- toasts ------------------------------------------------------- */

.toast-layer {
  position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + 16px);
  z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  max-width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; font-size: 15px; font-weight: 700;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  animation: toast-in 320ms var(--ease-bounce) both;
}
.toast--good { background: var(--primary); }
.toast--bad { background: #e04b4b; }
.toast.is-out { animation: toast-out 200ms var(--ease-soft) both; }
@keyframes toast-in {
  from { transform: translateY(14px) scale(0.96); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

/* ---------- misc --------------------------------------------------------- */

.boot {
  min-height: 55vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--ink-faint);
  font-weight: 700;
}
.boot-mochi { display: flex; }
.boot-mochi .mochi { width: 104px; height: 104px; }

.empty {
  text-align: center; padding: 30px 18px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty .big-emoji { font-size: 40px; }

.skeleton {
  border-radius: var(--r-md); background: var(--line-soft);
  animation: skeleton-pulse 1.3s ease-in-out infinite;
  height: 18px;
}
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.code-display {
  display: flex; gap: 6px; justify-content: center; align-items: center;
  font-size: 40px; font-weight: 700; letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.otp { display: flex; gap: 10px; justify-content: center; }
.otp input {
  width: 52px; height: 62px; text-align: center;
  font: inherit; font-size: 24px; font-weight: 700;
  border: 2px solid var(--line); border-radius: 16px; background: #fff;
  transition: border-color 160ms, box-shadow 160ms, transform 160ms var(--ease-bounce);
}
.otp input:focus { outline: none; border-color: #84d8ff; box-shadow: 0 0 0 3px rgba(132, 216, 255, 0.35); }
.otp input:not(:placeholder-shown) { border-color: #84d8ff; transform: translateY(-1px); }

.divider { height: 2px; background: var(--line-soft); border: 0; margin: 4px 0; }

.link {
  color: var(--primary-dark); font-weight: 700; cursor: pointer;
  background: none; border: 0; padding: 0; font-size: inherit;
}
.link:hover { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--line-soft); color: var(--ink-soft);
}
.badge--good { background: var(--mint); color: var(--mint-deep); }
.badge--warn { background: var(--sun); color: var(--sun-deep); }

.hero-emoji { font-size: 44px; line-height: 1; }

.dot-spin {
  width: 16px; height: 16px; margin-right: 9px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff;
  display: inline-block; animation: spin 720ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- chores, budgets & badges -------------------------------------- */

.chore-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  border-top: 1px solid var(--line-soft);
}
.chore-row:first-of-type { border-top: 0; }
.chore-row .meta {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0; flex: 1;
}
.chore-row .name {
  font-size: 15.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chore-row .sub {
  font-size: 12px; font-weight: 600; color: var(--ink-faint);
}

.budget-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 2px;
  border-top: 1px solid var(--line-soft);
}
.budget-row:first-of-type { border-top: 0; }
button.budget-row { width: 100%; font: inherit; color: inherit; }
.budget-row .budget-name { font-size: 15px; font-weight: 700; }
.progress--coral > span { background: var(--out); }

.badge-strip { align-items: stretch; }
.badge-mini-row {
  display: flex; justify-content: space-between; gap: 6px;
}
.badge-mini {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #f7f7f7; border: 2px solid var(--line-soft);
  font-size: 15px; filter: grayscale(1); opacity: 0.55;
}
.badge-mini.is-earned {
  background: var(--sun); border-color: #ffe08a;
  filter: none; opacity: 1;
}

.badge-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.badge-tile {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px; min-height: 148px;
  border: 2px solid var(--line); border-radius: var(--r-md);
  background: #fff;
}
.badge-tile.is-earned { border-color: #b8ec8f; background: #f8ffef; }
.badge-tile.is-locked .badge-medal { filter: grayscale(1); opacity: 0.5; }
.badge-medal {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sun); font-size: 21px;
}
.badge-tile.is-locked .badge-medal { background: var(--line-soft); font-size: 16px; }
.badge-name { font-size: 14px; font-weight: 700; line-height: 1.2; }
.badge-blurb { font-size: 11.5px; font-weight: 600; color: var(--ink-faint); line-height: 1.3; }
.badge-tile .tiny { margin-top: auto; }

.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-choice {
  width: 42px; height: 42px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff;
  font-size: 20px; cursor: pointer; display: grid; place-items: center;
  transition: transform 120ms var(--ease-bounce), border-color 120ms, background 120ms;
}
.emoji-choice:active { transform: scale(0.92); }
.emoji-choice.is-on { border-color: var(--primary); background: var(--mint); }

.check-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 0; cursor: pointer;
}
.check-row input {
  width: 20px; height: 20px; margin-top: 1px;
  accent-color: var(--primary); flex: none;
}
.check-row span { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.check-row small { font-size: 12px; font-weight: 600; color: var(--ink-faint); }


@media (max-width: 520px) {
  .chore-row { flex-wrap: wrap; }
  .chore-row .chore-actions {
    flex: 0 0 100%;
    justify-content: flex-end;
    padding-left: 46px;
  }
}

/* ---------- legal pages --------------------------------------------------- */

.legal-body {
  background: #fff;
  color: var(--ink-soft);
}

.legal {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 44px 24px 72px;
  font-size: 16px;
  line-height: 1.65;
}

.legal__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 26px;
}

.legal h1 {
  color: var(--ink);
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 6px;
}

.legal h2 {
  color: var(--ink);
  font-size: 20px;
  line-height: 1.3;
  margin: 30px 0 8px;
}

.legal p { margin: 0 0 12px; }

.legal ul {
  list-style: disc;
  padding-left: 22px;
  margin: 0 0 14px;
}

.legal li { margin: 0 0 7px; }

.legal a {
  color: var(--sky-deep);
  text-underline-offset: 2px;
}

.legal__updated {
  color: var(--ink-faint);
  font-size: 13px;
  margin-bottom: 26px;
}

.legal__footer {
  border-top: 1px solid var(--line);
  margin-top: 44px;
  padding-top: 18px;
  font-size: 13px;
  color: var(--ink-faint);
}

@media (max-width: 520px) {
  .legal { padding: 30px 20px 56px; font-size: 15px; }
  .legal h1 { font-size: 28px; }
}
