/* Một cột rộng tối đa 520px như app điện thoại; thanh tab cố định dưới đáy.
   Màu: xanh lam sẫm (tin cậy, bình tĩnh) + vàng nến ấm làm điểm nhấn; xanh "Bố ơi", hồng "Mẹ ơi". */
:root {
  --bg: #f5f8fc; --surface: #ffffff; --fg: #16263a; --muted: #586a80; --line: #dde5ef;
  --brand: #1f74c5; --brand-soft: #e7f1fb; --accent: #f89335; --accent-soft: #fff1e2; --accent-text: #b4590f;
  --bo: #1f74c5; --me: #b4590f; --ok: #2f8f5f; --err: #b3392f; --bubble: #eef4fa;
  --display: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tabh: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1622; --surface: #162131; --fg: #e6edf6; --muted: #9aabc0; --line: #26354b;
    --brand: #6eb0f2; --brand-soft: #1b2e47; --accent: #ffa654; --accent-soft: #3b2a17; --accent-text: #ffb877;
    --bo: #7db6f2; --me: #ffab66; --ok: #6fd19c; --err: #ff8a80; --bubble: #1c2a3d; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
.app { max-width: 520px; margin: 0 auto; min-height: 100%; padding: env(safe-area-inset-top, 0) max(16px, env(safe-area-inset-right, 0px)) calc(var(--tabh) + 24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
h1, h2, h3 { font-family: var(--display); line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 2.2rem; color: var(--brand); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
.view { display: flex; flex-direction: column; gap: 16px; padding-top: 20px; }
.top { display: flex; flex-direction: column; gap: 4px; position: relative; padding-right: 48px; }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sub { color: var(--muted); }
.small { font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* nút & form */
.btn { appearance: none; border: 0; border-radius: 12px; background: var(--brand); color: var(--surface); font: 600 1rem var(--body); padding: 13px 18px; cursor: pointer; min-height: 48px; }
.btn:disabled { opacity: .55; cursor: progress; }
a.btn { display: block; text-align: center; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.done { background: var(--ok); }
.icon-btn { position: absolute; right: 0; top: 0; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; display: grid; place-items: center; }
.icon-btn svg, .tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.form { display: flex; flex-direction: column; gap: 8px; }
.form label, legend { font-weight: 600; font-size: .92rem; margin-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
input, textarea, select { width: 100%; font: 400 1rem var(--body); color: var(--fg); background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; }
textarea { resize: vertical; }
.form .btn { margin-top: 10px; }
.hint { font-size: .82rem; color: var(--muted); }
.err { color: var(--err); font-size: .9rem; font-weight: 500; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > * { min-width: 0; }
.seg { display: flex; gap: 8px; margin-top: 4px; }
.seg label { flex: 1; margin: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; }
.seg span { display: block; text-align: center; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; cursor: pointer; }
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.seg input:focus-visible + span { outline: 3px solid var(--brand); }

/* màn đăng nhập */
.intro { gap: 22px; padding-top: 36px; }
.intro-top { display: flex; flex-direction: column; gap: 8px; }
.logo { width: 56px; height: 56px; }
/* logo Cầu Nối đầy đủ (biểu tượng + chữ) ở màn đăng nhập */
.logo-day-du { width: 172px; height: auto; display: block; margin: 0 0 4px -6px; }
@media (prefers-color-scheme: dark) { .logo-day-du { background: #ffffff; border-radius: 18px; padding: 10px 14px; margin-left: 0; } }
.an-chu { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* bài hôm nay */
.lesson { display: flex; flex-direction: column; gap: 14px; }
.book-tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); align-self: flex-start; }
.book-tag.bo-oi { color: var(--bo); } .book-tag.me-oi { color: var(--me); }
.lesson ul { margin: 0; padding-left: 1.1em; display: flex; flex-direction: column; gap: 6px; }
.block { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px dashed var(--line); }
.block .k { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.quote { background: var(--accent-soft); border-radius: 12px; padding: 12px 14px; font-style: italic; }
.read-ref { font-size: .88rem; color: var(--muted); }
.note-draft { font-size: .75rem; color: var(--muted); }

/* chat */
.chat-view { min-height: calc(100vh - var(--tabh) - 40px); }
.chat { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.msg { max-width: 88%; border-radius: 16px; padding: 10px 14px; font-size: .95rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.u { align-self: flex-end; background: var(--brand); color: var(--surface); border-bottom-right-radius: 4px; }
.msg.a { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.a strong { color: var(--brand); }
.msg .refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; white-space: normal; }
.msg .refs span { font-size: .75rem; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); }
.msg.alert { border-color: var(--err); }
.msg.typing { color: var(--muted); font-style: italic; }
.empty { color: var(--muted); font-size: .92rem; }
.goi-y { display: flex; flex-wrap: wrap; gap: 8px; }
.goi-y button { font: 500 .85rem var(--body); color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; text-align: left; }
.composer { position: sticky; bottom: calc(var(--tabh) + 8px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; align-items: flex-end; background: var(--bg); padding-top: 8px; }
.composer textarea { max-height: 140px; }
.send { padding: 12px 16px; }

/* nhật ký */
.entry { display: flex; flex-direction: column; gap: 6px; }
.entry .d { font-size: .8rem; font-weight: 700; color: var(--muted); }
.entry dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: .9rem; }
.entry dt { color: var(--muted); }
.entry dd { margin: 0; }
.ai-note { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; font-size: .92rem; white-space: pre-wrap; }
.ai-note b { color: var(--brand); }

/* 30 ngày */
.days { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.days button { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font: 500 .92rem var(--body); color: var(--fg); cursor: pointer; }
.days button:disabled { opacity: .5; cursor: default; }
.days .n { font-family: var(--display); font-weight: 700; font-size: 1.1rem; color: var(--brand); text-align: center; font-variant-numeric: tabular-nums; }
.days .s { font-size: .75rem; font-weight: 700; color: var(--ok); }
.days .today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* bài tự soi */
.quiz { min-height: calc(100vh - 40px); }
.quiz-top { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; }
.quiz-top .icon-btn { position: static; }
.bar { height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .25s; }
.quiz-body { display: flex; flex-direction: column; gap: 18px; flex: 1; padding-top: 12px; }
.quiz-q { font-family: var(--display); font-size: 1.45rem; line-height: 1.3; text-wrap: balance; }
.quiz-nhom { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand); }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: auto; padding-bottom: 12px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); color: var(--fg); border: 1.5px solid var(--line); border-radius: 14px; padding: 15px 16px; font: 600 1rem var(--body); cursor: pointer; }
.choice .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice.on .dot { border-color: var(--brand); background: var(--brand); }
.insight { background: var(--brand); color: var(--surface); border-radius: 20px; padding: 26px 22px; display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.insight h3 { font-size: 1.5rem; color: var(--surface); }
.insight .src { font-size: .8rem; opacity: .8; }
.insight + .btn, .quiz-body > .btn { margin-top: auto; }
.loading-note { text-align: center; color: var(--muted); padding: 60px 0; }

/* hồ sơ làm cha mẹ */
.scores { display: flex; flex-direction: column; gap: 12px; }
.score { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: .9rem; }
.score b { font-weight: 600; }
.score .v { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.score .track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; }
.score .track i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.score.weak .track i { background: var(--accent); }
.score .delta { color: var(--ok); font-weight: 700; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 9px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); align-self: flex-start; }
.pill.warm { background: var(--accent-soft); color: var(--accent-text); }
.change { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px dashed var(--line); }
.change:first-of-type { border-top: 0; padding-top: 0; }
.motto { font-family: var(--display); font-size: 1.25rem; color: var(--brand); text-align: center; text-wrap: balance; }
.mini-profile { display: flex; flex-direction: column; gap: 8px; background: var(--accent-soft); border-radius: 16px; padding: 16px 18px; }
.mini-profile .btn { align-self: flex-start; min-height: 40px; padding: 8px 14px; font-size: .9rem; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); font: 600 .9rem var(--body); cursor: pointer; text-decoration: underline; align-self: flex-start; }

/* tổng quan – màu biểu đồ (đã kiểm tra bằng bộ validate: tách biệt cho người mù màu, đủ tương phản cả 2 nền)
   lưới 30 ngày = thang tuần tự 1 màu (0/1/2 việc); không khí với con = 2 cực xanh/cam + xám ở giữa, luôn kèm nhãn */
:root { --seq-0: #e3ecf6; --seq-1: #8fb9e6; --seq-2: #1f74c5; --gan: #2a78d6; --cang: #eb6834; --binh: #9aa5a8; }
@media (prefers-color-scheme: dark) { :root { --seq-0: #1d2a3b; --seq-1: #2f5a8a; --seq-2: #6eb0f2; --gan: #3987e5; --cang: #d95926; --binh: #6d7b80; } }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile b { font-family: var(--display); font-size: 1.7rem; line-height: 1.1; color: var(--brand); font-variant-numeric: tabular-nums; }
.tile span { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.sec-h h3 { font-size: 1.05rem; }
.sec-h small { color: var(--muted); font-size: .78rem; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist button { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: 500 .92rem var(--body); color: var(--fg); cursor: pointer; }
.checklist .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--muted); display: grid; place-items: center; font-size: .75rem; color: var(--surface); }
.checklist .on .ck { background: var(--ok); border-color: var(--ok); }
.checklist .on .t { color: var(--muted); text-decoration: line-through; }
.checklist .go { color: var(--brand); font-weight: 700; }
.grid30 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.grid30 button { aspect-ratio: 1; max-width: 100%; border: 0; border-radius: 6px; background: var(--seq-0); font: 600 .62rem var(--body); color: var(--muted); cursor: pointer; padding: 0; position: relative; }
.grid30 .l1 { background: var(--seq-1); color: var(--fg); }
.grid30 .l2 { background: var(--seq-2); color: var(--surface); }
.grid30 .khoa { background: transparent; border: 1.5px dashed var(--line); cursor: default; }
.grid30 .nay { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .75rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.strip { display: flex; gap: 6px; flex-wrap: wrap; }
.strip .d { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .62rem; color: var(--muted); width: 30px; }
.strip .d i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .62rem; color: #fff; font-weight: 700; }
.strip .gan-gui i { background: var(--gan); } .strip .cang-thang i { background: var(--cang); } .strip .binh-thuong i { background: var(--binh); }
.strip .d.doi i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok); }
.ghost-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--muted); border-radius: 2px; }
.score .track { position: relative; overflow: visible; }
.score .track i { position: relative; }
.empty-viz { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; font-size: .88rem; color: var(--muted); }
.commit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.commit li { display: grid; grid-template-columns: 52px 1fr; gap: 8px; font-size: .9rem; }
.commit li span { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; padding-top: 2px; }

/* công cụ tặng kèm – màu trạng thái chỉ dùng cho mức Xanh/Vàng/Cam/Đỏ, luôn kèm chữ */
/* 4 mức theo đúng tài liệu; vàng–cam–đỏ gần nhau với người mù màu → mỗi mức luôn kèm chữ + ký hiệu riêng (✓ ! !! ⚠) */
:root { --st-xanh: #1f8a55; --st-vang: #9a7400; --st-cam: #e0661a; --st-do: #a3241c; }
@media (prefers-color-scheme: dark) { :root { --st-xanh: #5cc48e; --st-vang: #e9c13d; --st-cam: #f0843a; --st-do: #ff6b6b; } }
.sub-top { padding-left: 48px; }
.sub-top .back-btn { left: 0; right: auto; }
.tool-card { display: flex; flex-direction: column; gap: 8px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; color: var(--fg); font: inherit; cursor: pointer; width: 100%; }
.tool-card h3 { color: var(--brand); }
.tool-card .meta-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: .85rem; color: var(--muted); }
.pdf-link { font-size: .85rem; color: var(--brand); font-weight: 600; }
.chips-f { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chips-f button { flex: none; font: 600 .8rem var(--body); border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.chips-f button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: var(--surface); }
.toggle-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); }
.toggle-row input { width: auto; }
.nhom-cau { display: flex; flex-direction: column; gap: 10px; }
.nhom-cau h3 { font-size: 1.05rem; }
.nhom-cau .doc { font-size: .8rem; color: var(--muted); }
details.khoa-hoc { background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; font-size: .86rem; }
details.khoa-hoc summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
details.khoa-hoc p { margin-top: 6px; }
.cau { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 10px 0; border-top: 1px dashed var(--line); }
.cau:first-of-type { border-top: 0; }
.cau .so { font-family: var(--display); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cau q { quotes: '“' '”'; font-size: .98rem; }
.cau .phu { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.cau .tag { font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.cau .note { font-size: .78rem; color: var(--muted); font-style: italic; }
.thu-btn { font: 600 .78rem var(--body); border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.thu-btn.on { border-color: var(--ok); color: var(--ok); }
.tranh { background: var(--accent-soft); border-radius: 10px; padding: 8px 12px; font-size: .86rem; }
.tranh b { color: var(--st-do); }
.cau-hom-nay q { font-family: var(--display); font-size: 1.25rem; line-height: 1.35; color: var(--fg); }
.ck-step { display: flex; flex-direction: column; gap: 10px; }
.ck-step h3 span { font-family: var(--body); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); display: block; }
details.band { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
details.band[open] { border-color: var(--brand); }
details.band summary { cursor: pointer; font-weight: 700; }
.tick { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; padding: 8px 0; font-size: .92rem; border-top: 1px dashed var(--line); cursor: pointer; }
.tick:first-of-type { border-top: 0; }
.tick input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
.muc-h { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; margin-top: 8px; }
.muc-h::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: currentColor; }
.muc-vang { color: var(--st-vang); } .muc-cam { color: var(--st-cam); } .muc-do { color: var(--st-do); } .muc-xanh { color: var(--st-xanh); }
.ket-qua { border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 2px solid currentColor; }
.ket-qua .lv { font-family: var(--display); font-size: 1.4rem; }
.ket-qua p, .ket-qua li { color: var(--fg); }
.ket-qua ul { margin: 0; padding-left: 1.1em; font-size: .9rem; }
.sos { background: var(--st-do); color: #fff; border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.lich-su { width: 100%; border-collapse: collapse; font-size: .85rem; }
.lich-su td, .lich-su th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.lich-su th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lv-pill { font-weight: 700; }
.so-sanh { width: 100%; border-collapse: collapse; font-size: .84rem; }
.so-sanh th, .so-sanh td { padding: 6px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.so-sanh th { font-size: .72rem; text-transform: uppercase; color: var(--muted); }

/* sách nói */
.mini { position: fixed; left: 0; right: 0; bottom: calc(var(--tabh) + env(safe-area-inset-bottom, 0px)); z-index: 6; display: flex; align-items: center; gap: 6px; background: var(--brand); color: var(--surface); padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px)); }
.mini-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,.25); }
.mini-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.mini button { background: none; border: 0; color: inherit; font: 700 .8rem var(--body); cursor: pointer; padding: 6px; }
.mini-play { width: 38px; height: 38px; border-radius: 50%; background: var(--surface) !important; color: var(--brand) !important; font-size: 1rem !important; flex: none; }
.mini-info { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; }
.mini-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.mini-info span { font-size: .72rem; opacity: .85; font-weight: 500; font-variant-numeric: tabular-nums; }
.mini-btn { flex: none; min-width: 34px; }
body.co-mini .app { padding-bottom: calc(var(--tabh) + 90px + env(safe-area-inset-bottom, 0px)); }
body.co-mini .composer { bottom: calc(var(--tabh) + 66px + env(safe-area-inset-bottom, 0px)); }
.sn-chuong { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.track { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px dashed var(--line); padding: 10px 0; color: var(--fg); font: 500 .92rem var(--body); cursor: pointer; }
.track .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .8rem; }
.track.dang .ic { background: var(--brand); color: var(--surface); }
.track.xong .ic { background: var(--ok); color: var(--surface); }
.track .tg { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.track .tien { display: block; height: 3px; border-radius: 3px; background: var(--seq-0); margin-top: 5px; overflow: hidden; }
.track .tien i { display: block; height: 100%; background: var(--brand); }
.nghe-btn { display: flex; align-items: center; gap: 10px; }
.sn-tabs { display: flex; gap: 6px; }
body.o-sach-noi .mini { display: none; }
body.o-sach-noi.co-mini .app { padding-bottom: calc(var(--tabh) + 24px + env(safe-area-inset-bottom, 0px)); }
.now { display: flex; flex-direction: column; gap: 8px; background: var(--brand); color: var(--surface); border: 0; }
.now h3 { color: var(--surface); font-size: 1.25rem; }
.now .hint { color: var(--surface); opacity: .8; }
.now .pill { align-self: flex-start; }
.now input[type=range] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--accent); height: 28px; }
.np-tg { display: flex; justify-content: space-between; font-size: .78rem; font-variant-numeric: tabular-nums; opacity: .9; }
.np-ctl { display: flex; justify-content: center; align-items: center; gap: 22px; }
.np-ctl button { background: none; border: 0; color: inherit; font: 700 .95rem var(--body); cursor: pointer; min-width: 48px; min-height: 48px; }
.np-ctl .np-big { width: 64px; height: 64px; border-radius: 50%; background: var(--surface); color: var(--brand); font-size: 1.4rem; }
.np-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.chip-btn { font: 600 .8rem var(--body); border: 1.5px solid rgba(255,255,255,.5); background: transparent; color: inherit; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.card .tool-card { background: var(--bg); padding: 14px; }
.card .tool-card h3 { font-size: 1rem; }

/* thanh tab */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px)); z-index: 5; }
.tabs button { flex: 1; min-width: 0; max-width: 130px; height: var(--tabh); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--muted); font: 600 .68rem var(--body); cursor: pointer; white-space: nowrap; letter-spacing: -.01em; }
.tabs button[aria-current="page"] { color: var(--brand); }
@media (prefers-reduced-motion: no-preference) { .msg { animation: in .18s ease-out; } @keyframes in { from { opacity: .3; transform: translateY(4px); } } }
.doi-cach { text-align: center; margin-top: 12px; }
.doi-cach p { margin: 0 0 8px; }
#f-dang-nhap h3 { margin: 0 0 4px; }
.khoi-nk { margin-top: 28px; padding-top: 20px; border-top: 1px dashed var(--line); scroll-margin-top: 12px; }
.khoi-nk-dau { margin-bottom: 12px; }
.khoi-nk-dau h2 { margin: 0 0 4px; }
.khoi-nk .stack { margin-top: 14px; }
.lay-ma { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--brand-soft); text-align: center; }
.lay-ma p { margin: 0 0 8px; text-align: left; font-size: .92rem; }
.lay-ma p.small { text-align: center; margin: 4px 0 8px; }
.lay-ma img { display: block; margin: 4px auto; border-radius: 8px; background: #fff; padding: 6px; }

/* thư viện sách nói */
.tv-luoi { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.tv-o { appearance: none; border: 0; background: none; padding: 0; text-align: left; font: inherit; color: var(--fg); cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tv-o b { font-size: .92rem; line-height: 1.3; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tv-o small { color: var(--muted); font-size: .76rem; }
.tv-o .tien { display: block; height: 3px; border-radius: 3px; background: var(--seq-0); overflow: hidden; margin: 3px 0; }
.tv-o .tien i { display: block; height: 100%; background: var(--brand); }
.tv-bia { aspect-ratio: 3 / 4; width: 100%; border-radius: 10px; overflow: hidden; background: linear-gradient(150deg, var(--brand-soft), var(--accent-soft)); display: grid; place-items: center; box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.tv-bia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-bia span { font: 700 2.4rem var(--display); color: var(--brand); }
.tv-bia.nho { width: 64px; flex: none; }
.tv-bia.nho span { font-size: 1.4rem; }
.tv-nhan { align-self: flex-start; font: 600 .7rem var(--body); padding: 2px 8px; border-radius: 999px; margin-top: 4px; }
.tv-nhan.mien-phi { background: var(--accent-soft); color: var(--fg); }
.tv-nhan.cua-toi { background: var(--brand-soft); color: var(--brand); }
.tv-nhan.khoa { background: var(--bubble); color: var(--muted); }
.tv-tiep { display: flex; gap: 14px; align-items: flex-start; }
.tv-tiep h3 { margin: 6px 0 2px; }
.tv-tiep .btn { margin-top: 8px; }
.tv-loc { margin: 2px 0 4px; }
.tv-ve { margin-bottom: -4px; }
.tv-dau { display: flex; gap: 14px; align-items: flex-start; }
.tv-dau .tv-bia { width: 104px; flex: none; }
.tv-dau h3 { margin: 0 0 4px; }
.tv-dau p { margin: 0 0 4px; }
.tv-mota { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.tv-khoa h3 { margin: 0; }

/* biểu tượng Cầu Nối nhỏ ở đầu mỗi tab chính */
.view.tab > .top::before { content: ""; display: block; width: 46px; height: 28px; margin-bottom: 4px; background: url(/anh/bieu-tuong.png) no-repeat left center / contain; }

/* Tổng quan gọn: thẻ bật/tắt sách nói nhanh */
.tq-nghe { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; background: linear-gradient(120deg, var(--brand-soft), var(--accent-soft)); border-color: transparent; }
.tq-play { flex: none; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 1.25rem; cursor: pointer; box-shadow: 0 4px 12px rgb(31 116 197 / .3); display: grid; place-items: center; }
.tq-nghe.dang .tq-play { background: var(--accent); box-shadow: 0 4px 12px rgb(248 147 53 / .35); }
.tq-nghe-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tq-nghe-tt b { font-size: .98rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tq-nghe-tt small { color: var(--muted); font-size: .8rem; }
.tq-nhan { font: 700 .68rem var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.tq-tv { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface); color: var(--brand); font-size: 1.4rem; cursor: pointer; }
.cau-hom-nay q { font-size: 1.05rem; }
.tq-nhac { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; border: 1.5px dashed var(--accent); background: var(--accent-soft); color: var(--fg); border-radius: 14px; padding: 12px 14px; font: 600 .9rem var(--body); cursor: pointer; }
.tq-them { padding: 0; }
.tq-them > summary { cursor: pointer; list-style: none; padding: 14px 16px; font: 600 .95rem var(--body); color: var(--brand); display: flex; justify-content: space-between; align-items: center; }
.tq-them > summary::-webkit-details-marker { display: none; }
.tq-them > summary::after { content: "▾"; transition: transform .2s; }
.tq-them[open] > summary::after { transform: rotate(180deg); }
.tq-them[open] > summary { border-bottom: 1px solid var(--line); }
.tq-them > .tiles, .tq-them > section { margin: 16px; }
.tq-them > section + section { padding-top: 16px; border-top: 1px solid var(--line); }

/* thẻ sách nói ở Tổng quan: có thanh thời gian + tốc độ */
.tq-nghe { flex-direction: column; align-items: stretch; gap: 8px; }
.tq-hang { display: flex; align-items: center; gap: 14px; }
.tq-nghe input[type=range] { width: 100%; padding: 0; border: 0; background: transparent; accent-color: var(--brand); height: 26px; margin-top: 2px; }
.tq-tgian { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -6px; }
.tq-dk { display: flex; gap: 8px; }
.tq-dk button { flex: 1; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 8px 6px; font: 600 .82rem var(--body); cursor: pointer; }
.tq-dk #tq-toc { border-color: var(--brand); color: var(--brand); }

/* Tổng quan: lối vào trang Quà tặng kèm sách (/quatang) */
.tq-qua { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 16px; padding: 14px 16px; cursor: pointer; font: inherit; }
.tq-qua:hover { border-color: var(--accent); }
.tq-qua-ic { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: grid; place-items: center; font-size: 1.35rem; }
.tq-qua > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tq-qua b { font-size: .98rem; }
.tq-qua small { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.tq-qua em { font-style: normal; color: var(--err); font-weight: 600; }
.tq-qua .go { color: var(--brand); font-size: 1.3rem; }

/* Tổng quan: hẹn giờ tắt + thanh trượt tốc độ */
.tq-dk #tq-hen { border-color: var(--brand); color: var(--brand); }
.tq-dk #tq-hen.bat { background: var(--brand); color: #fff; }
.tq-toc { display: flex; align-items: center; gap: 10px; }
.tq-toc label { margin: 0; font: 600 .82rem var(--body); color: var(--muted); white-space: nowrap; }
.tq-toc input[type=range] { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); height: 26px; }
.tq-toc output { font: 700 .9rem var(--body); color: var(--accent-text); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* nút Tốc độ → bấm mới hiện thanh trượt (Tổng quan + tab Sách nói) */
.thanh-toc { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.thanh-toc[hidden] { display: none; }
.thanh-toc span { font: 600 .75rem var(--body); color: var(--muted); font-variant-numeric: tabular-nums; }
.thanh-toc input[type=range] { flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); height: 26px; }
.tq-dk #tq-toc-nut { border-color: var(--accent); color: var(--accent-text); }
.tq-dk #tq-toc-nut.bat { background: var(--accent-soft); }
.now .thanh-toc { background: rgb(255 255 255 / .14); border-color: rgb(255 255 255 / .3); margin-top: 10px; }
.now .thanh-toc span { color: inherit; opacity: .85; }
.now .thanh-toc input[type=range] { accent-color: #fff; }
.now #np-toc-nut.bat { background: rgb(255 255 255 / .2); }

/* ===== Trình phát sách nói kiểu Fonos (Tổng quan + tab Sách nói) ===== */
.tp-the { padding: 0; overflow: hidden; border: 0; background: linear-gradient(160deg, #1f74c5 0%, #155a9c 100%); color: #fff; }
.tp { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.tp svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tp-dau { display: flex; align-items: center; gap: 12px; }
.tp-bia { flex: none; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / .2); }
.tp-bia img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-ten { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tp-ten small { font-size: .75rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-ten b { font: 700 1.02rem/1.3 var(--display); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tp-mo { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(255 255 255 / .16); color: #fff; font-size: 1.3rem; cursor: pointer; }
.tp-seek { width: 100%; padding: 0; border: 0; background: transparent; accent-color: #fff; height: 24px; margin: 2px 0 -4px; }
.tp-tg { display: flex; justify-content: space-between; font-size: .76rem; opacity: .85; font-variant-numeric: tabular-nums; }
.tp-dk { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.tp-dk button { appearance: none; border: 0; background: none; color: #fff; cursor: pointer; padding: 0; display: grid; place-items: center; }
.tp-dk button:disabled { opacity: .35; cursor: default; }
.tp-nho { width: 30px; height: 30px; }
.tp-vua { width: 40px; height: 40px; }
.tp-play { width: 64px; height: 64px; border-radius: 50%; background: #fff !important; color: #1f74c5 !important; box-shadow: 0 6px 16px rgb(0 0 0 / .22); }
.tp-play svg { width: 30px; height: 30px; }
.tp.dang .tp-play { color: #e07a1f !important; }
.tp-cn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid rgb(255 255 255 / .18); padding-top: 10px; }
.tp-cn button { appearance: none; border: 0; background: none; color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; border-radius: 10px; font: 500 .78rem var(--body); }
.tp-cn button svg { width: 22px; height: 22px; }
.tp-cn button b { font: 700 1rem/22px var(--body); height: 22px; }
.tp-cn button.bat { background: rgb(255 255 255 / .16); }
.tp-cn .tp-hen.bat span { font-weight: 700; color: #ffd2a6; }
.tp .thanh-toc { background: rgb(255 255 255 / .14); border-color: rgb(255 255 255 / .28); margin: 0; }
.tp .thanh-toc span { color: #fff; opacity: .85; }
.tp .thanh-toc input[type=range] { accent-color: #fff; }

/* ===== Danh sách chương: bảng trượt từ dưới lên + trong trang 1 cuốn ===== */
dialog.sheet { border: 0; padding: 0 0 env(safe-area-inset-bottom, 0px); margin: auto auto 0; width: min(560px, 100vw); max-width: 100vw; max-height: 82vh; border-radius: 22px 22px 0 0; background: var(--surface); color: var(--fg); display: none; flex-direction: column; }
dialog.sheet[open] { display: flex; animation: keo-len .22s ease-out; }
dialog.sheet::backdrop { background: rgb(0 0 0 / .45); }
@keyframes keo-len { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-dau { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 22px 18px 4px; }
.sheet-keo { position: absolute; top: 8px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--line); }
.sheet-dau h3 { margin: 0; font: 700 1.2rem var(--display); }
.sheet-dong { border: 0; background: var(--bubble); color: var(--fg); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1rem; }
.sheet-sach { margin: 0 18px 6px; color: var(--muted); font-size: .85rem; }
.sheet-ds { overflow-y: auto; padding: 0 18px 18px; }
.ch-the .sec-h { margin-bottom: 4px; }
.ch { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg); padding: 13px 0; cursor: pointer; font: inherit; }
.ch:last-child { border-bottom: 0; }
.ch-tt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ch-tt b { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.ch-tt small { color: var(--muted); font-size: .8rem; }
.ch-tt .ch-nhan { color: var(--accent-text); font-weight: 700; font-size: .72rem; letter-spacing: .03em; }
.ch-ic { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; color: var(--accent); font-size: 1rem; }
.ch-ic svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.ch.dang b { color: var(--accent-text); }
.ch.dang .ch-ic { border-color: var(--accent); background: var(--accent-soft); }
.ch.xong .ch-ic { color: var(--ok); }
.ch.khoa b, .ch.khoa small { color: var(--muted); }
.ch.khoa .ch-ic { border-color: transparent; }
.ch-nhom { margin: 14px 0 0; font: 700 .78rem var(--body); color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.ch-mo-khoa { margin: 12px 0 6px; padding: 14px; border-radius: 14px; background: linear-gradient(120deg, #fde7e4, var(--accent-soft)); display: flex; flex-direction: column; gap: 10px; transition: box-shadow .2s; }
.ch-mo-khoa p { margin: 0; font-weight: 600; color: #16263a; }
.ch-mo-khoa .btn { margin: 0; }
.ch-mo-khoa.nhay { box-shadow: 0 0 0 3px var(--accent); }
.ch-ma { display: flex; gap: 8px; }
.ch-ma input { flex: 1; min-width: 0; text-transform: uppercase; }
.ch-ma .btn { flex: none; background: linear-gradient(90deg, #e86a5e, #f89335); }
.ch-loi { margin: 0; color: var(--err); font-size: .85rem; }
.tv-nhan.nghe-thu { background: var(--accent-soft); color: var(--accent-text); }
.tb-nho { position: fixed; left: 50%; bottom: calc(var(--tabh) + 20px); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: .9rem; max-width: calc(100vw - 32px); }
