:root {
  --bg:#f7f7f5; --card:#fff; --text:#171717; --muted:#777; --line:#e7e7e2;
  --soft:#f0f0ec; --warn:#9a6515; --danger:#a33; --radius:18px;
}
* { box-sizing:border-box; }
body {
  margin:0; font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  background:var(--bg); color:var(--text); -webkit-tap-highlight-color:transparent;
}
.app { max-width:560px; margin:0 auto; min-height:100vh; padding:calc(22px + env(safe-area-inset-top)) 18px calc(90px + env(safe-area-inset-bottom)); }
header { display:flex; align-items:flex-end; justify-content:space-between; margin-bottom:24px; }
h1 { font-size:30px; margin:0 0 4px; letter-spacing:-1px; }
.sub { color:var(--muted); font-size:14px; }
button { font:inherit; cursor:pointer; touch-action:manipulation; }
button:disabled { cursor:not-allowed; opacity:.42; }
button:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline:3px solid rgba(46,107,62,.3); outline-offset:2px;
}
.btn {
  border:0; border-radius:14px; padding:13px 16px; font-weight:700; background:#171717; color:white;
}
.btn.secondary { background:var(--soft); color:var(--text); }
.btn.ghost { background:transparent; color:var(--text); padding:8px 0; }
.card {
  background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:14px;
}
.exercise-title { font-size:21px; font-weight:800; margin-bottom:6px; }
.goal { font-size:30px; font-weight:800; letter-spacing:-1px; margin:12px 0 16px; }
.row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.actions { display:flex; gap:10px; }
.pill {
  display:inline-block; background:var(--soft); border-radius:999px; padding:7px 10px; font-size:13px; color:#444;
}
.completed { color:#2e6b3e; }
.warning { color:var(--warn); }
.danger { color:var(--danger); }
.empty { text-align:center; color:var(--muted); padding:42px 10px; }
.sheet {
  position:fixed; inset:0; background:rgba(0,0,0,.28); display:none; align-items:flex-end; justify-content:center; z-index:10;
}
.sheet.show { display:flex; }
.panel {
  width:min(560px,100%); max-height:92vh; overflow:auto; background:var(--bg);
  border-radius:24px 24px 0 0; padding:20px 18px calc(30px + env(safe-area-inset-bottom)); box-shadow:0 -8px 40px rgba(0,0,0,.12);
  overscroll-behavior:contain;
}
.panel h2 { margin:0 0 4px; font-size:26px; }
.panel h3 { margin:24px 0 10px; font-size:18px; }
.close { float:right; border:0; background:var(--soft); border-radius:999px; width:38px; height:38px; font-size:20px; }
.stepper { display:grid; grid-template-columns:1fr auto auto auto; gap:10px; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); }
.count { font-size:28px; font-weight:800; min-width:48px; text-align:center; }
.side-head, .side-row {
  display:grid; grid-template-columns:72px 1fr 1fr; gap:10px; align-items:center;
}
.side-head { padding:8px 0 4px; color:var(--muted); font-size:13px; text-align:center; }
.side-head div:first-child { text-align:left; }
.side-row { padding:10px 0; border-bottom:1px solid var(--line); }
.side-cell { display:grid; grid-template-columns:auto auto auto; gap:6px; align-items:center; justify-content:center; }
.side-cell .round { width:38px; height:38px; }
.side-cell .count { font-size:24px; min-width:38px; }
.side-choice { margin-top:12px; }
.set-actions { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.set-actions .btn { width:100%; }
.set-help { margin-top:8px; }
.round { width:44px; height:44px; border-radius:50%; border:0; background:var(--soft); font-size:22px; }
.choice-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.choice {
  border:1px solid var(--line); border-radius:14px; padding:13px; background:white; text-align:center;
}
.choice.active { border-color:#171717; box-shadow:inset 0 0 0 1px #171717; font-weight:800; }
textarea {
  width:100%; min-height:76px; resize:vertical; border:1px solid var(--line); border-radius:14px; padding:12px; font:inherit; background:white;
}
.checkbox { display:flex; gap:10px; align-items:center; margin:14px 0; }
.checkbox input { width:20px; height:20px; }
details { border-top:1px solid var(--line); padding:14px 0; }
summary { font-weight:800; cursor:pointer; }
ul,ol { padding-left:22px; line-height:1.65; }
.setup-list { display:grid; gap:10px; margin-top:16px; }
.setup-item {
  background:white; border:1px solid var(--line); border-radius:14px; padding:14px;
  display:grid; grid-template-columns:1fr 150px; align-items:center; gap:10px;
}
.plan-series-card {
  background:white; border:1px solid var(--line); border-radius:16px; padding:15px; margin-bottom:12px;
}
.plan-series-head {
  display:grid; grid-template-columns:1fr 150px; align-items:center; gap:12px;
}
.weekdays { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.day-check input { display:none; }
.day-check span {
  display:flex; align-items:center; justify-content:center; width:38px; height:38px;
  border:1px solid var(--line); border-radius:50%; background:white; font-size:13px; font-weight:700;
}
.day-check input:checked + span { background:#171717; color:white; border-color:#171717; }
select { width:100%; border:1px solid var(--line); border-radius:12px; padding:10px; background:white; font:inherit; }
.plan-row { padding:12px 0; border-bottom:1px solid var(--line); }
.notice { background:#fff8e7; border:1px solid #f1dfab; border-radius:14px; padding:14px; margin:12px 0; }
.recovery { background:#fff3f3; border-color:#efcccc; }
.small { font-size:13px; color:var(--muted); line-height:1.55; }
.local-data-note {
  margin-top:12px; padding:11px 12px; border-radius:12px; background:#edf5ef; color:#2e6b3e; font-size:13px; line-height:1.5;
}
.install-card {
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  background:#edf5ef; border:1px solid #cfe2d3; border-radius:16px; padding:14px; margin-bottom:14px;
}
.install-card strong { display:block; margin-bottom:4px; }
.install-button { flex:0 0 auto; padding:11px 16px; }
.offline-status {
  position:fixed; top:calc(8px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%); z-index:30;
  width:max-content; max-width:calc(100% - 28px); padding:9px 13px; border-radius:999px;
  background:#171717; color:white; font-size:12px; font-weight:700; box-shadow:0 6px 24px rgba(0,0,0,.16);
}
.offline-status[hidden] { display:none; }
.bottom-nav {
  position:fixed; bottom:0; left:0; right:0; background:rgba(247,247,245,.94); backdrop-filter:blur(14px);
  border-top:1px solid var(--line); padding:10px 18px max(10px,env(safe-area-inset-bottom));
}
.bottom-nav .inner { max-width:560px; margin:auto; display:flex; justify-content:space-around; }
.navbtn { flex:1; min-width:0; min-height:44px; border:0; background:transparent; color:#666; font-weight:700; padding:8px 6px; }
.navbtn.active { color:#111; }
@media (max-width:420px) {
  .setup-item, .plan-series-head { grid-template-columns:1fr 130px; }
  .actions { flex-direction:column; }
  .set-actions { grid-template-columns:1fr; }
}
@media (display-mode:standalone) {
  body { min-height:100svh; }
}
