:root{color-scheme:light;padding:env(safe-area-inset-top,0px) 0 env(safe-area-inset-bottom,0px)}body{margin:0}img{max-width:100%}[hidden]{display:none!important}
/* Layout: one phone-width column (header band, scrolling view, tab bar),
   centred on wide screens. Forest green carries the chrome, cream paper the
   content, and orange is reserved for the clicker. */
:root {
  --forest: #1f4a39;
  --forest-deep: #153427;
  --on-forest: #f4f1e6;
  --on-forest-soft: #b9cdbf;
  --ground: #e9e4d6;
  --page: #f6f2e8;
  --paper: #fffdf7;
  --ink: #1d2a23;
  --ink-soft: #55635a;
  --line: #e0d9c8;
  --moss: #dce8d5;
  --moss-ink: #24553f;
  --ember: #e2742b;
  --ember-deep: #bf5b17;
  --on-ember: #ffffff;
  --gold: #a9802a;
  --gold-pale: #f6ecd2;
  --bad: #b3261e;
  --bad-pale: #fbe9e6;
  --warn: #8a6100;
  --warn-pale: #fbf1dc;
  --good: #2e6b4f;
  --good-pale: #e4f1e8;
  --shadow: 0 1px 2px rgba(29, 42, 35, 0.06), 0 6px 18px rgba(29, 42, 35, 0.06);
  --display: "Chivo", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Manrope", "Avenir Next", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --forest: #1b4233; --forest-deep: #102a20; --on-forest: #f0efe4; --on-forest-soft: #a8bfb0;
    --ground: #0c120f; --page: #121a16; --paper: #19231e; --ink: #ecefe7; --ink-soft: #a5b2a8;
    --line: #2b3931; --moss: #24382e; --moss-ink: #a9d4bb; --ember: #e57a33; --ember-deep: #c96220;
    --on-ember: #ffffff; --gold: #d9b25c; --gold-pale: #33301f; --bad: #f0a59f; --bad-pale: #3a2220;
    --warn: #e6c26f; --warn-pale: #352d18; --good: #9bd3b4; --good-pale: #1f3329;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --forest: #1b4233; --forest-deep: #102a20; --on-forest: #f0efe4; --on-forest-soft: #a8bfb0;
  --ground: #0c120f; --page: #121a16; --paper: #19231e; --ink: #ecefe7; --ink-soft: #a5b2a8;
  --line: #2b3931; --moss: #24382e; --moss-ink: #a9d4bb; --ember: #e57a33; --ember-deep: #c96220;
  --on-ember: #ffffff; --gold: #d9b25c; --gold-pale: #33301f; --bad: #f0a59f; --bad-pale: #3a2220;
  --warn: #e6c26f; --warn-pale: #352d18; --good: #9bd3b4; --good-pale: #1f3329;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--forest);
}
* { box-sizing: border-box; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; border-radius: 6px; }

#app {
  height: 100%; max-width: 480px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--page);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.12);
}
.gutter {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---- header band ---- */
#bar { background: var(--forest); color: var(--on-forest); flex: none; }
.bar-row { display: flex; align-items: center; gap: 8px; min-height: 52px; padding-block: 6px; }
.bar-title {
  flex: 1; min-width: 0; text-align: center;
  font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: 0.01em;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-title.left { justify-content: flex-start; text-align: left; font-size: 19px; }
.bar-btn {
  flex: none; min-width: 44px; height: 40px; padding: 0 6px;
  display: inline-flex; align-items: center; gap: 2px;
  background: none; border: 0; border-radius: 10px; color: var(--on-forest);
  font-weight: 700; font-size: 15px;
}
.bar-btn:hover { background: rgba(255, 255, 255, 0.1); }
.bar-btn.is-on { color: #ffb38a; }
.bar-side { flex: none; min-width: 44px; font-size: 13px; color: var(--on-forest-soft); text-align: right; font-weight: 600; }

/* ---- scrolling view ---- */
#view { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; outline: none; }
.stack { display: flex; flex-direction: column; gap: 16px; padding-block: 16px 28px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; color: var(--gold); }
.h-page { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1.15; text-wrap: balance; }
.h-sec { font-family: var(--display); font-weight: 800; font-size: 17px; line-height: 1.25; text-wrap: balance; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.card-pad { padding: 14px; }
.chip {
  display: inline-flex; align-items: center; flex: none;
  padding: 3px 10px; border-radius: 999px;
  background: var(--moss); color: var(--moss-ink);
  font-size: 12px; font-weight: 800; white-space: nowrap;
}
.chip.gold { background: var(--gold-pale); color: var(--gold); }

/* ---- buttons ---- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 10px 16px;
  border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 800; font-size: 15px; text-align: center;
}
.btn.primary { background: var(--forest); color: var(--on-forest); }
.btn.primary:hover { background: var(--forest-deep); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--moss); }
.btn.done { background: var(--good-pale); color: var(--good); border-color: transparent; }
.btn.danger { background: var(--bad-pale); color: var(--bad); }
.btn-row { display: flex; flex-direction: column; gap: 10px; }

/* ---- lesson screen ---- */
.lesson-head { display: flex; align-items: flex-start; gap: 10px; }
.lesson-head .h-page { flex: 1; min-width: 0; }
.stage {
  position: relative; border-radius: 16px; overflow: hidden;
  aspect-ratio: 16 / 9; max-width: 100%;
  background: var(--forest-deep);
  display: grid; place-items: center;
}
.stage-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.stage-art { position: relative; width: 46%; max-width: 190px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45)); }
.stage-note {
  position: absolute; left: 10px; bottom: 10px; right: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(10, 22, 16, 0.72); color: #f4f1e6;
  font-size: 12px; font-weight: 700;
}
.click-row { display: flex; align-items: center; gap: 12px; }
.click-btn {
  flex: 1; min-height: 58px; border: 0; border-radius: 999px;
  background: var(--ember); color: var(--on-ember);
  box-shadow: 0 4px 0 var(--ember-deep);
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: 0.01em;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform 60ms ease, box-shadow 60ms ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none;
}
.click-btn:active, .click-btn.is-down { transform: translateY(3px); box-shadow: 0 1px 0 var(--ember-deep); }
.round-btn {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--line); color: var(--ink);
  display: grid; place-items: center; box-shadow: var(--shadow);
}
.round-btn.is-off { color: var(--ink-soft); background: var(--page); }

.tabs { display: flex; gap: 4px; }
.tab {
  flex: 1; min-width: 0; padding: 10px 6px; border: 1px solid var(--line); border-bottom: 0;
  border-radius: 12px 12px 0 0; background: var(--page); color: var(--ink-soft);
  font-weight: 800; font-size: 13.5px; text-align: center;
}
.tab[aria-selected="true"] { background: var(--forest); border-color: var(--forest); color: var(--on-forest); }
.tab-panel { border-radius: 0 0 16px 16px; border-top-left-radius: 0; padding: 6px 14px; }
.steps > li, .plain-list > li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.steps > li:last-child, .plain-list > li:last-child { border-bottom: 0; }
.steps .num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--moss); color: var(--moss-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums;
}
.steps p, .plain-list p { flex: 1; min-width: 0; }
.mark { flex: none; width: 22px; height: 22px; margin-top: 1px; display: grid; place-items: center; }
.mark.tip { color: var(--gold); }
.mark.bad { color: var(--bad); }

.facts { display: grid; gap: 12px; }
.facts dt { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 3px; }
.facts dd { margin: 0; }
.gear { display: flex; flex-wrap: wrap; gap: 6px; }
.gear span { padding: 4px 10px; border-radius: 8px; background: var(--page); border: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.goal { background: var(--gold-pale); border-radius: 12px; padding: 12px 14px; }
.goal .eyebrow { margin-bottom: 2px; }

/* ---- lists of lessons / rows ---- */
.rows > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; background: none; border: 0; text-align: left;
}
.row:hover { background: var(--page); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 800; }
.row-sub { font-size: 12.5px; color: var(--ink-soft); }
.status {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); color: var(--ink-soft);
  display: grid; place-items: center; font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums;
}
.status.done { background: var(--good); border-color: var(--good); color: var(--paper); }
.thumb { flex: none; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; }
.chev { flex: none; color: var(--ink-soft); }

.bar-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--good); }

/* ---- home ---- */
.next { display: flex; gap: 14px; align-items: center; }
.next img { flex: none; width: 84px; height: 84px; border-radius: 16px; }
.next-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week .d { font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.week .dot {
  margin: 4px auto 0; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center; color: var(--paper);
}
.week .dot.on { background: var(--good); border-color: var(--good); }
.week .dot.today { border-color: var(--ember); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 6px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line);
  font-weight: 800; font-size: 12.5px; text-align: center; line-height: 1.2; box-shadow: var(--shadow);
}
.quick button svg { color: var(--forest); }
.quick button:hover { background: var(--moss); }

/* ---- progress ---- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { padding: 12px 8px; text-align: center; }
.tile b { display: block; font-family: var(--display); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--body); font-size: 10px; font-weight: 700; fill: var(--ink-soft); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; }
.badge { text-align: center; }
.badge img { width: 76px; height: 76px; }
.badge.locked img { filter: grayscale(1); opacity: 0.3; }
.badge b { display: block; font-size: 12.5px; line-height: 1.25; }
.badge span { display: block; font-size: 11.5px; color: var(--ink-soft); line-height: 1.3; }

/* ---- tools ---- */
.search {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  font: inherit; font-size: 16px;
}
.search::placeholder { color: var(--ink-soft); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none; padding: 7px 14px; border-radius: 999px;
  background: var(--paper); border: 1.5px solid var(--line); color: var(--ink-soft);
  font-weight: 800; font-size: 13px;
}
.filter[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--on-forest); }
.pill { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.03em; }
.pill.toxic { background: var(--bad-pale); color: var(--bad); }
.pill.caution { background: var(--warn-pale); color: var(--warn); }
.pill.safe { background: var(--good-pale); color: var(--good); }
.safe-item { border-left: 4px solid var(--line); }
.safe-item.toxic { border-left-color: var(--bad); }
.safe-item.caution { border-left-color: var(--warn); }
.safe-item.safe { border-left-color: var(--good); }
.safe-item summary { list-style: none; cursor: pointer; padding: 12px 14px; }
.safe-item summary::-webkit-details-marker { display: none; }
.safe-top { display: flex; align-items: flex-start; gap: 8px; }
.safe-top b { flex: 1; min-width: 0; }
.safe-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.callout { border-radius: 12px; padding: 12px 14px; }
.callout.act { background: var(--gold-pale); font-weight: 700; }
.callout.dont { background: var(--bad-pale); }
.callout.help { background: var(--moss); }
.phone { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phone b { font-size: 17px; font-variant-numeric: tabular-nums; user-select: all; }
.mini {
  padding: 5px 12px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); font-weight: 800; font-size: 12.5px;
}
.sig { padding: 12px 14px; }
.sig + .sig { border-top: 1px solid var(--line); }
.sig b { font-family: var(--display); font-size: 16px; }
.sig dl { display: grid; grid-template-columns: 64px 1fr; gap: 2px 10px; margin: 4px 0 0; font-size: 13.5px; }
.sig dt { color: var(--ink-soft); font-weight: 700; }
.sig dd { margin: 0; min-width: 0; }
.big-click { display: grid; place-items: center; gap: 18px; padding-block: 24px; text-align: center; }
.big-click .click-btn { flex: none; width: 210px; height: 210px; border-radius: 50%; font-size: 30px; flex-direction: column; box-shadow: 0 8px 0 var(--ember-deep); }
.big-click .click-btn:active, .big-click .click-btn.is-down { transform: translateY(6px); box-shadow: 0 2px 0 var(--ember-deep); }
.count { font-family: var(--display); font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }

.field label { display: block; font-weight: 800; margin-bottom: 6px; }
.toggle { display: flex; align-items: center; gap: 12px; }
.toggle-main { flex: 1; min-width: 0; }
.switch {
  flex: none; width: 52px; height: 30px; border-radius: 999px; border: 0; padding: 3px;
  background: var(--line); display: flex;
}
.switch::after { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 120ms ease; }
.switch[aria-checked="true"] { background: var(--good); }
.switch[aria-checked="true"]::after { transform: translateX(22px); }
.prose { display: grid; gap: 10px; }

/* ---- puppy program: checklists, fold-out reference sections ---- */
.checks > li + li { border-top: 1px solid var(--line); }
.check {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 11px 14px; background: none; border: 0; text-align: left;
}
.check:hover { background: var(--page); }
.check .box {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 7px;
  border: 2px solid var(--ink-soft); color: transparent; display: grid; place-items: center;
}
.check .txt { flex: 1; min-width: 0; }
.check[aria-checked="true"] .box { background: var(--good); border-color: var(--good); color: var(--paper); }
.check[aria-checked="true"] .txt { color: var(--ink-soft); }
.dots { display: grid; gap: 8px; }
.dots > li { position: relative; padding-left: 18px; }
.dots > li::before { content: ""; position: absolute; left: 3px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.fold summary {
  list-style: none; cursor: pointer; padding: 13px 14px;
  display: flex; align-items: center; gap: 10px; font-weight: 800;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary .chev { margin-left: auto; display: grid; transition: transform 120ms ease; }
.fold[open] summary .chev { transform: rotate(90deg); }
.fold-body { padding: 0 14px 14px; display: grid; gap: 10px; }
.folds { display: grid; gap: 8px; }
.row.soon { color: var(--ink-soft); }
.row.soon:hover { background: none; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sec-head > span { flex: none; }
.paras { display: grid; gap: 8px; }

/* ---- notes and medication tracker ---- */
.form { display: grid; gap: 14px; }
.form label, .form .lab { display: block; font-weight: 800; margin-bottom: 6px; }
.form .opt { font-weight: 600; font-size: 12.5px; color: var(--ink-soft); }
textarea.search { display: block; min-height: 96px; resize: vertical; line-height: 1.45; }
input[type="date"].search { min-height: 48px; -webkit-appearance: none; appearance: none; }
.err { color: var(--bad); font-weight: 700; font-size: 13px; margin-top: 6px; }
.clamp1, .clamp2 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.clamp1 { -webkit-line-clamp: 1; }
.clamp2 { -webkit-line-clamp: 2; margin-top: 2px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.med-list { display: grid; gap: 10px; }
.med-list .paused .row-title { color: var(--ink-soft); }
.med-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--line);
}
.mini.go { background: var(--forest); border-color: var(--forest); color: var(--on-forest); padding: 8px 16px; font-size: 13.5px; }

/* ---- sign-in and access code ---- */
.auth { padding-top: 28px; }
.code-in {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 20px; font-weight: 700;
  letter-spacing: 0.14em; text-align: center; text-transform: uppercase;
}
.code-in::placeholder { letter-spacing: 0.14em; font-weight: 500; }
.btn:disabled, .mini:disabled { opacity: 0.6; cursor: default; }

/* ---- tab bar ---- */
#tabs { flex: none; background: var(--paper); border-top: 1px solid var(--line); }
.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding-block: 6px; }
.tabbar button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border: 0; border-radius: 12px; background: none;
  color: var(--ink-soft); font-size: 11.5px; font-weight: 800;
}
.tabbar button[aria-current="page"] { background: var(--moss); color: var(--moss-ink); }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: min(420px, calc(100% - 32px));
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--page);
  font-weight: 800; font-size: 13.5px; text-align: center; z-index: 20; box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
