:root {
  --bg: #F5F4EF;
  --card: #FFFFFF;
  --ink: #1C2421;
  --muted: #65706B;
  --line: #E3E1D9;
  --brand: #0F6E56;
  --brand-soft: #E1F5EE;
  --brand-ink: #085041;
  --warn: #7A4A0B;
  --warn-soft: #FAEEDA;
  --danger: #A32D2D;
  --danger-soft: #FCEBEB;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
#app { max-width: 480px; margin: 0 auto; padding: 18px 16px calc(110px + var(--safe-b)); }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 6px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 26px 0 10px; font-weight: 650; }
h3 { font-size: 18px; margin: 0; font-weight: 650; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.pad { padding: 40px 0; }
.brand { font-size: 12px; letter-spacing: 0.14em; font-weight: 700; color: var(--brand); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card.hero { border: 2px solid var(--brand); }
.card.warn { background: var(--warn-soft); border-color: #EFD3A6; color: var(--warn); }
.card.info { background: var(--brand-soft); border-color: #BFE6D6; color: var(--brand-ink); }
.card label, .lbl { display: block; font-weight: 600; margin-bottom: 8px; }
.kicker { font-size: 13px; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; border-radius: 12px; padding: 12px 16px; min-height: 48px; cursor: pointer; }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.ghost { background: transparent; }
.btn.block { display: block; width: 100%; margin-top: 12px; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn.danger { color: var(--danger); }
.link { appearance: none; background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; padding: 8px 0; cursor: pointer; }
.row-btns { display: flex; gap: 8px; margin-top: 12px; }
.row-btns .btn { flex: 1; }

.dots { display: flex; gap: 8px; margin: 10px 0 4px; }
.dot { flex: 1; height: 10px; border-radius: 5px; background: var(--line); }
.dot.on { background: var(--brand); }

.day-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.day-row:first-of-type { border-top: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -6px 0 6px; }
.top.sticky { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 8px 0; }
.top-c { text-align: center; line-height: 1.2; }
.top-c span { display: block; font-size: 13px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.ex-head { display: flex; gap: 12px; align-items: center; }
.num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 15px; }

.video { margin: 12px 0 4px; border-radius: 12px; overflow: hidden; background: #111; }
.video button { all: unset; display: block; width: 100%; aspect-ratio: 16 / 9; position: relative; cursor: pointer; background-size: cover; background-position: center; }
.video button::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,0.25); }
.video .play { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(255,255,255,0.95); color: var(--ink); border-radius: 999px; padding: 8px 16px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.video iframe { display: block; width: 100%; max-width: 300px; margin: 0 auto; aspect-ratio: 9 / 16; border: 0; }

.last { font-size: 14px; color: var(--muted); margin: 6px 0; }
.tip { font-size: 14px; padding: 8px 10px; border-radius: 10px; margin: 8px 0; }
.tip.up { background: var(--brand-soft); color: var(--brand-ink); }
.tip.hold, .tip.info { background: var(--bg); color: var(--muted); }

.set-head, .set { display: grid; grid-template-columns: 28px 1fr 1fr 48px; gap: 8px; align-items: center; }
.set-head { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 10px; }
.set-head span:nth-child(2), .set-head span:nth-child(3) { text-align: center; }
.set { margin: 8px 0; }
.sn { font-weight: 700; color: var(--muted); text-align: center; }
.set input, .field input { width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font: inherit; font-size: 18px; text-align: center; color: var(--ink); }
.set input:focus, .field input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.set input.err, .field input.err { border-color: var(--danger); background: var(--danger-soft); }
.nokg { text-align: center; font-size: 13px; color: var(--muted); }
.chk { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); font-size: 20px; font-weight: 700; color: var(--line); cursor: pointer; }
.set.done .chk { background: var(--brand); border-color: var(--brand); color: #fff; }
.set.done input { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
textarea { width: 100%; min-height: 72px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink); resize: vertical; }
.ex textarea { min-height: 44px; margin-top: 6px; }

details.card > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "+"; font-size: 22px; color: var(--muted); font-weight: 400; }
details.card[open] > summary::after { content: "–"; }
details.card[open] > summary { margin-bottom: 10px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 8px 0; }
.check input { width: 24px; height: 24px; accent-color: var(--brand); }
.badge { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; min-height: 44px; }
.chip.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input { flex: 1; accent-color: var(--brand); height: 32px; }
.range-row b { font-size: 24px; min-width: 32px; text-align: right; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.field input { text-align: left; padding: 0 14px; }
.err-msg { color: var(--danger); font-size: 14px; font-weight: 600; margin-top: 10px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat span { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 22px; }

.chart { width: 100%; height: auto; display: block; margin-top: 8px; overflow: visible; }
.chart .ct { font-size: 11px; fill: var(--muted); }
.chart .cv { font-size: 12px; fill: var(--ink); font-weight: 700; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.up-txt { color: var(--brand); font-weight: 700; font-size: 14px; white-space: nowrap; }

.hist { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.hist:first-child { border-top: 0; }

.done-hero { text-align: center; padding: 28px 0 8px; }
.done-hero .big { width: 72px; height: 72px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 36px; display: grid; place-items: center; margin: 0 auto 14px; }

.guide p, .guide li { font-size: 15px; }
.guide ul { padding-left: 20px; margin: 6px 0; }
.guide table { width: 100%; border-collapse: collapse; font-size: 14px; }
.guide td { padding: 6px 4px; border-top: 1px solid var(--line); vertical-align: top; }
.guide td:first-child { font-weight: 700; white-space: nowrap; color: var(--brand); }

#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(255,255,255,0.96); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + var(--safe-b)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
#nav .in { max-width: 480px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
#nav button { appearance: none; background: none; border: 0; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; cursor: pointer; }
#nav button svg { width: 24px; height: 24px; }
#nav button.on { color: var(--brand); }

#rest { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 0 12px calc(12px + var(--safe-b)); }
#rest .in { max-width: 456px; margin: 0 auto; background: var(--ink); color: #fff; border-radius: 18px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
#rest .in.go { background: var(--brand); }
#rest .lab { flex: 1; font-size: 14px; opacity: 0.85; }
#rest .t { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
#rest .btn { background: rgba(255,255,255,0.12); color: #fff; border-color: transparent; }
.set input::placeholder, .field input::placeholder, textarea::placeholder { color: #B4B2A9; }
