:root {
  --bg: #f4f2ed;
  --card: #ffffff;
  --ink: #243033;
  --muted: #697579;
  --accent: #6e7f66;
  --accent-dark: #55654e;
  --soft: #e9eee6;
  --line: #d8ded8;
  --warn: #8d533d;
  --warn-soft: #f5e9e3;
  --ok: #3d6e58;
  --planned: #f0ece1;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(33, 46, 48, .07);
  --text-scale: 1;
}

* { box-sizing: border-box; }
html { background: #eae6df; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(#ece9e2, #f7f5f0);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: calc(19px * var(--text-scale));
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

#app-shell {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: 98px;
  box-shadow: 0 0 50px rgba(0,0,0,.08);
}

.topbar {
  padding: calc(16px + env(safe-area-inset-top)) 20px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 900; letter-spacing: .02em; }
.version { color: var(--muted); font-size: .7em; margin-top: 1px; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 23px;
}
.screen { padding: 6px 18px 34px; }

h1 { font-size: 1.78em; line-height: 1.12; margin: 10px 0 14px; }
h2 { font-size: 1.42em; line-height: 1.18; margin: 10px 0 12px; }
h3 { font-size: 1.13em; line-height: 1.25; margin: 8px 0 10px; }
p { margin: 8px 0 12px; }
.lead { font-size: 1.09em; line-height: 1.5; color: #39484b; }
.small { color: var(--muted); font-size: .88em; line-height: 1.5; }
.muted { color: var(--muted); }
.section-label {
  font-size: .73em; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted); font-weight: 900; margin-bottom: 7px;
}

.card {
  background: var(--card); border: 1px solid rgba(0,0,0,.035); border-radius: var(--radius);
  padding: 18px; margin: 13px 0; box-shadow: var(--shadow);
}
.card.soft { background: var(--soft); box-shadow: none; }
.card.compact { padding: 14px 16px; }
.card.flush { padding: 0; overflow: hidden; }

.btn {
  width: 100%; border: 0; border-radius: 16px; padding: 15px 17px; margin: 7px 0;
  min-height: 58px; font-weight: 850; font-size: 1em;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:active { background: var(--accent-dark); }
.btn.secondary { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.ghost { background: transparent; border: 1px dashed #b8c1ba; color: var(--ink); }
.btn.warn { background: var(--warn-soft); color: #713e2e; }
.btn.inline { width: auto; min-height: 44px; padding: 10px 13px; font-size: .88em; }
.btn.linkish { background: transparent; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 8px; }

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.field { margin: 13px 0; }
.field label { display: block; font-weight: 800; margin-bottom: 7px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 14px; border-radius: 14px; border: 1px solid #cdd5ce;
  background: #fff; color: var(--ink); font-size: 1em;
}
.field textarea { min-height: 104px; resize: vertical; }
.choice {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px; margin: 8px 0;
  border: 1px solid var(--line); border-radius: 15px; background: #fff;
}
.choice input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 auto; }
.choice.selected { background: #eff4ec; border-color: var(--accent); }
.choice strong { display: block; }

.bottom-nav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); background: rgba(255,255,255,.97); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3,1fr);
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); z-index: 30;
}
.bottom-nav button { border: 0; background: none; color: #657174; padding: 8px 2px; font-size: .73em; font-weight: 800; }
.bottom-nav button.active { color: var(--accent-dark); }
.nav-icon { display: block; font-size: 24px; line-height: 1.1; margin-bottom: 2px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 7px 11px; border-radius: 999px; background: var(--soft); font-size: .78em; font-weight: 800; }
.pill.ok { background: #e2f0e8; color: #356348; }
.pill.planned { background: var(--planned); color: #66592e; }

.progress-row { display: flex; gap: 7px; margin: 12px 0; }
.progress-dot { height: 13px; flex: 1; border-radius: 999px; background: #d7ddd8; }
.progress-dot.done { background: var(--accent); }

.weekday {
  display: grid; grid-template-columns: 122px 1fr; gap: 12px; padding: 18px 0; border-bottom: 1px solid #e3e7e3;
}
.weekday:last-child { border-bottom: 0; }
.dayname { font-size: 1.08em; font-weight: 900; }
.daydate { color: var(--muted); font-size: .82em; }
.event { margin: 6px 0; padding: 12px 13px; border-radius: 13px; font-size: 1.02em; line-height: 1.4; }
.event.done { background: #e5f0e9; }
.event.planned { background: var(--planned); }
.event.free { background: #edf0f3; }

.stat { display: flex; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid #e6eae6; }
.stat:last-child { border-bottom: 0; }
.stat strong { font-size: 1.08em; }
.goal { font-size: 1.28em; font-weight: 900; color: var(--accent-dark); }

.exercise-visual {
  min-height: 210px; border-radius: 20px; background: linear-gradient(145deg,#e7ece4,#f8faf7);
  display: grid; place-items: center; overflow: hidden; margin-bottom: 15px; padding: 15px;
}
.exercise-visual svg { width: 100%; max-width: 250px; height: 180px; }
.exercise-visual line, .exercise-visual circle, .exercise-visual path, .exercise-visual polyline, .exercise-visual rect {
  stroke: #526459; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; fill: none;
}
.why { border-left: 4px solid var(--accent); padding: 2px 0 2px 13px; margin: 12px 0; color: #3c4a45; }
.cue { padding: 14px; border-radius: 14px; background: #f0f3ef; }
.count { font-size: 2.7em; text-align: center; font-weight: 900; color: var(--accent-dark); margin: 9px 0; }
.timer { font-size: 2.8em; text-align: center; font-weight: 900; letter-spacing: -.03em; margin: 18px 0 10px; }
.next { margin-top: 13px; padding: 13px 15px; border-radius: 14px; background: #eef1ec; color: #55615b; }

.toast {
  position: fixed; left: 50%; bottom: 104px; transform: translateX(-50%); z-index: 60;
  background: #253034; color: #fff; padding: 12px 16px; border-radius: 13px; font-size: .78em;
  opacity: 0; pointer-events: none; transition: .25s; max-width: min(420px, calc(100% - 28px)); text-align: center;
}
.toast.show { opacity: 1; }
.overlay { position: fixed; inset: 0; background: rgba(25,35,38,.48); display: grid; place-items: end center; z-index: 50; }
.sheet {
  width: min(480px, 100%); max-height: 88vh; overflow-y: auto; background: #fff;
  border-radius: 26px 26px 0 0; padding: 20px 18px calc(28px + env(safe-area-inset-bottom));
}
.sheet h2 { margin-top: 0; }

.routine-step { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.routine-step:last-child { border-bottom: 0; }
.step-num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-weight: 900; color: var(--accent-dark); }

.summary-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.summary-box { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; }
.summary-box strong { display: block; font-size: 1.2em; }

.profile-note { border-left: 5px solid var(--accent); padding-left: 14px; }
.benefit { padding: 11px 0; border-bottom: 1px solid #e7ebe6; }
.benefit:last-child { border-bottom: 0; }

.demo-box { min-height: 230px; display: grid; place-items: center; text-align: center; border-radius: 20px; padding: 20px; background: linear-gradient(145deg,#2e393c,#4a595d); color: #fff; }
.demo-box .play { font-size: 52px; line-height: 1; margin-bottom: 9px; }

@media (max-width: 390px) {
  .weekday { grid-template-columns: 105px 1fr; }
  .three { grid-template-columns: 1fr; }
}

@media (min-width: 700px) {
  body { padding: 24px 0; }
  #app-shell { min-height: 840px; border-radius: 30px; overflow: hidden; }
  .bottom-nav { bottom: 24px; border-radius: 0 0 30px 30px; }
  .overlay { align-items: center; }
  .sheet { border-radius: 26px; max-height: 82vh; }
  .toast { bottom: 126px; }
}
