/* Overload: mobile-first styles. Colors are tokens; dark mode redefines them (contrast-checked). */

:root {
  color-scheme: light;
  --bg: #f2f3f6;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --surface-3: #e8ebf0;
  --line: #e2e5ea;
  --text: #101318;
  --text-2: #3f4753;
  --muted: #646e7c;
  --accent: #1d63e0;
  --accent-bg: #1d63e0;
  --accent-soft: #e7eefc;
  --good: #0e7136;
  --good-bg: #16884a;
  --good-soft: #e2f4e8;
  --warn: #9a5300;
  --warn-soft: #fcefdc;
  --bad: #c62a24;
  --bad-bg: #c62a24;
  --seg-on: #ffffff;
  --on-fill: #ffffff;
  --shadow: 0 1px 2px rgb(16 19 24 / 0.05), 0 2px 10px rgb(16 19 24 / 0.05);
  --radius: 16px;
  --tabbar: 58px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b0d11;
    --surface: #15181e;
    --surface-2: #1b1f26;
    --surface-3: #252a33;
    --line: #2a303a;
    --text: #f1f3f6;
    --text-2: #bcc3cd;
    --muted: #8a93a1;
    --accent: #6aa6ff;
    --accent-bg: #2f6fe4;
    --accent-soft: #18263d;
    --good: #3ecf74;
    --good-bg: #1a7a42;
    --good-soft: #15301f;
    --warn: #ffaa3d;
    --warn-soft: #33250f;
    --bad: #ff6b61;
    --bad-bg: #c93a32;
    --seg-on: #3a414c;
    --shadow: none;
  }
}

/* ---- Base ---------------------------------------------------------------------------- */

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ol, ul { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabular { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 14px; }
.hint.warn { color: var(--warn); }
.splash { min-height: 100dvh; }

.page {
  max-width: 600px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--tabbar) + var(--safe-b) + 96px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---- Headers & sections -------------------------------------------------------------- */

.head { display: flex; flex-direction: column; gap: 2px; padding: 8px 2px 4px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; min-width: 0; overflow-wrap: anywhere; }
.head-sub { color: var(--muted); font-size: 15px; }
.head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.back {
  display: inline-flex; align-items: center; gap: 2px; align-self: flex-start;
  margin: 0 0 2px -8px; padding: 6px 8px 6px 4px; border: 0; border-radius: 8px;
  background: none; color: var(--accent); font-size: 16px;
}
.section-label {
  margin: 10px 4px 0;
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
section > .section-label { margin-bottom: 8px; }
.picker .section-label { margin: 6px 4px 2px; }

/* ---- Cards, lists, rows --------------------------------------------------------------- */

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.card-title { font-size: 17px; font-weight: 700; }
.list { display: flex; flex-direction: column; gap: 10px; }
.list-card { padding: 0 0 0 16px; overflow: hidden; }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 56px; padding: 10px 14px 10px 0;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
}
.row:last-child { border-bottom: 0; }
a.row:active, button.row:active { opacity: 0.7; }
.row > .icon:last-child { color: var(--muted); flex-shrink: 0; }
.row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row-date { display: flex; flex-direction: column; align-items: center; width: 40px; flex-shrink: 0; }
.row-day { font-size: 20px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.row-wd { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.row-n { width: 22px; flex-shrink: 0; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-create { color: var(--accent); font-weight: 600; gap: 8px; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 16px; text-align: center; }
.empty h2 { font-size: 20px; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-3); color: var(--text-2); }

/* ---- Buttons --------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border: 0; border-radius: 12px;
  font-size: 16px; font-weight: 600; white-space: nowrap;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--accent-bg); color: var(--on-fill); }
.btn-secondary { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--bad-bg); color: var(--on-fill); }
.btn-ghost { background: none; color: var(--text-2); }
.btn-text { background: none; color: var(--accent); min-height: 40px; padding: 0 8px; }
.btn-text-danger { background: none; color: var(--bad); }
.btn-sm { min-height: 38px; padding: 0 14px; border-radius: 10px; font-size: 15px; }
.btn-block { width: 100%; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.row-actions .btn { flex: 1 1 auto; }

.icon-btn {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; color: var(--text-2);
}
.icon-btn:active { background: var(--surface-3); }
.icon-btn:disabled { opacity: 0.3; }

/* ---- Badges & tags ---------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 14px; font-weight: 700; white-space: nowrap;
}
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.tag {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.tag-good { background: var(--good-soft); color: var(--good); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }

/* ---- Forms ------------------------------------------------------------------------------- */

.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.form-row > span:first-child { font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
input[type="text"], input[type="search"], input[type="date"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font-size: 16px; /* 16px stops iOS zooming into the field */
}
textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.search {
  display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px;
  border-radius: 12px; background: var(--surface-3); color: var(--muted);
}
.search input { flex: 1; min-width: 0; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); }
.search input:focus { box-shadow: none; }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }

/* Number field with −/+ */
.num { display: flex; align-items: stretch; height: 46px; min-width: 0; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.num input {
  flex: 1; width: 100%; min-width: 0; padding: 0; border: 0; background: none;
  text-align: center; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.num input:focus { outline: none; box-shadow: none; }
.num input::placeholder { color: var(--muted); font-size: 14px; font-weight: 500; }
.num:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.num-btn { width: 30px; flex-shrink: 0; padding: 0; border: 0; background: none; color: var(--text-2); font-size: 22px; line-height: 1; }
.num-btn:active { background: var(--line); }

.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); max-width: 100%; overflow-x: auto; }
.seg button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 14px; font-weight: 600; white-space: nowrap; }
.seg button.on { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.toggle-text { display: flex; flex-direction: column; }
.toggle-text small { color: var(--muted); font-size: 13px; }
.switch {
  position: relative; flex-shrink: 0; width: 51px; height: 31px; margin: 0;
  border-radius: 16px; background: var(--surface-3); appearance: none; -webkit-appearance: none;
  transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / 0.25); transition: transform 0.2s;
}
.switch:checked { background: var(--good-bg); }
.switch:checked::after { transform: translateX(20px); }

.prose { display: flex; flex-direction: column; gap: 10px; color: var(--text-2); }
.prose strong { color: var(--text); }
.prose ul { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---- Stats -------------------------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stat-v { font-size: 22px; font-weight: 700; }
.stat-l { font-size: 13px; color: var(--muted); }

.records-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 12px; }
.rec { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rec-l { font-size: 13px; font-weight: 600; color: var(--muted); }
.rec-v { font-size: 20px; font-weight: 700; }
.rec-s { font-size: 13px; color: var(--muted); }

/* ---- Train (home) ------------------------------------------------------------------------- */

.resume { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; text-align: left; }
.resume-dot { width: 10px; height: 10px; flex-shrink: 0; border-radius: 50%; background: var(--good-bg); box-shadow: 0 0 0 4px var(--good-soft); }
.resume-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.resume-text small { color: var(--muted); font-size: 14px; }

.routine { display: flex; align-items: center; gap: 4px; padding: 0; }
.routine-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px;
  padding: 14px 0 14px 16px; border: 0; background: none; text-align: left;
}
.routine-top { display: flex; align-items: center; gap: 8px; }
.routine-name { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.routine-ex { color: var(--text-2); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.routine-last { color: var(--muted); font-size: 13px; }
.routine-side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px 10px 0; }

.welcome { display: flex; flex-direction: column; gap: 14px; }
.welcome h2 { font-size: 22px; }
.welcome > p { color: var(--text-2); }
.plans { display: flex; flex-direction: column; gap: 10px; }
.plan {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left;
}
.plan:active { border-color: var(--accent); }
.plan-name { font-size: 17px; font-weight: 700; }
.plan-blurb { color: var(--text-2); font-size: 14px; }
.plan-routines { color: var(--accent); font-size: 13px; font-weight: 600; }

/* ---- Workout ------------------------------------------------------------------------------- */

.wk-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  margin: calc(-1 * (var(--safe-t) + 12px)) -16px 0;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--line);
}
.wk-title { flex: 1; min-width: 0; }
.wk-name { width: 100%; min-height: 0; padding: 2px 6px; margin-left: -6px; border: 0; border-radius: 8px; background: none; font-size: 22px; font-weight: 700; }
.wk-name:focus { box-shadow: none; background: var(--surface-3); }
.wk-meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }

.entry { display: flex; flex-direction: column; gap: 12px; padding: 14px 12px; }
.entry-head { display: flex; align-items: center; gap: 8px; padding-left: 4px; flex-wrap: wrap; }
.entry-name { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.entry-name.link { color: var(--text); }
.entry-head .icon-btn { margin: -6px -4px -6px 0; }
.entry-foot { display: flex; justify-content: space-between; gap: 8px; }

.coach { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.coach-card { display: flex; flex-direction: column; gap: 8px; }
.coach-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.coach-target { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.coach-why { color: var(--text-2); font-size: 14px; }
.coach-last { color: var(--muted); font-size: 13px; }

.sets { display: flex; flex-direction: column; gap: 6px; }
.set-row {
  display: grid; grid-template-columns: 24px minmax(0, 1.35fr) minmax(0, 1fr) 48px;
  align-items: center; gap: 6px; padding: 4px; border-radius: 12px;
}
.set-row-edit { grid-template-columns: 24px minmax(0, 1.35fr) minmax(0, 1fr) 40px; }
.set-head { padding-top: 0; padding-bottom: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.set-head span { text-align: center; }
.set-n { text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.set-row.done { background: var(--good-soft); }
.set-row.done .set-n { color: var(--good); }
.set-row.done .num { background: var(--surface); }

.check {
  display: grid; place-items: center; width: 48px; height: 46px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted);
}
.check.on { border-color: var(--good-bg); background: var(--good-bg); color: var(--on-fill); }

.effort { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; }
.effort-q { font-size: 14px; font-weight: 600; color: var(--text-2); }
.effort-q small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.effort-opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: center; padding: 8px 4px;
  border: 1.5px solid var(--line); border-radius: 12px; background: none; font-weight: 600;
}
.chip small { font-size: 12px; font-weight: 400; color: var(--muted); }
.chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip.on small { color: var(--accent); }

.logged { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.logged li { display: flex; gap: 12px; align-items: baseline; padding: 2px 4px; }
.logged .set-n { width: 20px; }
.notes { white-space: pre-wrap; margin-top: 4px; }

.summary { align-items: stretch; }
.summary-icon { align-self: center; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--good-bg); color: var(--on-fill); }
.records { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--good-soft); color: var(--good); }
.records span { color: var(--text); }

/* ---- Rest timer ---------------------------------------------------------------------------- */

.restbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + var(--safe-b) + 8px);
  width: min(576px, calc(100% - 24px));
  display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; overflow: hidden;
  border-radius: 16px; background: var(--text); color: var(--bg);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.25);
}
.restbar.over { background: var(--good-bg); color: var(--on-fill); }
.rest-progress { position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: var(--accent); transform-origin: left; }
.restbar.over .rest-progress { display: none; }
.rest-text { display: flex; align-items: baseline; gap: 8px; margin-right: auto; }
.rest-label { font-size: 14px; opacity: 0.8; }
.rest-time { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.restbar button {
  min-width: 48px; height: 40px; padding: 0 10px; border: 0; border-radius: 10px;
  background: rgb(127 127 127 / 0.25); color: inherit; font-size: 15px; font-weight: 600;
}

/* ---- Tab bar --------------------------------------------------------------------------------- */

.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + var(--safe-b));
  padding: 0 max(0px, calc((100% - 600px) / 2)) var(--safe-b);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.tab.on { color: var(--accent); }
.tab-dot { position: absolute; top: 7px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--good-bg); border: 2px solid var(--surface); }

/* ---- Sheets, toasts, banners --------------------------------------------------------------- */

.backdrop {
  position: fixed; z-index: 50; inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgb(0 0 0 / 0.45); animation: fade 0.15s ease;
}
.sheet {
  width: min(600px, 100%); max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(16px + var(--safe-b));
  border-radius: 20px 20px 0 0; background: var(--surface); animation: rise 0.2s ease;
}
.sheet::before { content: ""; display: block; width: 36px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--surface-3); }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-head { position: sticky; top: -8px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; background: var(--surface); }
.sheet-title { font-size: 20px; font-weight: 700; }
.sheet-text { color: var(--text-2); }
.sheet-actions { display: flex; flex-direction: column; gap: 6px; }
.menu { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 4px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 17px;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item .icon { color: var(--text-2); }
.menu-item.danger, .menu-item.danger .icon { color: var(--bad); }

.picker { display: flex; flex-direction: column; gap: 10px; }
.pick { padding-left: 4px; }
.pick-mark { display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 50%; }
.pick.on .pick-mark { border-color: var(--accent-bg); background: var(--accent-bg); color: var(--on-fill); }

.toasts {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar) + var(--safe-b) + 72px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast { padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); font-size: 15px; font-weight: 600; box-shadow: 0 8px 24px rgb(0 0 0 / 0.2); animation: rise 0.2s ease; }

.banner {
  position: fixed; z-index: 40; top: calc(var(--safe-t) + 8px); left: 50%; transform: translateX(-50%);
  width: min(576px, calc(100% - 24px));
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 14px;
  border-radius: 14px; background: var(--text); color: var(--bg); font-size: 15px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
}
.banner .btn-text { color: inherit; text-decoration: underline; }
.banner-error { background: var(--bad-bg); color: var(--on-fill); }

/* ---- Chart ----------------------------------------------------------------------------------- */

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline-offset: 4px; border-radius: 8px; }
.chart-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-height: 48px; margin-bottom: 6px; }
.chart-readout strong { font-size: 24px; font-weight: 700; }
.chart-readout span { color: var(--muted); font-size: 14px; }
.chart-change { flex-basis: 100%; }
.chart-grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-area { fill: var(--accent); opacity: 0.1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-empty { padding: 20px 0; color: var(--muted); font-size: 14px; text-align: center; }

/* ---- Narrow phones (iPhone SE and similar) ------------------------------------------------- */

@media (max-width: 360px) {
  .page { padding-left: 10px; padding-right: 10px; }
  .wk-head { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
  .entry { padding: 12px 8px; }
  .set-row { grid-template-columns: 18px minmax(0, 1.35fr) minmax(0, 1fr) 42px; gap: 4px; padding: 3px 2px; }
  .set-row-edit { grid-template-columns: 18px minmax(0, 1.35fr) minmax(0, 1fr) 36px; }
  .num-btn { width: 24px; }
  .check { width: 42px; }
  .head h1 { font-size: 26px; }
}

@keyframes rise { from { transform: translateY(24px); opacity: 0.6; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
