/* Shared components: text styles, cards, buttons, inputs, tab bar, timer, toast, sheet. */

/* ---- text ---- */
.eyebrow { font-size: 0.76rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); font-weight: 650; }
.lede { color: var(--muted); max-width: 60ch; }
.meta { color: var(--muted); font-size: 0.88rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.page-head { display: flex; flex-direction: column; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.bullets { margin: 8px 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }

/* ---- cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.warn-card { border-left: 5px solid var(--warn); }
.warn-card h3 { color: var(--warn); }

/* ---- chips and pills ---- */
.chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}
.chip.ok { color: var(--ok); }
.pill { background: var(--surface-2); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-weight: 600; font-size: 0.85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}
.chip-btn:active { background: var(--surface-2); }

/* ---- buttons ---- */
.btn-main {
  appearance: none;
  border: 0;
  border-radius: var(--radius);
  min-height: 54px;
  padding: 0 18px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-sec {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  min-height: 44px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
}
.btn-sec.danger { color: var(--warn); }
.btn-small {
  appearance: none;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.arm { border-color: var(--warn) !important; color: var(--warn) !important; }
.link-btn {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  font-weight: 650;
  font-size: 0.92rem;
  color: var(--accent-ink);
  cursor: pointer;
  align-self: flex-start;
}
.link { color: var(--accent-ink); font-weight: 650; }
a.link-btn { text-decoration: none; display: inline-block; }
.as-link { display: flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
.text-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.warn-text { color: var(--warn); }
.icon-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- inputs ---- */
.input {
  width: 100%;
  min-height: 46px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 0 12px;
  font-size: 1.05rem;
}
.input:focus { outline: none; border-color: var(--accent); }
.field-col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-col > span { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }

/* ---- small shapes ---- */
.pips { display: flex; gap: 5px; }
.pip { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); }
.pip.on { background: var(--ok); border-color: var(--ok); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); flex: none; }
.table-wrap { overflow-x: auto; }

/* ---- tab bar ---- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.tabbar a {
  height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[href="#more"] svg { stroke-width: 3.4; }
.tabbar a[aria-current="page"] { color: var(--accent-ink); }
.tabbar a[aria-current="page"] svg { stroke: var(--accent); }

/* ---- rest timer (above the tab bar) ---- */
.timer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  background: var(--ink);
  color: var(--bg);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
}
.timer-in { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; }
.t-label { font-size: 0.76rem; letter-spacing: 0.09em; text-transform: uppercase; opacity: 0.75; font-weight: 650; }
.t-time { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.timer.done .t-time { color: var(--accent); }
.t-btns { display: flex; gap: 8px; }
.t-btns button {
  appearance: none;
  background: transparent;
  color: var(--bg);
  border: 1.5px solid var(--bg);
  border-radius: 10px;
  height: 44px;
  padding: 0 14px;
  font-weight: 650;
  cursor: pointer;
}
.t-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--muted); overflow: hidden; }
.t-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left center; }
.t-next { grid-column: 1 / -1; font-size: 0.88rem; opacity: 0.88; }

/* ---- toast ---- */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 16px;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  width: max-content;
  max-width: calc(100% - 32px);
  display: flex;
  align-items: center;
  gap: 12px;
}
body.timing .toast { bottom: calc(var(--tabbar-h) + 140px + env(safe-area-inset-bottom, 0px)); }
.toast-action {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  cursor: pointer;
}

/* ---- bottom sheet ---- */
dialog.sheet {
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
@media (min-width: 620px) { dialog.sheet { margin: auto; border-radius: 18px; } }
.sheet-in {
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sheet-in > *, .sheet-body > * { flex-shrink: 0; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: sticky;
  top: -14px;
  background: var(--surface);
  padding-block: 6px 8px;
  margin-top: -6px;
  z-index: 1;
}
.sheet-top h2 { font-size: 1.7rem; }
.x {
  appearance: none;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
}
.sheet-h { font-size: 1.15rem; color: var(--accent-ink); }

/* exercise sheet content */
.anim {
  position: relative;
  margin: 0;
  width: 100%;
  aspect-ratio: 3 / 2;
  flex: none;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
}
.anim img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity 0.25s; }
.anim .f1 { opacity: 0; }
.anim.end .f1 { opacity: 1; }
.anim figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.68);
  color: #FFFFFF; /* always on a photo */
  font-size: 0.8rem;
  font-weight: 650;
  padding: 3px 10px;
  border-radius: 999px;
}
.what { max-width: 62ch; }
.works { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.88rem; color: var(--muted); }
.steps { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 8px; max-width: 62ch; }
.steps li::marker { color: var(--accent-ink); font-weight: 700; }
.avoid { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-width: 62ch; }
.avoid li { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr); }
.avoid li::before { content: "\2715"; color: var(--warn); font-weight: 700; }
.note { font-size: 0.88rem; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
