/* Momo Home components: plain CSS, "mo-" prefix, driven by tokens.css custom properties. */

.mo-root, .mo-root * { box-sizing: border-box; }
.mo-root {
  font-family: var(--font-body);
  font-size: 15px; line-height: 22px; font-weight: 500;
  color: var(--ink);
  background: var(--surface-000);
  -webkit-font-smoothing: antialiased;
}
.mo-display { font-family: var(--font-display); }

/* ---------- Button ---------- */
.mo-btn {
  --mo-btn-bg: var(--pink-500);
  --mo-btn-edge: var(--shadow-pink-edge);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 24px;
  border: 0; border-radius: var(--radius-lg);
  background: var(--mo-btn-bg); color: var(--ink-on-fill);
  box-shadow: var(--mo-btn-edge);
  font-family: var(--font-display); font-size: 17px; line-height: 22px; font-weight: 600;
  cursor: pointer; user-select: none; text-decoration: none;
  transform: translateY(0);
  transition: transform var(--duration-quick) ease, box-shadow var(--duration-quick) ease, filter var(--duration-quick) ease;
  margin-bottom: 4px;
}
.mo-btn:hover { filter: brightness(1.03); }
.mo-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-edge); }
.mo-btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.mo-btn[disabled], .mo-btn.is-disabled { opacity: .45; box-shadow: none; cursor: not-allowed; transform: none; }
.mo-btn--green { --mo-btn-bg: var(--green-500); --mo-btn-edge: var(--shadow-green-edge); }
.mo-btn--green:active { box-shadow: 0 1px 0 var(--green-edge); }
.mo-btn--soft { --mo-btn-bg: var(--surface-100); --mo-btn-edge: var(--shadow-soft-edge); color: var(--ink); }
.mo-btn--soft:active { box-shadow: 0 1px 0 var(--line); }
.mo-btn--ghost { background: transparent; box-shadow: none; color: var(--pink-text); min-height: 48px; margin-bottom: 0; }
.mo-btn--ghost:active { transform: none; box-shadow: none; opacity: .7; }
.mo-btn--danger { --mo-btn-bg: var(--danger-100); --mo-btn-edge: var(--shadow-soft-edge); color: var(--danger); }
.mo-btn--sm { min-height: 40px; padding: 0 14px; font-size: 15px; border-radius: var(--radius-md); }
.mo-btn--block { display: flex; width: 100%; }
.mo-btn--icon { width: 48px; min-height: 48px; padding: 0; border-radius: var(--radius-md); font-size: 22px; }
.mo-btn i, .mo-btn svg { font-size: 20px; width: 20px; height: 20px; flex: none; }

/* ---------- Card ---------- */
.mo-card {
  background: var(--surface-100);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 16px;
}
.mo-card--lg { padding: 24px; border-radius: var(--radius-xl); }
.mo-card--pink { background: var(--pink-100); box-shadow: none; }
.mo-card--green { background: var(--green-100); box-shadow: none; }
.mo-card--butter { background: var(--butter-100); box-shadow: none; }
.mo-card--flush { padding: 0; overflow: hidden; }
.mo-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mo-card__title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; margin: 0; }
.mo-card__meta { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.mo-card--interactive { cursor: pointer; transition: transform var(--duration-quick) ease; }
.mo-card--interactive:active { transform: scale(.985); }
.mo-card--interactive:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

/* ---------- Icon tile ---------- */
.mo-tile {
  display: inline-grid; place-items: center; flex: none;
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--pink-100); color: var(--ink); font-size: 22px;
}
.mo-tile svg { width: 22px; height: 22px; }
.mo-tile--green { background: var(--green-100); }
.mo-tile--butter { background: var(--butter-100); }
.mo-tile--plain { background: var(--surface-200); }
.mo-tile--lg { width: 56px; height: 56px; font-size: 28px; }
.mo-tile--sm { width: 32px; height: 32px; font-size: 18px; border-radius: var(--radius-sm); }

/* ---------- List + row ---------- */
.mo-list { background: var(--surface-100); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 4px 16px; }
.mo-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 0;
  color: var(--ink); text-decoration: none; background: none; border: 0; width: 100%; text-align: left; font: inherit;
}
.mo-row + .mo-row { border-top: 1px solid var(--line); }
.mo-row__body { flex: 1; min-width: 0; }
.mo-row__title { font-weight: 800; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-row__sub { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); display: block; }
.mo-row__end { flex: none; font-weight: 800; color: var(--ink); }
.mo-row__chev { flex: none; color: var(--ink-muted); width: 18px; height: 18px; }
button.mo-row, a.mo-row { cursor: pointer; }
button.mo-row:focus-visible, a.mo-row:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }

/* ---------- Chip ---------- */
.mo-chip {
  display: inline-flex; align-items: center; gap: 4px;
  min-height: 32px; padding: 4px 12px;
  border-radius: var(--radius-pill); border: 0;
  background: var(--surface-200); color: var(--ink);
  font-family: var(--font-body); font-size: 13px; line-height: 18px; font-weight: 700;
  white-space: nowrap;
}
.mo-chip i, .mo-chip svg { font-size: 15px; width: 15px; height: 15px; }
.mo-chip--pink { background: var(--pink-100); }
.mo-chip--green { background: var(--green-100); }
.mo-chip--butter { background: var(--butter-300); color: var(--ink-on-fill); }
button.mo-chip { cursor: pointer; min-height: 40px; padding: 8px 16px; transition: transform var(--duration-pop) var(--ease-bounce); }
button.mo-chip:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
button.mo-chip[aria-pressed="true"], .mo-chip.is-active { background: var(--pink-500); color: var(--ink-on-fill); box-shadow: 0 3px 0 var(--pink-edge); }
.mo-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.mo-chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }

/* ---------- Fields ---------- */
.mo-field { display: grid; gap: 6px; }
.mo-label { font-size: 13px; line-height: 18px; font-weight: 700; color: var(--ink-muted); }
.mo-input, .mo-select, .mo-textarea {
  width: 100%; min-height: 52px; padding: 12px 16px;
  border: 2px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface-100); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 22px; font-weight: 600;
  box-shadow: var(--shadow-soft-edge);
  appearance: none;
}
.mo-textarea { min-height: 96px; resize: vertical; }
.mo-input::placeholder, .mo-textarea::placeholder { color: var(--ink-muted); font-weight: 500; }
.mo-input:focus-visible, .mo-select:focus-visible, .mo-textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-color: var(--focus-ring); }
.mo-input.is-invalid { border-color: var(--danger); }
.mo-help { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); }
.mo-help--error { color: var(--danger); }
.mo-search { position: relative; }
.mo-search > svg, .mo-search > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; font-size: 20px; color: var(--ink-muted); pointer-events: none; }
.mo-search .mo-input { padding-left: 46px; }
.mo-input-group { display: flex; align-items: stretch; }
.mo-input-group .mo-input { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.mo-input-group__addon { display: grid; place-items: center; padding: 0 14px; background: var(--surface-200); border: 2px solid var(--line); border-right: 0; border-radius: var(--radius-md) 0 0 var(--radius-md); font-weight: 800; }

/* ---------- Stepper ---------- */
.mo-stepper { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--radius-sm); background: var(--surface-200); }
.mo-stepper button {
  width: 36px; height: 36px; border: 0; border-radius: 8px; display: grid; place-items: center;
  background: var(--pink-500); color: var(--ink-on-fill); font-size: 18px; font-weight: 800; cursor: pointer;
}
.mo-stepper button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.mo-stepper button svg { width: 16px; height: 16px; }
.mo-stepper output { min-width: 40px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Checkbox / todo ---------- */
.mo-check { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; cursor: pointer; }
.mo-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mo-check__box {
  width: 30px; height: 30px; flex: none; border-radius: 10px;
  background: var(--surface-100); border: 2.5px solid var(--line); box-shadow: var(--shadow-soft-edge);
  display: grid; place-items: center; color: transparent;
  transition: background var(--duration-quick) ease, transform var(--duration-pop) var(--ease-bounce);
}
.mo-check__box svg { width: 18px; height: 18px; }
.mo-check input:checked + .mo-check__box { background: var(--green-500); border-color: var(--green-500); box-shadow: 0 3px 0 var(--green-edge); color: var(--ink-on-fill); transform: scale(1.08); }
.mo-check input:focus-visible + .mo-check__box { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
.mo-check__text { flex: 1; min-width: 0; }
.mo-check__title { font-weight: 800; display: block; }
.mo-check__sub { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); display: block; }
.mo-check input:checked ~ .mo-check__text .mo-check__title { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--ink-muted); }

/* ---------- Avatar ---------- */
.mo-avatar {
  --mo-avatar-bg: var(--pink-500);
  width: 44px; height: 44px; flex: none; border-radius: var(--radius-pill);
  display: inline-grid; place-items: center; overflow: hidden;
  background: var(--mo-avatar-bg); color: var(--ink-on-fill);
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  border: 3px solid var(--surface-100);
}
.mo-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mo-avatar--green { --mo-avatar-bg: var(--green-500); }
.mo-avatar--butter { --mo-avatar-bg: var(--butter-300); }
.mo-avatar--lilac { --mo-avatar-bg: var(--lilac-300); }
.mo-avatar--sky { --mo-avatar-bg: var(--sky-300); }
.mo-avatar--sm { width: 30px; height: 30px; font-size: 13px; border-width: 2px; }
.mo-avatar--lg { width: 72px; height: 72px; font-size: 28px; }
.mo-avatar.is-selected { box-shadow: 0 0 0 3px var(--focus-ring); }

/* ---------- Meter ---------- */
.mo-meter { display: grid; gap: 6px; }
.mo-meter__track { height: 14px; border-radius: var(--radius-pill); background: var(--surface-200); overflow: hidden; }
.mo-meter__fill { height: 100%; border-radius: var(--radius-pill); background: var(--green-500); width: var(--mo-value, 0%); transition: width var(--duration-pop) ease; }
.mo-meter--pink .mo-meter__fill { background: var(--pink-500); }
.mo-meter--warn .mo-meter__fill { background: var(--butter-300); }
.mo-meter--over .mo-meter__fill { background: var(--danger); }
.mo-meter__label { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 18px; font-weight: 700; }
.mo-meter__label span:last-child { color: var(--ink-muted); }
.mo-meter--over .mo-meter__label span:last-child { color: var(--danger); }

/* ---------- Timer ring ---------- */
.mo-timer { position: relative; display: inline-grid; place-items: center; width: 220px; aspect-ratio: 1; }
.mo-timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.mo-timer__track { fill: none; stroke: var(--surface-200); stroke-width: 14; }
.mo-timer__progress { fill: none; stroke: var(--pink-500); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.mo-timer__value { font-family: var(--font-display); font-size: 56px; line-height: 60px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mo-timer__label { font-size: 13px; line-height: 18px; font-weight: 700; color: var(--ink-muted); text-align: center; }
.mo-timer__center { display: grid; justify-items: center; gap: 2px; z-index: 1; }
.mo-timer.is-done .mo-timer__progress { stroke: var(--green-500); }
.mo-timer.is-overdue .mo-timer__value { color: var(--danger); }
.mo-timer--sm { width: 72px; }
.mo-timer--sm .mo-timer__value { font-size: 14px; line-height: 18px; }
.mo-timer--sm .mo-timer__track, .mo-timer--sm .mo-timer__progress { stroke-width: 10; }

/* Timer pill (tray of running timers) */
.mo-timer-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 8px 6px 14px; border-radius: var(--radius-pill); background: var(--butter-300); color: var(--ink-on-fill); font-weight: 800; box-shadow: 0 3px 0 var(--line); }
.mo-timer-pill__time { font-family: var(--font-display); font-size: 17px; font-variant-numeric: tabular-nums; }
.mo-timer-pill.is-done { background: var(--green-500); }
.mo-timer-pill.is-overdue { background: var(--danger-100); color: var(--danger); }

/* ---------- Tab bar / rail ---------- */
.mo-tabbar {
  display: flex; justify-content: space-around; gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-100); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-card);
}
.mo-tab {
  flex: 1; display: grid; justify-items: center; gap: 2px; min-height: 56px; padding: 6px 4px;
  border-radius: var(--radius-md); color: var(--ink-muted); text-decoration: none; background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 11px; line-height: 14px; font-weight: 700;
}
.mo-tab i, .mo-tab svg { font-size: 24px; width: 24px; height: 24px; }
.mo-tab.is-active, .mo-tab.active { color: var(--ink); }
.mo-tab.is-active .mo-tab__icon, .mo-tab.active .mo-tab__icon { background: var(--pink-100); }
.mo-tab__icon { display: grid; place-items: center; width: 52px; height: 32px; border-radius: var(--radius-pill); transition: background var(--duration-quick) ease; }
.mo-tab:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.mo-rail { display: flex; flex-direction: column; gap: 6px; padding: 16px 12px; background: var(--surface-100); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); }
.mo-rail .mo-tab { flex: none; font-size: 13px; }

/* ---------- Top bar ---------- */
.mo-topbar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; min-height: 56px; }
.mo-topbar__title { text-align: center; font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; margin: 0; }
.mo-back { width: 44px; height: 44px; border-radius: var(--radius-pill); border: 2.5px solid var(--ink); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.mo-back svg, .mo-back i { width: 20px; height: 20px; font-size: 20px; }
.mo-back:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Section title ---------- */
.mo-section { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.mo-section h2, .mo-section__title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; margin: 0; }
.mo-section a, .mo-section__link { color: var(--pink-text); font-weight: 800; font-size: 13px; text-decoration: none; }

/* ---------- Banner ---------- */
.mo-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--green-100); color: var(--green-text); font-weight: 800; }
.mo-banner svg, .mo-banner i { width: 20px; height: 20px; font-size: 20px; flex: none; }
.mo-banner--pink { background: var(--pink-100); color: var(--pink-text); }
.mo-banner--butter { background: var(--butter-100); color: var(--ink); }
.mo-banner--danger { background: var(--danger-100); color: var(--danger); }

/* ---------- Segmented ---------- */
.mo-segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-200); }
.mo-segmented button { min-height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--ink-muted); font-family: var(--font-body); font-weight: 800; font-size: 13px; cursor: pointer; }
.mo-segmented button[aria-pressed="true"] { background: var(--surface-100); color: var(--ink); box-shadow: var(--shadow-soft-edge); }
.mo-segmented button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Sheet ---------- */
.mo-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.mo-sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--surface-100); border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 12px 20px 24px; box-shadow: var(--shadow-card); animation: mo-sheet-in var(--duration-pop) var(--ease-bounce); }
.mo-sheet__grip { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
.mo-sheet__title { font-family: var(--font-display); font-size: 20px; line-height: 26px; font-weight: 600; margin: 0 0 16px; }
@media (min-width: 768px) { .mo-scrim { align-items: center; } .mo-sheet { border-radius: var(--radius-xl); } }
@keyframes mo-sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Mascot slot ---------- */
.mo-mascot { position: relative; display: inline-grid; place-items: center; width: var(--mo-size, 140px); aspect-ratio: 1; flex: none; }
.mo-mascot img { width: 100%; height: 100%; object-fit: contain; }
.mo-mascot--halo::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: var(--pink-100); z-index: 0; }
.mo-mascot--halo img, .mo-mascot--halo .mo-mascot__placeholder { position: relative; z-index: 1; }
.mo-mascot__placeholder {
  width: 100%; height: 100%; border-radius: 42% 42% 38% 38%;
  border: 2.5px dashed var(--pink-edge); background: var(--pink-100);
  display: grid; place-items: center; align-content: center; gap: 4px; text-align: center; padding: 8px;
  color: var(--pink-text);
}
.mo-mascot__placeholder svg { width: 34%; height: auto; }
.mo-mascot__slot { font-size: 11px; line-height: 14px; font-weight: 800; }

/* ---------- Stat ---------- */
.mo-stat { display: grid; gap: 2px; }
.mo-stat__label { font-size: 13px; line-height: 18px; font-weight: 700; color: var(--ink-muted); }
.mo-stat__value { font-family: var(--font-display); font-size: 26px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mo-stat__value--xl { font-size: 40px; line-height: 44px; }
.mo-stat__value--good { color: var(--green-text); }
.mo-stat__value--bad { color: var(--danger); }

/* ---------- Speech bubble ---------- */
.mo-bubble { position: relative; display: inline-block; padding: 10px 14px; border-radius: var(--radius-md); background: var(--surface-100); box-shadow: var(--shadow-card); font-weight: 700; }
.mo-bubble::after { content: ""; position: absolute; left: -7px; top: 50%; width: 14px; height: 14px; background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 3px; }

/* ---------- Utilities ---------- */
.mo-stack { display: grid; gap: 20px; }
.mo-hstack { display: flex; align-items: center; gap: 12px; }
.mo-muted { color: var(--ink-muted); }
.mo-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .mo-btn, .mo-btn:active, .mo-check__box, button.mo-chip, .mo-sheet { transition: none; animation: none; transform: none; }
}
