:root {
  --teal: #1F6F6A;
  --teal-deep: #164F4B;
  --teal-soft: #CFE8E4;
  --teal-mist: #E6F2EF;
  --peach: #F2B8A2;
  --peach-soft: #FBE3D8;
  --rose: #9C4A35;
  --cream: #FBF5EE;
  --card: #FFFFFF;
  --ink: #1E3433;
  --muted: #4A5C5B;
  --line: #E4DCD2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(30, 52, 51, .06), 0 6px 18px rgba(30, 52, 51, .06);
  --nav-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 17px/1.5 var(--sans);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -.005em; }
h1 { font-size: 30px; }
h2 { font-size: 23px; }
h3 { font-size: 19px; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }

.app { max-width: 480px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 0 10px; }
.mono { display: inline-flex; flex: none; }
.brand { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--teal-deep); line-height: 1.15; }
.brand-sub { font-size: 16px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
main, main:focus, main:focus-visible { outline: none; }
main > * + * { margin-top: 16px; }
.foot { text-align: center; color: var(--muted); font-size: 16px; padding: 28px 8px 8px; }
.storage-note { background: var(--peach-soft); border: 1px solid var(--peach); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; font-size: 16px; }

/* Bottom navigation */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line);
  padding: 4px max(4px, env(safe-area-inset-left)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-right));
  backdrop-filter: blur(10px);
}
.tabbar a {
  min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 16px; line-height: 1.1; border-radius: 14px; min-width: 0;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--teal-deep); font-weight: 650; }
.tabbar a[aria-current="page"] svg { background: var(--teal-soft); border-radius: 10px; width: 44px; padding: 0 10px; }
@media (min-width: 520px) { .tabbar { max-width: 480px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 20px 20px 0 0; } }

/* Generic blocks */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.tint { background: var(--teal-mist); box-shadow: none; }
.card.peach { background: var(--peach-soft); box-shadow: none; }
.eyebrow { font-size: 16px; font-weight: 650; color: var(--teal); letter-spacing: .02em; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.sample {
  display: inline-block; font: 600 16px/1.2 var(--sans); color: var(--rose);
  background: #fff; border: 1.5px dashed var(--peach); border-radius: 999px; padding: 2px 10px; white-space: nowrap; vertical-align: middle;
}
.note { font-size: 16px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 999px; border: 0;
  background: var(--teal); color: #fff; font-weight: 650; text-decoration: none; font-size: 17px;
}
.btn:hover { background: var(--teal-deep); }
.btn.ghost { background: #fff; color: var(--teal-deep); border: 1.5px solid var(--teal); }
.btn.ghost:hover { background: var(--teal-mist); }
.btn.soft { background: var(--teal-soft); color: var(--teal-deep); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  min-width: 44px; min-height: 44px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: var(--teal-deep);
}

/* Today */
.hello h1 { margin-top: 2px; }
.hello .date { color: var(--muted); }
.name-edit { display: flex; gap: 8px; margin-top: 10px; }
.name-edit input { flex: 1; min-width: 0; min-height: 48px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; }
.name-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline dotted var(--peach) 2px; text-underline-offset: 5px; min-height: 44px; }

.progress { height: 10px; background: #fff; border-radius: 999px; overflow: hidden; margin-top: 12px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), #2E8C85); border-radius: 999px; }

.hero { position: relative; overflow: hidden; background: var(--teal); color: #fff; }
.hero .eyebrow { color: var(--peach-soft); }
.hero h2 { color: #fff; margin: 4px 0 6px; }
.hero p { color: #EAF4F2; }
.hero .art { position: absolute; right: -26px; bottom: -30px; width: 150px; height: 150px; opacity: .8; pointer-events: none; }
.hero > :not(.art) { position: relative; }
.hero .btn { background: var(--cream); color: var(--teal-deep); margin-top: 14px; }
.hero .btn:hover { background: #fff; }
.hero .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 12px; font-size: 16px; background: rgba(255,255,255,.14); color: #fff; }
.done-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--teal-deep); background: var(--teal-soft); border-radius: 999px; padding: 4px 12px; font-weight: 650; font-size: 16px; }
.hero .done-badge { background: var(--cream); }

.walk-count { font-family: var(--serif); font-size: 34px; color: var(--teal-deep); line-height: 1; }
.meals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.meal {
  min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; font-size: 16px; padding: 6px 4px;
}
.meal[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 650; }
.meal .tick { font-size: 16px; line-height: 1.2; }
.walk-dots { display: flex; gap: 6px; }
.walk-dots i { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--teal); }
.walk-dots i.on { background: var(--teal); }

.quick { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-height: 64px; }
.quick .q-ic { flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--peach); display: grid; place-items: center; color: var(--ink); }
.quick .q-txt { flex: 1; min-width: 0; }
.quick .chev { color: var(--teal); flex: none; }

/* R.E.A.L. */
.pillars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pillar { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.pillar .letter {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font: italic 600 24px/1 var(--serif); color: #fff; background: var(--teal); margin-bottom: 8px;
}
.pillar:nth-child(2) .letter { background: var(--rose); }
.pillar:nth-child(3) .letter { background: #2E7D73; }
.pillar:nth-child(4) .letter { background: #7A5547; }
.pillar h3 { font-size: 18px; overflow-wrap: anywhere; }
.pillar .sample { margin-top: 6px; }

.weeks { list-style: none; margin: 0; padding: 0; }
.weeks li + li { margin-top: 8px; }
.week { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.week summary {
  list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; cursor: pointer;
}
.week summary::-webkit-details-marker { display: none; }
.week .wk-num {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--teal-mist); color: var(--teal-deep); font-weight: 700; font-size: 16px;
}
.week.done .wk-num { background: var(--teal); color: #fff; }
.week.current .wk-num { background: var(--peach); color: var(--ink); }
.week .wk-txt { flex: 1; min-width: 0; }
.week .wk-title { font-weight: 650; }
.week .wk-state { font-size: 16px; color: var(--muted); }
.week .caret { flex: none; transition: transform .2s; color: var(--teal); }
.week[open] .caret { transform: rotate(180deg); }
.week.current { outline: 2px solid var(--peach); }
.sessions { padding: 0 14px 14px; }
.session { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.session .s-txt { flex: 1; min-width: 0; }
.session .s-title { font-weight: 600; }
.session .s-meta { font-size: 16px; color: var(--muted); }
.check {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--teal); background: #fff; color: var(--teal);
  display: grid; place-items: center;
}
.check[aria-pressed="true"] { background: var(--teal); color: #fff; }
.play { flex: none; min-height: 44px; padding: 8px 16px; font-size: 16px; }

/* Movement */
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: 16px;
}
.chip[aria-pressed="true"] { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; font-weight: 650; }
.lib { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.lib a {
  display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 18px; box-shadow: var(--shadow);
  padding: 10px; text-decoration: none; color: inherit; min-height: 84px;
}
.lib .thumb { flex: none; width: 76px; height: 76px; border-radius: 14px; overflow: hidden; }
.lib .thumb svg { display: block; width: 100%; height: 100%; }
.lib .l-txt { flex: 1; min-width: 0; }
.lib .l-title { font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.25; }
.lib .l-meta { font-size: 16px; color: var(--muted); }
.lib .mins { flex: none; font-weight: 700; color: var(--teal-deep); background: var(--teal-mist); border-radius: 12px; padding: 6px 10px; font-size: 16px; text-align: center; line-height: 1.1; }
.group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 0 8px; }

/* Player */
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--teal-deep); text-decoration: none; font-weight: 600; }
.player { text-align: center; }
.ring { position: relative; width: min(260px, 72vw); aspect-ratio: 1; margin: 6px auto 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--teal-mist); }
.ring .bar { stroke: var(--teal); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.ring .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring .time { font: 600 52px/1 var(--serif); font-variant-numeric: tabular-nums; color: var(--teal-deep); }
.ring .left { font-size: 16px; color: var(--muted); margin-top: 6px; }
.now-move { margin-top: 14px; }
.now-move .label { font-size: 16px; color: var(--muted); }
.now-move .move { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.now-move .next { font-size: 16px; color: var(--muted); }
.controls { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.controls .btn { min-width: 132px; }
.toggles { display: grid; gap: 8px; text-align: left; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 4px 4px 4px 0; }
.switch { position: relative; flex: none; width: 60px; height: 44px; border: 0; background: transparent; padding: 0; }
.switch::before { content: ""; position: absolute; left: 2px; top: 6px; width: 56px; height: 32px; border-radius: 999px; background: #8A9B99; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 10px; left: 6px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch[aria-checked="true"]::before { background: var(--teal); }
.switch[aria-checked="true"]::after { transform: translateX(24px); }
.switch-wrap { min-width: 56px; min-height: 44px; display: flex; align-items: center; }
.moves { list-style: none; margin: 0; padding: 0; text-align: left; }
.moves li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.moves li.on { font-weight: 700; color: var(--teal-deep); }
.moves li .d { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.finish { background: var(--peach-soft); border-radius: 18px; padding: 16px; margin-top: 16px; }

/* Check-in */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: 8px; }
.q + .q { margin-top: 18px; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.scale.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale label {
  min-height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-size: 16px; line-height: 1.15; padding: 4px 2px; cursor: pointer; overflow-wrap: anywhere;
}
.scale label b { font-size: 18px; }
.scale input:checked + label { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 650; }
.scale input:focus-visible + label { outline: 3px solid var(--rose); outline-offset: 2px; }
.scale-ends { display: flex; justify-content: space-between; font-size: 16px; color: var(--muted); margin-top: 4px; }
.measure { display: flex; gap: 8px; align-items: stretch; }
.measure input { flex: 1; min-width: 0; min-height: 48px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 14px; background: #fff; }
.measure select { flex: none; min-height: 48px; border: 1.5px solid var(--line); border-radius: 14px; padding: 0 10px; background: #fff; }
.saved-msg { color: var(--teal-deep); font-weight: 650; text-align: center; margin-top: 10px; min-height: 24px; }

.metric-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.metric-tabs .chip { padding: 8px 6px; }
.chart { margin-top: 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }


.chart-sum { margin-top: 6px; font-size: 16px; color: var(--muted); }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 16px; }
.history li .h-day { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.history li .h-val { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.chart .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; color: var(--muted); font-size: 16px; margin-top: 4px; }
.chart .days .today { color: var(--teal-deep); font-weight: 800; text-decoration: underline 2px var(--peach); text-underline-offset: 4px; }
