/* Colors measured from the School UI mockup; type and states from the UI Kit. */
:root {
  --primary: #07332f;      /* header, buttons, active switch */
  --nav: #1d322f;          /* bottom bar, dark image panels */
  --splash: #023330;
  --bg: #f9f5f0;           /* page */
  --card: #fcf8f3;         /* cards */
  --light-gray: #eae6e0;   /* switch track, image placeholders */
  --line: #e4e0d8;         /* borders, dividers */
  --track: #d1cac6;        /* progress track */
  --text: #0e1412;
  --text-2: #55574f;
  --success: #2e8b57;
  --success-soft: #e6f1ea;
  --warning: #e4a11b;
  --warning-soft: #f8ecd3;
  --error: #d9534f;
  --error-soft: #f8e6e4;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --tabbar-h: 64px;
  --gutter: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

a { color: var(--primary); }
img { max-width: 100%; }

/* ---------- Opening screen ---------- */
.splash {
  position: fixed; inset: 0; z-index: 100;
  background: var(--splash);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
  transition: opacity .35s ease;
}
.splash.is-hidden { opacity: 0; pointer-events: none; }
.splash-lockup { display: flex; align-items: center; gap: 18px; }
.splash-mark { width: 88px; height: 88px; border-radius: 50%; display: block; }
.wordmark {
  color: #f3f0ea; font-weight: 800; text-transform: uppercase;
  font-size: 17px; line-height: 1.25; letter-spacing: .16em;
}
.splash-bar { width: 120px; height: 5px; border-radius: 99px; background: rgba(255,255,255,.15); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 0; background: #f3f0ea; border-radius: 99px; animation: load 1.1s ease forwards; }
@keyframes load { to { width: 100%; } }

/* ---------- Page & type ---------- */
.page { max-width: 480px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) var(--gutter) 28px; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -.4px; line-height: 1.2; margin: 6px 4px 18px; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.1px; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.3; }
.lead { color: var(--text-2); margin: -10px 4px 18px; font-size: 14px; }
.muted { color: var(--text-2); margin: 3px 0; font-size: 13px; }
.tiny { font-size: 12px; color: var(--text-2); margin: 2px 0; }
.center { text-align: center; margin-top: 24px; }
.state-msg { color: var(--text-2); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 26px 4px 10px; }
.section-title > span { color: var(--text-2); font-size: 12px; }
.view-all { font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }

/* Top app bar (detail screens) */
.appbar { display: flex; align-items: center; gap: 6px; margin: -10px -6px 10px; min-height: 48px; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  color: var(--text); text-decoration: none; flex: none;
}
.icon-btn:hover { background: var(--light-gray); }
.icon-btn svg, .ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.appbar-title { font-weight: 600; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Switch tabs (Modules / Completed …) ---------- */
.segmented {
  display: flex; gap: 4px; padding: 3px; margin: 0 0 6px;
  background: var(--light-gray); border-radius: var(--radius-sm);
}
.seg {
  flex: 1; font: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  height: 34px; border: 0; border-radius: var(--radius-xs); background: transparent; cursor: pointer;
}
.seg.is-active { background: var(--primary); color: #fff; font-weight: 600; }

/* ---------- Cards ---------- */
.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 12px; overflow: hidden;
}
.state-card { padding: 24px 20px; text-align: center; }
.state-card .ic { width: 36px; height: 36px; color: var(--text-2); margin-bottom: 6px; }
.state-card .btn { margin-top: 10px; }

.stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; color: var(--text); font-size: 13px; }
.stats li { display: inline-flex; align-items: center; gap: 6px; }
.stats .ic { width: 16px; height: 16px; }

/* Featured workout (Train) */
.feature { padding: 10px; }
.feature-top { display: flex; gap: 16px; text-decoration: none; color: inherit; }
.feature-thumb {
  flex: none; width: 104px; height: 136px; border-radius: var(--radius-xs); overflow: hidden;
  background: var(--light-gray); display: grid; place-items: center; color: var(--text-2);
}
.feature-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature-info { min-width: 0; padding-top: 14px; }
.feature-info h2 { font-size: 19px; margin: 6px 0 2px; }
.feature-actions { display: flex; gap: 10px; margin-top: 12px; }
.feature-actions .btn-primary { flex: 1; }

/* Today's Workout (Home) */
.today-card { display: flex; padding: 0; }
.today-thumb { flex: none; width: 92px; background: var(--nav); overflow: hidden; }
.today-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .9; }
.today-body { flex: 1; min-width: 0; padding: 14px 14px 12px 18px; }
.today-body h2 { font-size: 17px; }
.today-body .btn { width: 100%; margin-top: 12px; }

/* Continue Learning (Home) */
.continue-card { display: flex; gap: 14px; padding: 8px; text-decoration: none; color: inherit; box-shadow: 0 8px 24px rgba(7, 51, 47, .12); }
.continue-thumb { flex: none; width: 150px; height: 154px; border-radius: var(--radius-xs); overflow: hidden; background: var(--light-gray); }
.continue-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.continue-body { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 10px 6px 4px 0; }
.continue-body h3 { font-size: 16px; line-height: 1.3; }
.continue-body .tiny { margin: 6px 0; }
.continue-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.mini-track { flex: 1; max-width: 80px; height: 4px; border-radius: 99px; background: var(--track); overflow: hidden; }
.mini-track span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.continue-foot .play-dot { margin-left: auto; }

/* Lesson list (Learn) */
.lesson-list { padding: 0; }
.lesson-row {
  display: flex; gap: 16px; align-items: center; padding: 6px 12px 6px 6px;
  text-decoration: none; color: inherit; border: 1px solid transparent; border-radius: var(--radius);
}
.lesson-row + .lesson-row { border-top-color: var(--line); border-radius: 0; }
.lesson-row.is-next { border: 1px solid var(--text); border-radius: var(--radius); margin: -1px; }
.lesson-thumb { flex: none; width: 90px; height: 100px; border-radius: var(--radius-xs); overflow: hidden; background: var(--light-gray); }
.lesson-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lesson-body { flex: 1; min-width: 0; }
.lesson-body .muted { font-size: 12.5px; }
.status-icon { flex: none; width: 26px; height: 26px; color: var(--text); }
.play-dot {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary);
  display: grid; place-items: center;
}
.play-dot svg { width: 12px; height: 12px; fill: #fff; }

.done-line { display: flex; align-items: center; gap: 6px; color: var(--success); font-weight: 600; font-size: 13px; margin: 8px 0 0; }
.done-line .ic { width: 18px; height: 18px; }

.crosslink {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 16px; padding: 14px 16px; border-radius: var(--radius); background: var(--light-gray);
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--primary);
}

/* ---------- Chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; line-height: 1.6;
}
.chip-level { background: var(--success-soft); color: var(--success); }
.chip-intermediate { background: var(--warning-soft); color: #94650a; }
.chip-advanced { background: var(--error-soft); color: #b23b37; }
.chip-sample { background: var(--warning-soft); color: #94650a; }
.chip-progress { background: #e5eef7; color: #2f5f8f; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: 15px;
  min-height: 46px; padding: 0 20px; border-radius: var(--radius-xs);
  border: 1px solid transparent; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  transition: background .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0b4640; }
.btn-primary:disabled { background: #a7b6b2; cursor: not-allowed; }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--primary); }
.btn-secondary:hover { background: var(--light-gray); }
.btn-block { width: 100%; margin: 14px 0; }
.btn-sm { min-height: 30px; font-size: 13px; padding: 0 14px; }
.btn-danger { background: var(--card); color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-soft); }
.btn-danger .ic { width: 18px; height: 18px; }
.btn:focus-visible, .tab:focus-visible, .seg:focus-visible, a:focus-visible { outline: 3px solid var(--success); outline-offset: 2px; }

/* ---------- Video ---------- */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; margin: 4px 0 8px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-fallback { font-size: 13px; color: var(--text-2); margin: 0 0 8px; }
.demo-missing {
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg);
  color: var(--text-2); font-size: 13px; text-align: center; padding: 28px 12px;
}

/* ---------- Workout session ---------- */
.session-bar {
  position: sticky; top: 8px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--primary); color: #fff; border-radius: var(--radius);
  padding: 8px 8px 8px 14px; margin: 14px 0; font-size: 13px; font-weight: 600;
}
.session-bar .progress { flex: 1; }
.progress-track { height: 4px; border-radius: 99px; background: rgba(255,255,255,.2); margin-top: 6px; overflow: hidden; }
.progress-track span { display: block; height: 100%; background: #fff; border-radius: 99px; transition: width .3s; }
.session-bar .btn { background: #fff; color: var(--primary); }

.exercises { list-style: none; padding: 0; margin: 0; }
.exercise {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 12px 8px 8px; margin-bottom: 8px; scroll-margin-top: 80px;
}
.exercise.is-current { border-color: var(--text); }
.ex-row { display: flex; gap: 14px; align-items: center; }
.ex-thumb {
  flex: none; width: 72px; height: 72px; border-radius: var(--radius-xs); background: var(--light-gray);
  display: grid; place-items: center; color: var(--text-2); font-weight: 700; overflow: hidden;
}
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-text { flex: 1; min-width: 0; }
.ex-rx { margin: 3px 0 0; font-size: 13px; color: var(--text); }
.ex-rest { margin: 0; font-size: 12px; color: var(--text-2); }
.ex-check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--track); display: grid; place-items: center; }
.ex-check.is-done { background: var(--primary); border-color: var(--primary); }
.ex-check.is-done svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 2.5; }
.ex-detail { margin-top: 10px; }
.ex-detail > img { border-radius: var(--radius-sm); width: 100%; display: block; }
.ex-notes { margin: 10px 0 0; font-size: 13px; color: var(--text-2); }
.ex-nav { display: flex; gap: 10px; margin-top: 12px; }
.ex-nav .btn { flex: 1; }

.complete-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--success-soft); border-radius: var(--radius); padding: 10px 12px; margin: 14px 0;
}
.complete-box .done-line { margin: 0; }

.warn { background: var(--error-soft); color: #9b2c28; border-radius: var(--radius); padding: 10px 14px; font-size: 13px; }

/* ---------- Home ---------- */
.hero {
  background: var(--primary); color: #fff;
  margin: calc(-24px - env(safe-area-inset-top)) calc(-1 * var(--gutter)) 0;
  padding: calc(34px + env(safe-area-inset-top)) 26px 92px;
}
.hero-hello { font-size: 18px; margin: 0; }
.hero-name { font-size: 31px; font-weight: 700; letter-spacing: -.5px; line-height: 1.15; margin: 0; }
.hero-add {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 6px;
  color: #fff; font-weight: 700; font-size: 16px; text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.5);
}
.hero-add .ic { width: 18px; height: 18px; }
.hero .section-title { margin: 30px 0 0; }
.hero .section-title h2, .hero .view-all { color: #fff; }
.hero-overlap { margin-top: -78px; position: relative; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { padding: 14px 12px 14px 16px; margin-bottom: 0; min-height: 72px; }
.stat-num { display: flex; align-items: center; gap: 8px; }
.stat-num strong { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-num .ic { width: 22px; height: 22px; color: var(--primary); }
.stat-num .spark { width: 56px; height: 24px; margin-left: auto; color: var(--text); stroke-width: 1.2; }
.stat-card .muted { font-size: 13px; color: var(--text); margin-top: 4px; white-space: nowrap; }
.flame { width: 22px; height: 22px; fill: var(--primary); }

.recent-list { padding: 2px 10px; }
.recent-item { display: flex; align-items: center; gap: 14px; padding: 6px 0; text-decoration: none; color: inherit; }
.recent-item + .recent-item { border-top: 1px solid var(--line); }
.recent-thumb { flex: none; width: 64px; height: 46px; border-radius: var(--radius-xs); overflow: hidden; background: var(--light-gray); display: grid; place-items: center; color: var(--text-2); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recent-body { flex: 1; min-width: 0; }
.recent-body h3 { font-size: 13.5px; font-weight: 600; }
.recent-check { width: 24px; height: 24px; color: var(--text); flex: none; }

/* ---------- Progress ---------- */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 14px 12px; text-align: center; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.week-dot { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--track); display: grid; place-items: center; }
.week-dot.is-done { background: var(--primary); border-color: var(--primary); }
.week-dot.is-done svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.5; }
.week-day.is-today { color: var(--text); font-weight: 700; }

/* ---------- Profile ---------- */
.profile-card { display: flex; align-items: center; gap: 16px; padding: 14px; }
.avatar {
  flex: none; width: 60px; height: 60px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
  font-size: 24px; font-weight: 700;
}
.avatar .ic { width: 28px; height: 28px; }
.name-form { flex: 1; min-width: 0; }
.name-row { display: flex; gap: 8px; margin-top: 4px; }
.input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text);
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg);
}
.input:focus { outline: 2px solid var(--success); outline-offset: 1px; border-color: transparent; }
.name-row .btn { min-height: 38px; }
.link-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; text-decoration: none; color: inherit;
}
.link-row .ic { color: var(--primary); }
.link-row span { flex: 1; font-weight: 600; }
.settings { padding: 14px 16px; }
.settings .muted { margin: 0 0 12px; }

/* ---------- Version 2: shared form pieces ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.form-card { padding: 14px 16px; }
.form-card legend, .choice-set legend { font-weight: 600; font-size: 15px; padding: 0; margin-bottom: 8px; }
fieldset.form-card, .choice-set { border: 1px solid var(--line); min-width: 0; }
/* Keep fieldset titles inside the card instead of on its border. */
fieldset.form-card > legend, .choice-set > legend { float: left; width: 100%; }
fieldset.form-card > legend + *, .choice-set > legend + * { clear: both; }
.choice-set:not(.card) { border: 0; padding: 0; margin: 10px 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text); margin: 10px 0; }
.field .input { font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-error { color: var(--error); font-size: 13px; margin: 4px 0 0; min-height: 0; }
.field-error:empty { display: none; }
.full { grid-column: 1 / -1; flex-basis: 100%; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
select.input { appearance: auto; }
.note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--light-gray); border-radius: var(--radius); padding: 10px 12px; }
.note .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.pad { padding: 0 4px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.row-actions .btn { min-height: 40px; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 4px; min-height: 40px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--primary); cursor: pointer; text-decoration: none;
}
.link-btn .ic { width: 16px; height: 16px; }
.link-btn.danger { color: var(--error); }
.link-btn.small { min-height: 32px; padding: 4px; font-size: 12px; }
.center-btn { display: flex; margin: 18px auto 0; }
.sum-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: 14px; }
.sum-row + .sum-row { border-top: 1px solid var(--line); }
.sum-ex + .sum-ex { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.sum-ex h3 { margin-bottom: 2px; }
.input.small { width: 84px; height: 36px; text-align: center; flex: none; }
details.fix { margin: 4px 0; }
details.fix summary { font-size: 13px; color: var(--primary); font-weight: 600; cursor: pointer; padding: 6px 0; }

.choice {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; min-height: 48px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); cursor: pointer; font-weight: 600; font-size: 14px;
}
.choice input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.choice.is-selected { border-color: var(--primary); background: var(--card); box-shadow: inset 0 0 0 1px var(--primary); }

/* ---------- Active exercise ---------- */
.session-top { display: flex; align-items: center; gap: 8px; margin: -10px -6px 4px; }
.session-meta { flex: 1; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.elapsed { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ex-title { margin: 6px 4px 14px; }
.demo-img { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius); display: block; margin: 6px 0; }
.set-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.set-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; }
.set-card.is-done { border-color: var(--success); background: #f6faf6; }
.set-card.is-skipped { opacity: .7; }
.set-head { display: flex; align-items: center; gap: 8px; }
.set-head strong { font-size: 16px; }
.set-status { margin-left: auto; font-size: 12px; color: var(--text-2); font-weight: 600; }
.is-done .set-status { color: var(--success); }
.set-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 13px; color: var(--text-2); margin: 4px 0 10px; }
.set-info strong { color: var(--text); }
.set-entry { display: flex; gap: 10px; }
.input.big { height: 52px; font-size: 22px; font-weight: 700; text-align: center; flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.set-entry .btn { min-height: 52px; flex: none; min-width: 120px; }
.btn-done { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.btn-done .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.set-foot { display: flex; justify-content: space-between; }
.input[aria-invalid="true"] { border-color: var(--error); }
.btn-finish { background: var(--card); color: var(--primary); border-color: var(--primary); margin-top: 6px; }
.ex-nav .btn .ic { width: 18px; height: 18px; }
.ex-nav > span { flex: 1; }
.exercise.is-link { display: block; text-decoration: none; color: inherit; }
.exercise.is-link .ex-row > .ic { width: 18px; height: 18px; color: var(--text-2); }

/* Rest timer */
.rest-panel {
  position: fixed; left: 0; right: 0; z-index: 20;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 8px 12px; background: transparent; pointer-events: none;
}
.rest-panel[hidden] { display: none; }
.rest-inner {
  pointer-events: auto; max-width: 448px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--primary); color: #fff; border-radius: 12px; padding: 8px 8px 8px 14px;
  box-shadow: 0 8px 24px rgba(7, 51, 47, .3);
}
.rest-inner > .ic { width: 24px; height: 24px; flex: none; }
.rest-text { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.rest-text .tiny { color: rgba(255,255,255,.75); margin: 0; }
.rest-time { font-size: 24px; font-variant-numeric: tabular-nums; }
.rest-adj {
  min-width: 48px; height: 44px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,.35);
  background: transparent; color: #fff; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
}
.rest-btn { background: #fff; color: var(--primary); min-height: 44px; }
.rest-inner.is-finished { background: var(--success); }
body.has-rest .page { padding-bottom: 110px; }

/* Feedback */
.fb-q { font-size: 17px !important; }
.effort { display: grid; grid-template-columns: 1fr; gap: 8px; }
.effort-opt {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); font-weight: 600; cursor: pointer; position: relative;
}
.effort-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.effort-opt.is-selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.effort-opt:focus-within { outline: 3px solid var(--success); outline-offset: 2px; }
.saved-banner { display: flex; align-items: center; gap: 12px; background: var(--success-soft); color: var(--success); border-radius: var(--radius); padding: 14px 16px; margin: 4px 0 14px; }
.saved-banner .ic { width: 28px; height: 28px; flex: none; }
.saved-banner div { display: flex; flex-direction: column; }
.saved-banner span { color: var(--text-2); font-size: 13px; }
.confirm-card { border-color: var(--warning); background: #fffaf0; }

/* Progress */
.week-note { font-size: 13px; color: var(--text-2); margin: 10px 4px 12px; }
.stat-num small { font-size: 15px; color: var(--text-2); font-weight: 600; }
.best-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; }
.best-row + .best-row { border-top: 1px solid var(--line); }
.best-row .right { text-align: right; }
.best-row .right .tiny, .best-row p.tiny { margin: 0; }
.bench-card { padding: 14px 16px; text-decoration: none; color: inherit; }
.bench-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bench-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.bench-stats div { display: flex; flex-direction: column; }
.bench-stats strong { font-size: 18px; }
.chart { width: 100%; height: auto; margin-top: 12px; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; }
.chart .dot { fill: var(--primary); }
.chart .lbl { font-size: 10px; fill: var(--text-2); font-family: inherit; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-form .field { flex: 1 1 120px; margin: 0; }
.inline-form .btn { min-height: 38px; }

/* Learn v2 */
.lesson-progress { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 8px 0; }
.watch-line { display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.mini-track.wide { max-width: 120px; width: 120px; }
.complete-box > div { flex: 1; }
.complete-box .done-line + .done-line { margin-top: 4px; }

/* Profile v2 */
.avatar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar { overflow: hidden; }
.import-preview { background: var(--light-gray); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; font-size: 13px; }
.import-preview p { margin: 4px 0; }
.btn-danger { margin-top: 8px; }

/* ---------- Bottom navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: var(--nav);
}
.tab {
  flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; color: rgba(234, 245, 246, .82); font-size: 11px; font-weight: 500;
}
.tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tab.is-active { color: #fff; font-weight: 700; }
.tab.is-active svg { fill: currentColor; stroke-width: 1.5; }
.tab.is-active svg .no-fill { fill: none; }

/* ---------- Toast & dialog ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); z-index: 30;
  display: flex; align-items: center; gap: 10px;
  background: var(--card); color: var(--text); border: 1px solid var(--success); border-radius: var(--radius);
  padding: 12px 16px; font-weight: 600; font-size: 14px; width: max-content; max-width: calc(100% - 32px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.toast svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--success); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast.is-error { border-color: var(--error); }
.toast.is-error svg { stroke: var(--error); }
.toast[hidden], .dialog-backdrop[hidden] { display: none; }

.dialog-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(7, 51, 47, .45);
  display: grid; place-items: center; padding: 16px;
}
.dialog { background: var(--card); border-radius: 12px; padding: 22px; width: 100%; max-width: 360px; }
.dialog p { color: var(--text-2); }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog-actions .btn { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .splash, .splash-bar span, .progress-track span { transition: none; animation-duration: .01s; }
}
