html.fonts-fallback, html.fonts-fallback body {
  --font-ui: "PingFang HK", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
  font-family: "PingFang HK", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, sans-serif;
}
/* Health Duo Tracker — frontend-design v0.5-ui
   Tokens: paper #F7F6F2 · ink #1A1F1C · mint #2A9B7D · coral #E07A5F · line #D8DDD8
   Type: Fraunces (display) + Source Sans 3 (UI)
   Avoid: dark SaaS stacks, cream+terracotta template kits
*/

:root {
  --paper: #F7F6F2;
  --paper-2: #EEF0EB;
  --ink: #1A1F1C;
  --ink-soft: #4A524C;
  --muted: #6B746E;
  --mint: #2A9B7D;
  --mint-deep: #1F7A62;
  --mint-wash: rgba(42, 155, 125, 0.12);
  --coral: #E07A5F;
  --coral-wash: rgba(224, 122, 95, 0.14);
  --line: #D8DDD8;
  --ok: #2A9B7D;
  --warn: #C4892A;
  --danger: #E07A5F;
  --radius: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Fraunces", "Noto Serif TC", Georgia, serif;
  --font-ui: system-ui, -apple-system, "PingFang HK", "PingFang TC", "Source Sans 3", "Noto Sans TC", sans-serif;
  --shadow-soft: 0 1px 0 rgba(26, 31, 28, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(72px + var(--safe-bottom));
}

h1, h2, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

a { color: var(--mint-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

/* ——— Header ——— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 246, 242, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-text { min-width: 0; }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.app-header h1 {
  font-size: 1.35rem;
  font-weight: 650;
  line-height: 1.15;
}
.app-header .sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--font-ui);
  font-weight: 400;
}

/* ——— Bottom nav ——— */
.nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 4px 2px calc(6px + var(--safe-bottom));
}
.nav.nav-6 { grid-template-columns: repeat(6, 1fr); }
.nav button {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 8px 2px 6px;
  border-radius: 0;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
}
.nav button .ico { font-size: 1.1rem; line-height: 1; opacity: 0.85; }
.nav.nav-6 button .ico { font-size: 1.05rem; }
.nav button.active {
  color: var(--mint-deep);
}
.nav button.active::before {
  content: "";
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--mint);
  border-radius: 0 0 2px 2px;
}

/* ——— Pages ——— */
.page {
  display: none;
  padding: 16px 16px 28px;
  max-width: 520px;
  margin: 0 auto;
}
.page.active { display: block; }

/* ——— Panels (not stacked SaaS cards) ——— */
.card,
.panel {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 18px 0;
  margin-bottom: 0;
  box-shadow: none;
}
.card:last-child,
.panel:last-child { border-bottom: 0; }

.card h2,
.panel h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}
.card .hint,
.panel .hint,
.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* Auth card needs a contained surface */
.auth-card.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 22px;
  box-shadow: var(--shadow-soft);
}

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.stack { display: flex; flex-direction: column; gap: 10px; }

label.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
input, select, textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  width: 100%;
  color: var(--ink);
  font-weight: 400;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--mint-wash);
  border-color: var(--mint);
  outline-offset: 0;
}
input::placeholder, textarea::placeholder { color: #9AA39C; }

/* ——— Buttons: clear verbs ——— */
.btn {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-weight: 650;
  font-size: 0.92rem;
  cursor: pointer;
  background: var(--ink);
  color: var(--paper);
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn.primary {
  background: var(--mint);
  color: #fff;
}
.btn.primary:hover { background: var(--mint-deep); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}
.btn.ghost:hover { border-color: var(--ink-soft); background: var(--paper-2); }
.btn.danger {
  background: var(--coral);
  color: #fff;
}
.btn.block { width: 100%; }
.btn.sm {
  padding: 7px 11px;
  font-size: 0.78rem;
  border-radius: 6px;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 4px 9px;
  border-radius: 4px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  letter-spacing: 0.02em;
}
.pill.warn { background: rgba(196, 137, 42, 0.15); color: var(--warn); }
.pill.ok { background: var(--mint-wash); color: var(--mint-deep); }
.pill.muted { background: var(--paper-2); color: var(--muted); }

/* ——— Today: calorie rail + meta strip ——— */
.today-hero {
  padding-bottom: 4px;
}
.today-hero h2 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.rail-wrap {
  margin: 14px 0 8px;
}
.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.rail-head .rail-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
}
.rail-head .rail-goal {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}
.rail {
  height: 8px;
  background: var(--paper-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.rail-fill {
  height: 100%;
  background: var(--mint);
  border-radius: 999px;
  min-width: 0;
  transition: width 0.35s ease;
}
.rail-fill.over {
  background: var(--coral);
}

.meta-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}
.meta-strip .meta-item {
  padding: 12px 8px 4px;
  text-align: left;
  border-right: 1px solid var(--line);
}
.meta-strip .meta-item:last-child { border-right: 0; }
.meta-strip .v {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.meta-strip .l {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  text-transform: none;
}

/* Legacy .stats still used on dashboard */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 8px;
}
.stat {
  background: var(--paper);
  padding: 14px 12px;
  border: 0;
  border-radius: 0;
}
.stat .v {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.stat .l {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 3px;
  font-weight: 600;
}

.list { list-style: none; }
.list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.list li:last-child { border-bottom: 0; }
.list .meta { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.list .title {
  font-weight: 650;
  font-size: 0.92rem;
  font-family: var(--font-ui);
}

.thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--paper-2);
  flex-shrink: 0;
  border: 1px solid var(--line);
}

.preview-box {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--paper-2);
  position: relative;
}
.preview-box img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}
.preview-box .placeholder {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 20px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  padding: 8px 10px;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 650;
  border-bottom: 2px solid transparent;
}
.tabs button.active {
  color: var(--mint-deep);
  border-bottom-color: var(--mint);
  background: transparent;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-bottom));
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: 0.22s;
  z-index: 50;
  max-width: 90%;
  border: 0;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ——— Auth ——— */
.auth-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, var(--mint-wash), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 100%, var(--coral-wash), transparent 50%),
    var(--paper);
}
.auth-card { width: 100%; max-width: 400px; }
.logo {
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}
.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 120px;
  padding-top: 8px;
}
.chart .bar {
  flex: 1;
  background: var(--mint);
  border-radius: 3px 3px 1px 1px;
  min-height: 4px;
  position: relative;
  opacity: 0.9;
}
.chart .bar span {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}

.hidden { display: none !important; }

.mic-on {
  animation: pulse 1s infinite;
  background: var(--coral) !important;
  color: #fff !important;
  border-color: var(--coral) !important;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 122, 95, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(224, 122, 95, 0); }
}

.search-results { max-height: 200px; overflow: auto; }
.search-results button {
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 500;
}
.search-results button:active {
  border-color: var(--mint);
  background: var(--mint-wash);
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  border: 0;
  border-right: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 0;
  padding: 9px;
  font-size: 0.82rem;
  font-weight: 650;
}
.seg button:last-child { border-right: 0; }
.seg button.active {
  color: var(--mint-deep);
  background: var(--mint-wash);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
  font-size: 0.88rem;
}

/* ——— Chat ——— */
.chat-card {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 160px);
  border-bottom: 0;
}
.chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.chat-log {
  flex: 1;
  min-height: 220px;
  max-height: min(52dvh, 420px);
  overflow-y: auto;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-bubble {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--mint);
  color: #fff;
  border: 0;
  border-bottom-right-radius: 3px;
}
.chat-bubble.user .time { color: rgba(255,255,255,0.7); }
.chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
  color: var(--ink);
}
.chat-bubble .time {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.chat-compose {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 6px;
  align-items: end;
  margin-top: 10px;
}
.chat-compose textarea {
  min-height: 44px;
  max-height: 120px;
}
.confirm-card {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--mint);
  background: var(--mint-wash);
}
.confirm-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--mint-deep);
  font-family: var(--font-display);
}
.confirm-dl {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px 8px;
  font-size: 0.85rem;
}
.confirm-dl dt { color: var(--muted); }
.confirm-dl dd { font-weight: 650; }

/* Quick action grid on home */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.action-grid .btn { width: 100%; }
.action-grid .span-2 { grid-column: 1 / -1; }

@media (min-width: 560px) {
  .page { padding-left: 20px; padding-right: 20px; }
}

/* ——— v0.5.3 Today check-in UX ——— */
.today-checklist {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}
.today-checklist .chip {
  font-size: 0.72rem;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--muted);
}
.today-checklist .chip.done {
  background: var(--mint-wash);
  border-color: rgba(42, 155, 125, 0.35);
  color: var(--mint-deep);
}
.today-checklist .chip.miss {
  background: var(--coral-wash);
  border-color: rgba(224, 122, 95, 0.35);
  color: #b85a42;
}
.today-checklist .chip.optional {
  background: var(--paper);
  border-style: dashed;
  color: var(--muted);
}

.checkin-card h2 { margin-bottom: 4px; }

.checkin-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.checkin-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  padding: 12px 12px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.checkin-tile:hover, .checkin-tile:focus-visible {
  border-color: var(--mint);
  background: var(--mint-wash);
  outline: none;
}
.checkin-tile.done {
  border-color: rgba(42, 155, 125, 0.4);
  background: var(--mint-wash);
}
.checkin-tile .tile-ico {
  font-size: 1.1rem;
  line-height: 1;
  opacity: 0.9;
}
.checkin-tile .tile-label {
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-display);
}
.checkin-tile .tile-status {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}
.checkin-tile.done .tile-status { color: var(--mint-deep); }
.checkin-tile[data-tile="cycle"],
.checkin-tile[data-tile="measure"],
.checkin-tile[data-tile="zero"] { /* share row with siblings */ }

.inline-forms {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 520px) {
  .inline-forms { grid-template-columns: 1fr 1fr; }
  #inline-cycle { grid-column: 1 / -1; }
}
.inline-form {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  background: var(--paper-2);
}
.inline-form-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.inline-form .field.grow { flex: 1; min-width: 0; }
.inline-form .row { align-items: flex-end; }

/* Shortcuts sample list */
.shortcuts-samples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}
.sample-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}
.sample-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.sample-meta strong { font-size: 0.9rem; }
.sample-code {
  display: block;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--ink-soft);
  background: var(--paper-2);
  border-radius: 6px;
  padding: 6px 8px;
  overflow-x: auto;
  white-space: nowrap;
  max-width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Recent food chips */
.recent-foods {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.recent-foods-title {
  font-weight: 700;
  font-size: 0.92rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.food-chip {
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
  max-width: 100%;
  text-align: left;
  line-height: 1.3;
}
.food-chip:hover, .food-chip:focus-visible {
  border-color: var(--mint);
  background: var(--mint-wash);
  outline: none;
}

/* Favorites chips (reuse recent-foods layout) */
.favorite-foods {
  border-top: none;
  padding-top: 0;
  margin-top: 10px;
}
.food-chip.fav {
  border-color: rgba(224, 122, 95, 0.45);
  background: var(--coral-wash);
  color: #9a4a35;
}
.btn-fav {
  min-width: 2rem;
  padding: 4px 8px;
  font-size: 0.95rem;
  line-height: 1;
}
.btn-fav.on {
  color: #c45a3a;
}

/* Weight trend */
.weight-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 8px 0 4px;
  font-size: 0.9rem;
  font-weight: 650;
}
.weight-summary .delta-up { color: #b85a42; }
.weight-summary .delta-down { color: var(--mint-deep); }
.weight-summary .delta-flat { color: var(--muted); }
.chart.weight-chart .bar {
  background: var(--coral);
  opacity: 0.88;
}
.chart.weight-chart .bar.is-empty {
  background: var(--line);
  opacity: 0.45;
  min-height: 2px;
}

/* Cycle calendar */
.cycle-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0 10px;
}
.cycle-cal-title {
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 1rem;
}
.cycle-cal-weekdays,
.cycle-cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cycle-cal-weekdays span {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  padding: 2px 0;
}
.cycle-cal-day {
  aspect-ratio: 1;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-soft);
  cursor: default;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cycle-cal-day.out {
  opacity: 0.28;
}
.cycle-cal-day.has-log {
  cursor: pointer;
  border-color: var(--line);
}
.cycle-cal-day.status-yes {
  background: var(--coral-wash);
  border-color: rgba(224, 122, 95, 0.45);
  color: #9a4a35;
}
.cycle-cal-day.status-no {
  background: var(--mint-wash);
  border-color: rgba(42, 155, 125, 0.35);
  color: var(--mint-deep);
}
.cycle-cal-day.status-spotting {
  background: #f3e8d8;
  border-color: rgba(180, 140, 80, 0.4);
  color: #8a6a30;
}
.cycle-cal-day.status-predicted {
  background: repeating-linear-gradient(
    -45deg,
    rgba(224, 122, 95, 0.12),
    rgba(224, 122, 95, 0.12) 4px,
    rgba(224, 122, 95, 0.22) 4px,
    rgba(224, 122, 95, 0.22) 8px
  );
  border-color: rgba(224, 122, 95, 0.35);
  border-style: dashed;
  color: #9a4a35;
  cursor: default;
}
.cycle-predict-line {
  margin: 0 0 8px;
  font-weight: 650;
  color: var(--ink-soft);
}
.cycle-cal-day.today {
  box-shadow: inset 0 0 0 2px var(--mint);
}
.cycle-cal-day.selected {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.cycle-cal-detail {
  margin-top: 10px;
  min-height: 1.2em;
}


/* ——— v0.5.6 checklist + calorie goal ——— */
.today-checklist .checklist-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.today-checklist .checklist-missing {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 650;
  color: #b85a42;
  background: var(--coral-wash);
  border: 1px solid rgba(224, 122, 95, 0.3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.rail-unset .calorie-goal-hint {
  margin: 6px 0 8px;
}
.rail-unset .btn {
  margin-bottom: 4px;
}
.shortcuts-today-note {
  background: var(--mint-wash);
  border: 1px solid rgba(42, 155, 125, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: 8px 0;
  color: var(--mint-deep);
  font-weight: 600;
}

/* Sleep / workout minute charts */
.chart.sleep-chart .bar {
  background: #5b7c9a;
  opacity: 0.9;
}
.chart.sleep-chart .bar.is-empty,
.chart.workout-min-chart .bar.is-empty {
  background: var(--line);
  opacity: 0.45;
  min-height: 2px;
}
.chart.workout-min-chart .bar {
  background: var(--mint);
  opacity: 0.9;
}

/* Weekly summary card */
.weekly-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.weekly-summary .ws-item {
  background: var(--paper-2, rgba(26, 31, 28, 0.04));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 10px;
}
.weekly-summary .ws-item .v {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}
.weekly-summary .ws-item .l {
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.weekly-summary .ws-item .sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ink-soft);
}
@media (min-width: 520px) {
  .weekly-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


/* v0.5.8 — zero-kcal chips + weekly report + goal rails */
.zero-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.zero-quick .btn {
  flex: 0 0 auto;
}
.weekly-report-box {
  margin: 0;
  padding: 12px 14px;
  background: var(--paper-2, #efece4);
  border: 1px solid var(--line, #e2ddd2);
  border-radius: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Noto Sans TC", "Source Sans 3", system-ui, sans-serif;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink, #1A1F1C);
  min-height: 4.5rem;
}
.rail-wrap + .rail-wrap { margin-top: 12px; }
.goal-rails { display: grid; gap: 10px; margin-top: 10px; }
.goal-rails .rail-wrap { margin: 0; }
.chart.weight-chart#waist-chart .bar { background: linear-gradient(180deg, #7eb8a8, var(--mint-deep, #2A9B7D)); }

@media (min-width: 520px) {
  .inline-forms { grid-template-columns: 1fr 1fr; }
}

/* —— v0.6.1 —— */
.nav.nav-7 { grid-template-columns: repeat(7, 1fr); }
.nav.nav-7 button { font-size: 0.62rem; padding: 6px 2px 8px; }
.nav.nav-7 button .ico { font-size: 1rem; }

.quick-hero h2 { margin-bottom: 4px; }
.quick-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  border-radius: 14px;
  border: 1px solid var(--line, #e2ddd2);
  background: var(--paper-2, #efece4);
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.quick-tile:hover, .quick-tile:focus-visible {
  border-color: var(--mint-deep, #2A9B7D);
  background: #e7f3ee;
}
.quick-tile .tile-ico { font-size: 1.25rem; }
.quick-inline-panel {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--cream, #F7F6F2);
  border: 1px dashed var(--line);
}
.quick-inline-panel.hidden { display: none; }

.companion-row {
  display: grid;
  gap: 6px;
  margin: 4px 0 8px;
  align-items: start;
}
@media (min-width: 640px) {
  .companion-row { grid-template-columns: 1fr 1fr 1fr; }
}
.companion-card,
.companion-float {
  padding: 6px 4px;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
}
.companion-row .companion-card.card,
.companion-row .companion-float {
  background: transparent !important;
  border: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  padding: 4px 2px;
  margin: 0;
}
.quote-card .quote-label {
  font-size: 0.75rem;
  color: var(--mint-deep, #2A9B7D);
  font-weight: 600;
  margin-bottom: 6px;
}
.quote-text {
  font-family: "Noto Serif TC", Fraunces, serif;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink, #1A1F1C);
  margin: 0 0 10px;
  min-height: 2.8em;
}
.pet-card, .avatar-card {
  display: flex;
  gap: 10px;
  align-items: center;
}
.pet-visual, .avatar-visual { flex: 0 0 auto; }
.pet-name, .avatar-title { font-weight: 600; font-size: 0.92rem; }
.pet-svg .pet-bob {
  transform-origin: center;
  animation: pet-bob 2.4s ease-in-out infinite;
}
.pet-svg .pet-blink {
  animation: pet-blink 4.5s ease-in-out infinite;
}
@keyframes pet-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes pet-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.15); }
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ffe8e0;
  color: #b54a3a;
  font-weight: 600;
  font-size: 0.88rem;
  margin: 4px 0 10px;
  border: 1px solid #f0c4ba;
}
.streak-pill:empty { display: none; }

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.82rem;
  cursor: pointer;
  user-select: none;
}
.cat-chip input { margin: 0; }
.cat-chip.on {
  background: #e7f3ee;
  border-color: var(--mint-deep, #2A9B7D);
  color: var(--mint-deep, #2A9B7D);
}
.cat-manage-list { display: grid; gap: 6px; }
.cat-manage-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.cat-manage-row input { flex: 1; }
.cat-filter-row { margin: 8px 0; }

.entry-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.entry-cat-tag {
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef6f2;
  color: var(--mint-deep, #2A9B7D);
}

/* ---------- v0.6.2: dark mode + goals / macros / templates / backup / accounts ---------- */
html[data-theme="dark"] {
  --paper: #1A1F1C;
  --paper-2: #242A26;
  --ink: #F2F4F1;
  --ink-soft: #C5CBC6;
  --muted: #9AA39C;
  --mint: #3CB894;
  --mint-deep: #5AD0AB;
  --mint-wash: rgba(60, 184, 148, 0.18);
  --coral: #E8957F;
  --coral-wash: rgba(232, 149, 127, 0.18);
  --line: #3A423C;
  --ok: #3CB894;
  --warn: #D4A84A;
  --danger: #E8957F;
  --shadow-soft: 0 1px 0 rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

.weight-goal-card .wg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 8px;
}
.weight-goal-card .wg-stat {
  min-width: 88px;
}
.weight-goal-card .wg-stat .v {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--ink);
}
.weight-goal-card .wg-stat .l {
  font-size: 0.75rem;
  color: var(--muted);
}
.weight-goal-card .wg-suggest {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.weight-goal-card.wg-empty .hint { margin-top: 6px; }

.macro-card .macro-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.macro-row {
  display: grid;
  grid-template-columns: 52px 1fr 48px;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.macro-row .macro-label { color: var(--ink-soft); font-weight: 600; }
.macro-row .macro-track {
  height: 10px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.macro-row .macro-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--mint);
}
.macro-row.carb .macro-fill { background: var(--warn); }
.macro-row.fat .macro-fill { background: var(--coral); }
.macro-row .macro-val { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.wo-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}
.wo-tpl-btn {
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-family: var(--font-ui);
  cursor: pointer;
}
.wo-tpl-btn:hover, .wo-tpl-btn:focus-visible {
  border-color: var(--mint);
  outline: 2px solid var(--mint-wash);
}
.wo-tpl-btn .tpl-min {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 4px;
}

.backup-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  margin: 0 0 10px;
  border-radius: var(--radius-sm);
  background: var(--coral-wash);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
}
.backup-banner.hidden { display: none; }

.account-switcher {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.account-switcher h3 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.account-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.account-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.account-list li.current {
  border-color: var(--mint);
  background: var(--mint-wash);
}
.account-list .acc-meta { flex: 1; min-width: 0; }
.account-list .acc-name { font-weight: 600; font-size: 0.95rem; }
.account-list .acc-email { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.account-list .acc-last { font-size: 0.75rem; color: var(--muted); }
.theme-seg {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.theme-seg button {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 0.85rem;
}
.theme-seg button.active {
  background: var(--mint-wash);
  border-color: var(--mint);
  color: var(--mint-deep);
  font-weight: 600;
}

.auth-accounts {
  margin-top: 14px;
  text-align: left;
}
.auth-accounts h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

/* v0.6.3 — pet interact / mood-steps / weekly challenge */
.pet-card { cursor: pointer; user-select: none; }
.pet-card:focus-visible { outline: 2px solid var(--mint, #3cb371); outline-offset: 2px; }
.pet-svg.pet-happy {
  animation: pet-happy-bounce 0.55s ease;
}
@keyframes pet-happy-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.12) rotate(-4deg); }
  60% { transform: scale(1.08) rotate(3deg); }
  100% { transform: scale(1); }
}
.pet-tap-hint { opacity: 0.75; font-size: 0.8rem; }
.mood-steps-card .mood-row,
.mood-steps-card .steps-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.mood-btns { display: inline-flex; gap: 4px; }
.mood-btn.active {
  outline: 2px solid var(--mint-deep, #2a8f5a);
  background: #e8fff2;
}
.challenge-list { list-style: none; padding: 0; margin: 8px 0 0; }
.challenge-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 6px;
  border-radius: 10px; background: #f7faf8; border: 1px solid #e2ebe6;
}
.challenge-item.done { background: #e8fff2; border-color: #b7e6c9; }
.challenge-mark { font-weight: 700; width: 1.2em; }
.challenge-label { flex: 1; }
.challenge-prog { font-variant-numeric: tabular-nums; opacity: 0.85; }
.friend-label-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
html[data-theme="dark"] .challenge-item { background: #1e2a24; border-color: #2f4038; }
html[data-theme="dark"] .challenge-item.done { background: #1a3328; border-color: #2d5a40; }
html[data-theme="dark"] .mood-btn.active { background: #1a3328; }

/* v0.6.4 — plump transition + avatar breathe + reduced-motion */
.pet-visual {
  transition: transform 0.4s ease;
}
.pet-visual[data-plump] .pet-svg {
  transition: transform 0.4s ease;
}
.avatar-svg {
  transform-origin: 50% 70%;
  animation: avatar-breathe 3.2s ease-in-out infinite;
}
@keyframes avatar-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .pet-svg .pet-bob,
  .pet-svg .pet-blink,
  .pet-svg.pet-happy,
  .avatar-svg {
    animation: none !important;
  }
  .pet-visual,
  .pet-visual[data-plump] .pet-svg {
    transition: none !important;
  }
}


/* v0.6.5 — quick companion strip, mic unsupported, weight line, idle reinforce */
.quick-companion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  margin: 0 0 8px;
  width: 100%;
  text-align: left;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.quick-companion:hover { opacity: 0.9; }
.quick-companion:focus-visible { outline: 2px solid var(--mint, #3cb371); outline-offset: 2px; }
.quick-pet-face {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 12px;
  background: #f3faf6;
  display: grid;
  place-items: center;
}
.quick-pet-face .pet-svg {
  width: 52px;
  height: 44px;
  transform: scale(0.72);
  transform-origin: center;
}
.quick-pet-quote {
  flex: 1;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted, #5a6b62);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.btn.mic-unsupported,
button.mic-unsupported {
  opacity: 0.45;
  filter: grayscale(1);
  cursor: not-allowed;
  pointer-events: none;
}

.chart.weight-chart.is-line {
  display: block;
  height: auto;
  min-height: 120px;
  padding-top: 0;
}
.weight-line-svg { display: block; }
.weight-line-svg .wline-label {
  font-size: 9px;
  fill: var(--muted, #5a6b62);
  font-weight: 600;
}
html[data-theme="dark"] .quick-companion { background: transparent; border: 0; }
html[data-theme="dark"] .quick-pet-face { background: #24302a; }
html[data-theme="dark"] .weight-line-svg .wline-path { stroke: #5dcea3; }
html[data-theme="dark"] .weight-line-svg .wline-dot { fill: #5dcea3; }

/* idle reinforce */
.pet-svg.pet-idle .pet-bob,
.pet-svg .pet-bob {
  animation: pet-bob 2.4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .quick-pet-face .pet-svg .pet-bob,
  .quick-pet-face .pet-svg .pet-blink,
  .pet-svg.pet-happy {
    animation: none !important;
  }
}


/* v0.6.6 compact + fold */
.page {
  padding: 10px 14px 18px;
}
.card, .panel {
  padding: 12px 0;
}
.card .hint, .panel .hint, .hint.compact {
  margin-bottom: 6px;
}
.fold-card {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  margin: 0;
  background: transparent;
}
.fold-card > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  padding: 6px 0;
  color: var(--ink);
}
.fold-card > summary::-webkit-details-marker { display: none; }
.fold-card > summary::before {
  content: '▸ ';
  color: var(--mint-deep, #2A9B7D);
}
.fold-card[open] > summary::before { content: '▾ '; }
.fold-body { padding: 6px 0 10px; }
.fold-hr {
  border: none;
  border-top: 1px dashed var(--line);
  margin: 12px 0;
}
.checkin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}
.checkin-tabs button {
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: inherit;
}
.checkin-tabs button.active {
  background: var(--mint, #3cb371);
  border-color: var(--mint, #3cb371);
  color: #fff;
}
.inline-forms .inline-form { display: none; }
.inline-forms .inline-form.active-panel { display: block; }
.today-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 4px 0 8px;
}
.today-bmi-pill { margin: 4px 0 0; font-weight: 600; color: var(--mint-deep, #2A9B7D); }
.settings-groups { display: flex; flex-direction: column; gap: 0; }
.pet-visual svg { max-height: 96px; width: auto; }
.avatar-visual svg { max-height: 148px; width: auto; }
.companion-card .hint { margin-bottom: 4px; }
.quote-text { min-height: 2.2em; margin-bottom: 6px; font-size: 0.92rem; }
.mood-steps-card h2, .weekly-challenge-card h2 { font-size: 1rem; margin-bottom: 4px; }
.mood-steps-card, .weekly-challenge-card { padding-top: 8px; padding-bottom: 8px; }


/* v0.6.7 — comic female avatar */
.avatar-visual svg.avatar-comic-f {
  max-height: 148px;
  width: auto;
}
.avatar-svg .avatar-blink {
  animation: avatar-blink 4.8s ease-in-out infinite;
}
@keyframes avatar-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.12); }
}
@media (prefers-reduced-motion: reduce) {
  .avatar-svg .avatar-blink { animation: none !important; }
}
.companion-row .avatar-card .avatar-visual {
  min-width: 96px;
}


/* v0.6.8 — avatar hint single line · about bottom padding · Google auth */
.avatar-hint-line,
#avatar-hint.avatar-hint-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 0.78rem;
  line-height: 1.3;
  margin-bottom: 2px;
}
#page-settings {
  padding-bottom: calc(96px + var(--safe-bottom));
}
#page-settings .fold-about .fold-body,
#page-settings #fold-about .fold-body {
  padding-bottom: calc(48px + var(--safe-bottom));
}
.auth-google {
  margin-top: 14px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.google-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
}
.google-btn:hover { border-color: var(--mint); }
.google-btn-host {
  display: flex;
  justify-content: center;
  margin-top: 8px;
  min-height: 40px;
}
.google-btn-host:not([hidden]) { display: flex; }

/* v0.6.8 fun — confetti + pet tap bounce + streak chip */
.hdt-confetti {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  overflow: hidden;
}
.hdt-confetti-piece {
  position: absolute;
  top: -8px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0.95;
  animation: hdt-confetti-fall 1.15s ease-out forwards;
}
@keyframes hdt-confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(72vh) rotate(420deg); opacity: 0; }
}
#pet-card.pet-tap-bounce {
  animation: pet-card-bounce 0.55s ease;
}
@keyframes pet-card-bounce {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-8px) scale(1.03); }
  70% { transform: translateY(2px) scale(0.99); }
  100% { transform: translateY(0) scale(1); }
}
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--mint-wash);
  color: var(--mint-deep);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  margin: 4px 0 8px;
}
@media (prefers-reduced-motion: reduce) {
  .hdt-confetti-piece,
  #pet-card.pet-tap-bounce { animation: none !important; }
}


/* ===== v0.6.10 — avatar maker modal · photo · morph ===== */
body.hdt-modal-open { overflow: hidden; }
.hdt-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: flex-end; justify-content: center;
}
.hdt-modal.hidden, .hdt-modal[hidden] { display: none !important; }
.hdt-modal-backdrop {
  position: absolute; inset: 0; background: rgba(20,30,28,0.45);
}
.hdt-modal-sheet {
  position: relative; z-index: 1;
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: var(--card, #fff);
  color: var(--text, #1a2a26);
  border-radius: 18px 18px 0 0;
  padding: 14px 16px 20px;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
}
@media (min-width: 640px) {
  .hdt-modal { align-items: center; }
  .hdt-modal-sheet { border-radius: 18px; max-height: 88vh; }
}
.hdt-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 6px;
}
.hdt-modal-head h2 { margin: 0; font-size: 1.1rem; }
.hdt-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border, #d5e4df);
}
.avatar-maker-grid {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) {
  .avatar-maker-grid { grid-template-columns: 140px 1fr; align-items: start; }
}
.avatar-maker-preview {
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #eef7f3, #f7faf8);
  border-radius: 14px;
  padding: 8px;
  border: 1px solid var(--border, #d5e4df);
}
.avatar-maker-preview .avatar-svg { width: 120px; height: 180px; }
.avatar-maker-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.avatar-tab.on { background: var(--primary, #2A9B7D); color: #fff; }
.avatar-preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.avatar-preset-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 2px solid transparent; border-radius: 12px; padding: 4px;
  background: transparent; cursor: pointer; font-size: 0.75rem;
}
.avatar-preset-btn img {
  width: 56px; height: 72px; object-fit: cover; border-radius: 8px;
  display: block;
}
.avatar-preset-btn.on { border-color: var(--primary, #2A9B7D); }
.avatar-photo-wrap {
  position: relative; width: 110px; height: 165px;
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden; border-radius: 12px;
}
.avatar-photo {
  max-width: 110px; max-height: 165px; object-fit: contain;
  transform-origin: center bottom;
  transition: transform 0.35s ease, filter 0.35s ease;
}
.avatar-photo-dash {
  position: absolute; inset: 8px;
  border: 1.5px dashed #A8C8BE; border-radius: 40% 40% 30% 30%;
  pointer-events: none; opacity: 0.55;
}
.avatar-card .avatar-visual { min-height: 148px; }
#avatar-card #btn-avatar-open-maker { margin-top: 4px; }


/* ===== v0.6.10 — friends · nick color · today lights ===== */
.header-user-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nick-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--nick-color, #2A9B7D);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--nick-color, #2A9B7D) 35%, transparent);
}
.today-lights {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.today-lights .tl-dot {
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  background: var(--surface-2, #eceae4);
  opacity: 0.38;
  border: 1px solid transparent;
  transition: opacity .2s, border-color .2s, background .2s;
}
.today-lights .tl-dot.on {
  opacity: 1;
  background: color-mix(in srgb, var(--mint, #2A9B7D) 18%, var(--surface, #fff));
  border-color: color-mix(in srgb, var(--mint, #2A9B7D) 45%, transparent);
}
.friends-list li {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #e5e2da);
}
.friends-list .friend-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.friends-list .friend-metrics {
  font-size: 0.82rem;
  color: var(--muted, #6b675f);
  line-height: 1.35;
}
.friends-list .friend-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.friends-compare {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.friend-week-card {
  border: 1px solid var(--border, #e5e2da);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface, #fff);
  border-left: 4px solid var(--friend-color, #2A9B7D);
}
.friend-week-card .fw-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 6px;
}
.friend-week-card .fw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 6px 10px;
  font-size: 0.85rem;
}
.friend-week-card .fw-grid .k { color: var(--muted, #6b675f); font-size: 0.75rem; }
.friend-week-card .fw-grid .v { font-weight: 600; }
.friends-avg {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 4px;
}
.friends-avg .avg-chip {
  background: var(--surface-2, #eceae4);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
}
.btn-like.active {
  background: color-mix(in srgb, #E07A5F 22%, transparent);
  border-color: #E07A5F;
}


/* ===== v0.6.10 UI tidy — global padding · nav-5 · toast-top · chat sticky ===== */
.page {
  padding-bottom: calc(96px + var(--safe-bottom));
}
#page-settings {
  padding-bottom: calc(96px + var(--safe-bottom));
}
.toast.toast-top {
  top: calc(12px + env(safe-area-inset-top, 0px));
  bottom: auto;
  transform: translateX(-50%) translateY(-8px);
}
.toast.toast-top.show {
  transform: translateX(-50%) translateY(0);
}
.nav.nav-5 {
  grid-template-columns: repeat(5, 1fr);
}
.nav.nav-5 button {
  font-size: 0.72rem;
  padding: 8px 4px 10px;
}
.nav.nav-5 button .ico { font-size: 1.15rem; }
.quick-goto-home {
  margin-bottom: 24px;
}
.quick-companion-tip {
  margin: 4px 0 10px;
  text-align: center;
}
.quick-hero { margin-bottom: 8px; }
.quick-companion.companion-float {
  margin-bottom: 10px;
}
/* companion stay frameless + clear of bottom CTA */
.companion-float {
  box-shadow: none !important;
  border: 0 !important;
  background: transparent !important;
}
#page-quick .companion-float {
  margin-bottom: 12px;
}
/* avatar full-body readable */
.avatar-card .avatar-visual,
#avatar-card .avatar-visual {
  min-height: 140px;
}
.avatar-card .avatar-svg,
#avatar-card svg.avatar-svg {
  width: min(160px, 42vw);
  height: auto;
  max-height: 220px;
}
/* chat composer sticky above bottom nav */
#page-chat .chat-compose,
#page-chat .chat-input-bar,
#page-chat .composer,
#page-chat .chat-footer {
  position: sticky;
  bottom: calc(64px + var(--safe-bottom));
  z-index: 15;
  background: var(--paper, #F7F6F2);
  padding-top: 8px;
  padding-bottom: 8px;
}
/* fold tighten on dash/home */
#page-dash .fold-card,
#page-home .fold-card {
  margin-bottom: 8px;
}
#page-dash .card { margin-bottom: 8px; }
#page-dash > .card:first-child { margin-top: 0; }
.auth-wrap .field { margin-bottom: 14px; }
.auth-wrap .btn.primary { margin-top: 4px; }
.hdt-modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
#btn-avatar-maker-reset { margin-right: auto; }
.home-more-links { justify-content: flex-start; }
@media (max-width: 520px) {
  .companion-row {
    flex-direction: column;
  }
  .companion-row .companion-card {
    width: 100%;
  }
}
/* pet bounce on quick face */
.quick-pet-face.pet-tap-bounce,
.quick-companion.pet-tap-bounce {
  animation: pet-tap-bounce 0.55s ease;
}
@keyframes pet-tap-bounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.12); }
  55% { transform: scale(0.96); }
  100% { transform: scale(1); }
}


/* ===== v0.6.11 — friends narrow wrap · avatar parts ===== */
@media (max-width: 420px) {
  .friends-list .friend-row-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .friends-list .friend-metrics {
    display: block;
  }
  .friends-list .friend-actions {
    width: 100%;
  }
  .friends-list .friend-actions input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    width: auto !important;
  }
}
