:root {
  --bg: #F6F5F1;
  --card: #FFFFFF;
  --ink: #1F2A30;
  --muted: #5B6970;
  --teal: #2F7F7A;
  --teal-soft: #E3EFEC;
  --amber: #D99A2B;
  --amber-soft: #FBF0DA;
  --red: #B5473A;
  --red-soft: #F6E1DD;
  --line: #E2E0D8;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}
h1 { font-size: 1.35rem; margin: 0; line-height: 1.3; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
p { margin: 8px 0; }
a { color: var(--teal); }
.loading, .muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; min-height: 48px; }
.bar .back, .bar .icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); font-size: 1.3rem; flex: none;
}
.bar h1 { flex: 1; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 116px; padding: 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.tile .sym { font-size: 1.7rem; line-height: 1; }
.tile small { font-weight: 400; color: var(--muted); font-size: 0.85rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
a.card { display: block; color: var(--ink); text-decoration: none; }
.card.amber { background: var(--amber-soft); border-color: var(--amber); }
.card.red { background: var(--red-soft); border-color: var(--red); }
.card.teal { background: var(--teal-soft); border-color: var(--teal); }
.big { font-size: 1.4rem; font-weight: 700; line-height: 1.35; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 12px 16px; margin: 10px 0;
  border-radius: 14px; border: 0; cursor: pointer;
  background: var(--teal); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; text-align: center;
}
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.amber { background: var(--amber); color: #1F2A30; }
.btn.danger { background: var(--card); color: var(--red); border: 1px solid var(--red); }
.btn:disabled { opacity: 0.55; cursor: default; }
.row { display: flex; gap: 10px; }
.row .btn { flex: 1; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, textarea, select {
  width: 100%; font: inherit; color: var(--ink);
  padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, .btn:focus-visible, .tile:focus-visible, a:focus-visible {
  outline: 3px solid var(--amber); outline-offset: 2px;
}

.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a, .list button.item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; padding: 14px 4px; min-height: 56px;
  background: none; border: 0; font: inherit; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.list .meta { color: var(--muted); font-size: 0.9rem; }

ol.steps { padding-left: 1.4em; }
ol.steps li { margin: 8px 0; }
ol.steps li.done { color: var(--muted); text-decoration: line-through; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 10px 14px; font: inherit; font-size: 0.95rem; cursor: pointer; color: var(--ink);
}

.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; background: var(--teal); width: 0; transition: width .3s; }

.error { color: var(--red); font-weight: 600; }

/* Breathing */
.breath-wrap { display: flex; flex-direction: column; align-items: center; padding: 24px 0; }
.breath {
  width: 200px; height: 200px; border-radius: 50%;
  background: var(--teal-soft); border: 4px solid var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700; text-align: center;
  transform: scale(0.6); transition-property: transform; transition-timing-function: ease-in-out;
}
.breath.in { transform: scale(1); }
.breath.hold { }
.breath.out { transform: scale(0.6); }

/* Voice meter */
.meter { position: relative; height: 40px; border-radius: 12px; background: var(--line); overflow: hidden; margin: 16px 0 6px; }
.meter .zone { position: absolute; top: 0; bottom: 0; background: var(--teal-soft); border-left: 2px solid var(--teal); border-right: 2px solid var(--teal); }
.meter .level { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--teal); opacity: .75; }
.meter-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  .breath { transition-duration: 0s !important; }
  .progress span { transition: none; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
