:root {
  --crimson: #a31d38;
  --crimson-deep: #7c1229;
  --ink: #2a1418;
  --ink-soft: #6d5257;
  --paper: #fff8f3;
  --card: #ffffff;
  --line: #f0dcd4;
  --salmon: #f28b77;
  --green: #17936a;
  --amber: #e2a11b;
  --radius: 24px;
  --shadow: 0 14px 40px rgba(124, 18, 41, 0.14);
  --amp: 0;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 50% -180px, #ffd9cf 0%, rgba(255, 217, 207, 0) 70%),
    var(--paper);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#app { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }

/* ---------- Màn chào ---------- */
.start { display: grid; place-items: center; min-height: calc(100dvh - 56px); }

.start-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 32px 24px 24px;
  text-align: center;
}

.start-face {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--crimson), 0 10px 24px rgba(163, 29, 56, 0.25);
}

.eyebrow {
  margin: 16px 0 4px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--crimson);
}

h1 { margin: 0; font-size: clamp(1.7rem, 6vw, 2.3rem); line-height: 1.15; font-weight: 800; text-wrap: balance; }
h1 span { color: var(--crimson); }

.lead { margin: 12px auto 20px; max-width: 46ch; color: var(--ink-soft); line-height: 1.6; }

.notice {
  margin: 0 auto 16px; max-width: 52ch;
  padding: 12px 14px; border-radius: 14px;
  background: #fff4d6; border: 1px solid #f1d58a; color: #6b4a00;
  font-size: 0.92rem; line-height: 1.5; text-align: left;
}

#start-form { display: grid; gap: 16px; max-width: 420px; margin: 0 auto; text-align: left; }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 0.95rem; }

.login-box, .dk-box { display: grid; gap: 12px; }
.login-box[hidden], .dk-box[hidden] { display: none; }
/* Ô tài khoản ở màn hình đầu: học thử / đăng nhập / đăng ký (thầy Tùng dặn 27/11/2026) */
.tk { display: grid; gap: 12px; padding: 14px; border-radius: 18px; background: #fff3ee; border: 1px solid var(--line); }
.tk[hidden], .tk-da[hidden], #tk-chua[hidden] { display: none; }
#tk-chua { display: grid; gap: 12px; }
.tk-thu { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--ink); }
.tk-tab { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: #f6e0d6; }
.tk-tab[hidden] { display: none; }
.tk-tab button { border: 0; background: none; padding: 9px 6px; border-radius: 11px; font: inherit; font-weight: 700; font-size: 0.92rem; color: var(--ink-soft); cursor: pointer; }
.tk-tab button.on { background: #fff; color: var(--crimson-deep); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }
.tk .field > span small { font-weight: 500; color: var(--crimson-deep); }
.tk-nut { justify-self: stretch; }
.tk-dong-y { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8rem; line-height: 1.45; color: var(--ink-soft); }
.tk-dong-y input { margin-top: 2px; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--crimson); }
.tk-hien-mk { display: flex; gap: 8px; align-items: center; margin-top: -4px; font-size: 0.85rem; color: var(--ink-soft); cursor: pointer; }
.tk-hien-mk input { width: 18px; height: 18px; accent-color: var(--crimson); }
.tk-loi { margin: 0; padding: 9px 12px; border-radius: 12px; background: #ffe3e3; color: #8a1c1c; font-size: 0.9rem; line-height: 1.4; }
.tk-loi[hidden] { display: none; }
.tk-da { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.95rem; line-height: 1.5; }
.tk-da > div { flex: 1 1 220px; }
.tk-da .btn-link[hidden] { display: none; }
.moi-hoc-them { margin-top: 16px; padding: 14px 16px; border-radius: 16px; background: #fff3d6; border: 1px solid #f0d28a; display: grid; gap: 10px; justify-items: start; }
.moi-hoc-them[hidden], .moi-hoc-them a[hidden] { display: none; }
.moi-hoc-them p { margin: 0; font-weight: 600; line-height: 1.5; }
.moi-hoc-them a { text-decoration: none; }
@media print { .moi-hoc-them { display: none !important; } }

input[type="text"], input[type="password"], input[type="tel"], input[type="email"], input[type="search"] {
  width: 100%; padding: 13px 16px;
  border: 2px solid var(--line); border-radius: 14px; background: #fffdfb;
  font-size: 1.05rem; outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="tel"]:focus, input[type="email"]:focus, input[type="search"]:focus { border-color: var(--salmon); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chips button {
  padding: 12px 4px; border-radius: 14px;
  border: 2px solid var(--line); background: #fffdfb;
  font-weight: 600; font-size: 0.98rem;
}
.chips button.on { border-color: var(--crimson); background: var(--crimson); color: #fff; }
.chips.chips-3 { grid-template-columns: repeat(3, 1fr); }

.btn-primary {
  border: 0; border-radius: 16px; padding: 15px 22px;
  background: var(--crimson); color: #fff; font-weight: 700; font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(163, 29, 56, 0.28);
  transition: transform 0.12s, background 0.15s;
}
.btn-primary:hover { background: var(--crimson-deep); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }
.btn-primary.small { padding: 12px 18px; font-size: 1rem; box-shadow: none; }

.btn-link { border: 0; background: none; color: var(--crimson); font-weight: 600; text-decoration: underline; padding: 4px; justify-self: center; }

.btn-ghost {
  border: 1.5px solid var(--line); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-weight: 600; font-size: 0.9rem; color: var(--ink-soft);
}
.btn-ghost:hover { border-color: var(--salmon); color: var(--ink); }

.small-print {
  margin: 24px auto 0; padding: 16px 0 0 18px; max-width: 54ch;
  border-top: 1px dashed var(--line);
  text-align: left; font-size: 0.84rem; line-height: 1.55; color: var(--ink-soft);
}
.small-print li + li { margin-top: 6px; }
.small-print strong { color: var(--ink); }

/* ---------- Lớp học ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--crimson); }
.brand strong { display: block; font-size: 1.02rem; line-height: 1.2; white-space: nowrap; }
.badge-ai {
  display: inline-block; margin-top: 2px; padding: 2px 8px; border-radius: 999px;
  background: #ffe7df; color: var(--crimson-deep); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.top-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
/* Đồng hồ đếm ngược của ca học (20 phút): nằm ở góc trên bên trái khung hình thầy,
   để thanh trên cùng không bị chật trên điện thoại. */
.dong-ho {
  position: absolute; left: 14px; top: 14px; z-index: 2;
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 0.95rem;
  padding: 6px 12px; border-radius: 999px;
  background: #fff; color: var(--crimson-deep);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.dong-ho.sap-het { background: var(--crimson); color: #fff; border-color: var(--crimson); animation: pulse-soft 1s ease-in-out infinite; }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } }

.demo-banner {
  margin-bottom: 12px; padding: 9px 14px; border-radius: 12px;
  background: #fff4d6; border: 1px solid #f1d58a; color: #6b4a00;
  font-size: 0.88rem; font-weight: 600; text-align: center;
}

.stage {
  position: relative; overflow: hidden;
  aspect-ratio: 1100 / 862;
  max-height: min(56dvh, 600px);
  width: 100%;
  border-radius: var(--radius);
  background: #7c1229;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.poses { position: absolute; inset: 0; animation: breathe 5.5s ease-in-out infinite; transform-origin: 50% 70%; }
.stage[data-phase="talking"] .poses { animation: talk-bob 1.9s ease-in-out infinite; }

.pose {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 36%;
  opacity: 0; transition: opacity 0.42s ease;
}
.pose.on { opacity: 1; }

/* ---------- Bảng giải thích: nghĩa tiếng Việt · IPA · ngữ điệu (thầy Tùng dặn 24/11/2026) ----------
   Màn hình rộng: bảng nằm bên tay phải khung hình. Điện thoại: bảng nằm ngay dưới câu thầy cô vừa nói. */
.giai-thich {
  margin: 10px 0; padding: 16px 18px; border-radius: 20px; text-align: left;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(124, 18, 41, 0.08);
}
.gt-cau { margin: 0 0 12px; font-size: 1.15rem; font-weight: 700; line-height: 1.35; }
.giai-thich dl { margin: 0; display: grid; gap: 10px; }
.giai-thich dt { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--crimson); }
.giai-thich dd { margin: 2px 0 0; line-height: 1.5; }
#gt-ipa { font-family: "Segoe UI", "Noto Sans", Arial, sans-serif; font-size: 1.06rem; overflow-wrap: anywhere; }
@media (min-width: 1040px) {
  #app:has(#screen-class:not([hidden])) { max-width: 1130px; }
  #screen-class:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) 330px; column-gap: 22px; align-items: start; }
  #screen-class > *, #screen-class .giua > * { grid-column: 1; }
  #screen-class .giua > .cot-phai { grid-column: 2; grid-row: 2 / span 40; position: sticky; top: 16px; }
  .cot-phai > * { margin-top: 0; }
}
@media print { .giai-thich { display: none !important; } #screen-class { display: block !important; } }

/* ---------- Chọn thầy cô (thầy Tùng · thầy Tony · cô Jessica · cô Emma · cô Lily) ----------
   Năm người: hàng trên ba, hàng dưới hai (26/11/2026 thêm cô Emma, cô Lily). */
.chon-gv { display: flex; flex-wrap: wrap; gap: 8px; }
.chon-gv .gv {
  flex: 1 1 calc(33.333% - 8px); min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px 8px; border-radius: 16px; cursor: pointer;
  background: #fff; border: 2px solid rgba(163, 29, 56, 0.16); color: var(--ink); font: inherit; font-size: 0.86rem;
}
.chon-gv .gv.on { border-color: var(--crimson); background: #fff3ee; box-shadow: 0 6px 16px rgba(163, 29, 56, 0.16); }
.chon-gv .gv img, .gv-hinh { width: 58px; height: 58px; border-radius: 50%; overflow: hidden; display: block; object-fit: cover; background: #f3e4dc; }
.gv-hinh svg { width: 100%; height: 100%; display: block; }
.gv-ghi-chu { display: block; margin-top: 8px; color: var(--ink-soft); font-size: 0.78rem; line-height: 1.45; }
.brand .brand-hinh { width: 40px; height: 40px; flex-shrink: 0; }
/* Nhân vật vẽ: không có bức tường lớp học thật nên nền mặc định là màu của lớp. */
.pose.nhan-vat svg { width: 100%; height: 100%; display: block; }
.stage.hoat-hinh { background: radial-gradient(120% 90% at 50% 20%, #b3223f 0%, #7c1229 70%); }
.nhan-vat .mat, .gv-hinh .mat { transform-box: fill-box; transform-origin: center; animation: chop-mat 4.6s infinite; }
@keyframes chop-mat { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.08); } }
@media (prefers-reduced-motion: reduce) { .nhan-vat .mat, .gv-hinh .mat { animation: none; } }

/* Điện thoại: khung hình thầy cao hơn một chút để mặt thầy to, dễ nhìn môi. */
@media (max-width: 520px) {
  .stage { aspect-ratio: 1 / 0.8; }
}

/* ---------- Nền theo bài học ----------
   Bình thường nền là bức tường lớp học trong ảnh thật. Khi thầy AI báo chủ đề (dòng CANH), ảnh thầy được
   cắt khỏi nền bằng mặt nạ (avatar/thay-*-mat.png) và phía sau hiện cảnh của chủ đề đó. */
.canh { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease; overflow: hidden; }
.stage.co-canh .canh { opacity: 1; }
.stage { container-type: size; }

/* ---------- Khung thầy cô nằm giữa cảnh Việt Nam (thầy Tùng dặn tối 01/12/2026) ----------
   "Cho video bé hơn một tí… đầu thầy cô ở 1/3 trên, đừng cắt đầu… các khung cảnh ở biển, danh lam thắng cảnh Việt Nam,
   thỉnh thoảng đổi". → Khung ngoài (.stage) là cảnh vẽ (canh-vn/*.svg, tự đổi, xem nenVietNam trong app.js); video / ảnh
   thầy cô nằm trong khung nhỏ hơn (.khung-gv) ở giữa, hiện TRỌN khung hình 16:9 nên không bị cắt đầu.
   Riêng thầy Tùng: video gốc quay sát đầu (tóc chạm mép trên), nên khung cao hơn (16:10), video đặt sát đáy, phần trống
   phía trên tô màu tường đỏ để đầu thầy hạ xuống gần đường 1/3. */
.nen-vn { position: absolute; inset: 0; z-index: 0; background: #bfe3ff; }
.nen-anh { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; }
.nen-anh.on { opacity: 1; }
.khung-gv {
  position: absolute; left: 50%; top: 54%; z-index: 1; transform: translate(-50%, -50%);
  width: min(82cqw, calc(80cqh * 16 / 9)); aspect-ratio: 16 / 9;
  border-radius: 16px; overflow: hidden; border: 3px solid rgba(255, 255, 255, 0.92);
  background: #7c1229; box-shadow: 0 10px 26px rgba(20, 10, 30, 0.32); container-type: inline-size;
}
.stage[data-gv="tung"] .khung-gv { aspect-ratio: 16 / 10; width: min(82cqw, calc(80cqh * 1.6)); background: linear-gradient(180deg, #ad4a5b, #9b2c41 70%); }
.stage[data-gv="tung"] .khung-gv .pose { object-fit: contain; object-position: 50% 100%; }
.stage > .dong-ho, .stage > .level-chip, .stage > .status, .stage > .wave { z-index: 3; }
/* Biển hiệu của lớp trên nền cảnh, nhỏ, phía trên khung thầy cô (thầy dặn: nền các thầy cô có "Thầy Tùng Trần · Đam mê
   và giỏi tiếng Anh", để bé thôi). */
.bien-hieu {
  position: absolute; left: 50%; top: 1.5cqh; z-index: 2; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 0.5em; padding: 0.25em 0.9em; border-radius: 999px; white-space: nowrap;
  background: #8e1630; color: #fff; font-size: clamp(9px, 2.3cqw, 15px); line-height: 1.3; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}
.bien-hieu b { font-weight: 800; letter-spacing: 0.04em; }
/* Thầy Tùng: tường thật sau lưng thầy đã có "THẦY TÙNG TRẦN · ĐAM MÊ VÀ GIỎI TIẾNG ANH" (chữ THẦY chèn thêm vào video
   tối 01/12/2026, bản gốc ở giong/mau/avatar-goc-truoc-chu-thay/), nên không hiện biển nhỏ nữa cho khỏi lặp. */
.stage[data-gv="tung"] .bien-hieu { display: none; }
.bien-hieu span { font-weight: 600; opacity: 0.92; }
/* Tên cảnh (vừa học vừa biết thêm danh lam thắng cảnh): góc dưới bên phải của cảnh, rất nhỏ. */
.nen-ten {
  position: absolute; right: 1.2cqw; bottom: 1cqh; z-index: 2; max-width: 40%; padding: 0.15em 0.6em; border-radius: 999px;
  background: rgba(255, 255, 255, 0.82); color: #3a2a2a; font-size: clamp(8px, 1.7cqw, 12px); font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 0.6s;
}
.nen-ten:empty { display: none; }
.stage[data-phase="talking"] .nen-ten { opacity: 0.85; }
.canh .troi, .canh .dat { position: absolute; left: 0; right: 0; }
.canh .troi { top: 0; bottom: 0; }
.canh .dat { bottom: 0; height: 34%; border-radius: 50% 50% 0 0 / 22% 22% 0 0; }
.canh .do { position: absolute; transform: translate(-50%, -50%); line-height: 1; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18)); }
@keyframes breathe { 0%, 100% { transform: scale(1.015); } 50% { transform: scale(1.035); } }
@keyframes talk-bob {
  0%, 100% { transform: scale(1.03) translateY(0); }
  30% { transform: scale(1.045) translateY(-0.5%); }
  65% { transform: scale(1.035) translateY(0.3%); }
}

.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(42, 12, 20, 0) 62%, rgba(42, 12, 20, 0.55) 100%);
}

.status {
  position: absolute; left: 14px; bottom: 14px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(30, 10, 16, 0.68); color: #fff;
  font-weight: 600; font-size: 0.92rem;
  backdrop-filter: blur(6px);
}
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.stage[data-phase="talking"] .dot { background: var(--salmon); animation: pulse 0.9s ease-in-out infinite; }
.stage[data-phase="listening"] .dot { background: #3ddc97; animation: pulse 0.9s ease-in-out infinite; }
.stage[data-phase="thinking"] .dot { background: var(--amber); animation: pulse 0.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: 0.55; } }

.wave { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; align-items: flex-end; gap: 4px; height: 30px; opacity: 0; transition: opacity 0.2s; }
.stage[data-phase="talking"] .wave { opacity: 1; }
.wave i { width: 5px; border-radius: 3px; background: #fff; height: 30%; animation: bar 0.7s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: 0.12s; }
.wave i:nth-child(3) { animation-delay: 0.26s; }
.wave i:nth-child(4) { animation-delay: 0.08s; }
.wave i:nth-child(5) { animation-delay: 0.2s; }
@keyframes bar { 0%, 100% { height: 22%; } 50% { height: 100%; } }
/* Khi có âm lượng thật (giọng thầy), sóng chạy theo âm lượng */
.stage[data-amp] .wave i { animation: none; height: calc(18% + var(--amp) * 82%); transition: height 0.07s linear; }
.stage[data-amp] .wave i:nth-child(odd) { height: calc(14% + var(--amp) * 60%); }

.level-chip {
  position: absolute; right: 14px; top: 14px; z-index: 2;
  padding: 7px 14px; border-radius: 999px;
  background: #fff; color: var(--crimson-deep); font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.caption { min-height: 104px; padding: 18px 6px 4px; text-align: center; }
.cap-prev { margin: 0 0 6px; color: #a48c90; font-size: 0.98rem; line-height: 1.45; min-height: 1.45em; }
.cap-main { margin: 0; font-size: clamp(1.25rem, 4.6vw, 1.6rem); font-weight: 700; line-height: 1.35; text-wrap: balance; }
.cap-main[data-lang="vi"] { color: var(--crimson-deep); font-weight: 600; }

.fix-card, .result-card {
  margin: 10px 0; padding: 16px 18px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 8px 22px rgba(124, 18, 41, 0.08);
  animation: pop 0.28s ease;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.card-label { font-size: 0.76rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--crimson); margin-bottom: 8px; }
.fix-said { color: #a48c90; text-decoration: line-through; text-decoration-color: rgba(163, 29, 56, 0.45); font-size: 1rem; }
.fix-better { margin-top: 4px; font-size: 1.3rem; font-weight: 700; color: var(--green); line-height: 1.35; }

/* Phân tích lỗi sau mỗi 3–5 câu (thầy Tùng dặn 30/11/2026). */
.phan-tich {
  margin: 10px 0; padding: 14px 18px; border-radius: 20px;
  background: #fff8ec; border: 1px solid #f3c98b;
  box-shadow: 0 8px 22px rgba(124, 18, 41, 0.08);
  animation: pop 0.28s ease;
}
.phan-tich ul { margin: 0; padding-left: 1.1em; }
.phan-tich li { margin: 4px 0; line-height: 1.45; font-size: 1rem; }
.phan-tich li b { color: var(--green); }

.result-card { border: 2px solid var(--crimson); background: linear-gradient(180deg, #fff 0%, #fff3ee 100%); }
.result-level { font-size: 2rem; font-weight: 800; color: var(--crimson); line-height: 1.1; }
.result-meaning { margin: 4px 0 10px; font-weight: 600; }
.result-note { margin: 0 0 12px; line-height: 1.55; }
.result-disclaimer { margin: 0; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 0.82rem; line-height: 1.5; color: var(--ink-soft); }

/* Thầy Tùng dặn 25/11/2026: "phần thầy nghe được thì in đậm, màu đen". */
.heard { margin: 8px 0 0; text-align: center; color: #000; font-weight: 800; font-size: 1.05rem; line-height: 1.4; min-height: 1.5em; }
.heard-label { font-weight: 800; }
.heard.interim #heard-text { opacity: 0.72; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-top: 16px; }
.controls > :first-child { justify-self: start; }
.controls > :last-child { justify-self: end; }

.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: #f6e6df; }
.lang-switch button { border: 0; background: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); }
.lang-switch button.on { background: #fff; color: var(--crimson-deep); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08); }

.mic {
  position: relative; width: 86px; height: 86px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: var(--crimson); color: #fff;
  box-shadow: 0 10px 26px rgba(163, 29, 56, 0.35);
  transition: background 0.2s, transform 0.12s;
}
.mic:active { transform: scale(0.96); }
/* Đồng hồ đếm ngược cho lượt con nói (thầy Tùng dặn 26/11/2026). Con cất tiếng thì dừng (đổi màu xám). */
.mic .dem { position: absolute; top: -8px; right: -10px; z-index: 1; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center; background: #fff; color: var(--crimson-deep); font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28); }
.mic .dem.dung { background: #e9e4df; color: #7d6f6a; }
.mic::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid transparent; }
.mic[data-phase="listening"] { background: var(--green); box-shadow: 0 10px 26px rgba(23, 147, 106, 0.4); }
.mic[data-phase="listening"]::before { border-color: rgba(23, 147, 106, 0.45); animation: ring 1.2s ease-out infinite; }
.mic[data-phase="thinking"] { background: #c9b6b0; box-shadow: none; cursor: progress; }
.mic[data-phase="talking"] { background: #d98a7c; }
@keyframes ring { from { transform: scale(0.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }

.type-form { display: flex; gap: 8px; margin-top: 14px; }
.type-form input { flex: 1; }

.hint { margin: 14px 0 0; text-align: center; color: var(--ink-soft); font-size: 0.95rem; min-height: 1.5em; }
.error { margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: #ffe3e3; border: 1px solid #f3b4b4; color: #8a1c1c; font-size: 0.93rem; line-height: 1.5; text-align: center; }

/* ---------- Phiếu nhận xét cuối buổi ---------- */
.class[data-ended] .controls,
.class[data-ended] .type-form,
.class[data-ended] .heard,
.class[data-ended] .hint,
.class[data-ended] .fix-card,
.class[data-ended] .result-card { display: none; }

.report {
  margin-top: 12px; padding: 22px 20px 18px; border-radius: 24px;
  background: var(--card); border: 2px solid var(--crimson);
  box-shadow: var(--shadow);
  animation: pop 0.3s ease;
}
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.report h2 { margin: 0; font-size: 1.45rem; line-height: 1.2; font-weight: 800; }
.report-meta { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.92rem; }
.report h3 { margin: 0 0 6px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--crimson); }

.score {
  flex-shrink: 0; width: 92px; height: 92px; border-radius: 50%;
  display: grid; place-content: center; text-align: center;
  background: var(--crimson); color: #fff;
  box-shadow: 0 8px 20px rgba(163, 29, 56, 0.3);
}
.score strong { font-size: 2rem; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.score span { font-size: 0.8rem; opacity: 0.85; }

.report-nograde { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: #fff4d6; color: #6b4a00; font-size: 0.93rem; line-height: 1.5; }

.criteria { display: grid; gap: 10px; margin: 18px 0 4px; }
.criterion { display: grid; grid-template-columns: minmax(0, 11.5em) 1fr 2.4em; align-items: center; gap: 10px; font-size: 0.95rem; }
.criterion .bar { height: 10px; border-radius: 6px; background: #f6e6df; overflow: hidden; }
.criterion .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--salmon), var(--crimson)); }
.criterion b { text-align: right; font-variant-numeric: tabular-nums; }

.report-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.report ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.report li + li { margin-top: 6px; }
.report-line { margin-top: 16px; }
/* Lúc thầy Tùng nhận xét trong buổi học với cô / thầy khác: phủ ảnh thầy lên khung hình */
.thay-vao { display: none; position: absolute; inset: 0; z-index: 5; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(circle at 50% 40%, #fff6e6 0%, #f3dcc0 100%); text-align: center; padding: 12px; }
.stage[data-thay-nx="1"] .thay-vao { display: flex; }
.thay-vao img { width: min(44%, 200px); aspect-ratio: 1; border-radius: 50%; object-fit: cover; border: 4px solid #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.thay-vao b { font-size: 1.05rem; color: var(--crimson-deep); }
.thay-vao-song { display: flex; gap: 4px; align-items: flex-end; height: 18px; }
.thay-vao-song i { width: 5px; height: 6px; border-radius: 3px; background: var(--crimson); }
.stage[data-phase="talking"] .thay-vao-song i { animation: nx-song 0.9s ease-in-out infinite; }
.thay-vao-song i:nth-child(2) { animation-delay: 0.15s; }
.thay-vao-song i:nth-child(3) { animation-delay: 0.3s; }
.thay-vao-song i:nth-child(4) { animation-delay: 0.45s; }
@keyframes nx-song { 50% { height: 18px; } }
/* Thầy Tùng nhận xét bằng giọng (02/12/2026): ảnh thầy + lời nhận xét xen Việt / Anh + nút nghe lại */
.thay-nx { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 18px; background: #fff8e8; border: 1px solid #f3dfb0; }
.thay-nx[hidden] { display: none; }
.thay-nx img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12); }
.thay-nx h3 { margin: 0 0 6px; }
.thay-nx p { margin: 0 0 10px; line-height: 1.6; }
.thay-nx .nx-en { color: var(--crimson-deep); font-style: italic; font-weight: 600; }
.thay-nx .nx-dang { background: #ffe9a8; border-radius: 6px; }
.report-line p { margin: 0; line-height: 1.55; }
.report .best { font-size: 1.2rem; font-weight: 700; color: var(--green); }

.cheer { margin-top: 18px; padding: 16px 18px; border-radius: 18px; background: linear-gradient(180deg, #fff3ee 0%, #ffe7df 100%); }
.cheer-text { margin: 0; font-size: 1.05rem; line-height: 1.6; font-weight: 500; }
.cheer blockquote { margin: 12px 0 0; padding: 0 0 0 14px; border-left: 4px solid var(--crimson); }
.cheer blockquote p { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--crimson-deep); line-height: 1.35; }
.cheer blockquote footer { margin-top: 2px; color: var(--ink-soft); font-size: 0.93rem; }
.cheer-sign { margin: 10px 0 0; text-align: right; font-weight: 700; color: var(--crimson-deep); font-size: 0.92rem; }

.report .result-disclaimer { margin-top: 16px; }
/* Phiếu lỗi sai (thầy Tùng dặn 26/11/2026: "xuất các lỗi sai ra bản PDF để học sinh in và sửa") */
.fixes { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 12px; }
.fixes li { line-height: 1.55; }
.fixes s { color: #a48c90; text-decoration-color: rgba(163, 29, 56, 0.5); }
.fixes b { color: var(--green); font-size: 1.08rem; }
.fixes small { color: var(--ink-soft); font-size: 0.9rem; }
.fixes .viet-lai { display: block; margin-top: 4px; padding-bottom: 14px; border-bottom: 1.5px dotted #b9a6a0; color: var(--ink-soft); font-size: 0.9rem; }
/* Bảng xếp hạng theo tuần (26/11/2026) */
.bxh-toi { margin: 0 0 8px; font-weight: 700; color: var(--crimson-deep); line-height: 1.45; }
.bxh-ds { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bxh-ds li { display: grid; grid-template-columns: 2.2em 1fr auto; grid-template-areas: "hang ten tong" "hang phu tong"; align-items: center; column-gap: 8px; padding: 7px 12px; border-radius: 12px; background: #fff7f3; border: 1px solid var(--line); }
.bxh-ds li.toi { background: #e6f6ef; border-color: #8fd2b6; }
.bxh-ds .hang { grid-area: hang; font-weight: 800; font-size: 1.1rem; text-align: center; }
.bxh-ds .ten { grid-area: ten; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bxh-ds small { grid-area: phu; color: var(--ink-soft); font-size: 0.8rem; }
.bxh-ds b { grid-area: tong; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--crimson); }
.bxh-ghi-chu { margin: 8px 0 0; font-size: 0.8rem; color: var(--ink-soft); }
@media print { .bxh { display: none !important; } } /* phiếu in ra không kèm tên các bạn khác */
.report-in-huong-dan { margin: 10px 0 0; font-size: 0.84rem; line-height: 1.5; color: var(--ink-soft); }
@media print { .report-in-huong-dan { display: none; } .fixes li { break-inside: avoid; } .fixes .viet-lai { padding-bottom: 26px; } }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

@media (max-width: 480px) {
  .report-cols { grid-template-columns: 1fr; gap: 14px; }
  .criterion { grid-template-columns: minmax(0, 9em) 1fr 2.2em; font-size: 0.9rem; }
  .score { width: 80px; height: 80px; }
  .score strong { font-size: 1.7rem; }
}

@media print {
  body { background: #fff; }
  .topbar .top-actions, .demo-banner, .stage, .caption, .controls, .type-form, .heard, .hint, .error, .report-actions, .fix-card, .result-card { display: none !important; }
  .report { border: 1px solid #999; box-shadow: none; animation: none; }
  .score, .criterion .bar i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Nhật ký ---------- */
.log-dialog { width: min(640px, calc(100vw - 24px)); max-height: 82dvh; border: 0; border-radius: 24px; padding: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); color: var(--ink); }
.log-dialog::backdrop { background: rgba(42, 12, 20, 0.45); }
.log-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; }
.log-list { padding: 14px 18px; display: grid; gap: 10px; }

/* ---------- Bảng chọn chủ đề (01/12/2026): "Ngẫu nhiên" trước, rồi 20 chủ đề ---------- */
.cd-dialog { width: min(720px, calc(100vw - 16px)); max-height: 90dvh; overflow: hidden; }
.cd-dialog[open] { display: flex; flex-direction: column; }
.cd-dialog .log-head { position: static; gap: 10px; padding: 12px 14px; }
.cd-dau { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cd-dau img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; background: #f3e4dc; }
.cd-dau strong { font-size: 1rem; line-height: 1.3; }
.cd-than { padding: 12px 14px 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cd-nhan { margin: 10px 2px 8px; font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); }
/* Cấp độ 1–5 trong bảng chọn (tối 01/12/2026) */
.cd-cap-khung { margin-bottom: 10px; }
.cd-cap-nhan { display: block; margin: 0 2px 6px; font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); }
.cd-cap { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.cd-cap button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 52px; padding: 4px 2px;
  border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; cursor: pointer;
}
.cd-cap button b { font-size: 1.15rem; line-height: 1.1; }
.cd-cap button small { font-size: 0.68rem; color: var(--ink-soft); line-height: 1.15; white-space: nowrap; }
.cd-cap button.on { border-color: var(--crimson); background: var(--crimson); color: #fff; }
.cd-cap button.on small { color: #ffe3da; }
.cd-cap button:focus-visible { outline: 3px solid #ffb9a6; outline-offset: 1px; }
.cd-cap-ghi { display: block; margin: 6px 2px 0; font-size: 0.76rem; color: var(--ink-soft); line-height: 1.35; }
/* Nút gợi ý màu đỏ có mũi tên chỉ xuống câu hỏi (thầy dặn tối 01/12/2026) */
.goi-y-tu {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 auto 4px; padding: 3px 11px; border: 0; border-radius: 999px;
  background: #d62828; color: #fff; font: inherit; font-size: 0.78rem; font-weight: 700; line-height: 1.5; cursor: pointer;
  box-shadow: 0 2px 6px rgba(214, 40, 40, 0.25);
}
.goi-y-tu[hidden] { display: none; }
.goi-y-tu:hover { background: #b71c1c; }
.goi-y-tu:active { transform: scale(0.97); }
.cap-main.nhay-tu .tu { animation: nhay-tu 0.5s ease-in-out 3; }
@keyframes nhay-tu { 50% { background: #ffd9c7; } }
@media (prefers-reduced-motion: reduce) { .cap-main.nhay-tu .tu { animation: none; background: #ffe7da; } }
/* Bấm vào một từ tiếng Anh trên màn hình: hiện nghĩa, IPA, cách đọc và đọc to từ đó (tối 01/12/2026) */
.cap-main[data-lang="en"] .tu, .gt-cau .tu { cursor: pointer; border-radius: 6px; }
.cap-main[data-lang="en"] .tu:hover, .gt-cau .tu:hover { background: #fff1e6; }
.cap-main .tu.dang-tra, .gt-cau .tu.dang-tra { background: #ffe0cc; }
.tu-hop {
  position: fixed; z-index: 60; width: min(300px, calc(100vw - 24px)); padding: 12px 14px 12px; border-radius: 16px;
  background: #fff; color: var(--ink); box-shadow: 0 10px 30px rgba(60, 20, 10, 0.22); border: 2px solid #ffd2bd;
}
.tu-hop[hidden] { display: none; }
.tu-dau { display: flex; align-items: center; gap: 8px; }
.tu-chu { font-size: 1.3rem; font-weight: 800; color: #d9480f; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tu-nut { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #fff1e6; font-size: 1.2rem; cursor: pointer; }
.tu-nut:active { transform: scale(0.95); }
.tu-dong { flex: none; border: 0; background: none; font-size: 1.3rem; color: var(--ink-soft); cursor: pointer; padding: 4px 6px; }
.tu-than { margin: 8px 0 0; display: grid; gap: 4px; font-size: 0.95rem; line-height: 1.4; }
.tu-than dt { font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.02em; }
.tu-than dd { margin: 0 0 4px; }
.tu-ipa { font-family: "Segoe UI", "Noto Sans", "Lucida Sans Unicode", sans-serif; color: #7a3410; }
.tu-cho { color: var(--ink-soft); font-size: 0.9rem; margin: 8px 0 0; }
/* Hai "thư mục" của bảng chọn: Chủ đề đời sống · Nghề nghiệp (01/12/2026) */
.cd-tab { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cd-tab-nut {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 2px 8px; min-height: 52px; padding: 8px 6px;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); font: inherit; font-weight: 700; font-size: 0.92rem; cursor: pointer;
}
.cd-tab-nut small { font-weight: 600; font-size: 0.74rem; color: var(--ink-soft); }
.cd-tab-nut.on { border-color: var(--crimson); background: var(--crimson); color: #fff; }
.cd-tab-nut.on small { color: #ffe3da; }
.cd-tab-nut:focus-visible { outline: 3px solid #ffb9a6; outline-offset: 1px; }
.cd-luoi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.cd-o {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 86px; padding: 8px 4px;
  border: 2px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); font: inherit; text-align: center; cursor: pointer;
}
.cd-o:hover, .cd-o:focus-visible { border-color: var(--crimson); background: #fff3ee; outline: none; }
.cd-o:active { transform: scale(0.97); }
.cd-o b { font-size: 0.88rem; line-height: 1.25; }
.cd-o small { font-size: 0.72rem; color: var(--ink-soft); line-height: 1.2; }
.cd-hinh { font-size: 1.7rem; line-height: 1.1; }
.cd-ngau-nhien { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px 10px; min-height: 64px; border-color: var(--crimson); background: #fff3ee; }
.cd-ngau-nhien b { font-size: 1.05rem; }
.cd-ngau-nhien small { font-size: 0.8rem; }
@media (max-width: 640px) { .cd-luoi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 380px) { .cd-luoi { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.log-item { max-width: 86%; padding: 10px 14px; border-radius: 16px; line-height: 1.5; font-size: 0.96rem; }
.log-item.thay { background: #fff0ea; justify-self: start; border-bottom-left-radius: 4px; }
.log-item.con { background: #e6f6ef; justify-self: end; border-bottom-right-radius: 4px; }
.log-item.sua { background: #f3fbf7; border: 1px dashed #8fd2b6; justify-self: start; color: #0f6e4d; font-weight: 600; }
.log-who { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.6; margin-bottom: 2px; }
.log-foot { margin: 0; padding: 12px 18px 16px; font-size: 0.8rem; color: var(--ink-soft); }

@media (max-width: 480px) {
  #app { padding: 12px 12px 32px; }
  .start-card { padding: 26px 18px 20px; border-radius: 26px; }
  .controls { gap: 8px; }
  .lang-switch button { padding: 8px 8px; font-size: 0.76rem; white-space: nowrap; }
  .top-actions .btn-ghost { padding: 7px 11px; font-size: 0.84rem; }
  .mic { width: 78px; height: 78px; }
  .caption { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .poses, .stage[data-phase="talking"] .poses, .wave i, .dot, .mic::before { animation: none !important; }
}

/* ---------- Bản tối ưu cho điện thoại (thầy Tùng dặn 24/11/2026) ----------
   Màn hình hẹp: nút "Vào lớp học" và hàng nút micro luôn dính ở mép dưới màn hình để không phải cuộn tìm;
   bảng giải thích và phần đầu trang gọn lại để khung hình thầy cô, câu đang nói, bảng giải thích và micro
   cùng nằm trong một màn hình. */
@media (max-width: 720px) {
  .controls {
    position: sticky; bottom: 0; z-index: 5; margin-top: 4px; padding: 10px 0 12px;
    background: linear-gradient(180deg, rgba(255, 248, 243, 0) 0%, var(--paper) 30%);
  }
  .caption { min-height: 78px; padding-top: 12px; }
  .cap-prev { font-size: 0.9rem; margin-bottom: 4px; }
  .giai-thich { margin: 6px 0; padding: 12px 14px; border-radius: 16px; }
  .giai-thich .card-label { margin-bottom: 4px; }
  .gt-cau { margin-bottom: 8px; font-size: 1rem; }
  .giai-thich dl { gap: 6px; }
  .giai-thich dd { font-size: 0.92rem; line-height: 1.4; }
  #gt-ipa { font-size: 0.98rem; }
  #btn-start { position: sticky; bottom: 10px; z-index: 5; box-shadow: 0 10px 26px rgba(124, 18, 41, 0.3); }
  .start-face { width: 72px; height: 72px; }
  .chon-gv .gv { padding: 8px 2px 6px; font-size: 0.8rem; }
  .chon-gv .gv img, .gv-hinh { width: 52px; height: 52px; }
}

/* ---------- Màu micro và chú thích (thầy Tùng dặn 24/11/2026) ----------
   XANH = tới lượt con nói · CAM ĐẬM = thầy cô đang nói (hoặc đang nghĩ), con lắng nghe, không ngắt lời. */
.mic, .mic[data-phase="idle"], .mic[data-phase="listening"] { background: var(--green); box-shadow: 0 10px 26px rgba(23, 147, 106, 0.38); }
.mic[data-phase="talking"], .mic[data-phase="thinking"] { background: #d9480f; box-shadow: 0 10px 26px rgba(217, 72, 15, 0.36); cursor: not-allowed; }
.mic[data-phase="talking"] { cursor: pointer; } /* bấm được: con muốn nói thì thầy cô dừng lại (25/11/2026) */
.btn-xong { border: 0; border-radius: 999px; padding: 12px 18px; font: inherit; font-weight: 800; color: #fff; background: var(--green); box-shadow: 0 4px 14px rgba(14,107,76,.3); cursor: pointer; animation: xong-hien .2s ease-out; }
.btn-xong { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; line-height: 1.15; }
.btn-xong small { font-weight: 600; font-size: 0.72em; opacity: 0.95; white-space: nowrap; }
.btn-xong[hidden] { display: none; }
.btn-xong:active { transform: scale(.96); }
@keyframes xong-hien { from { opacity: 0; transform: scale(.9); } }
.chu-thich-mic { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; font-size: 0.86rem; color: var(--ink-soft); }
.chu-thich-mic > span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; }
.chu-thich-mic i { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.chu-thich-mic .xanh i { background: var(--green); }
.chu-thich-mic .cam i { background: #d9480f; }
.chu-thich-mic[data-phase="idle"] .xanh, .chu-thich-mic[data-phase="listening"] .xanh { background: #e2f6ee; color: #0e6b4c; font-weight: 700; }
.chu-thich-mic[data-phase="talking"] .cam, .chu-thich-mic[data-phase="thinking"] .cam { background: #ffe8dc; color: #b03a0a; font-weight: 700; }

/* ---------- Câu tiếng Anh thầy cô đang nói: chữ màu cam, ngữ điệu ngay trên từ ----------
   ● = từ được nhấn · ↗ = lên giọng ở cuối câu · ↘ = xuống giọng ở cuối câu */
.cap-main[data-lang="en"] { color: #d9480f; }
.cap-main .tu, .gt-cau .tu { position: relative; display: inline-block; padding-top: 0.72em; }
.cap-main .tu[data-m]::before, .gt-cau .tu[data-m]::before {
  content: attr(data-m); position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  font-size: 0.6em; line-height: 1; font-weight: 800; color: #b03a0a; white-space: nowrap;
}
@media (max-width: 720px) {
  .chu-thich-mic { font-size: 0.78rem; gap: 2px 8px; margin-top: 6px; }
  .chu-thich-mic > span { padding: 2px 8px; }
}
@media print { .chu-thich-mic { display: none !important; } }
.gt-cau { color: #d9480f; line-height: 1.7; }
.gt-chu-giai { display: block; margin-top: 10px; color: var(--ink-soft); font-size: 0.74rem; }
/* Cột bên phải: mọi lời giải thích cho con (bảng giải thích + thẻ "câu hay hơn"). Điện thoại: nằm dưới câu đang nói. */
.cot-phai { display: grid; gap: 10px; align-content: start; }
.cot-phai:not(:has(> :not([hidden]))) { display: none; }
#gt-ghichu { color: #0e6b4c; font-weight: 600; }

/* ---------- Kiểm tra micro (25/11/2026) ---------- */
.btn-kiem-mic { display: block; width: 100%; margin: 0 0 10px; padding: 10px 14px; border: 2px dashed var(--green); border-radius: 14px; background: #f1fbf6; color: #0e6b4c; font: inherit; font-weight: 700; cursor: pointer; }
.mic-dialog { max-width: 460px; width: calc(100vw - 32px); }
.mic-huong-dan { margin: 10px 0; font-size: 0.95rem; }
.mic-ds { display: grid; gap: 8px; }
.mic-hang { display: grid; gap: 6px; width: 100%; text-align: left; padding: 10px 12px; border: 2px solid #e3e0da; border-radius: 12px; background: #fff; font: inherit; cursor: pointer; }
.mic-hang.chon { border-color: var(--green); background: #f1fbf6; }
.mic-hang .ten { font-weight: 700; font-size: 0.92rem; }
.mic-hang .ten small { font-weight: 600; color: #0e6b4c; }
.mic-hang .do { height: 10px; border-radius: 999px; background: #ece9e3; overflow: hidden; }
.mic-hang .do i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 999px; transition: width .08s linear; }
.mic-bao { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: #fff3e6; color: #8a3b00; font-size: 0.9rem; white-space: pre-line; }
.mic-bao[hidden] { display: none; }

/* ---------- Điện thoại: TẤT CẢ trong một màn hình (thầy Tùng dặn 25/11/2026) ----------
   "Thầy muốn tất cả nó nằm ở trong một cái khung hình của điện thoại: ảnh của thầy, phần giải thích cho con,
   phần thầy nghe được, cái mic ở dưới." → Lúc đang học, màn hình lớp cao đúng bằng màn hình điện thoại và
   KHÔNG cuộn: khung hình thầy co giãn (bảng giải thích hiện ra thì hình thấp lại), bên dưới là câu đang nói,
   bảng giải thích, thẻ sửa câu, dòng "Thầy nghe được" và hàng micro. Chỉ khi nội dung giữa quá dài mới cuộn
   riêng vùng giữa. Hết buổi (có phiếu nhận xét) thì trang cuộn bình thường. */
.giua { display: contents; }
@media (max-width: 720px) {
  #app:has(#screen-class:not([hidden]):not([data-ended])) { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  #screen-class:not([hidden]):not([data-ended]) {
    display: flex; flex-direction: column; gap: 6px; overflow: hidden;
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px - env(safe-area-inset-bottom));
  }
  #screen-class:not([data-ended]) > * { flex: 0 0 auto; margin-top: 0; margin-bottom: 0; }

  #screen-class:not([data-ended]) .topbar { gap: 8px; }
  #screen-class:not([data-ended]) .brand img, #screen-class:not([data-ended]) .brand .brand-hinh { width: 32px; height: 32px; }
  #screen-class:not([data-ended]) .brand strong { font-size: 0.95rem; }
  #screen-class:not([data-ended]) .badge-ai { margin-top: 0; padding: 1px 7px; font-size: 0.66rem; }
  #screen-class:not([data-ended]) .top-actions .btn-ghost { padding: 5px 10px; font-size: 0.8rem; }
  #screen-class:not([data-ended]) .demo-banner { padding: 4px 10px; font-size: 0.74rem; }

  /* Khung hình thầy cô: nhỏ lại, cao khoảng 1/3 màn hình (thầy Tùng dặn 25/11/2026: "em có thể cho ảnh thầy bé
     hơn"), và là phần co lại đầu tiên khi bên dưới cần chỗ. Chỗ trống còn lại thuộc về vùng giữa. */
  #screen-class:not([data-ended]) > .stage { aspect-ratio: auto; max-height: none; flex: 0 1000 clamp(150px, 31vh, 270px); min-height: 120px; border-radius: 18px; }
  /* Điện thoại: khung cảnh thấp, nên khung thầy cô lấy gần hết chiều cao (vẫn chừa viền cảnh và chỗ cho biển hiệu). */
  #screen-class:not([data-ended]) .khung-gv { width: min(80cqw, calc(74cqh * 16 / 9)); top: 55%; border-width: 2px; border-radius: 12px; }
  #screen-class:not([data-ended]) .stage[data-gv="tung"] .khung-gv { width: min(80cqw, calc(74cqh * 1.6)); }
  #screen-class:not([data-ended]) .dong-ho { left: 8px; top: 8px; padding: 4px 10px; font-size: 0.84rem; }
  #screen-class:not([data-ended]) .level-chip { right: 8px; top: 8px; padding: 4px 10px; font-size: 0.8rem; }
  #screen-class:not([data-ended]) .status { left: 8px; bottom: 8px; padding: 5px 11px; font-size: 0.82rem; }
  #screen-class:not([data-ended]) .wave { right: 10px; bottom: 10px; height: 22px; }

  #screen-class:not([data-ended]) > .giua { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .giua > * { flex: 0 0 auto; margin-top: 0; margin-bottom: 0; }
  .giua .caption { min-height: 0; padding: 0 4px; }
  .giua .cap-prev { display: none; }
  /* Thầy Tùng dặn 26/11/2026: "chữ có thể cho to hơn chút cho dễ nhìn". */
  .giua .cap-main { font-size: 1.32rem; line-height: 1.28; }
  .giua .cot-phai { gap: 6px; }
  .giua .giai-thich { margin: 0; padding: 8px 12px; border-radius: 14px; box-shadow: none; }
  .giua .giai-thich .card-label { display: none; }
  .giua .gt-cau { margin: 0 0 2px; font-size: 1.1rem; line-height: 1.55; }
  .giua .giai-thich dl { gap: 2px; }
  .giua .giai-thich dl > div { display: flex; align-items: baseline; gap: 8px; }
  /* Nhãn ngắn cho vừa một dòng: "Nghĩa", "IPA", "Lưu ý". */
  .giua .giai-thich dt { flex: 0 0 auto; min-width: 3.1em; white-space: nowrap; font-size: 0; letter-spacing: 0.04em; }
  .giua .giai-thich dt::before { font-size: 0.72rem; }
  .giua #gt-o-nghia dt::before { content: "Nghĩa"; }
  .giua #gt-o-ipa dt::before { content: "IPA"; }
  .giua #gt-o-ghichu dt::before { content: "Lưu ý"; }
  .giua .giai-thich dd { margin: 0; font-size: 1.02rem; line-height: 1.35; min-width: 0; }
  .giua #gt-ipa { font-size: 1.02rem; }
  .giua .gt-chu-giai { margin-top: 3px; font-size: 0.64rem; }
  .giua .fix-card { margin: 0; padding: 7px 12px; border-radius: 14px; box-shadow: none; }
  .giua .fix-card .card-label { margin-bottom: 1px; font-size: 0.66rem; }
  .giua .fix-said { font-size: 0.94rem; }
  .giua .fix-better { margin-top: 0; font-size: 1.22rem; line-height: 1.25; }
  .giua .result-card { margin: 0; padding: 10px 12px; border-radius: 14px; }

  #screen-class:not([data-ended]) .heard {
    font-size: 1.1rem; line-height: 1.3; min-height: 0;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  }

  /* Chú thích micro: chỉ hiện dòng đang đúng (xanh = tới lượt con, cam = thầy cô đang nói). */
  #screen-class:not([data-ended]) .chu-thich-mic { margin: 0; font-size: 0.82rem; }
  #screen-class:not([data-ended]) .chu-thich-mic > span { display: none; }
  .chu-thich-mic[data-phase="idle"] > .xanh, .chu-thich-mic[data-phase="listening"] > .xanh,
  .chu-thich-mic[data-phase="talking"] > .cam, .chu-thich-mic[data-phase="thinking"] > .cam { display: inline-flex !important; }

  /* Hàng micro: bên trái chọn tiếng, giữa là micro, bên phải "Gõ chữ" + "Micro" (đổi thành "Con nói xong" khi con đang nói). */
  #screen-class:not([data-ended]) .controls {
    position: static; background: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: auto auto; gap: 4px 10px; align-items: center;
  }
  /* 26/11/2026: hàng trên là cụm micro (Con chưa hiểu · micro · Giải thích lỗi / Con nói xong); hàng dưới, nhỏ,
     là chọn tiếng + "Gõ chữ" + "Micro". */
  #screen-class:not([data-ended]) .controls { grid-template-columns: auto 1fr auto auto; gap: 5px 6px; }
  .controls .cum-mic { grid-column: 1 / -1; grid-row: 1; gap: 8px; }
  .controls .lang-switch { grid-column: 1; grid-row: 2; justify-self: start; }
  .controls .lang-switch button { padding: 4px 10px; font-size: 0.76rem; }
  .controls .mic { width: 66px; height: 66px; }
  .controls .mic svg { width: 28px; height: 28px; }
  .controls #btn-kbd { grid-column: 3; grid-row: 2; justify-self: end; padding: 4px 11px; font-size: 0.78rem; }
  .controls #btn-mic-cai { grid-column: 4; grid-row: 2; justify-self: end; padding: 4px 9px; font-size: 0.78rem; white-space: nowrap; }
  .controls .btn-xong { padding: 10px 12px; font-size: 0.86rem; line-height: 1.2; }
  .controls .btn-nho { padding: 6px 7px; border-radius: 14px; }
  .controls .btn-nho b { font-size: 0.84rem; }
  .controls .btn-nho small { font-size: 0.68rem; }

  #screen-class:not([data-ended]) .type-form { gap: 6px; }
  #screen-class:not([data-ended]) .type-form input { padding: 9px 12px; font-size: 1rem; }
  #screen-class:not([data-ended]) .hint {
    font-size: 0.86rem; line-height: 1.25; min-height: 1.25em;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  }
  #screen-class:not([data-ended]) .error { padding: 7px 10px; font-size: 0.82rem; line-height: 1.35; border-radius: 12px; }
}
@media print { #screen-class { height: auto !important; overflow: visible !important; } }

/* Màn hình rộng: hàng micro gọn một cụm (trước đây nút "Micro" bị rớt xuống hàng dưới, lệch sang trái). */
@media (min-width: 721px) {
  .controls { grid-template-rows: auto auto; row-gap: 6px; }
  .controls .lang-switch { grid-column: 1; grid-row: 1 / span 2; }
  .controls .cum-mic { grid-column: 2; grid-row: 1 / span 2; }
  .controls #btn-kbd { grid-column: 3; grid-row: 1; justify-self: end; }
  .controls #btn-mic-cai { grid-column: 3; grid-row: 2; justify-self: end; }
}

/* ---------- Hai nút nhờ giải thích, nằm hai bên micro (thầy Tùng dặn 26/11/2026) ----------
   "Thêm một nút bấm là con cần cô giải thích thêm, con chưa hiểu cô hỏi… giải thích bằng tiếng Anh, rồi giải
   thích bằng tiếng Việt, rồi cho một ví dụ trả lời. Sau khi học sinh trả lời xong, nếu có lỗi thì thêm một nút
   bấm là em cần cô giải thích lỗi của em trong câu vừa rồi. Các nút bấm ở bên cạnh cái mic."
   Trái: "Con chưa hiểu" (luôn có). Phải: "Giải thích lỗi" (chỉ hiện khi lượt vừa rồi thầy cô có sửa câu của
   con); khi con đang nói thì chỗ đó là "Con nói xong". Micro luôn ở chính giữa. */
.cum-mic { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.cum-mic > #btn-chua-hieu { grid-column: 1; grid-row: 1; justify-self: end; }
.cum-mic > .mic, .cum-mic > .mic-khung { grid-column: 2; grid-row: 1; }
/* Nút ✋ Giơ tay (thầy Tùng dặn tối 01/12/2026): nhỏ (khoảng một nửa đường kính micro, tức chừng 1/4 diện tích), gắn ở
   góc trên bên trái micro — góc đó của hình vuông bao micro là chỗ trống nên không che micro. Bàn tay vàng trên nền
   tím than cho nổi. Đang chờ con nói (đã bấm giơ tay) thì viền vàng sáng nhấp nháy. */
.mic-khung { position: relative; display: grid; place-items: center; }
.gio-tay {
  position: absolute; left: -14px; top: -12px; z-index: 2; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 2px solid #fff; background: #2f2a7a; font-size: 1.25rem; line-height: 1; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(47, 42, 122, 0.4);
}
.gio-tay:active { transform: scale(0.94); }
.gio-tay:disabled { opacity: 0.45; cursor: default; }
.gio-tay.dang-gio { border-color: #ffd43b; animation: gio-tay-nhay 1s ease-in-out infinite; }
@keyframes gio-tay-nhay { 50% { box-shadow: 0 0 0 6px rgba(255, 212, 59, 0.45); } }
@media (prefers-reduced-motion: reduce) { .gio-tay.dang-gio { animation: none; box-shadow: 0 0 0 4px rgba(255, 212, 59, 0.6); } }
/* Điện thoại: cụm micro sát nhau (khe 8px), nên nút giơ tay lùi vào trong để không đè lên ô "Con chưa hiểu". */
@media (max-width: 720px) { .controls .gio-tay { width: 34px; height: 34px; left: -5px; top: -6px; font-size: 1.05rem; } }
/* Nút ⏸ Tạm dừng (thầy Tùng dặn 02/12/2026): cùng cỡ nút giơ tay, ở góc DƯỚI bên trái micro. Đang tạm dừng thì thành ▶
   xanh lá, nhấp nháy nhẹ để con biết bấm vào đó là học tiếp. */
.tam-dung-nut {
  position: absolute; left: -14px; bottom: -12px; z-index: 2; width: 40px; height: 40px; padding: 0; border-radius: 50%;
  border: 2px solid #fff; background: #3b3f4a; color: #fff; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 4px 12px rgba(30, 32, 40, 0.35);
}
.tam-dung-nut:active { transform: scale(0.94); }
.tam-dung-nut:disabled { opacity: 0.45; cursor: default; }
.tam-dung-nut .td-chay { display: none; }
.tam-dung-nut.dang-dung { background: #17936a; animation: tam-dung-nhay 1.1s ease-in-out infinite; }
.tam-dung-nut.dang-dung .td-dung { display: none; }
.tam-dung-nut.dang-dung .td-chay { display: block; }
@keyframes tam-dung-nhay { 50% { box-shadow: 0 0 0 6px rgba(23, 147, 106, 0.35); } }
@media (prefers-reduced-motion: reduce) { .tam-dung-nut.dang-dung { animation: none; } }
@media (max-width: 720px) { .controls .tam-dung-nut { width: 34px; height: 34px; left: -5px; bottom: -6px; } }
.luu-y .ly-dung { background: #3b3f4a; color: #fff; }

/* Màn hình tạm dừng: phủ lên khung hình thầy cô (khung sửa lỗi bên phải / bên dưới vẫn nhìn thấy). */
.tam-dung {
  position: absolute; inset: 0; z-index: 6; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 16px 16px; background: #fffcf8; color: var(--ink); text-align: left;
  display: flex; flex-direction: column; gap: 8px;
}
.tam-dung[hidden] { display: none; }
.td-dau { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: -14px; margin: -14px -16px 0; padding: 12px 16px 8px; background: #fffcf8; z-index: 1; }
.td-dau h3 { margin: 0; font-size: 1.15rem; color: var(--crimson-deep); }
.td-tiep {
  flex: none; border: 0; border-radius: 999px; padding: 10px 18px; background: #17936a; color: #fff; font: inherit; font-weight: 800;
  font-size: 1rem; cursor: pointer; box-shadow: 0 6px 16px rgba(23, 147, 106, 0.35);
}
.td-tiep:active { transform: scale(0.96); }
.td-ghi { margin: 0; font-size: 0.9rem; line-height: 1.45; color: var(--ink-soft); }
.td-meo { margin: 0; padding: 8px 10px 8px 12px; list-style: none; display: grid; gap: 4px; border-radius: 14px; background: #fff; border: 1px dashed #e7cdbf; font-size: 0.88rem; line-height: 1.4; }
.td-meo b { color: var(--crimson-deep); }
.td-muc h4 { margin: 4px 0 6px; font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--crimson); }
.td-muc ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.td-cau { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; font-size: 1.02rem; line-height: 1.45; }
.td-cau[lang="en"] { font-weight: 700; color: #b33c0d; }
.td-loa { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #fff1e6; font-size: 0.95rem; cursor: pointer; }
.td-loa:active { transform: scale(0.94); }
.td-loi-noi { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: rgba(163, 29, 56, 0.45); }
.td-loi-hay { font-weight: 700; color: #0b5c41; }
.td-loi-ghi { display: block; margin-top: 2px; font-size: 0.86rem; color: var(--ink-soft); }
.chi-hep { display: none; }
@media (max-width: 1039px) { .chi-rong { display: none; } .chi-hep { display: inline; } }
/* Từ tiếng Anh bấm được để tra nghĩa: trong màn hình tạm dừng và thẻ "Câu hay hơn". */
.cau-tu .tu { cursor: pointer; border-radius: 5px; }
.cau-tu .tu:hover { background: #fff1e6; }
.cau-tu .tu.dang-tra { background: #ffe0cc; }
/* Điện thoại: lúc tạm dừng, khung hình cao hơn để đọc được màn hình tạm dừng. */
@media (max-width: 720px) {
  #screen-class[data-tam-dung]:not([data-ended]) > .stage { flex: 0 0 min(56dvh, 460px); }
  .tam-dung { padding: 12px 12px 14px; }
  .td-dau { margin: -12px -12px 0; padding: 10px 12px 6px; top: -12px; }
  .td-dau h3 { font-size: 1rem; }
  .td-tiep { padding: 8px 14px; font-size: 0.95rem; }
  .td-meo { font-size: 0.8rem; }
}
.cum-mic > #btn-giai-loi, .cum-mic > .btn-xong { grid-column: 3; grid-row: 1; justify-self: start; }
.cum-mic:has(.btn-xong:not([hidden])) #btn-giai-loi { display: none; }
/* 27/11/2026: thầy dặn "đổ màu cam nhạt để học sinh biết là nút bấm" → nền cam nhạt, viền cam, có bóng đổ. */
.btn-nho { display: grid; gap: 1px; justify-items: center; text-align: center; border: 2px solid #f2a05c; background: #ffe2c2; color: #7a3d00; box-shadow: 0 4px 10px rgba(217, 122, 30, 0.22); border-radius: 16px; padding: 8px 14px; font: inherit; line-height: 1.2; cursor: pointer; }
.btn-nho b { font-size: 0.94rem; font-weight: 800; white-space: nowrap; }
.btn-nho small { font-size: 0.76rem; opacity: 0.85; }
.btn-nho[hidden] { display: none; }
.btn-nho:active { transform: scale(0.96); }
.btn-nho:disabled { opacity: 0.45; cursor: progress; }
.btn-nho.loi { border-color: #5cc29d; background: #d5f3e6; color: #0b5c41; box-shadow: 0 4px 10px rgba(23, 147, 106, 0.2); }
.btn-nho.loi.moi { animation: nut-nhay 0.9s ease-in-out 2; } /* thầy cô vừa sửa câu: nút nháy nhẹ để con để ý */
@keyframes nut-nhay { 50% { transform: scale(1.07); box-shadow: 0 6px 16px rgba(23, 147, 106, 0.45); } }
/* Ba lưu ý dưới hàng micro (thầy Tùng dặn 27/11/2026: "sổ ra 1, 2, 3 cái lưu ý ở dưới để học sinh đọc được và tự học") */
.luu-y { margin: 10px auto 0; padding: 8px 12px 8px 30px; max-width: 560px; border-radius: 14px; background: #fff; border: 1px dashed #e7cdbf; color: var(--ink); font-size: 0.9rem; line-height: 1.5; display: grid; gap: 1px; }
.luu-y b { padding: 0 6px; border-radius: 8px; white-space: nowrap; }
.luu-y .ly-mic { background: #d5f3e6; color: #0b5c41; }
.luu-y .ly-cam { background: #ffe2c2; color: #7a3d00; }
.luu-y .ly-xanh { background: #d5f3e6; color: #0b5c41; }
.luu-y .ly-tay { background: #2f2a7a; color: #fff; }
.class[data-ended] .luu-y, .class[data-ended] .luu-y-khung { display: none; }
@media print { .luu-y, .luu-y-khung { display: none !important; } }
/* Khung hướng dẫn gọn, bấm tiêu đề để mở / đóng (tối 01/12/2026) */
.luu-y-khung { margin: 10px auto 0; max-width: 560px; border-radius: 14px; background: #fff; border: 1px dashed #e7cdbf; }
.luu-y-khung > summary {
  list-style: none; cursor: pointer; padding: 7px 12px; font-size: 0.86rem; font-weight: 700; color: var(--crimson-deep);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.luu-y-khung > summary::-webkit-details-marker { display: none; }
.luu-y-khung > summary::after { content: "▾"; font-size: 0.9em; transition: transform 0.2s; }
.luu-y-khung[open] > summary::after { transform: rotate(180deg); }
.luu-y-khung > .luu-y { margin: 0; border: 0; border-top: 1px dashed #efdcd2; border-radius: 0 0 14px 14px; max-width: none; }

/* ---------- Câu thầy cô đang nói nằm trong khung ĐÁM MÂY (thầy Tùng dặn tối 01/12/2026) ----------
   "Để trong cái khuôn, mây nhấp nhô một tí, để học sinh để ý cái đang nói, đỡ lẫn." Viền mây vẽ bằng border-image (một
   hình SVG nhỏ cắt 9 mảnh, mép lặp lại thành các nốt tròn); hai chấm tròn phía trên là "đuôi" chỉ lên thầy cô. */
.cap-main:not(:empty) {
  position: relative; display: block; width: fit-content; max-width: 100%; margin: 14px auto 4px; padding: 2px 6px; box-sizing: border-box;
  border: 18px solid transparent;
  border-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 78 78'%3E%3Cg fill='%23f3a37a'%3E%3Ccircle cx='13' cy='13' r='12.5'/%3E%3Ccircle cx='39' cy='13' r='12.5'/%3E%3Ccircle cx='65' cy='13' r='12.5'/%3E%3Ccircle cx='13' cy='39' r='12.5'/%3E%3Ccircle cx='65' cy='39' r='12.5'/%3E%3Ccircle cx='13' cy='65' r='12.5'/%3E%3Ccircle cx='39' cy='65' r='12.5'/%3E%3Ccircle cx='65' cy='65' r='12.5'/%3E%3C/g%3E%3Cg fill='%23fff'%3E%3Ccircle cx='13' cy='13' r='10'/%3E%3Ccircle cx='39' cy='13' r='10'/%3E%3Ccircle cx='65' cy='13' r='10'/%3E%3Ccircle cx='13' cy='39' r='10'/%3E%3Ccircle cx='65' cy='39' r='10'/%3E%3Ccircle cx='13' cy='65' r='10'/%3E%3Ccircle cx='39' cy='65' r='10'/%3E%3Ccircle cx='65' cy='65' r='10'/%3E%3Crect x='13' y='13' width='52' height='52'/%3E%3C/g%3E%3C/svg%3E") 26 fill / 18px round;
  filter: drop-shadow(0 4px 8px rgba(160, 70, 30, 0.14));
}
.cap-main:not(:empty)::before, .cap-main:not(:empty)::after {
  content: ""; position: absolute; left: 12%; border-radius: 50%; background: #fff; border: 2.5px solid #f3a37a;
}
.cap-main:not(:empty)::before { top: -30px; width: 15px; height: 15px; }
.cap-main:not(:empty)::after { top: -44px; left: calc(12% - 9px); width: 9px; height: 9px; }
.cap-main[data-lang="vi"]:not(:empty) { filter: drop-shadow(0 4px 8px rgba(163, 29, 56, 0.14)); }
@media (max-width: 720px) {
  #screen-class:not([data-ended]) .luu-y { margin: 0; padding: 5px 8px 5px 24px; font-size: 0.76rem; line-height: 1.32; border-radius: 0 0 12px 12px; }
  #screen-class:not([data-ended]) .luu-y-khung { margin: 0; border-radius: 12px; }
  #screen-class:not([data-ended]) .luu-y-khung > summary { padding: 5px 10px; font-size: 0.76rem; }
  .giua .cap-main:not(:empty) { margin-top: 10px; border-width: 14px; border-image-width: 14px; }
  .giua .cap-main:not(:empty)::before { top: -22px; width: 12px; height: 12px; }
  .giua .cap-main:not(:empty)::after { top: -33px; width: 7px; height: 7px; }
  .luu-y b { padding: 0 4px; }
}
@media print { .cum-mic { display: none !important; } }

/* ---------- Bài thi thử IELTS: bài nói được ghi lại + câu nâng band (27/11/2026) ---------- */
.bai-noi { margin: 6px 0 0; padding-left: 22px; display: grid; gap: 14px; }
.bai-noi li { line-height: 1.5; }
.bai-noi p { margin: 0; }
.bai-noi .nhan { font-weight: 700; color: var(--ink-soft); font-size: 0.86rem; }
.bai-noi .hoi { color: var(--ink-soft); }
.bai-noi .nang { color: var(--green); font-weight: 700; }
.bai-noi .cau-truc { font-size: 0.9rem; color: var(--crimson-deep); }
.chon-gv .gv small { font-size: 0.72rem; color: var(--ink-soft); margin-top: -4px; }

/* Đường dẫn sang trang thi thử IELTS ở màn hình đầu (27/11/2026) */
.lien-ket-ielts { display: grid; gap: 2px; margin: 16px 0 14px; padding: 12px 14px; border-radius: 16px; background: #eef6ff; border: 2px solid #b9d6f5; color: #17406e; text-decoration: none; line-height: 1.4; text-align: left; }
.lien-ket-ielts small { color: #3d5f86; font-size: 0.82rem; }
.lien-ket-ielts:hover { border-color: #6ea8e6; }
