:root {
  --bg: #fdf8f2;
  --card: #ffffff;
  --ink: #2e2620;
  --muted: #8a7a68;
  --line: #eee2d4;
  --accent: #b4552d;
  --accent-ink: #ffffff;
  --green: #3e7d4e;
  --green-bg: #e7f2e9;
  --amber: #a86a12;
  --amber-bg: #fdf0d8;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(90, 60, 30, 0.08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.error { color: #b3261e; min-height: 1.2em; }
h1 { font-size: 1.6rem; margin: 0.4rem 0; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 0.5rem; }
main { max-width: 640px; margin: 0 auto; padding: 0 14px 20px; }
footer { max-width: 640px; margin: 0 auto; padding: 0 14px 28px; }

/* ---------- buttons & forms ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); border-radius: 999px; padding: 0.5rem 1rem;
  font-size: 0.95rem; cursor: pointer; min-height: 42px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; padding: 0.8rem 1rem; font-size: 1.05rem; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small-btn { min-height: 34px; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
label { display: block; font-size: 0.9rem; margin-bottom: 0.8rem; }
input[type="email"], input[type="password"], input[type="number"], input[type="text"], select {
  width: 100%; padding: 0.65rem 0.75rem; margin-top: 0.3rem;
  border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; background: #fff;
}
.check-inline { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; }
.check-inline input { width: auto; margin: 0; }

/* ---------- auth ---------- */
.view { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 28px 24px; max-width: 380px; width: 100%; text-align: center;
}
.auth-card form { text-align: left; margin-top: 1rem; }
.auth-badge {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 16px;
  background: var(--accent); color: #fff; font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- app chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: rgba(253, 248, 242, 0.95);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
.topbar-title { display: flex; gap: 10px; align-items: center; }
.topbar-badge {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-top: 14px;
}
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }

.kid-switcher { display: flex; gap: 8px; margin-top: 14px; }
.kid-switcher button {
  flex: 1; padding: 0.7rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 1rem; font-weight: 600; cursor: pointer; min-height: 48px;
}
.kid-switcher button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- scorecard ---------- */
.scorecard { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.ring-wrap { position: relative; width: 120px; height: 120px; flex: none; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 0.5s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-pct { font-size: 1.5rem; font-weight: 700; }
.score-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; flex: 1; min-width: 180px; }
.stat-num { display: block; font-size: 1.15rem; font-weight: 700; }
.stat-label { font-size: 0.78rem; color: var(--muted); }
.xpbar { width: 100%; height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.xpbar-fill { height: 100%; background: var(--accent); width: 0%; transition: width 0.5s ease; }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.badge {
  font-size: 0.78rem; padding: 0.3rem 0.6rem; border-radius: 999px;
  background: var(--amber-bg); color: var(--amber); border: 1px solid #f0dcb2;
}
.badge.locked { background: #f4efe8; color: var(--muted); border-color: var(--line); opacity: 0.75; }

/* ---------- checklists ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
}
.checklist li:last-child { border-bottom: none; }
.check-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--muted); background: #fff; color: #fff;
  font-size: 1rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
li.done .check-btn { background: var(--green); border-color: var(--green); }
li.done .chore-title { color: var(--muted); text-decoration: line-through; }
.chore-main { flex: 1; min-width: 0; }
.chore-title { font-size: 1rem; }
.via { font-size: 0.78rem; color: var(--amber); }
.makeup-btn { flex: none; }

.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { padding: 9px 2px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.plainlist li:last-child { border-bottom: none; }
.pill { font-size: 0.75rem; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--green-bg); color: var(--green); white-space: nowrap; }
.pill.wait { background: var(--amber-bg); color: var(--amber); }

.settings-form { display: grid; gap: 2px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.inline-form input[type="text"] { flex: 1; min-width: 160px; margin: 0; }
.inline-form select { width: auto; margin: 0; }

dialog { border: none; border-radius: var(--radius); padding: 0; max-width: min(92vw, 420px); }
dialog::backdrop { background: rgba(46, 38, 32, 0.45); }
.dialog-card { padding: 20px; }
.makeup-options { display: grid; gap: 8px; margin: 12px 0; }
.makeup-options button { text-align: left; }

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1712; --card: #2a211a; --ink: #f3e9dd; --muted: #b3a08a;
    --line: #453729; --green-bg: #22392a; --amber-bg: #40331a;
  }
  input, select { background: #241c16; color: var(--ink); }
  .check-btn { background: transparent; }
}
