/* Tokutei Gino: giao diện tối giản, màu theo thương hiệu (xanh đậm, xanh nhạt, hồng nhạt). Ưu tiên điện thoại. */
:root {
  --brand: #10291a;
  --accent: #a8d5b5;
  --brand-2: #1a4a2a;
  --soft: #e5efd7;
  --pink: #fae6e6;
  --bg: #f3f6f4;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --ok: #218838;
  --bad: #dc3545;
  --warn: #f0ad00;
  --radius: 14px;
  --tabbar-h: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);   /* vùng vạch Home trên iPhone: thanh menu dưới cao thêm phần này */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, 'Noto Sans JP', 'Yu Gothic', Arial, sans-serif;
  line-height: 1.5; font-size: 16px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
ruby rt { font-size: 0.55em; }

/* ---------- khung ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 12.5px; letter-spacing: -.2px;   /* logo chữ TMY */
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 17px; letter-spacing: .3px; }
.brand-text small { font-size: 11px; opacity: .75; }
.topnav { display: none; margin-left: auto; gap: 4px; }
.topnav a { padding: 8px 14px; border-radius: 20px; font-size: 14px; opacity: .85; }
.topnav a:hover { opacity: 1; background: rgba(255,255,255,.1); }
.topnav a.on { background: var(--soft); color: var(--brand); opacity: 1; font-weight: 600; }

.view { max-width: 960px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px); min-height: calc(100vh - 56px); }
body.no-chrome .topbar, body.no-chrome .tabbar { display: none; }
body.no-chrome .view { padding-bottom: 28px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.tabbar a {
  flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 11.5px; color: var(--muted);
}
.tabbar a span { font-size: 20px; line-height: 1; }
.tabbar a.on { color: var(--brand); font-weight: 700; }

@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .view { padding: 24px 20px 48px; }
  .quiz-bar { bottom: 12px; }
}

/* ---------- thành phần chung ---------- */
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.crumbs a { color: var(--brand-2); font-weight: 500; }
.crumbs a:hover { text-decoration: underline; }
.page-title { font-size: 22px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 16px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 10px;
  padding: 10px 18px; background: var(--brand); color: #fff; font-weight: 600; font-size: 15px;
}
.btn:hover { background: var(--brand-2); }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.ghost:hover { background: var(--soft); }
.btn.soft { background: var(--soft); color: var(--brand); }
.btn.danger { background: #fff; color: var(--bad); border: 1px solid var(--bad); }
.btn.sm { padding: 6px 12px; font-size: 13.5px; border-radius: 8px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: .45; cursor: default; }

.bar { height: 8px; background: #e8ece9; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .3s; }
.bar.pink > i { background: #c0564e; }
.meta { font-size: 13px; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); color: var(--brand); border-radius: 99px; padding: 2px 9px; font-size: 12.5px; }
.chip.warn { background: #fff3cd; color: #8a6d00; }
.chip.ok { background: #d6efdc; color: #14632a; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 17px; }
.spinner { text-align: center; color: var(--muted); padding: 48px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 99;
  pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- đăng nhập ---------- */
.auth-wrap { max-width: 400px; margin: 6vh auto 0; }
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .brand-mark { width: 56px; height: 56px; font-size: 19px; border-radius: 16px; background: var(--brand); color: var(--soft); margin: 0 auto 10px; }
.auth-logo h1 { font-size: 24px; color: var(--brand); }
.auth-logo p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; color: var(--brand); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid #cfd8d2; border-radius: 10px; background: #fff; font-size: 16px;
}
.field input:focus { outline: 2px solid var(--soft); border-color: var(--brand-2); }
.form-err { color: var(--bad); font-size: 14px; margin: 4px 0 10px; min-height: 1em; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 14.5px; color: var(--muted); }
.auth-switch a { color: var(--brand-2); font-weight: 600; }

/* ---------- khóa học của tôi ---------- */
.hello { margin-bottom: 14px; }
.hello h1 { font-size: 22px; color: var(--brand); }
.hello p { margin: 2px 0 0; color: var(--muted); font-size: 14.5px; }
.course-card { display: block; padding: 18px; border-left: 5px solid var(--brand); transition: transform .12s, box-shadow .12s; }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.course-card h2 { font-size: 19px; color: var(--brand); }
.course-card .sub { color: var(--muted); font-size: 14px; margin: 2px 0 12px; }
.course-card .row { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; }
.course-card .pct { font-weight: 700; color: var(--ok); }
.continue { display: flex; align-items: center; gap: 8px; background: var(--soft); color: var(--brand); border-radius: 10px; padding: 9px 12px; font-size: 14px; font-weight: 600; }
.continue small { font-weight: 400; color: #425a47; display: block; }

/* ---------- chi tiết khóa / mục ---------- */
.hero { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.hero h1 { font-size: 22px; }
.hero p { margin: 2px 0 12px; opacity: .8; font-size: 14.5px; }
.hero .bar { background: rgba(255,255,255,.2); }
.hero .bar > i { background: var(--soft); }
.hero .meta { color: rgba(255,255,255,.8); margin-top: 6px; }
.hero .btn { background: var(--soft); color: var(--brand); margin-top: 12px; }
.sec-card { display: block; padding: 16px; }
.sec-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.sec-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.sec-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.sec-head h3 { font-size: 17px; color: var(--brand); }
.sec-head small { color: var(--muted); font-size: 13px; }
.sec-card .meta { margin-top: 6px; }
.sec-card.soon { opacity: .65; }
.sec-card.soon:hover { box-shadow: none; }

.group-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--brand-2); margin: 18px 0 8px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border-radius: 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.lesson-row:hover { background: #fafcf8; }
.lesson-num { width: 36px; height: 36px; border-radius: 10px; background: var(--soft); color: var(--brand); display: grid; place-items: center; font-weight: 700; flex: none; }
.lesson-row.done .lesson-num { background: var(--ok); color: #fff; }
.lesson-body { flex: 1; min-width: 0; }
.lesson-body b { display: block; font-weight: 600; }
.lesson-state { font-size: 13px; color: var(--muted); white-space: nowrap; }
.lesson-row.done .lesson-state { color: var(--ok); font-weight: 600; }

/* ---------- bài học ---------- */
.lesson-title { font-size: 21px; color: var(--brand); font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.lt-done { font-size: 12.5px; font-weight: 700; color: #1e6b35; background: #e3f3e7; border: 1px solid #9fd3ad; border-radius: 99px; padding: 3px 10px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; border-bottom: 2px solid var(--line); scrollbar-width: thin; }
.tabs::-webkit-scrollbar { height: 3px; }   /* thanh cuộn mảnh: báo còn tab bị khuất bên phải (chỉ hiện khi tab tràn) */
.tabs::-webkit-scrollbar-thumb { background: #c9d3cc; border-radius: 3px; }
.tab { flex: none; padding: 10px 14px; border: 0; background: none; border-bottom: 3px solid transparent; margin-bottom: -2px; color: var(--muted); font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.tab.on { color: var(--brand); border-bottom-color: var(--accent); }
.subtabs { display: flex; gap: 6px; margin: 0 0 14px; padding: 4px; background: var(--soft); border-radius: 99px; }
.subtab { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 99px; color: var(--brand-2); font-weight: 600; font-size: 14px; }
.subtab.on { background: var(--brand); color: #fff; }
.tab .ck { color: var(--ok); margin-left: 4px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.lesson-nav .btn { flex: 1; max-width: 260px; }
.lesson-nav .btn.right { margin-left: auto; }

.player { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; width: 100%; }
.player video, .player iframe { width: 100%; height: 100%; border: 0; display: block; }
.watch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* thẻ từ vựng */
.fc { perspective: 1000px; cursor: pointer; margin: 0 auto 14px; max-width: 560px; }
.fc-in { position: relative; height: clamp(300px, 62vh, 460px); transition: transform .45s; transform-style: preserve-3d; }
.fc.flip .fc-in { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--brand); color: #fff; border-radius: 16px;
  border: 2px solid rgba(168,213,181,.3); box-shadow: 0 2px 10px rgba(0,0,0,.1); padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; overflow-y: auto;
}
.fc-back { transform: rotateY(180deg); justify-content: flex-start; text-align: left; align-items: stretch; background: #fff; color: #222; border: 1px solid var(--brand); }
.fc-no { position: absolute; top: 10px; left: 14px; font-size: 12.5px; color: rgba(255,255,255,.55); }
.fc-back .fc-no { color: var(--muted); }
.fc-jp { font-size: 46px; font-weight: 900; color: #fff; line-height: 1.2; word-break: break-all; }
.fc-read { font-size: 20px; color: rgba(255,255,255,.6); margin-top: 6px; }
.fc-type { margin-top: 8px; }
.fc-hint { position: absolute; bottom: 10px; font-size: 12.5px; color: rgba(255,255,255,.5); }
.fc-face .chip { background: var(--accent); color: var(--brand); }
.fc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.fc-head .jp { font-size: 24px; font-weight: 700; color: var(--brand); }
.fc-head .read { color: var(--brand-2); }
.fc-vn { font-size: 19px; font-weight: 600; margin-bottom: 10px; }
.fc-ex { border-left: 3px solid var(--soft); padding: 4px 0 4px 10px; margin-bottom: 8px; font-size: 15px; }
.fc-ex .vn { color: var(--muted); font-size: 13.5px; }
.fc-notes { background: #f6f8f4; border-radius: 8px; padding: 8px 10px; margin-top: 6px; font-size: 14px; }
.fc-notes b { color: var(--brand); }
.fc-notes ul { margin: 4px 0 0; padding-left: 18px; }
.fc-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.fc-count { background: #fff; border-radius: 99px; padding: 6px 16px; font-weight: 700; color: var(--muted); min-width: 84px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.fc-tools { display: flex; justify-content: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.shuffle.on { background: var(--brand); color: #fff; }
.word-list .w { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; background: #fff; border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.word-list .w.on { background: var(--pink); }
.word-list .w b { min-width: 84px; color: var(--brand); }
.word-list .w span { color: var(--muted); font-size: 14px; }

/* bài tập */
.quiz-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.q { background: #fff; border-radius: var(--radius); box-shadow: 0 1px 4px rgba(0,0,0,.06); padding: 14px 14px 8px; margin-bottom: 12px; }
.q-num { font-size: 12.5px; font-weight: 700; color: var(--brand-2); margin-bottom: 4px; }
.q-text { font-size: 17px; margin-bottom: 10px; line-height: 1.7; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.opt:hover { background: #f7faf5; }
.opt input { margin-top: 5px; flex: none; }
.opt.picked { background: #e6f7ff; border-color: #8ccaf0; }
.opt.right { background: #e4f5e8; border-color: #6fc283; }
.opt.wrong { background: #fde8ea; border-color: #ee9aa2; }
.opt .mk { margin-left: auto; font-weight: 700; }
.opt.right .mk { color: var(--ok); }
.opt.wrong .mk { color: var(--bad); }
.explain { background: #eef6ff; border-left: 4px solid var(--brand); border-radius: 8px; padding: 8px 12px; font-size: 14.5px; margin: 4px 0 10px; }
.quiz-bar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px); z-index: 20; background: #fff; border-radius: 99px; box-shadow: 0 2px 14px rgba(0,0,0,.18); padding: 8px 8px 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
@media (min-width: 900px) { .quiz-bar { bottom: 16px; } }
.result { text-align: center; padding: 22px 16px; margin-bottom: 14px; }
.result .big { font-size: 40px; font-weight: 800; color: var(--brand); }
.result.pass { background: #e4f5e8; }
.result.fail { background: var(--pink); }

.prose { background: #fff; border-radius: var(--radius); padding: 16px; line-height: 1.8; }

/* ---------- tiến độ / tài khoản / quản trị ---------- */
.prog-card { margin-bottom: 14px; }
.prog-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.prog-top h2 { font-size: 18px; color: var(--brand); }
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 800; color: var(--brand);
  background: conic-gradient(var(--ok) calc(var(--p) * 1%), #e8ece9 0); position: relative; }
.ring::before { content: ''; position: absolute; inset: 7px; background: #fff; border-radius: 50%; }
.ring span { position: relative; font-size: 15px; }
.sec-line { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 14.5px; }
.sec-line .nm { width: 120px; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sec-line .bar { flex: 1; }
.sec-line .n { width: 54px; text-align: right; color: var(--muted); font-size: 13px; flex: none; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.recent li:last-child { border-bottom: 0; }
.recent .t { flex: 1; min-width: 0; }
.recent .t small { display: block; color: var(--muted); }
.recent .when { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

.acct-grid { display: grid; gap: 14px; }
@media (min-width: 760px) { .acct-grid { grid-template-columns: 1fr 1fr; } }
.acct-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: var(--brand); color: var(--soft); display: grid; place-items: center; font-weight: 700; font-size: 24px; flex: none; }

.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.admin-tabs .tab { border: 1px solid var(--line); border-radius: 99px; margin: 0; background: #fff; }
.admin-tabs .tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.u-row { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.u-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.u-top b { display: block; }
.u-top small { color: var(--muted); }
.u-courses { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 14.5px; }
.u-courses label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.u-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th, .tbl td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
.tbl th { font-size: 12.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- phần (nhóm mục) của khóa học ---------- */
.grp-head { margin: 22px 0 10px; padding: 14px 16px; background: var(--soft); border-radius: var(--radius); }
.grp-head:first-of-type { margin-top: 4px; }
.grp-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.grp-head h2 { font-size: 19px; color: var(--brand); }
.grp-head p { margin: 4px 0 10px; font-size: 14px; color: #425a47; }
.grp-head .pct { font-weight: 700; color: var(--ok); }
.grp-head .bar { background: rgba(255,255,255,.7); }
.grp-head + .grid { margin-top: 12px; }
.prog-grp { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--brand-2); margin: 14px 0 2px; }

/* ---------- nhiều thành phần trong một tab ---------- */
.tab-item-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--brand-2); margin: 18px 0 8px; }
.tab-item-title:first-child { margin-top: 4px; }
.tab-item + .tab-item-title { margin-top: 22px; }

/* ---------- thẻ kanji ---------- */
.fc-kanji { font-size: 96px; font-family: 'Noto Sans JP', 'Yu Mincho', 'Hiragino Mincho ProN', serif; }
.fc-kanji-sm { font-size: 44px; font-family: 'Noto Sans JP', 'Yu Mincho', serif; }
.kj-yomi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kj-yomi > div { background: #f6f8f4; border-radius: 8px; padding: 8px 10px; }
.kj-yomi small { display: block; color: var(--muted); font-size: 12px; }
.kj-yomi b { font-size: 17px; color: var(--brand); font-weight: 600; }
.kj-ex { margin-bottom: 8px; }
.kj-ex > b { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--brand-2); margin-bottom: 4px; }
.kj-w { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.kj-w .w { font-weight: 700; font-size: 17px; }
.kj-w .r { color: var(--brand-2); }
.kj-w .v { color: var(--muted); font-size: 13.5px; flex-basis: 100%; }
.fc-head .jp.fc-kanji-sm { font-size: 44px; }

/* ---------- bài tập: tiêu đề phần (問題) và chỗ trống ---------- */
.q-part { background: var(--brand); color: #fff; border-radius: 12px; padding: 12px 14px; margin: 18px 0 10px; }
.q-part h3 { font-size: 16px; font-weight: 700; line-height: 1.5; }
.q-part p { margin: 4px 0 0; font-size: 13px; opacity: .85; }
.q-text u { text-decoration-thickness: 2px; text-underline-offset: 4px; }
.q-gap { display: inline-block; min-width: 3.2em; border-bottom: 2px solid #374151; margin: 0 3px; vertical-align: baseline; }

/* ---------- nội dung ngữ pháp (HTML nhập từ web) ---------- */
.prose .lead { margin: 0 0 14px; padding: 10px 12px; background: #f6f8f4; border-left: 4px solid var(--brand-2); border-radius: 8px; font-size: 14.5px; color: #374151; }
.prose .grammar-blocks { display: block; }
.prose .grammar-rule { border: 1px solid var(--line); border-radius: 12px; margin: 0 0 16px; background: #fff; }   /* không overflow:hidden: bảng rộng bên trong bị cắt mất cột trên điện thoại */
.prose .grammar-rule-head { display: flex; align-items: center; gap: 10px; background: var(--soft); padding: 10px 12px; border-radius: 11px 11px 0 0; }
.prose .grammar-rule-num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 14px; }
.prose .grammar-rule-title { font-weight: 700; color: var(--brand); font-size: 16.5px; line-height: 1.4; }
.prose .grammar-rule-body { padding: 12px 14px; }
.prose .grammar-subhead { font-weight: 700; color: var(--brand); margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--soft); }
.prose .grammar-subhead:first-child { margin-top: 0; }
.prose .grammar-formula { background: var(--pink); border-radius: 8px; padding: 9px 12px; margin: 8px 0; font-size: 15px; }
.prose .grammar-desc { margin: 8px 0; font-size: 15px; line-height: 1.75; }
.prose .grammar-eg { margin: 6px 0; padding: 6px 0 6px 12px; border-left: 3px solid var(--soft); font-size: 16px; line-height: 2; }
.prose .grammar-eg span { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.prose .grammar-table-wrap, .prose .grammar-table-scroll { overflow-x: auto; margin: 8px 0; -webkit-overflow-scrolling: touch; }
.prose .grammar-table, .prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose .grammar-table th, .prose .grammar-table td, .prose table th, .prose table td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.prose .grammar-table th, .prose table th { background: var(--soft); color: var(--brand); white-space: nowrap; }
.prose .grammar-note, .prose .grammar-warn { background: #fff8e1; border-left: 4px solid var(--warn); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14.5px; }
.prose ul, .prose ol { padding-left: 22px; }

/* ---------- trang khóa có nhiều lộ trình (Lớp Mất Gốc: N5 và N4) ---------- */
.banner { margin-bottom: 12px; }
.banner img { display: block; width: 100%; max-height: 300px; object-fit: cover;   /* banner khóa Tokutei cao hơn để chữ hiện đủ */ object-position: 50% 50%; border-radius: var(--radius); background: #dfe7e1; }
.hero-tag { font-weight: 400; opacity: .8; font-size: .8em; }
.hstats { display: flex; gap: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.hstat { background: rgba(255,255,255,.12); border-radius: 10px; padding: 6px 14px; text-align: center; }
.hstat b { display: block; font-size: 18px; }
.hstat span { font-size: 12px; opacity: .8; }
.intro { margin: 18px 0 6px; }
.intro h2 { font-size: 20px; color: var(--brand); }
.intro p { margin: 6px 0 0; color: #4b5563; font-size: 15px; line-height: 1.65; }
.eyebrow-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 18px 0 10px; flex-wrap: wrap; }
.eyebrow { font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px; color: var(--brand-2); }
.eyebrow-note { font-size: 13px; color: var(--muted); }
.path-row { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: stretch; }
.path-arrow { display: none; align-self: center; font-size: 26px; color: var(--brand-2); }
@media (min-width: 760px) { .path-row { grid-template-columns: 1fr auto 1fr; } .path-arrow { display: block; } }
.path-card { position: relative; display: flex; flex-direction: column; background: #fff; border-radius: var(--radius); padding: 22px 18px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); border-top: 5px solid var(--brand-2); transition: transform .12s, box-shadow .12s; }
.path-card.p2 { border-top-color: #e3a3a3; }
.path-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.path-card .step { position: absolute; top: -13px; left: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pbadge { align-self: flex-start; background: var(--soft); color: var(--brand); border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.path-card.p2 .pbadge { background: var(--pink); color: #a13a3a; }
.pbadge.on-dark { background: rgba(255,255,255,.18); color: #fff; margin-top: 4px; display: inline-block; }
.plevel { font-size: 44px; font-weight: 800; line-height: 1; color: var(--brand); margin: 10px 0 2px; font-family: 'Noto Sans JP', 'Roboto', sans-serif; }
.path-card.p2 .plevel { color: #a13a3a; }
.path-card h3 { font-size: 19px; color: var(--brand); }
.pdesc { margin: 6px 0 10px; color: #4b5563; font-size: 14.5px; line-height: 1.6; flex: 1; }
.pchips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.pchips.on-dark .chip { background: rgba(255,255,255,.18); color: #fff; }
.pcta { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding: 10px 14px; background: var(--brand); color: #fff; border-radius: 10px; font-weight: 700; }
.path-card.p2 .pcta { background: #a13a3a; }
.part-hero .hero-top { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.plevel-sm { font-size: 34px; font-weight: 800; background: rgba(255,255,255,.14); border-radius: 12px; padding: 4px 14px; font-family: 'Noto Sans JP', 'Roboto', sans-serif; }

/* phần bổ trợ của khóa (Thử Thách N4, Lớp Trực Tiếp) */
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
@media (max-width: 640px) { .mini-row { grid-template-columns: 1fr; } }
.mini-card { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius); padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .12s, box-shadow .12s; }
.mini-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.mini-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: none; background: var(--soft); color: var(--brand); }
.mini-card.thu-thach .mini-icon { background: #fff3d6; color: #8a6100; }
.mini-card.truc-tiep .mini-icon { background: var(--pink); color: #a13a3a; }
.mini-card.thi-thu .mini-icon { background: #e6efff; color: #2f4f9a; }
.mini-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-tag { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.mini-body b { font-size: 16px; color: var(--brand); }
.mini-desc { font-size: 13px; color: var(--muted); }
.mini-prog { font-size: 12px; color: var(--brand-2); font-weight: 600; margin-top: 2px; }
.mini-arrow { font-size: 22px; color: var(--muted); }

/* đề thi: kỹ năng, đoạn đọc, ảnh, file nghe */
.q-skill { margin: 18px 0 6px; padding: 8px 14px; background: var(--brand); color: #fff; border-radius: 10px; font-weight: 700; }
.q-passage { background: #fffdf6; border: 1px solid #eadfc0; border-left: 4px solid #e0c46a; border-radius: 10px; padding: 12px 14px; margin: 10px 0; font-size: 15.5px; line-height: 1.9; overflow-x: auto; }
.q-passage img, .q-img { display: block; max-width: 100%; height: auto; margin: 6px auto; border-radius: 8px; }
.q-audio { display: block; width: 100%; margin: 6px 0 8px; }

/* Quản lý học viên: cây nhóm năm → tháng → khóa */
.add-user { margin-bottom: 12px; }
.add-user summary { cursor: pointer; font-weight: 700; color: var(--brand); }
.add-user[open] summary { margin-bottom: 10px; }
.ad-search { margin-bottom: 12px; }
.ad-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
@media (max-width: 760px) { .ad-wrap { grid-template-columns: 1fr; } }
.ad-tree { background: #fff; border-radius: var(--radius); padding: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
@media (max-width: 760px) { .ad-tree { position: static; max-height: none; } }
.tn { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 10px; font-size: 14.5px; color: #222; cursor: pointer; }
.tn:hover { background: #f3f6f1; }
.tn.lv1 { padding-left: 26px; }
.tn.lv2 { padding-left: 48px; }
.tn.on { background: var(--soft); color: var(--brand); font-weight: 700; }
.tn .car { display: inline-block; width: 16px; font-style: normal; color: var(--muted); transition: transform .15s; }
.tn.open .car { transform: rotate(90deg); }
.tn.grp { font-weight: 600; }
.tn-n { font-size: 12px; font-weight: 700; color: var(--muted); background: #f0f2ef; border-radius: 99px; padding: 1px 8px; min-width: 28px; text-align: center; }
.ul-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.ul-head h3 { color: var(--brand); font-size: 17px; }
.u-code { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand-2); background: var(--soft); border-radius: 6px; padding: 1px 7px; margin-right: 6px; }

/* thẻ mục của khóa (vd JLPT N3): chữ Hán lớn, nhãn, ghi chú như trang web */
.sec-icon { font-family: 'Noto Sans JP', 'Yu Gothic', sans-serif; font-weight: 800; color: var(--brand); }
.sec-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.sec-badges .chip:nth-child(2) { background: #e5efd7; color: #2c4a32; }
.sec-note { font-size: 12.5px; color: var(--muted); background: #f6f8f4; border-radius: 8px; padding: 6px 10px; margin: 6px 0; }

/* câu chọn từ vào chỗ trống */
.fill-sel { font: inherit; font-size: 14px; padding: 3px 6px; margin: 2px 4px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; max-width: 100%; }
.fill-sel.right { border-color: var(--ok); background: #eaf7ee; }
.fill-sel.wrong { border-color: #d9534f; background: #fdeeee; }
.fill-ans { color: var(--ok); font-weight: 700; font-size: 13.5px; margin-right: 6px; }
.q.q-ok { box-shadow: inset 4px 0 0 var(--ok); }
.q.q-ng { box-shadow: inset 4px 0 0 #d9534f; }
.q-text { line-height: 2; }

/* tài liệu PDF */
.docs-list { display: flex; flex-direction: column; gap: 10px; }
.doc-row { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: inherit; }
.doc-row:hover { border-color: var(--accent); }
.doc-ic { width: 42px; height: 42px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 20px; font-weight: 800; flex: none; }
.doc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.doc-txt small { color: var(--muted); }
.doc-dl { background: var(--soft); color: var(--brand); font-weight: 700; font-size: 13px; border-radius: 99px; padding: 5px 12px; flex: none; }

/* ngữ pháp N3 (theo trang web) */
.gn3 .formula-list { list-style: none; margin: 4px 0 18px; padding: 12px 12px; background: #fae6e6; border: 1.5px solid #f0b8c4; border-radius: 8px; font-weight: 600; color: #333; line-height: 2; }
.gn3 .formula-list li::before { content: "● "; color: var(--brand); }
.gn3 .meaning-title { font-weight: 800; font-size: 16.5px; color: var(--brand); margin: 16px 0 8px; padding-bottom: 5px; border-bottom: 2px solid #c8ddb8; }
.gn3 .explanation { margin: 5px 0; color: #333; line-height: 1.7; }
.gn3 .meaning-section > p:not([class]) { font-weight: 700; color: var(--brand); margin: 10px 0 4px; }
.gn3 .example-box { background: #f8fbf6; padding: 10px 12px; border-left: 3px solid var(--brand); margin: 10px 0; border-radius: 0 6px 6px 0; }
.gn3 .ja-text { font-size: 16px; color: #333; margin-bottom: 5px; display: block; line-height: 2; }

/* nghe hiểu N3 (theo trang web) */
.nh .nh-lesson-tag { display: inline-block; font-size: 11px; font-weight: 800; color: var(--brand); background: var(--soft); padding: 3px 10px; border-radius: 20px; margin-bottom: 10px; }
.nh .nh-title { font-size: 19px; font-weight: 800; line-height: 1.3; color: #111; margin-bottom: 6px; }
.nh .nh-goal { font-size: 13.5px; font-weight: 700; color: #555; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid #e8e8e8; }
.nh .nh-sec { display: flex; gap: 12px; margin-bottom: 20px; align-items: flex-start; }
.nh .nh-badge { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.nh .nh-sec-body { flex: 1; min-width: 0; }
.nh .nh-sh { font-size: 14.5px; font-weight: 700; color: #222; margin-bottom: 8px; }
.nh .nh-vocab { background: #fff; border: 1.5px dashed #c4d4c4; border-radius: 10px; padding: 10px 14px; }
.nh .nh-vocab ul { list-style: disc; padding-left: 18px; margin: 0; }
.nh .nh-vocab li { font-size: 14px; padding: 2px 0; color: #333; line-height: 1.75; }
.nh .nh-text { font-size: 14px; color: #333; }
.nh .nh-eg { padding: 4px 12px; border-left: 3px solid var(--brand); color: #555; margin: 3px 0 12px; font-size: 13.5px; }
.nh .nh-note { font-size: 13px; color: #666; background: #fffbe6; border-left: 3px solid #e8b800; padding: 8px 12px; border-radius: 0 6px 6px 0; margin-top: 8px; }
.nh .nh-divider { border: none; border-top: 2px dashed #e8e8e8; margin: 24px 0; }
.nh .nh-img-box img, .nh img { max-width: 100%; display: block; border-radius: 8px; margin: 6px 0; }
.nh-ex-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.nh-ex-num { font-weight: 800; color: var(--brand); }
.nh-ex-inst { font-size: 14px; color: #333; }
.q-passage audio { display: block; width: 100%; margin: 6px 0; }

/* đọc hiểu N3 (theo trang web) */
.rd-goal { font-weight: 700; color: #555; margin-bottom: 14px; }
.rd-sec { margin-bottom: 18px; }
.rd-h { font-weight: 700; color: #222; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.rd-badge { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; display: grid; place-items: center; }
.rd-sec ul { background: #fff; border: 1.5px dashed #c4d4c4; border-radius: 10px; padding: 10px 14px 10px 32px; line-height: 1.9; }
.rd-rule { margin: 6px 0 2px; }
.rd-eg { padding: 4px 12px; border-left: 3px solid var(--brand); color: #555; margin: 3px 0 10px; }
.rd-sec img { max-width: 100%; border-radius: 8px; }
.rd-plabel { font-weight: 800; color: var(--brand); margin-bottom: 4px; }
.rd-desc { color: #444; margin-bottom: 6px; }
.rd-notes { font-size: 13px; color: #555; margin: 8px 0 0; padding-left: 18px; }
.q-passage .dhn-img-box { background: #f0f0f0; border-radius: 8px; overflow: hidden; margin-bottom: 12px; }
.q-passage .dhn-img-box img { width: 100%; height: auto; display: block; }
.dhn-jp-passage { background: #fff; border: 1.5px solid #d0dbc8; border-radius: 10px; padding: 14px 12px; line-height: 2; color: #222; margin-bottom: 12px; }
.dhn-jp-passage p { margin-bottom: 10px; }
.dhn-jp-doc { border: 1px solid #ccc; border-radius: 8px; padding: 14px 12px; margin-bottom: 12px; background: #fefefe; font-size: 14px; line-height: 1.9; }
.dhn-jp-doc .jp-header { text-align: center; border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 14px; }
.dhn-jp-doc .jp-header .jp-sub { font-size: 12px; color: #666; }
.dhn-jp-doc .jp-header .jp-main { font-size: 15px; font-weight: 700; }
.dhn-jp-doc .jp-stars li { list-style: none; padding-left: 20px; position: relative; margin-bottom: 5px; }
.dhn-jp-doc .jp-stars li::before { content: "★"; position: absolute; left: 0; }
.dhn-jp-doc .jp-detail { background: #f9f9f9; border: 1px dashed #ccc; padding: 10px 14px; border-radius: 6px; margin: 10px 0; }
.dhn-jp-doc .jp-notice li { list-style: none; padding-left: 16px; position: relative; margin-bottom: 8px; font-size: 13px; }
.dhn-jp-doc .jp-notice li::before { content: "●"; position: absolute; left: 0; font-size: 10px; top: 4px; }
.dhn-jp-doc .jp-footer { margin-top: 14px; font-size: 13px; color: #444; border-top: 1px solid #eee; padding-top: 10px; }
.dhn-jp-flyer { border: 2px solid #333; border-radius: 8px; padding: 14px 12px; margin-bottom: 12px; background: #fefefe; font-size: 14px; line-height: 1.9; }
.dhn-jp-flyer h3 { text-align: center; font-size: 18px; letter-spacing: 0.3em; border-bottom: 2px solid #333; padding-bottom: 8px; margin-bottom: 14px; }
.dhn-jp-flyer .jp-req { margin: 12px 0; padding: 0; }
.dhn-jp-flyer .jp-req li { list-style: none; padding-left: 16px; position: relative; margin-bottom: 5px; }
.dhn-jp-flyer .jp-req li::before { content: "・"; position: absolute; left: 0; }
.dhn-jp-flyer .jp-contact { text-align: right; margin-top: 14px; font-size: 13px; }
.dhn-jp-flyer .jp-contact strong { font-size: 15px; display: block; }
.dhn-person-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.dhn-person-block { background: #f7f9f5; border: 1px solid #d0dbc8; border-radius: 8px; padding: 9px 12px; font-size: 14px; color: #333; line-height: 1.75; }
.dhn-pname { font-weight: 700; color: var(--brand); margin-right: 6px; }

/* ôn tập N4 */
.grammar-table .td-formula { font-weight: 700; color: var(--brand); }
.grammar-struct-title { font-size: 16px; font-weight: 800; color: var(--brand); margin: 18px 0 8px; }
.grammar-struct-title:first-child { margin-top: 0; }

/* đề thi thử: tab kỹ năng + đồng hồ riêng (như trang web) */
.exam-intro h3 { color: var(--brand); margin-bottom: 10px; }
.exam-skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.exam-skills > div { background: var(--soft); border-radius: 12px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.exam-skills b { color: var(--brand); }
.exam-skills small { color: var(--muted); }
.exam-skills span { font-weight: 800; color: var(--brand); margin-top: 4px; }
.exam-intro .btn { margin-top: 12px; }
.exam-bar { position: sticky; top: 54px; z-index: 30; background: var(--bg, #f3f5f2); padding: 8px 0 10px; margin-bottom: 8px; }
.exam-tabs { display: flex; gap: 8px; margin-bottom: 8px; overflow-x: auto; }
.exam-tab { flex: none; border: 1px solid #ccc; background: #fff; border-radius: 99px; padding: 7px 16px; font-size: 15px; color: #222; cursor: pointer; }
.exam-tab.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.exam-tab.over { text-decoration: line-through; opacity: .6; }
/* điện thoại: đồng hồ + 2 nút không vừa một hàng thì xuống hàng, nút "Nộp bài" không bị đẩy ra ngoài màn hình */
.exam-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; background: #fff; border-radius: 12px; padding: 6px 6px 6px 14px; box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.exam-status #ex-time { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--brand); }
.exam-status #ex-time.low { color: #c0392b; }
.exam-status #ex-cnt { margin-left: 6px; }
.exam-status .btn { margin-left: auto; }
.exam-score { display: grid; gap: 4px; margin-top: 10px; text-align: left; }
.exam-score > div { display: flex; justify-content: space-between; gap: 10px; border-top: 1px dashed rgba(0,0,0,.12); padding-top: 4px; }

/* đề thi: văn bản / bảng soạn sẵn trong dữ liệu đề (thay cho khối <style> trong dữ liệu, chỉ áp dụng trong khung này) */
.exam-doc { line-height: 1.9; overflow-x: auto; }
.exam-doc table { border-collapse: collapse; margin: 6px 0; background: #fff; max-width: 100%; }
.exam-doc th, .exam-doc td { border: 1px solid #333; padding: 5px 8px; font-weight: normal; background: #fff; vertical-align: top; }
.exam-doc table table { margin: 4px 0; }
.exam-doc .indent { margin-left: 15px; }
.exam-doc .empty-cell { background: #bfbfbf; }

/* phân quyền: tiến độ học viên, nhân sự */
.u-pct { font-size: 12px; font-weight: 700; color: var(--brand-2); background: var(--soft); border-radius: 99px; padding: 0 7px; margin-left: 4px; }
.btn.danger { color: #b3261e; border-color: #e3a3a3; }
.btn.danger:hover { background: #fdeeee; }
.u-prog { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.up-course { margin-bottom: 12px; }
.up-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 4px; }
.up-secs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-top: 6px; font-size: 13px; }
.up-secs > div, .up-recent > div { display: flex; justify-content: space-between; gap: 8px; }
.up-recent { font-size: 13px; display: grid; gap: 4px; }
.up-recent > div span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .up-secs { grid-template-columns: 1fr; } }
.role-help h3 { color: var(--brand); margin-bottom: 8px; }
.role-help > div { display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 14px; }
.role-help > div b { min-width: 150px; color: var(--brand); }
@media (max-width: 600px) { .role-help > div { flex-direction: column; gap: 0; } }
.role-sel { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* thi thử hàng tuần (luật thi thật) */
.exam-rules { margin: 4px 0 8px; padding-left: 20px; font-size: 14px; line-height: 1.7; }
.exam-tab:disabled { opacity: .45; cursor: not-allowed; }
/* thuộc tính hidden luôn thắng display của .btn (vd nút Nộp bài khi chưa tới phần cuối của thi thử) */
[hidden] { display: none !important; }
.exam-tab.next-open { border-color: #e6a817; background: #fff6dc; color: #6b4e00; }
.exam-tab.next-open::after { content: " →"; }
.pop-bg { position: fixed; inset: 0; z-index: 95; background: rgba(16,41,26,.45); display: grid; place-items: center; padding: 16px; }
.pop { max-width: 440px; width: 100%; text-align: center; }
.pop .pop-h { display: block; font-size: 17px; color: var(--brand); margin-bottom: 8px; }
.pop p { font-size: 15px; line-height: 1.6; margin-bottom: 14px; overflow-wrap: anywhere; }
.pop input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.pop-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.exam-break { text-align: center; margin-bottom: 12px; background: #fff8e6; border: 1px solid #f0d79a; }
.exam-break .eb-time { font-size: 32px; font-weight: 800; color: #c0392b; margin: 8px 0 12px; font-variant-numeric: tabular-nums; }
.once-audio { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 8px 0; }
.once-audio audio { display: none; }
.oa-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 16px; cursor: pointer; }
.oa-play:disabled { background: #9fb3a6; cursor: default; }
.oa-bar { height: 6px; background: #e6ebe6; border-radius: 99px; overflow: hidden; }
.oa-bar i { display: block; height: 100%; width: 0; background: var(--brand); }
.oa-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.oa-msg { grid-column: 1 / -1; font-size: 12.5px; color: #0d6efd; }
.once-audio.done .oa-msg { color: var(--muted); }

/* mở / ẩn đề (thi thử hàng tuần) */
.pub-bar { margin-bottom: 12px; display: grid; gap: 6px; font-size: 14.5px; border-left: 4px solid #e6a817; }
.pub-only { font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.pub-row { display: flex; align-items: center; gap: 8px; }
.pub-row .lesson-row { flex: 1; min-width: 0; margin-bottom: 0; }
.pub-row + .pub-row, .pub-row + .group-title { margin-top: 8px; }
.pub-row .btn { flex: none; }
.lesson-row.is-hidden { opacity: .7; }
.hid-tag, .open-tag { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 99px; padding: 1px 8px; margin-top: 3px; }
.hid-tag { background: #eceeec; color: var(--muted); }
.open-tag { background: #e4f5e8; color: #1e7b3a; }

/* báo cáo tiến độ (nhân sự) */
.rp-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; padding: 10px; }
.rp-bar select, .rp-bar input { font: inherit; font-size: 14.5px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.rp-bar input { flex: 1 1 200px; }
.rp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 12px; }
.rp-kpi { background: var(--brand); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; }
.rp-kpi b { font-size: 21px; line-height: 1.2; }
.rp-kpi span { font-size: 12.5px; opacity: .8; }
.rp-donuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.rp-donut { text-align: center; }
.rp-donut h3 { font-size: 14.5px; color: var(--brand); margin-bottom: 8px; }
.rp-donut .dn { width: 112px; height: 112px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#2e7d46 calc(var(--p) * 1%), #e2e8e2 0); }
.rp-donut .dn span { width: 74%; height: 74%; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; color: var(--brand); font-size: 18px; }
/* điện thoại: đặt SAU các quy tắc gốc ở trên (trước đây đứng trước nên bị ghi đè, vòng 112px đẩy cột thứ ba ra ngoài màn hình) */
@media (max-width: 640px) { .rp-donuts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; } .rp-donut { padding: 10px 6px; min-width: 0; } .rp-donut .dn { width: 76px; height: 76px; } .rp-donut .dn span { font-size: 15px; } .rp-donut h3 { font-size: 12.5px; } }
.rp-table-wrap { padding: 0; overflow-x: auto; margin-bottom: 16px; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.rp-table th { text-align: left; padding: 10px 12px; background: #f3f6f2; color: var(--brand); font-size: 13px; white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; }
.rp-detail th { cursor: default; }
.rp-table th.asc::after { content: ' ▲'; font-size: 10px; }
.rp-table th.desc::after { content: ' ▼'; font-size: 10px; }
.rp-table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.rp-table td small { display: block; color: var(--muted); font-size: 12px; }
.rp-table tbody tr[data-u] { cursor: pointer; }
.rp-table tbody tr[data-u]:hover { background: #f7faf5; }
.rp-table tbody tr.on { background: var(--soft); }
.rp-pct { display: inline-block; width: 70px; height: 7px; background: #e2e8e2; border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.rp-pct i { display: block; height: 100%; background: #2e7d46; }
.rp-pct.low i { background: #e0a030; }
.rp-sec td { background: #fafbf9; font-weight: 700; color: var(--brand-2); font-size: 13px; }
.rp-st { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 99px; padding: 2px 9px; background: #eef0ee; color: #6b786d; white-space: nowrap; }
.rp-st.ok { background: #e4f5e8; color: #1e7b3a; }
.rp-st.ng { background: #fdeeee; color: #b3261e; }
.rp-st.na { background: transparent; color: #a0aaa2; font-weight: 400; }

/* ---------- nội dung nhập từ web: không để chữ / bảng / ảnh bị cắt hoặc tràn trên điện thoại ---------- */
.prose, .q-passage, .q-text, .opt, .explain, .fc-face, .exam-doc { overflow-wrap: break-word; }
.prose img, .q-passage img, .q-text img, .opt img, .explain img, .fc-face img { max-width: 100%; height: auto; }
.prose audio, .prose video, .prose iframe, .q-passage video, .q-passage iframe, .q audio, .explain audio { max-width: 100%; }
.prose audio { display: block; width: 100%; }
.prose pre { white-space: pre-wrap; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; margin: 8px 0; }   /* khung cuộn ngang cho bảng rộng (wrapTables trong players.js) */
.tbl-scroll > table { margin: 0; }
.prose li:has(ruby), .prose p:has(ruby), .q-passage p:has(ruby) { line-height: 2.1; }   /* furigana không dính dòng trên */
.fc-ex { line-height: 1.9; }
@media (max-width: 480px) {
  /* điện thoại: bớt lề lồng nhau để nội dung (nhất là bảng) có thêm chỗ */
  .prose { padding: 12px; }
  .prose .grammar-rule-body { padding: 10px; }
  .prose .grammar-eg { padding-left: 10px; }
  .nh .nh-sec { gap: 8px; }
  .q-passage { padding: 10px; }
}

/* hoàn thành tự động: thanh đã xem của video, số thẻ đã lật */
.watch-row { justify-content: flex-start; }
.watch-bar { flex: 1 1 140px; max-width: 260px; height: 6px; background: #e2e8e2; border-radius: 99px; overflow: hidden; }
.watch-bar i { display: block; height: 100%; width: 0; background: #e0a030; transition: width .3s; }
.watch-bar.ok i { background: #2e7d46; }
.fc-tools { align-items: center; }
.fc-prog { order: 2; flex-basis: 100%; text-align: center; font-size: 13px; color: var(--muted); }   /* dưới nút Xáo trộn, nút luôn ở giữa */
.word-list .w.seen b::after { content: ' ✓'; color: var(--ok); font-size: 12px; }

/* tài khoản học viên: chỉ xem thông tin */
.acct-h { color: var(--brand); font-size: 15px; margin-bottom: 8px; }
.acct-courses { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.acct-courses li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8faf7; }

/* chống sao chép (html.protect: học viên, cài đặt protect_content) */
html.protect body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.protect input, html.protect textarea, html.protect select { -webkit-user-select: text; user-select: text; }
html.protect img, html.protect video { -webkit-user-drag: none; }
html.veil #view { filter: blur(18px); }
/* chặn in / lưu PDF với mọi tài khoản: bản in chỉ có dòng thông báo */
@media print {
  html, body { background: #fff !important; }
  body > * { display: none !important; }
  body::before { content: "Nội dung bài học của Thanh Mai Yokohama · Tokutei Gino không được phép in."; display: block; padding: 40px; font-size: 18px; color: #000; }
}

/* tập viết kanji */
.wr-head { background: var(--brand); color: #fff; border-radius: 18px; padding: 14px 16px 16px; text-align: center; position: relative; margin-bottom: 12px; }
.wr-no { position: absolute; top: 10px; left: 14px; font-size: 12.5px; color: rgba(255,255,255,.6); }
.wr-sino { font-size: 34px; font-weight: 900; letter-spacing: 1px; margin-top: 14px; }
.wr-read { font-size: 14px; color: rgba(255,255,255,.7); min-height: 1.2em; }
.wr-ask { font-size: 13px; color: var(--accent); margin-top: 6px; }
.wr-pad { width: min(100%, 340px); margin: 0 auto; aspect-ratio: 1; background: #fff; border: 2px solid var(--brand); border-radius: 14px; overflow: hidden; }
.wr-pad svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.wr-grid { stroke: #d5ddd2; stroke-width: .5; stroke-dasharray: 2 2; fill: none; }
.wr-ink { fill: none; stroke: #2f6fd6; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.wr-stroke { fill: none; stroke: var(--brand); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.wr-model { fill: none; stroke: #c9d6c3; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.wr-hint { fill: none; stroke: #f0b4b4; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 3 2; }
.wr-dot { fill: #d93b3b; }
.wr-finished .wr-stroke { stroke: #2e7d46; }
.wr-shake { animation: wr-shake .3s; }
@keyframes wr-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.wr-msg { text-align: center; font-size: 14.5px; min-height: 1.5em; margin: 10px 0 6px; color: var(--muted); }
.wr-msg.ok { color: #2e7d46; font-weight: 600; }
.wr-msg.bad { color: #b3261e; font-weight: 600; }
.wr-tools { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wr-back { margin: 4px 0 12px; }
.btn.pulse { box-shadow: 0 0 0 0 rgba(16,41,26,.5); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(16,41,26,0); } 100% { box-shadow: 0 0 0 0 rgba(16,41,26,0); } }

/* khóa học quá hạn (như web): mờ, không bấm được */
.course-card.expired { opacity: .6; filter: grayscale(1); cursor: not-allowed; }
.course-card .exp-note { color: #b3261e; font-weight: 700; margin-top: 10px; }
.course-card .exp-date { margin-top: 8px; }

/* trang bài học: danh sách bài cùng mục (như web tokuteigino.vn). Máy tính: cột trái, nút ☰ ẩn / hiện.
   Điện thoại: nút ☰ mở ngăn kéo trượt từ trái. Bài tập / đề thi: cột "Danh sách câu" cạnh câu hỏi (máy tính). */
/* hàng đầu trang bài: nút ☰ danh sách + đường dẫn cùng một hàng */
.lesson-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.lesson-top .crumbs { margin: 0; }
.side-toggle { font: inherit; font-size: 13px; font-weight: 700; color: var(--brand); background: #fff; border: 1px solid var(--line);
  border-radius: 99px; padding: 5px 12px; cursor: pointer; white-space: nowrap; }
.side-toggle:hover { background: var(--soft); }
.ls-head { position: sticky; top: 0; z-index: 1; background: var(--brand); color: #fff; font-weight: 800; padding: 14px 16px; display: flex; justify-content: space-between; align-items: baseline; }
.ls-head small { font-weight: 400; opacity: .7; font-size: 12.5px; }
.ls-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.ls-grp { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 10px 6px 2px; }
.ls-item { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: #f6f8f6;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14.5px; border-left: 4px solid transparent; }
.ls-item:hover { background: var(--soft); }
.ls-item.on { background: var(--brand); color: #fff; border-left-color: #e6a817; }
.ls-item.done .ck { color: #2e7d46; font-weight: 800; }
.ls-item.on .ck { color: var(--accent); }
.qnav { display: none; }
/* làm từng câu: chỉ hiện câu đang chọn (kèm tiêu đề phần / đoạn đọc của nó) */
.one-q .q, .one-q .q-part, .one-q .q-passage, .one-q .q-skill { display: none; }
.one-q .q.q-show, .one-q .q-part.q-show, .one-q .q-passage.q-show, .one-q .q-skill.q-show { display: block; }
.qstep { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 4px; }
.qstep .btn { min-width: 104px; }
.qs-pos { white-space: nowrap; font: inherit; font-size: 14px; font-weight: 700; color: var(--brand); background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; cursor: pointer; }
/* nút đánh dấu ở góc phải dòng "Câu N", không chen vào câu hỏi */
.q-num:has(.q-flag) { display: flex; align-items: center; gap: 6px; }
.q-flag { font: inherit; font-size: 12.5px; font-weight: 600; margin-left: auto; flex: none; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.q-flag.on { background: #fff3cd; border-color: #f0ad00; color: #6b4e00; }
.qn-head { font-size: 13px; font-weight: 800; color: var(--brand); margin: 2px 2px 8px; }
/* công tắc Từng câu | Tất cả: chiếm cả chiều ngang cột, không xô chữ xuống dòng */
.qn-seg { display: grid; grid-template-columns: 1fr 1fr; background: #eef2ee; border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.qn-seg button { font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap; border: 0; border-radius: 8px; padding: 6px 4px;
  background: transparent; color: var(--muted); cursor: pointer; }
.qn-seg button.on { background: var(--brand); color: #fff; }
.qn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.qn-grid button { position: relative; font: inherit; font-size: 13px; font-weight: 700; padding: 8px 4px; border-radius: 8px; border: 1px solid var(--line);
  background: #f6f8f6; color: var(--text); cursor: pointer; }
.qn-grid button:hover { border-color: var(--brand); }
.qn-grid button.done { background: var(--soft); border-color: #9fc7a8; color: var(--brand); }
.qn-grid button.ok { background: #e3f3e7; border-color: #7cc08f; color: #1e6b35; }
.qn-grid button.bad { background: #fde8e8; border-color: #e59a9a; color: #a12a2a; }
.qn-grid button.flag { border-color: #f0ad00; box-shadow: inset 0 0 0 1px #f0ad00; }
.qn-grid button.flag::after { content: "🚩"; position: absolute; top: -7px; right: -3px; font-size: 11px; }
.qn-grid button.cur { outline: 2px solid var(--brand); outline-offset: 1px; }
.qn-legend { font-size: 11.5px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.qn-legend .lg.done { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--soft); border: 1px solid #9fc7a8; }
@media (max-width: 999px) {   /* điện thoại: danh sách câu là bảng chọn nhanh, mở bằng nút "Câu x/N ▾" */
  .qnav.open { display: flex; position: fixed; inset: 0; z-index: 96; background: rgba(16,41,26,.45); align-items: center; justify-content: flex-end; padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 16px); }
  .qnav.open > * { background: #fff; }
  .qnav.open .qn-head { width: 100%; max-width: 480px; margin: 0; padding: 14px 16px 8px; border-radius: 16px 16px 0 0; }
  .qnav.open .qn-seg { width: 100%; max-width: 480px; margin: 0; border-radius: 0; padding: 3px 16px 6px; background: #fff; }
  .qnav.open .qn-grid { width: 100%; max-width: 480px; grid-template-columns: repeat(5, 1fr); padding: 6px 16px; max-height: 50vh; overflow: auto; }
  .qnav.open .qn-legend { width: 100%; max-width: 480px; margin: 0; padding: 8px 16px 16px; border-radius: 0 0 16px 16px; }
  .qnav.open { flex-direction: column; }
}
.side-backdrop { display: none; }
@media (max-width: 999px) {
  .lesson-side:not([hidden]) { display: block; position: fixed; z-index: 96; top: 0; bottom: 0; left: 0; width: min(86vw, 340px); overflow: auto;
    background: #fff; box-shadow: 4px 0 24px rgba(0,0,0,.2); transform: translateX(-105%); transition: transform .25s; }
  .drawer-open .lesson-side:not([hidden]) { transform: none; }
  .drawer-open .side-backdrop { display: block; position: fixed; inset: 0; z-index: 95; background: rgba(16,41,26,.45); }
}
@media (min-width: 1000px) {
  .view.wide { max-width: 1280px; }
  .lesson-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 22px; align-items: start; }
  .lesson-layout.side-off { grid-template-columns: minmax(0, 1fr); }
  .lesson-layout.side-off .lesson-side { display: none !important; }
  .lesson-layout .lesson-side { order: -1; }
  .view.wide .lesson-side:not([hidden]) { display: block; position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow: auto;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; }
  .tab-item.has-qnav { display: grid; grid-template-columns: 180px minmax(0, 1fr); column-gap: 16px; align-items: start; }
  .tab-item.has-qnav .qnav { grid-row: 1 / span 2; }
  .tab-item .qstep { display: none; }   /* máy tính đã có cột câu hỏi */
  .tab-item.has-qnav .qnav { display: block; position: sticky; top: 74px; max-height: calc(100vh - 96px); overflow: auto;
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
}

/* mục chỉ dành cho Full khóa với học viên học qua video */
.sec-card.locked { opacity: .65; cursor: not-allowed; }
.sec-card.locked .sec-lock { margin-top: 10px; font-size: 13.5px; font-weight: 700; color: #8a6100; background: #fff3d6; border-radius: 8px; padding: 6px 10px; display: inline-block; }
