/* Học Calisthenics — bố cục & thành phần */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.5; min-height: 100vh; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0 0 .7em; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 14.5px; }
.nowrap { white-space: nowrap; }
.ico { width: 22px; height: 22px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.s { width: 18px; height: 18px; }
.ico.l { width: 28px; height: 28px; }

/* ---------- khung ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 258px; flex: 0 0 258px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; transition: width .2s, flex-basis .2s; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 16px; text-decoration: none; color: var(--ink); }
.brand .logo { width: 40px; height: 40px; flex: 0 0 40px; }
.brand b { font-size: 21px; display: block; line-height: 1.05; }
.brand small { display: block; color: var(--muted); font-size: 13px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-decoration: none; color: var(--ink-2); font-size: 16.5px; white-space: nowrap; }
.nav a:hover { background: var(--surface-3); }
.nav a.on { background: var(--green-soft); color: var(--green-ink); font-weight: 700; }
.nav a .badge { margin-left: auto; }
.side-foot { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); flex: 0 0 auto; }
.icon-btn:hover { background: var(--surface-3); }
body.side-mini .sidebar { width: 78px; flex-basis: 78px; }
body.side-mini .brand div, body.side-mini .nav a span, body.side-mini .nav a .badge { display: none; }
body.side-mini .nav a { justify-content: center; padding: 11px; }
body.side-mini .side-foot { flex-direction: column; align-items: center; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.view { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 32px 40px; flex: 1; }
.foot { max-width: 1180px; width: 100%; margin: 0 auto; padding: 18px 32px 28px; color: var(--muted); font-size: 14.5px; display: flex; gap: 8px 18px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }
.tabbar { display: none; }

/* ---------- thành phần ---------- */
.page-head { margin: 4px 0 22px; }
.page-head h1 { font-size: clamp(28px, 3.4vw, 40px); }
.page-head p { color: var(--muted); font-size: 17.5px; margin: 8px 0 0; max-width: 760px; }
.eyebrow { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--green); font-weight: 700; margin-bottom: 6px; display: block; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); }
.card.flat { box-shadow: none; }
.card h2 { font-size: 23px; }
.card h3 { font-size: 19px; }
.section { margin-top: 30px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { font-size: 26px; }
.sec-head p { margin: 4px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 16.5px; text-decoration: none; transition: transform .12s, background .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); background: var(--green); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--green); padding-left: 8px; padding-right: 8px; }
.btn.danger { color: var(--coral); border-color: var(--coral-soft); }
.btn.big { min-height: 58px; font-size: 19px; padding: 14px 26px; border-radius: 16px; }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: 15px; border-radius: 10px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.on { background: var(--green-soft); border-color: var(--green-pastel); color: var(--green-ink); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 3px 11px; font-size: 13.5px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.lv-foundation { background: var(--blue-soft); color: var(--blue); }
.lv-beginner { background: var(--green-soft); color: var(--green-ink); }
.lv-intermediate { background: var(--amber-soft); color: var(--amber); }
.lv-advanced { background: var(--coral-soft); color: var(--coral); }
.lv-elite { background: var(--violet-soft); color: var(--violet); }
.badge { min-width: 22px; height: 22px; border-radius: 11px; padding: 0 6px; background: var(--coral); color: #fff; font-size: 12.5px; display: inline-grid; place-items: center; font-weight: 700; }
.note { border-radius: 14px; padding: 12px 15px; background: var(--surface-3); color: var(--ink-2); font-size: 16px; }
.note.tip { background: var(--green-soft); color: var(--green-ink); }
.note.info { background: var(--blue-soft); color: var(--blue); }
.note.warn { background: var(--coral-soft); color: var(--coral); }
.note.amber { background: var(--amber-soft); color: var(--amber); }
.note strong { display: block; margin-bottom: 2px; }
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green-pastel), var(--green)); }
.empty { text-align: center; padding: 34px 18px; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: var(--radius); }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kv > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kv small { display: block; color: var(--muted); font-size: 13.5px; }
.kv b { font-size: 16.5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 15px; color: var(--ink-2); min-height: 38px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .lbl { font-weight: 700; font-size: 16px; }
.input { border: 1px solid var(--line-2); background: var(--surface); border-radius: 12px; min-height: 46px; padding: 9px 13px; font-size: 16.5px; width: 100%; }
.input:focus { outline: 2px solid var(--green-pastel); border-color: var(--green); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--green); flex: 0 0 auto; }
.check.on { border-color: var(--green-pastel); background: var(--green-soft); }
.toggle { position: relative; width: 50px; height: 30px; flex: 0 0 50px; display: inline-block; }
.toggle input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: .2s; }
.toggle span::after { content: ""; position: absolute; width: 24px; height: 24px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2.5px solid var(--blue); outline-offset: 2px; }
.setting { display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting p { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

/* ---------- thẻ bài tập ---------- */
.ex-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.ex-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.ex-art { aspect-ratio: 16 / 10; background: var(--fig-bg); position: relative; }
.ex-art .tag { position: absolute; top: 8px; right: 8px; display: flex; gap: 5px; }
.ex-art .tag span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-1); }
.ex-art .tag .ok { background: var(--green); color: #fff; }
.ex-art .tag .wq { color: var(--amber); }
.ex-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.ex-body h3 { font-size: 18.5px; }
.ex-body .en { color: var(--muted); font-style: italic; font-size: 14.5px; margin-top: -4px; }
.ex-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.mini { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: inherit; }
.mini .ex-art { width: 104px; flex: 0 0 104px; border-radius: 10px; }
.mini b { display: block; font-size: 16.5px; }
.mini small { color: var(--muted); }

/* ---------- trang chủ ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); border-radius: 26px; overflow: hidden; background: linear-gradient(135deg, var(--green-soft) 0%, var(--blue-soft) 100%); border: 1px solid var(--line); }
.hero-text { padding: 30px 32px; display: flex; flex-direction: column; gap: 14px; }
.hero-text h1 { font-size: clamp(30px, 3.6vw, 44px); }
.hero-text .lead { color: var(--ink-2); font-size: 18px; margin: 0; }
.hero-art { position: relative; min-height: 270px; }
.hero-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.today-box { background: var(--surface); border-radius: 18px; padding: 14px 16px; border: 1px solid var(--line); display: flex; gap: 14px; align-items: center; }
.today-box .t { flex: 1; min-width: 0; }
.today-box b { display: block; font-size: 18px; }
.ring { width: 78px; height: 78px; flex: 0 0 78px; }
.ring circle { fill: none; stroke-width: 8; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--green); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .6s; }
.ring text { font: 700 19px var(--font); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-size: 32px; font-weight: 700; line-height: 1.1; }
.stat .k { color: var(--muted); font-size: 15px; }
.stat .ico { color: var(--green); margin-bottom: 4px; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { text-align: center; padding: 8px 2px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.wd b { display: block; font-size: 15px; color: var(--ink); }
.wd .m { display: block; height: 12px; margin-top: 4px; }
.wd.plan .m::after { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--green); }
.wd.done { background: var(--green-soft); border-color: var(--green-pastel); }
.wd.done .m::after { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--green); border: 0; }
.wd.today { outline: 2px solid var(--blue); outline-offset: -1px; }
.goal { display: flex; flex-direction: column; gap: 8px; }
.sugg { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: inherit; }
.sugg .ico { margin-top: 2px; }
.sugg.up .ico { color: var(--green); }
.sugg.down .ico { color: var(--amber); }
.sugg.deload .ico { color: var(--coral); }

/* ---------- chi tiết bài tập ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; margin-bottom: 14px; font-size: 16px; background: none; border: 0; padding: 0; }
.detail { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.viewer { position: sticky; top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.viewer .stage { aspect-ratio: 16 / 10; background: var(--fig-bg); }
.viewer .cap { min-height: 54px; padding: 10px 16px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); font-size: 17px; }
.viewer .cap .n { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.viewer .ctrl { display: flex; gap: 6px; padding: 10px 12px 12px; flex-wrap: wrap; border-top: 1px solid var(--line); }
.viewer .ctrl .btn { min-height: 40px; padding: 6px 12px; font-size: 15px; }
.legend { display: flex; gap: 14px; padding: 0 16px 12px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.d-title h1 { font-size: clamp(30px, 3.3vw, 40px); }
.d-title .en { color: var(--muted); font-style: italic; font-size: 18px; margin: 4px 0 10px; }
.muscles { display: flex; gap: 6px; flex-wrap: wrap; }
.muscles .p1 { background: var(--coral-soft); color: var(--coral); }
.muscles .p2 { background: var(--amber-soft); color: var(--amber); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 12px 42px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 29px; height: 29px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); font-weight: 700; display: grid; place-items: center; font-size: 15px; }
.mist { display: grid; gap: 10px; }
.mist > div { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mist .m { background: var(--coral-soft); color: var(--coral); padding: 10px 13px; }
.mist .f { padding: 10px 13px; background: var(--surface-2); }
.mist small { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; opacity: .85; }
.dsec { margin-top: 18px; }
.dsec h2 { font-size: 21px; margin-bottom: 9px; display: flex; gap: 8px; align-items: center; }
.dsec h2 .ico { color: var(--green); }

/* ---------- skill tree ---------- */
.tree-wrap { position: relative; padding-top: 4px; }
.tree-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.tree-svg path { fill: none; stroke: var(--line-2); stroke-width: 2.5; }
.tree-svg path.ok { stroke: var(--green-pastel); stroke-width: 3; }
.tier { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; position: relative; z-index: 1; }
.node { width: 168px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; text-decoration: none; color: inherit; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.node .ex-art { aspect-ratio: 16 / 10; }
.node b { font-size: 15px; padding: 7px 10px 2px; line-height: 1.25; }
.node small { padding: 0 10px 9px; color: var(--muted); font-size: 13px; }
.node .st { position: absolute; top: 7px; left: 7px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.node.mastered { border-color: var(--green); }
.node.mastered .st { background: var(--green); color: #fff; border-color: var(--green); }
.node.learned { border-color: var(--blue-pastel); }
.node.learned .st { color: var(--blue); }
.node.locked { opacity: .6; }
.node.locked .ex-art { filter: grayscale(.85); }
.node.next { box-shadow: 0 0 0 3px var(--amber-soft); border-color: var(--amber); }

/* ---------- lộ trình ---------- */
.phase-line { display: grid; gap: 14px; }
.phase { display: grid; grid-template-columns: 64px 1fr auto; gap: 16px; align-items: center; padding: 18px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: inherit; }
.phase .num { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-weight: 700; font-size: 22px; }
.phase h3 { font-size: 21px; }
.phase.cur { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.weeks { display: flex; gap: 6px; flex-wrap: wrap; }
.weeks button { min-width: 46px; min-height: 42px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; }
.weeks button.on { background: var(--ink); color: var(--bg); }
.weeks button.cur { border-color: var(--green); border-width: 2px; }
.sess { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--surface); }
.sess-h { padding: 12px 15px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.sess-h b { font-size: 17.5px; display: block; }
.it { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.it:last-child { border-bottom: 0; }
.it .ex-art { border-radius: 9px; }
.it b { font-size: 16px; display: block; }
.it small { color: var(--muted); display: block; font-size: 14px; }
.it .dose { font-weight: 700; text-align: right; white-space: nowrap; font-size: 15.5px; }
.part { padding: 7px 14px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); font-weight: 700; }
.flag { font-size: 12.5px; padding: 1px 7px; border-radius: 6px; margin-left: 4px; font-weight: 700; white-space: nowrap; }
.flag.sub { background: var(--blue-soft); color: var(--blue); }
.flag.equip { background: var(--amber-soft); color: var(--amber); }
.flag.injury { background: var(--coral-soft); color: var(--coral); }

/* ---------- trình tập ---------- */
.runner { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; overflow-y: auto; }
.run-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 2; }
.run-top .t { flex: 1; min-width: 0; }
.run-top .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-top .t small { color: var(--muted); }
.run-prog { height: 4px; background: var(--surface-3); }
.run-prog span { display: block; height: 100%; background: var(--green); transition: width .3s; }
.run-body { width: 100%; max-width: 860px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.run-art { aspect-ratio: 16 / 9; background: var(--fig-bg); border-radius: 20px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.phasecap { margin-top: -6px; font-size: 15.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 7px 12px; border-radius: 12px; min-height: 38px; }
.setdots { display: flex; gap: 8px; flex-wrap: wrap; }
.setdots span { min-width: 54px; padding: 6px 10px; border-radius: 11px; border: 1.5px solid var(--line-2); text-align: center; font-weight: 700; background: var(--surface); }
.setdots span.done { background: var(--green-soft); border-color: var(--green-pastel); color: var(--green-ink); }
.setdots span.cur { border-color: var(--green); border-width: 2.5px; }
.stepper { display: flex; align-items: center; gap: 14px; justify-content: center; }
.stepper button { width: 62px; height: 62px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--surface); font-size: 30px; line-height: 1; }
.stepper output { font-size: 56px; font-weight: 700; min-width: 110px; text-align: center; font-variant-numeric: tabular-nums; }
.clock { font-size: 64px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; line-height: 1; }
.rest { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: grid; place-items: center; padding: 20px; }
.rest-card { width: min(440px, 100%); text-align: center; display: grid; gap: 16px; }
.rest-ring { width: 220px; height: 220px; margin: 0 auto; }
.rest-ring circle { fill: none; stroke-width: 12; }
.rest-ring .bg { stroke: var(--surface-3); }
.rest-ring .fg { stroke: var(--blue); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.rest-ring text { font: 700 52px var(--font); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.rpe { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rpe button { min-height: 52px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: 18px; }
.rpe button.on { background: var(--green); color: var(--on-accent); border-color: var(--green); }

/* ---------- sheet / toast ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 100; background: rgba(15, 25, 22, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.sheet { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 22px; padding: 20px; box-shadow: var(--shadow-2); }
.sheet h2 { font-size: 22px; margin-bottom: 12px; }
.sheet.wide { width: min(980px, 100%); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; z-index: 120; opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100% - 32px); font-size: 16px; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- thống kê ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 15px var(--font); fill: var(--muted); }
.chart .bar { fill: var(--green-pastel); }
.chart .bar.hi { fill: var(--green); }
.chart .grid-l { stroke: var(--line); }
.chart .line { fill: none; stroke: var(--blue); stroke-width: 2.5; }
.chart .pt { fill: var(--blue); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); grid-auto-columns: 14px; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 14px; height: 14px; border-radius: 3px; background: var(--surface-3); display: block; }
.heat i.l1 { background: var(--green-pastel); }
.heat i.l2 { background: var(--green); }
.lvbar { display: grid; grid-template-columns: 110px 1fr 96px; gap: 10px; align-items: center; padding: 6px 0; }
.lvbar .steps5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.lvbar .steps5 i { height: 12px; border-radius: 4px; background: var(--surface-3); }
.lvbar .steps5 i.on { background: var(--green); }
.hist { display: grid; gap: 8px; }
.hist > div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); align-items: center; }

/* ---------- kiến thức ---------- */
.art-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.art-card h3 { font-size: 19.5px; }
.article { max-width: 780px; }
.article h1 { font-size: clamp(30px, 3.4vw, 40px); }
.article h2 { font-size: 24px; margin: 28px 0 10px; }
.article p, .article li { font-size: 18px; line-height: 1.65; }
.article ul { padding-left: 22px; }
.article .fig { margin: 14px 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--fig-bg); }
.article .fig .ex-art { aspect-ratio: 16 / 7; }
.article .fig figcaption { padding: 8px 14px; font-size: 15px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }
.article .src { font-size: 15px; color: var(--muted); }
.diag { width: 100%; height: auto; display: block; }
.diag text { font-family: var(--font); fill: var(--ink); }
.gl { display: grid; gap: 10px; }
.gl > div { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }

/* ---------- đánh giá ---------- */
.wiz { max-width: 720px; margin: 0 auto; }
.wiz .progress { margin: 6px 0 18px; }
.wiz h1 { font-size: clamp(26px, 3vw, 34px); margin-bottom: 8px; }
.opts { display: grid; gap: 10px; margin: 16px 0; }
.opt { text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--surface); }
.opt.on { border-color: var(--green); background: var(--green-soft); }
.opt b { display: block; }
.opt small { color: var(--muted); }
.numin { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.numin .input { max-width: 170px; font-size: 22px; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
  .viewer { position: relative; top: 0; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--bg); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; flex: 1; min-width: 0; }
  .topbar .brand .logo { width: 34px; height: 34px; flex-basis: 34px; }
  .topbar .brand b { font-size: 19px; }
  .topbar .brand small { display: none; }
  .view { padding: 18px 16px 28px; }
  .foot { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; min-height: 54px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 12.5px; background: none; border: 0; font-weight: 700; }
  .tabbar .on { color: var(--green-ink); background: var(--green-soft); }
  .g2, .g3 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-text { padding: 22px 20px 4px; }
  .hero-art { min-height: 210px; order: -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ex-body { padding: 10px 11px 12px; }
  .ex-body h3 { font-size: 16.5px; }
  .ex-body .en { font-size: 13.5px; }
  .ex-meta .pill { font-size: 12px; padding: 2px 8px; }
  .phase { grid-template-columns: 48px 1fr; }
  .phase .num { width: 46px; height: 46px; font-size: 18px; }
  .phase > :last-child { grid-column: 1 / -1; }
  .mist > div { grid-template-columns: 1fr; }
  .node { width: 140px; }
  .tier { gap: 10px; }
  .lvbar { grid-template-columns: 86px 1fr 80px; font-size: 15px; }
  .sheet-bg { align-items: flex-end; padding: 0; }
  .sheet { border-radius: 22px 22px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .it { grid-template-columns: 60px minmax(0, 1fr); }
  .it .dose { grid-column: 2; text-align: left; }
  .stat .v { font-size: 27px; }
}
@media (max-width: 380px) {
  .cards { grid-template-columns: 1fr; }
  .stepper output { font-size: 46px; min-width: 90px; }
  .node { width: 100%; max-width: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .tabbar, .foot, .viewer .ctrl { display: none !important; }
}
