:root {
  --ink: #17332d;
  --muted: #60716d;
  --paper: #f4f6f1;
  --card: #ffffff;
  --green: #17624f;
  --green-dark: #0f493b;
  --green-soft: #dcebe5;
  --amber: #f2c46d;
  --amber-soft: #fff4dc;
  --red: #b62929;
  --red-soft: #fde9e7;
  --line: #d9e1dc;
  --shadow: 0 10px 28px rgba(20, 54, 45, .09);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% -5%, #dbe9df 0 20%, transparent 38%),
    var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  line-height: 1.5;
}
button, input { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 18px calc(92px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(30px, 9vw, 44px); line-height: 1.12; }
h2 { margin-bottom: 10px; font-size: 28px; line-height: 1.2; }
h3 { margin-bottom: 8px; font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.center { text-align: center; }

.hero {
  padding: 26px 4px 18px;
}
.hero-copy { max-width: 520px; color: var(--muted); }

.card {
  margin: 14px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.card.compact { padding: 16px; border-radius: 18px; }
.card.alert { border-color: #efc8c4; background: var(--red-soft); }
.card.tip { border-color: #ecd49a; background: var(--amber-soft); }
.card.soft { background: var(--green-soft); box-shadow: none; }

.status-line, .meta-row, .button-row, .counter-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-line, .meta-row { justify-content: space-between; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2b936f; }

.timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}
.timeline-step {
  padding: 12px 8px;
  border-radius: 14px;
  background: #eef2ee;
  text-align: center;
}
.timeline-step strong { display: block; font-size: 17px; }
.timeline-step span { color: var(--muted); font-size: 13px; }

.btn {
  width: 100%;
  min-height: 58px;
  padding: 13px 18px;
  border: 0;
  border-radius: 17px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--green-soft); color: var(--green-dark); }
.btn.ghost { border: 1px solid var(--line); background: white; color: var(--ink); }
.btn.danger { background: var(--red); }
.btn.text { width: auto; min-height: 44px; padding: 8px 12px; background: transparent; color: var(--green); }
.btn.small-btn { width: auto; min-height: 48px; padding: 10px 16px; }
.button-row { margin-top: 14px; }
.button-row > * { flex: 1; }

.safety-strip {
  margin: 12px 0 20px;
  padding: 12px;
  border-radius: 14px;
  background: #17332d;
  color: white;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
}

.nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 720px);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(12px);
}
.nav button {
  min-height: 54px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.nav button.active { background: var(--green-soft); color: var(--green-dark); }

.check-list { display: grid; gap: 12px; margin: 18px 0; }
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.check-item input { width: 23px; height: 23px; margin-top: 2px; accent-color: var(--green); }

.timer {
  margin: 12px 0;
  color: var(--green-dark);
  font-size: clamp(58px, 19vw, 94px);
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.04em;
}
.timer.resting { color: #9c5b00; }
.phase-progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #dfe6e1;
}
.phase-progress > span { display: block; height: 100%; background: var(--green); transition: width .3s linear; }

.diagram {
  margin: 14px 0;
  overflow: hidden;
  border-radius: 18px;
  background: #eef4f0;
}
.exercise-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 7px;
  background: #dce7e1;
}
.visual-panel {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border-radius: 13px;
  background: white;
}
.visual-panel img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 640 / 675;
  object-fit: cover;
}
.visual-panel span {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 73, 59, .9);
  color: white;
  font-size: 13px;
  font-weight: 800;
}
.cue-grid { display: grid; gap: 8px; }
.cue {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.cue:last-child { border: 0; }
.cue strong { color: var(--green); font-size: 15px; }

.exercise-list { display: grid; gap: 12px; }
.exercise-card {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  color: var(--ink);
  text-align: left;
}
.exercise-index {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 850;
}
.exercise-card strong, .exercise-card span { display: block; }
.exercise-card span { color: var(--muted); font-size: 14px; }

.input-group { margin: 12px 0; }
.input-group label { display: block; margin-bottom: 6px; font-size: 15px; font-weight: 800; }
.input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid #bfcac4;
  border-radius: 14px;
  background: white;
  color: var(--ink);
}
.counter-row { justify-content: center; margin: 18px 0; }
.counter-row button {
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 28px;
}
.counter-value { min-width: 70px; text-align: center; font-size: 36px; font-weight: 850; }

.progress-label { display: flex; justify-content: space-between; margin: 8px 0; font-size: 14px; color: var(--muted); }
.session-progress { height: 7px; overflow: hidden; border-radius: 99px; background: #dfe6e1; }
.session-progress span { display: block; height: 100%; background: var(--green); }

.danger-link {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  border: 1px solid #e5aaa4;
  border-radius: 16px;
  background: white;
  color: var(--red);
  font-weight: 850;
}
.emergency-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 18px auto;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 38px;
  font-weight: 900;
}
.symptoms { padding-left: 23px; }
.symptoms li { margin: 8px 0; }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(94px + env(safe-area-inset-bottom));
  width: min(calc(100% - 32px), 500px);
  padding: 14px 16px;
  transform: translateX(-50%);
  border-radius: 15px;
  background: #102b24;
  color: white;
  box-shadow: var(--shadow);
  text-align: center;
}
.toast button {
  margin-left: 12px;
  border: 0;
  background: transparent;
  color: #91dfc1;
  font-weight: 850;
}

.history-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.history-row:last-child { border: 0; }
.empty { padding: 46px 14px; color: var(--muted); text-align: center; }
.tag { display: inline-block; margin: 3px 4px 3px 0; padding: 5px 9px; border-radius: 99px; background: #edf2ee; font-size: 13px; }

@media (min-width: 620px) {
  .app-shell { padding-left: 28px; padding-right: 28px; }
  .exercise-list { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
