/* Góc học viên (/hoc-vien/). Một cột, mỗi màn hình chỉ một việc.
   Màu và font theo giao diện B của web chính (assets/site.css): đỏ #9A2720, nền kem, Be Vietnam Pro. */
:root {
  color-scheme: light;
  --bg: #FBF8F5;
  --card: #FFFFFF;
  --soft: #F6F1EC;
  --ink: #221B1A;
  --muted: #5E5450;
  --line: #EDE6E0;
  --teal: #9A2720; /* = --accent của web chính (assets/site.css) */
  --teal-soft: #F7EAE8;
  --coral: #A35A1F;
  --gold: #E39A2D;
  --ok: #2F7A57;
  --ok-soft: #E7F3EC;
  --bad: #B42318;
  --bad-soft: #FCEDEB;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(34, 27, 26, .06);
  --han: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: 'Be Vietnam Pro', Arial, sans-serif; font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
[hidden] { display: none !important; }
.han { font-family: var(--han); font-weight: 500; letter-spacing: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Thanh trên */
.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  max-width: 600px; margin: 0 auto; padding: 10px 20px; background: var(--bg);
}
.bar-logo img { display: block; width: 64px; height: auto; border-radius: 10px; }
.bar-name { flex: 1; font-weight: 600; }
.link { padding: 8px 4px; border: 0; background: none; color: var(--teal); font-weight: 600; cursor: pointer; }

.app { max-width: 600px; margin: 0 auto; padding: 8px 20px 48px; }

/* Nút */
.btn {
  display: inline-flex; width: 100%; min-height: 56px; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 20px; border: 0; border-radius: 16px; background: var(--teal); color: #fff;
  font-size: 17px; font-weight: 600; cursor: pointer; transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-soft { background: var(--teal-soft); color: var(--teal); }
.btn:disabled { background: var(--soft); color: var(--muted); cursor: default; }

/* Đăng nhập */
.login { padding-top: 6vh; }
.login-logo { display: block; width: 120px; height: auto; margin: 0 auto 18px; border-radius: 16px; }
.login h1 { margin: 0 0 6px; font-size: 26px; text-align: center; }
.login p { margin: 0 0 24px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; }
.field input {
  min-height: 54px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); font-size: 17px;
}
.form-error { min-height: 24px; margin: 0 0 8px; color: var(--bad); font-weight: 600; }
.demo-note { margin-top: 22px; padding: 14px 16px; border-radius: 14px; background: var(--soft); color: var(--muted); font-size: 14px; }

/* Lộ trình */
.hello { margin: 8px 0 18px; font-size: 24px; font-weight: 700; }
.continue {
  display: block; width: 100%; margin-bottom: 28px; padding: 22px; border: 0; border-radius: var(--radius);
  background: var(--teal); color: #fff; text-align: left; box-shadow: var(--shadow); cursor: pointer;
}
.continue small { display: block; opacity: .8; font-size: 14px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.continue strong { display: block; margin: 4px 0 12px; font-size: 24px; }
.continue .meter { background: rgba(255,255,255,.25); }
.continue .meter span { background: #fff; }
.continue .continue-sub { display: block; margin-top: 8px; font-size: 14px; opacity: .9; }

.books { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.books button {
  flex: 1 0 auto; min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); font-weight: 600; cursor: pointer;
}
.books button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal); color: #fff; }
.books button:disabled { color: #B9ADA6; cursor: default; }

.path { position: relative; display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.path::before { content: ''; position: absolute; top: 20px; bottom: 20px; left: 27px; width: 2px; background: var(--line); }
.node {
  position: relative; display: flex; width: 100%; align-items: center; gap: 14px; padding: 12px 14px;
  border: 1px solid transparent; border-radius: 16px; background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.node:not(:disabled):hover { background: var(--card); }
.node:disabled { cursor: default; }
.dot {
  position: relative; z-index: 1; display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center;
  border: 2px solid var(--line); border-radius: 50%; background: var(--bg); color: #fff; font-size: 14px; font-weight: 700;
}
.node-title { display: block; font-weight: 600; }
.node-sub { display: block; color: var(--muted); font-size: 14px; }
.node.is-done .dot { border-color: var(--ok); background: var(--ok); }
.node.is-current { border-color: var(--teal); background: var(--card); box-shadow: var(--shadow); }
.node.is-current .dot { border-color: var(--teal); background: var(--teal); }
.node.is-locked { color: #A79A93; }
.node.is-locked .dot { color: #A79A93; }

.meter { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--teal); transition: width .25s ease; }

/* Bài học */
.lesson-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.lesson-head h1 { flex: 1; margin: 0; font-size: 20px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 22px; padding: 0; list-style: none; }
.steps li { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.steps li::before { content: ''; display: block; height: 6px; margin-bottom: 6px; border-radius: 99px; background: var(--line); }
.steps li.is-done::before { background: var(--ok); }
.steps li.is-active { color: var(--teal); }
.steps li.is-active::before { background: var(--teal); }
.speak-entry { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; margin: -8px 0 18px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 14px; background: var(--card); color: var(--teal); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.speak-entry small { color: var(--muted); font-size: 12px; font-weight: 500; }
.speak-entry:hover, .speak-entry:focus-visible { border-color: var(--teal); }
.speak-title { margin: 0 0 10px; font-size: 19px; }
.speak-notes { margin: 0 0 18px; padding-left: 20px; line-height: 1.6; }
.speak-notes li { margin-bottom: 6px; }
.speak-word { display: grid; justify-items: center; gap: 4px; margin: 10px 0 6px; text-align: center; }
.speak-word .han { font-size: 64px; line-height: 1.15; }
.speak-word .pinyin { color: var(--teal); font-size: 20px; font-weight: 600; }
.speak-word .meaning { color: var(--muted); }
.speak-row { justify-content: center; align-items: center; }
.mic { display: grid; width: 88px; height: 88px; place-items: center; border: 0; border-radius: 50%; background: var(--teal); color: #fff; font-size: 34px; cursor: pointer; }
.mic.is-on { background: #C94A4A; box-shadow: 0 0 0 8px rgba(201,74,74,.18); }
.mic:disabled { opacity: .45; cursor: default; }

.panel { padding: 26px 22px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.panel-top { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); font-size: 14px; font-weight: 600; }
.panel .meter { margin-bottom: 22px; }
.ask { margin: 0 0 18px; color: var(--muted); text-align: center; }

.card {
  display: grid; width: 100%; min-height: 260px; place-items: center; padding: 20px; border: 0; border-radius: 18px;
  background: var(--soft); color: var(--ink); text-align: center; cursor: pointer;
}
.card .han { display: block; color: var(--teal); font-size: clamp(64px, 18vw, 96px); line-height: 1.2; }
.card .pinyin { display: block; margin-top: 6px; color: var(--coral); font-size: 24px; font-weight: 600; }
.card .meaning { display: block; margin-top: 2px; font-size: 20px; }
.card .tap { display: block; margin-top: 12px; color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; margin-top: 16px; }
.row .btn { flex: 1; }
.sound { flex: 0 0 56px !important; width: 56px; padding: 0; }

.prompt { margin-bottom: 18px; text-align: center; }
.prompt .han { display: block; color: var(--teal); font-size: clamp(56px, 16vw, 84px); line-height: 1.2; }
.play { display: grid; width: 104px; height: 104px; margin: 6px auto 0; place-items: center; border: 0; border-radius: 50%; background: var(--teal); color: #fff; font-size: 36px; cursor: pointer; }
.choices { display: grid; gap: 10px; }
.choice {
  min-height: 58px; padding: 12px 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--card);
  color: var(--ink); font-size: 18px; font-weight: 500; cursor: pointer;
}
.choice.han { font-size: 30px; }
.choice:disabled { cursor: default; }
.choice.is-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.choice.is-bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.feedback { min-height: 26px; margin: 14px 0 10px; font-weight: 600; text-align: center; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--bad); }

.done { text-align: center; }
.done .big { margin: 0; color: var(--teal); font-size: 64px; font-weight: 700; line-height: 1; }
.done h2 { margin: 12px 0 6px; font-size: 22px; }
.done p { margin: 0 0 20px; color: var(--muted); }
.done .btn + .btn { margin-top: 10px; }
.review { display: grid; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; text-align: left; }
.review li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 14px; border-radius: 12px; background: var(--soft); }
.review .han { color: var(--teal); font-size: 24px; }
.review .pinyin { color: var(--coral); font-weight: 600; }

@media (min-width: 560px) {
  .choices { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .meter span { transition: none; }
}

/* Trang giáo viên */
.teacher .app, .teacher .bar { max-width: 760px; }
.teacher .panel { margin-bottom: 18px; }
.t-current { cursor: default; }
.t-current .row { margin-top: 18px; }
.t-current .btn-soft { background: rgba(255,255,255,.16); color: #fff; }
.t-current .btn-soft:disabled { opacity: .4; }
.t-open { background: #fff; color: var(--teal); }
.t-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; }
.t-select { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; }
.t-current .t-select { flex: 1; min-width: 200px; }
.t-title { margin: 0 0 14px; font-size: 18px; }
.t-head, .t-row { display: grid; grid-template-columns: 1.6fr 1fr .8fr .9fr; align-items: center; gap: 10px; }
.t-head { padding: 0 4px 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.t-list { margin: 0; padding: 0; list-style: none; }
.t-row { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.t-name { font-weight: 600; }
.t-name small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
button.t-name { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
button.t-name:hover, button.t-name:focus-visible { color: var(--teal); }
button.t-name:hover small, button.t-name:focus-visible small { color: var(--teal); }
.s-back { display: inline-block; margin: 0 0 14px; }
.s-head h2 { margin: 0 0 4px; font-size: 22px; }
.s-head .muted { margin: 0 0 16px; }
.s-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.s-sum div { padding: 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); }
.s-sum strong { display: block; font-size: 18px; }
.s-sum span { color: var(--muted); font-size: 13px; }
.s-lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.s-lesson h3 { margin: 0; font-size: 17px; }
.s-lesson h3 small { margin-left: 6px; color: var(--teal); font-size: 12px; font-weight: 600; }
.s-chip { padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.s-chip.is-ok { background: var(--ok-soft); color: var(--ok); }
.s-chip.is-low { background: #FCEFD9; color: #9A5B00; }
.s-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.s-step { padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.s-step.is-ok { border-color: var(--ok); background: var(--ok-soft); }
.s-step.is-low { border-color: #E9B866; background: #FFF8EC; }
.s-step-name { display: block; color: var(--muted); font-size: 12px; }
.s-score { display: block; margin: 2px 0; font-size: 20px; }
.s-meta { display: block; color: var(--muted); font-size: 12px; }
.s-last { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.t-cur { display: flex; gap: 4px; }
.t-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.t-dot.is-on { background: var(--ok); }
.t-num, .t-time { color: var(--muted); font-size: 14px; }
.t-form .field select { min-height: 54px; }
.t-cancel { margin-top: 10px; }
.t-created { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--ok-soft); }
.t-created p { margin: 0 0 10px; }
.t-created pre { margin: 0 0 12px; padding: 12px; border-radius: 10px; background: #fff; font: 14px/1.6 'Be Vietnam Pro', Arial, sans-serif; white-space: pre-wrap; }
@media (max-width: 560px) {
  .t-head { display: none; }
  .s-steps { grid-template-columns: repeat(2, 1fr); }
  .s-sum strong { font-size: 15px; }
  .t-row { grid-template-columns: 1fr auto; }
  .t-num, .t-time { grid-column: auto; font-size: 13px; }
}

/* Ngữ pháp (mẫu câu) và nút phần thêm */
.extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: -8px 0 18px; }
.extras .speak-entry { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; margin: 0; text-align: left; }
.g-card { margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.g-pattern { margin: 0 0 6px; color: var(--teal); font-size: 20px; font-weight: 700; }
.g-note { margin: 0 0 10px; color: var(--muted); line-height: 1.5; }
.g-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.g-ex { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.g-ex > span { display: grid; gap: 2px; }
.g-ex .han { font-size: 22px; }
.g-ex .pinyin { color: var(--teal); font-size: 14px; }
.g-ex .meaning { color: var(--muted); font-size: 14px; }
.g-target { margin: 4px 0 14px; font-size: 18px; font-weight: 600; text-align: center; }
.g-answer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 58px; margin: 0 0 14px; padding: 8px; border: 2px dashed var(--line); border-radius: 14px; }
.g-answer.is-ok { border-color: #2E8B57; border-style: solid; }
.g-answer.is-bad { border-color: #C94A4A; border-style: solid; }
.g-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 14px; }
.g-tile { padding: 8px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 24px; cursor: pointer; }
.g-answer .g-tile { cursor: default; }
.g-tile:disabled { opacity: .3; cursor: default; }
.g-title { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* Máy đăng nhập (trang giáo viên) */
.t-name .t-warn { color: var(--bad); font-weight: 700; }
.d-list { margin: 0 0 14px; padding-left: 18px; }
.d-list li { margin: 6px 0; }
.d-list .muted { display: block; font-size: 13px; }
.d-warn li { color: var(--bad); }
.note { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: #FFF8EC; border: 1px solid #E9B866; color: var(--ink); font-size: 15px; }
.legal { margin-top: 16px; font-size: 14px; } .legal a { color: var(--teal); }

/* ---------- Giao diện Trẻ Em (body.kids: lớp học khóa Trẻ Em) ----------
   Màu tươi, chữ và nút to, bo tròn, nút "nổi" có bóng đáy để bé dễ bấm. */
body.kids {
  --bg: #FFF8E8; --card: #FFFFFF; --soft: #FFF0D1; --ink: #2B2340; --muted: #6E6280; --line: #F1E3C4;
  --teal: #2E9BE6; --teal-soft: #E3F2FD; --coral: #FF7A6B; --gold: #FFC83D;
  --ok: #2FA968; --ok-soft: #E6F8EE; --bad: #E2554A; --bad-soft: #FFECEA;
  --radius: 26px; --shadow: 0 6px 0 #F1E3C4;
}
body.kids .btn { min-height: 60px; border-radius: 999px; font-size: 19px; font-weight: 800; box-shadow: 0 5px 0 rgba(0,0,0,.14); }
body.kids .btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0,0,0,.14); }
body.kids .btn-soft { background: var(--gold); color: var(--ink); }
body.kids .hello { font-size: 28px; font-weight: 800; }
body.kids .bar-logo img { width: 76px; background: #fff; padding: 4px; box-shadow: 0 2px 0 rgba(0,0,0,.06); }
body.kids .continue { background: linear-gradient(135deg, #2E9BE6, #4FC3F7); border-radius: 28px; box-shadow: 0 6px 0 #1F7CC0; }
body.kids .continue strong { font-size: 26px; font-weight: 800; }
body.kids .continue .meter span { background: var(--gold); }
body.kids .books button[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); }
body.kids .path { gap: 14px; }
body.kids .path::before { left: 33px; width: 6px; border-radius: 6px; background: #F1E3C4; }
body.kids .node { border-radius: 24px; padding: 10px 14px; }
body.kids .dot { width: 46px; height: 46px; font-size: 20px; border-width: 0; background: #E4DACB; color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.12); }
body.kids .node.is-done .dot { background: var(--ok); }
body.kids .node.is-current { border-color: var(--coral); }
body.kids .node.is-current .dot { background: var(--coral); animation: kids-pulse 1.2s ease-in-out infinite; }
body.kids .node.is-current .dot::after { content: '★'; }
body.kids .node-title { font-size: 18px; font-weight: 800; }
body.kids .meter { height: 14px; background: #F1E3C4; }
body.kids .meter span { background: var(--ok); }
body.kids .steps li { font-size: 13px; font-weight: 800; }
body.kids .steps li::before { height: 10px; }
body.kids .panel { border-radius: 30px; box-shadow: 0 8px 0 #F1E3C4; }
body.kids .card { border-radius: 28px; }
body.kids .card .han, body.kids .prompt .han { color: var(--ink); font-size: clamp(84px, 26vw, 128px); }
body.kids .card .pinyin, body.kids .speak-word .pinyin { color: var(--teal); font-size: 30px; font-weight: 800; }
body.kids .card .meaning { font-size: 24px; font-weight: 800; }
body.kids .play, body.kids .mic { width: 112px; height: 112px; font-size: 44px; background: var(--teal); box-shadow: 0 6px 0 #1F7CC0; }
body.kids .mic { background: var(--coral); box-shadow: 0 6px 0 #D0584B; }
body.kids .sound { background: var(--gold) !important; color: var(--ink); }
body.kids .choices { grid-template-columns: 1fr 1fr; gap: 14px; }
body.kids .choice { min-height: 84px; border-width: 4px; border-radius: 24px; font-weight: 800; box-shadow: 0 5px 0 #F1E3C4; }
body.kids .choice.han { min-height: 110px; font-size: 48px; }
body.kids .feedback { font-size: 20px; font-weight: 800; }
body.kids .feedback.ok::after { content: ' 🎉'; }
body.kids .done .big { font-size: 80px; }
body.kids .done h2 { font-size: 28px; font-weight: 800; }
body.kids .speak-entry { border: 3px dashed #F1E3C4; border-radius: 22px; font-weight: 800; }
@keyframes kids-pulse { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { body.kids .node.is-current .dot { animation: none; } }
/* Trang giáo viên: đặt lại mật khẩu học viên */
.pw-form { display: grid; gap: 8px; }
.form-error.is-ok { color: var(--ok); }
.t-row.tc-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
