:root {
  --bg: #100f0c;
  --bg-deep: #090908;
  --card: #1b1a16;
  --card-2: #232219;
  --ink: #f3ecdf;
  --muted: #b3aa9e;
  --faint: #8a8276;
  --line: rgba(243, 236, 223, 0.1);
  --copper: #e0a15c;
  --copper-ink: #2a1c0d;
  --copper-dim: rgba(224, 161, 92, 0.14);
  --sage: #9db89a;
  --sage-dim: rgba(157, 184, 154, 0.14);
  --clay: #d4785a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --tab: 62px;
  --safe-t: env(safe-area-inset-top);
  --safe-b: env(safe-area-inset-bottom);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(224, 161, 92, 0.14), transparent 55%),
    var(--bg-deep);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
}
::selection { background: var(--copper); color: var(--copper-ink); }

.app {
  width: min(480px, 100%);
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(243, 236, 223, 0.05);
}

.top, .tabbar { flex: none; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-t)) 20px 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  font-size: 22px;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.brand svg { display: block; }
.top-sub { margin: 2px 0 0; color: var(--faint); font-size: 12px; letter-spacing: 0.08em; }
.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.main {
  flex: 1;
  overflow: auto;
  padding: 4px 20px 28px;
  overscroll-behavior: contain;
}
.main.has-dock { padding-bottom: calc(108px + var(--safe-b)); }
.main::-webkit-scrollbar { width: 0; }

.tabbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(16, 15, 12, 0.92);
  backdrop-filter: blur(16px);
  padding-bottom: var(--safe-b);
}
.tabbar button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--faint);
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.tabbar button.active { color: var(--copper); }
.tabbar svg { width: 22px; height: 22px; }

.kicker {
  margin: 0;
  color: var(--copper);
  font-size: 12px;
  letter-spacing: 0.16em;
}
.week-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.week-no { margin: 0; color: var(--faint); font-size: 12px; letter-spacing: 0.12em; }
.mini {
  width: auto;
  flex: none;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(243, 236, 223, 0.06);
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.hero.rest .mini {
  color: var(--sage);
  border-color: rgba(157, 184, 154, 0.4);
}

h1 {
  margin: 8px 0 0;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  font-size: 42px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.lede { margin: 8px 0 0; color: var(--muted); font-size: 16px; line-height: 1.5; }

.hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(224, 161, 92, 0.1), transparent 70%),
    var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px 20px 18px;
}
.hero.rest {
  background:
    linear-gradient(180deg, rgba(157, 184, 154, 0.12), transparent 72%),
    var(--card);
}
.hero.rest .kicker { color: var(--sage); }
.watermark {
  position: absolute;
  right: 8px;
  top: -18px;
  margin: 0;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 148px;
  line-height: 1;
  color: rgba(243, 236, 223, 0.05);
  pointer-events: none;
}

.bar {
  display: flex;
  height: 8px;
  margin-top: 18px;
  border-radius: 99px;
  overflow: hidden;
  background: #2a2822;
}
.bar i { display: block; height: 100%; box-shadow: -2px 0 0 #1b1a16; }
.bar i:first-child { box-shadow: none; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 99px; display: inline-block; }

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 16px 0 0;
}
.week button, .daypick button {
  border: 1px solid transparent;
  background: var(--card);
  border-radius: 14px;
  padding: 8px 0 7px;
  color: var(--muted);
}
.week button small, .daypick button small {
  display: block;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.week button strong, .daypick button strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 600;
}
.week button.on, .daypick button.on {
  background: var(--copper-dim);
  color: var(--ink);
  border-color: rgba(224, 161, 92, 0.4);
}
.pip {
  width: 5px;
  height: 5px;
  border-radius: 99px;
  margin: 5px auto 0;
  background: transparent;
}
.pip.done { background: var(--sage); }
.pip.miss { background: var(--clay); }
.pip.today { background: var(--copper); }

.section-label {
  margin: 22px 0 10px;
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.16em;
}

.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--area, #e0a15c) 22%, transparent), color-mix(in srgb, var(--area, #e0a15c) 8%, transparent) 42%, transparent 78%),
    var(--card);
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--area, #e0a15c) 28%, transparent);
}
.item.emphasis { border-color: color-mix(in srgb, var(--area, #e0a15c) 55%, transparent); }
.index {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--area, #e0a15c) 28%, #241f18);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.item h3 { margin: 0; font-size: 16px; font-weight: 600; }
.meta { margin: 3px 0 0; color: var(--faint); font-size: 12px; line-height: 1.4; }
.tag {
  justify-self: end;
  font-size: 12px;
  color: var(--faint);
  text-align: right;
}
.tag span { display: block; margin-top: 2px; }
.tag b { display: block; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--copper-dim);
  color: var(--copper);
  font-size: 11px;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

.habits {
  display: grid;
  gap: 8px;
}
.habit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 16px;
  padding: 12px 14px;
}
.habit.on { border-color: rgba(157, 184, 154, 0.45); background: var(--sage-dim); }
.habit span { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.check {
  width: 22px;
  height: 22px;
  border-radius: 99px;
  border: 1.5px solid var(--faint);
  display: grid;
  place-items: center;
  flex: none;
}
.habit.on .check { background: var(--sage); border-color: var(--sage); color: #142015; }

.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  bottom: calc(var(--tab) + var(--safe-b));
  padding: 18px 20px 8px;
  background: linear-gradient(to top, var(--bg) 62%, rgba(16, 15, 12, 0));
  z-index: 4;
}
.primary, .secondary, .texty {
  width: 100%;
  border-radius: 16px;
  padding: 15px 16px;
  border: 0;
}
.primary { background: var(--copper); color: var(--copper-ink); font-weight: 700; letter-spacing: 0.04em; }
.primary:disabled { opacity: 0.45; }
.secondary { background: var(--card-2); color: var(--ink); }
.texty { background: transparent; color: var(--muted); padding: 10px; }
.primary:active, .secondary:active { transform: translateY(1px); }

.daypick {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.banner {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--copper-dim);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.banner strong { color: var(--copper); font-weight: 600; }

.card {
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  border: 1px solid var(--line);
}
.card + .card { margin-top: 12px; }
.card h2 {
  margin: 0;
  font-size: 20px;
  font-family: "Songti SC", "Noto Serif SC", "Source Han Serif SC", serif;
  font-weight: 600;
}
.card p { color: var(--muted); line-height: 1.6; }
.quiet { color: var(--faint); font-size: 13px; line-height: 1.6; }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.slots button {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  padding: 10px 6px;
}
.slots button b { display: block; font-size: 14px; }
.slots button small { color: var(--faint); }
.slots button.on { background: var(--sage-dim); border-color: rgba(157, 184, 154, 0.5); }

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.switch button {
  width: 48px;
  height: 28px;
  border-radius: 99px;
  border: 0;
  background: #3a372f;
  position: relative;
  flex: none;
}
.switch button i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 99px;
  background: var(--ink);
  transition: transform 0.2s ease;
}
.switch button.on { background: var(--copper); }
.switch button.on i { transform: translateX(20px); }

.orb-wrap {
  height: 148px;
  display: grid;
  place-items: center;
}
.orb {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f3e2c4, #c4894a 48%, #8a5a2c 82%);
  transform: scale(1);
}
.orb.squeeze {
  background:
    radial-gradient(circle at 35% 30%, #d5e4d0, #7ea384 50%, #3d5a44 84%);
  transition: transform 0.4s ease;
}
.checkline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}
.checkline p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 0.06em; }
.stamps { display: flex; gap: 5px; }
.stamps i {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--faint);
  font-style: normal;
  font-size: 11px;
}
.stamps i.now { border-color: rgba(224, 161, 92, 0.7); color: var(--ink); }
.stamps i.on { background: var(--sage); border-color: var(--sage); color: #142015; }
.phase-name {
  margin: 0;
  text-align: center;
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 44px;
  letter-spacing: 0.18em;
}
.phase-name.inhale,
.phase-name.tight { color: var(--copper); }
.phase-name.exhale,
.phase-name.loose { color: var(--ink); }
.clock {
  margin: 4px 0 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper .num { text-align: center; }
.stepper strong {
  font-family: "Songti SC", "Noto Serif SC", serif;
  font-size: 40px;
  font-weight: 600;
}
.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 22px;
}
.protein { margin: 12px 0 0; font-size: 15px; color: var(--ink); }
.principles { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.principles article { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.numeral {
  font-family: "Songti SC", "Noto Serif SC", serif;
  color: var(--copper);
  font-size: 18px;
}
.principles h3 { margin: 0 0 4px; font-size: 16px; }
.principles p { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.chips li {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 13px;
}
.date-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.date-row input {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}

.session {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-t)) 20px calc(18px + var(--safe-b));
}
.session-top, .session-actions { display: flex; align-items: center; justify-content: space-between; }
.session-top p { margin: 0; color: var(--faint); letter-spacing: 0.12em; font-size: 12px; }
.track { height: 4px; border-radius: 99px; background: #2c2a24; margin: 16px 0 8px; overflow: hidden; }
.track i { display: block; height: 100%; background: var(--copper); }
.session-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { margin: 0; color: var(--copper); letter-spacing: 0.14em; font-size: 12px; }
.session h1 { font-size: 36px; }
.ring-box { width: 210px; height: 210px; margin: 8px auto 0; position: relative; }
.ring-box svg { width: 210px; height: 210px; transform: rotate(-90deg); }
.ring-box strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 56px;
  font-variant-numeric: tabular-nums;
  font-family: "Songti SC", "Noto Serif SC", serif;
}
.side-pill {
  align-self: flex-start;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--card-2);
  color: var(--muted);
  font-size: 13px;
}
.weight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--card);
}
.weight input {
  width: 96px;
  background: transparent;
  border: 0;
  text-align: right;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
.weight input:focus { outline: none; }
.session-actions { gap: 8px; margin-top: 18px; align-items: center; }
.session-actions .primary,
.session-actions .secondary { width: auto; flex: 1; }
.session-actions .texty {
  width: auto;
  flex: none;
  white-space: nowrap;
  padding: 12px 6px;
}

.done-list { list-style: none; padding: 0; margin: 18px 0; }
.done-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.install-ios { margin-top: 8px; }
.install-ios ol { margin: 8px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }

@media (prefers-reduced-motion: reduce) {
  .switch button i { transition: none; }
}
