/* Nói Hay · app web v0.1. Nhận diện 10xSystem v1.0: bảng màu A "Mực và Nghệ",
   Roboto + Noto Serif (đặt tại chỗ, có đủ dấu tiếng Việt), nghệ dùng ít (≤ 1/10 diện tích). */
@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("phong/roboto-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("phong/roboto-500.woff2") format("woff2"); }
@font-face { font-family: "Noto Serif"; font-weight: 400; font-display: swap; src: url("phong/notoserif-400.woff2") format("woff2"); }

:root {
  --ink: #15171A;
  --paper: #F5F2EB;
  --acc: #F0B400;
  --grey: #62666D;
  --line: #D8D2C6;
  --card: #FFFDF8;
  --ok: #2F6B3A;
  --warn: #8A4B00;
  --grey-on-ink: #B9B6AE;
  --sans: "Roboto", "Noto Sans", -apple-system, "Segoe UI", Arial, sans-serif;
  --serif: "Noto Serif", Georgia, serif;
  --r: 14px;
  --tab: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 18px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
h1 { font: 500 30px/1.2 var(--sans); letter-spacing: -0.01em; }
h2 { font: 500 22px/1.3 var(--sans); }
h3 { font: 500 18px/1.35 var(--sans); }
button, input, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.man { flex: 1; padding: 20px 20px calc(var(--tab) + var(--safe-b) + 28px); display: flex; flex-direction: column; gap: 18px; }
.man.khong-tab { padding-bottom: calc(24px + var(--safe-b)); }
.dau { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.dau .nhan { font-size: 14px; color: var(--grey); letter-spacing: 0.02em; text-transform: uppercase; }
.dau .lui { margin-left: -10px; }
.muted { color: var(--grey); }
.nho { font-size: 15px; }
.serif { font-family: var(--serif); }
.giua { text-align: center; }
.hang { display: flex; gap: 12px; align-items: center; }
.cot { display: flex; flex-direction: column; gap: 12px; }
.day-cuoi { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

/* nút: cao ≥ 56px, bấm một tay */
.nut {
  appearance: none; border: 0; border-radius: var(--r); min-height: 58px; padding: 14px 22px;
  font-weight: 500; font-size: 19px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--ink); color: var(--paper); width: 100%; text-decoration: none;
}
.nut:disabled { opacity: 0.35; cursor: default; }
.nut.phu { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.nut.chu { background: transparent; color: var(--ink); min-height: 48px; text-decoration: underline; text-underline-offset: 4px; font-weight: 400; }
.nut.lon { min-height: 76px; font-size: 22px; border-radius: 18px; }
.nut .goc { width: 12px; height: 12px; background: var(--acc); align-self: flex-start; margin: -2px -8px 0 0; }
.nut-icon { appearance: none; border: 0; background: transparent; width: 48px; height: 48px; display: grid; place-items: center; cursor: pointer; border-radius: 50%; }

.the { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.the.toi { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.the.toi .muted { color: var(--grey-on-ink); }

/* Andy nói */
.andy { display: flex; gap: 12px; align-items: flex-start; }
.andy .mat { width: 52px; height: 52px; border-radius: 50%; flex: none; border: 2px solid var(--ink); object-fit: cover; background: var(--paper); }
.andy .bong { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 4px var(--r) var(--r) var(--r); padding: 12px 16px; font-family: var(--serif); font-size: 18px; line-height: 1.55; }
.andy .ten { display: block; font: 500 13px var(--sans); color: var(--grey); margin-bottom: 2px; letter-spacing: 0.03em; text-transform: uppercase; }
.anh-andy { width: min(62%, 260px); margin: 0 auto; }
.anh-andy.nho { width: min(42%, 180px); }
.anh-andy.vua { width: auto; height: min(26vh, 220px); }
.anh-andy { height: auto; }

/* tab dưới */
.tab {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--paper);
  border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tab nav { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); height: var(--tab); }
.tab a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--grey); font-size: 13px; font-weight: 500; }
.tab a svg { width: 26px; height: 26px; }
.tab a[aria-current="page"] { color: var(--ink); }
.tab a[aria-current="page"] svg .nhan-goc { fill: var(--acc); }

/* Hôm nay */
.so-ngay { display: flex; align-items: flex-end; gap: 6px; }
.so-ngay b { font: 500 84px/0.9 var(--sans); letter-spacing: -0.03em; position: relative; }
.so-ngay b::after { content: ""; position: absolute; width: 14px; height: 14px; background: var(--acc); right: -18px; top: -4px; }
.so-ngay span { font-size: 22px; color: var(--grey); margin-left: 20px; padding-bottom: 6px; }
.thanh { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; display: grid; grid-template-columns: repeat(28, 1fr); gap: 2px; }
.thanh i { background: #E8E2D6; }
.thanh i.xong { background: var(--ink); }
.thanh i.nay { background: var(--acc); }
.chuoi { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.chuoi b { font-size: 26px; }

/* bài tập */
.van-ban { font-family: var(--serif); font-size: 21px; line-height: 1.75; }
.chu-de { font: 500 24px/1.35 var(--sans); }
.buoc { counter-reset: b; display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0; list-style: none; }
.buoc li { counter-increment: b; display: flex; gap: 12px; align-items: baseline; }
.buoc li::before { content: counter(b); font-weight: 500; width: 28px; height: 28px; flex: none; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: 14px; }
.dong-ho { font: 500 64px/1 var(--sans); font-variant-numeric: tabular-nums; text-align: center; letter-spacing: -0.02em; }
.vong { width: 200px; height: 200px; margin: 0 auto; position: relative; }
.vong svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.vong .so { position: absolute; inset: 0; display: grid; place-items: center; font: 500 52px var(--sans); font-variant-numeric: tabular-nums; }
.cham { display: flex; gap: 6px; justify-content: center; }
.cham i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.cham i.on { background: var(--ink); }

/* ghi âm */
.song { width: 100%; height: 120px; display: block; }
.nut-ghi { width: 104px; height: 104px; border-radius: 50%; border: 0; background: var(--ink); margin: 0 auto; display: grid; place-items: center; cursor: pointer; position: relative; }
.nut-ghi::after { content: ""; position: absolute; width: 20px; height: 20px; background: var(--acc); top: 2px; right: 2px; }
.nut-ghi .tron { width: 36px; height: 36px; border-radius: 50%; background: #E5484D; }
.nut-ghi.dang .tron { border-radius: 6px; width: 32px; height: 32px; background: var(--paper); }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; background: var(--card); }
.chip.canh { border-color: #E0B36A; background: #FFF4DC; color: var(--warn); }
.dang-ghi { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.dang-ghi::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #E5484D; animation: nhay 1s infinite; }
@keyframes nhay { 50% { opacity: 0.2; } }

/* kết quả */
.luoi-so { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.o-so { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.o-so .gt { font: 500 34px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.o-so .dv { font-size: 14px; color: var(--grey); }
.o-so .ten { font-size: 15px; color: var(--grey); margin-bottom: 4px; }
.o-so .doi { font-size: 14px; margin-top: 4px; }
.ban-chep { font-family: var(--serif); font-size: 19px; line-height: 1.9; }
.ban-chep span { cursor: pointer; border-radius: 4px; }
.ban-chep .dem { background: var(--acc); color: var(--ink); padding: 1px 5px; font-family: var(--sans); font-weight: 500; font-size: 17px; }
/* v3: câu hỏi đuôi khác từ đệm: nền giấy, viền mực đứt (không dùng màu nghệ của từ đệm) */
.ban-chep .hoi { border: 1.5px dashed var(--ink); padding: 0 4px; font-family: var(--sans); font-weight: 500; font-size: 17px; }
p .dem { background: var(--acc); color: var(--ink); padding: 0 5px; border-radius: 4px; }
p .hoi { border: 1.5px dashed var(--ink); padding: 0 4px; border-radius: 4px; }
.ban-chep .lang { color: var(--grey); font-family: var(--sans); font-size: 14px; }
.ban-chep .dang-phat { outline: 2px solid var(--ink); }
.loi-mai { border: 2px solid var(--ink); position: relative; }
.loi-mai::after { content: ""; position: absolute; width: 18px; height: 18px; background: var(--acc); top: -10px; right: -10px; }
.nhan-gia-lap { background: var(--ink); color: var(--paper); font-size: 13px; padding: 6px 12px; border-radius: 8px; }
audio { width: 100%; height: 44px; }
.tabs-luot { display: flex; gap: 8px; }
.tabs-luot button { flex: 1; min-height: 48px; border-radius: 12px; border: 2px solid var(--ink); background: transparent; font-weight: 500; cursor: pointer; }
.tabs-luot button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* tiến bộ */
.bieu-do svg { width: 100%; height: auto; overflow: visible; }
.bieu-do .truc { stroke: var(--line); }
.bieu-do .duong { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.bieu-do .diem { fill: var(--ink); }
.bieu-do .diem.cuoi { fill: var(--acc); stroke: var(--ink); stroke-width: 2; }
.bieu-do text { font: 12px var(--sans); fill: var(--grey); }
.bieu-do .vung { fill: #EDE7DA; }
table.so-sanh { width: 100%; border-collapse: collapse; font-size: 16px; }
table.so-sanh th, table.so-sanh td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
table.so-sanh th:first-child, table.so-sanh td:first-child { text-align: left; }
table.so-sanh thead th { font-weight: 500; color: var(--grey); font-size: 14px; }

/* cài đặt, đồng ý */
.dong { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dong:last-child { border-bottom: 0; }
.dong .chu { flex: 1; }
.dong .chu small { display: block; color: var(--grey); font-size: 14px; line-height: 1.45; margin-top: 2px; }
.cong-tac { appearance: none; width: 54px; height: 32px; border-radius: 16px; background: var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.cong-tac::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.cong-tac:checked { background: var(--ink); }
.cong-tac:checked::after { transform: translateX(22px); }
.o-tich { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.o-tich input { appearance: none; width: 28px; height: 28px; border: 2px solid var(--ink); border-radius: 6px; flex: none; margin: 2px 0 0; cursor: pointer; display: grid; place-items: center; background: var(--card); }
.o-tich input:checked { background: var(--ink); }
.o-tich input:checked::after { content: ""; width: 7px; height: 13px; border: solid var(--paper); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.o-tich .bb { font-size: 13px; color: var(--grey); font-weight: 400; }
.o-tich small { display: block; color: var(--grey); font-size: 15px; line-height: 1.5; margin-top: 4px; }
input[type="time"], input[type="url"], input[type="text"] { border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; min-height: 48px; background: var(--card); width: 100%; }
.nhap { background: #FFF4DC; border: 1px dashed #E0B36A; border-radius: 10px; padding: 10px 14px; font-size: 14px; color: var(--warn); }
.cho-dien { background: #FFF4DC; color: var(--warn); border-radius: 4px; padding: 0 4px; }
.van-ban-dai { font-size: 17px; line-height: 1.65; }
.van-ban-dai h1 { font-size: 26px; margin: 8px 0 12px; }
.van-ban-dai h2 { font-size: 20px; margin: 22px 0 8px; }
.van-ban-dai h3 { font-size: 18px; margin: 18px 0 6px; }
.van-ban-dai p, .van-ban-dai ul, .van-ban-dai ol, .van-ban-dai blockquote { margin: 0 0 12px; }
.van-ban-dai ul, .van-ban-dai ol { padding-left: 22px; }
.van-ban-dai blockquote { border-left: 4px solid var(--acc); padding: 6px 12px; background: var(--card); }
.van-ban-dai table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; margin-bottom: 12px; }
.van-ban-dai td, .van-ban-dai th { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: left; }
.van-ban-dai code { background: var(--card); padding: 1px 4px; border-radius: 4px; font-size: 0.9em; }

.thong-bao { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 16px); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-size: 16px; z-index: 50; max-width: calc(100% - 32px); }
.hop-thoai { position: fixed; inset: 0; background: rgba(21,23,26,.55); display: grid; place-items: end center; z-index: 60; padding: 16px; }
.hop-thoai .the { width: 100%; max-width: 488px; padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-bottom: var(--safe-b); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
a.nut-icon, .nut-icon { color: var(--ink); text-decoration: none; font-size: 24px; line-height: 1; }

/* khung ghi âm luôn nằm dưới đáy màn, văn bản cuộn phía trên */
.dock { position: sticky; bottom: 0; z-index: 5; margin: auto -20px calc(-24px - var(--safe-b)); padding: 14px 20px calc(16px + var(--safe-b)); background: var(--paper); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -8px 16px rgba(245,242,235,.9); }
.dock .song { height: 64px; }
.dock .dong-ho { font-size: 44px; }
.hang-ghi { display: flex; align-items: center; gap: 16px; width: 100%; }
.dock .nut-ghi { width: 84px; height: 84px; }
.dock .nut-ghi::after { width: 16px; height: 16px; }
a.dong { color: inherit; }
table.so-sanh thead th { white-space: nowrap; }
table.so-sanh td:first-child { line-height: 1.3; }

/* liên kết trong chữ: màu mực, gạch chân màu nghệ (không dùng xanh mặc định) */
.man p a:not(.nut), .man li a:not(.nut) { color: var(--ink); text-decoration: underline; text-decoration-color: var(--acc); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 500; }
.anh-andy.vua { height: min(22vh, 200px); }
.cong-tac:disabled { opacity: .4; cursor: not-allowed; }
