:root {
  --bg: #FFF7E6;
  --ink: #2B2D42;
  --ink-2: #5C5F7A;
  --muted: #6B6E8A;   /* do tuong phan 22/10: >= 4.5:1 tren nen kem (cu #9A9CB5 = 2.5) */
  --card: #FFFFFF;
  --line: #F0E6D2;
  --orange: #FF9F1C; --orange-d: #E07F00;
  --teal: #1A7F75;   --teal-d: #12615A;
  --purple: #8B5CF6; --purple-d: #6D3FE0;
  --pink: #C2337F;   --pink-d: #962460;
  --green: #278253;  --green-d: #1C6440;
  --red: #C8284D;    --red-d: #9E1C3B;
  --blue: #2563D0;   --blue-d: #1A4FA8;
  --yellow: #FFD166;
  --radius: 22px;
  --shadow: 0 6px 0 rgba(43,45,66,.08), 0 10px 24px rgba(43,45,66,.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(rgba(255,159,28,.10) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.45;
  min-height: 100vh; min-height: 100dvh;
  overscroll-behavior-y: none;
}
h1, h2, h3, .display { font-family: 'Baloo 2', 'Nunito', sans-serif; line-height: 1.15; margin: 0; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 24px; font-weight: 800; }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

#app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(96px + var(--safe-b)); min-height: 100vh; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0 10px; margin: 0 -16px 8px; padding-left: 16px; padding-right: 16px;
  background: linear-gradient(var(--bg) 75%, rgba(255,247,230,0));
}
.topbar .title { flex: 1; font-family: 'Baloo 2'; font-weight: 800; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--card);
  box-shadow: 0 4px 0 rgba(43,45,66,.10); font-size: 22px; display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(43,45,66,.10); }
.chip-stat {
  display: inline-flex; align-items: center; gap: 4px; background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-weight: 800; font-family: 'Baloo 2'; font-size: 18px; box-shadow: 0 3px 0 rgba(43,45,66,.08);
}

/* ---------- buttons ---------- */
.btn {
  --c: var(--orange); --cd: var(--orange-d);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 18px; padding: 14px 20px; min-height: 54px;
  background: var(--c); color: #fff; font-family: 'Baloo 2'; font-weight: 800; font-size: 19px;
  box-shadow: 0 5px 0 var(--cd); cursor: pointer; text-decoration: none; user-select: none;
  transition: transform .06s, box-shadow .06s, filter .2s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--cd); }
.btn[disabled] { filter: grayscale(.7) opacity(.6); pointer-events: none; }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 66px; font-size: 22px; border-radius: 22px; }
.btn.teal { --c: var(--teal); --cd: var(--teal-d); }
.btn.purple { --c: var(--purple); --cd: var(--purple-d); }
.btn.pink { --c: var(--pink); --cd: var(--pink-d); }
.btn.green { --c: var(--green); --cd: var(--green-d); }
.btn.red { --c: var(--red); --cd: var(--red-d); }
.btn.blue { --c: var(--blue); --cd: var(--blue-d); }
.btn.ghost { --c: #fff; --cd: #E9DFC9; color: var(--ink); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: 16px; border-radius: 14px; box-shadow: 0 3px 0 var(--cd); }
.btn.small:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--cd); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > .grow { flex: 1; }
.stack { display: grid; gap: 14px; }
.stack.tight { gap: 8px; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt2 { margin-top: 28px; } .mb { margin-bottom: 16px; }
.muted { color: var(--muted); }
.small-t { font-size: 14px; }
.ink2 { color: var(--ink-2); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.tap { cursor: pointer; transition: transform .08s; }
.card.tap:active { transform: scale(.98); }
.card.flat { box-shadow: none; border: 2px solid var(--line); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 12px; }
.section-title h3 { font-size: 20px; }

/* ---------- mascot ---------- */
.mascot-wrap { display: flex; align-items: flex-end; gap: 10px; }
.mascot { width: 92px; height: 92px; flex: none; }
.mascot.lg { width: 150px; height: 150px; }
.mascot.bob { animation: bob 2.4s ease-in-out infinite; }
.bubble {
  position: relative; background: #fff; border-radius: 20px; padding: 12px 16px; box-shadow: var(--shadow);
  font-weight: 700; margin-bottom: 18px;
}
.bubble::after { content: ''; position: absolute; left: -9px; bottom: 16px; border: 10px solid transparent; border-right-color: #fff; border-left: 0; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.owl-eye { transform-origin: center; transform-box: fill-box; animation: blink 4s infinite; }

/* ---------- login ---------- */
.hero { text-align: center; padding-top: 6vh; }
.hero h1 { font-size: 36px; margin-top: 8px; }
.hero h1 span { color: var(--orange); }
.hero .sub { color: var(--ink-2); margin: 10px auto 26px; max-width: 360px; font-weight: 600; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 26px 0; text-align: left; }
.feature { background: #fff; border-radius: 18px; padding: 12px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); }
.feature b { display: block; font-size: 26px; }
#gsi-btn { display: flex; justify-content: center; min-height: 48px; }
/* cac cach dang nhap: cung be rong, xep doc */
.login-opts { max-width: 380px; margin: 0 auto; display: grid; gap: 14px; }
.login-opts > * { margin: 0 !important; max-width: none !important; }
.login-opts > #zalo-in:empty { display: none; }
.zl-card { text-align: left; padding: 16px 18px; display: grid; gap: 12px; }
.zl-head { display: flex; align-items: center; gap: 12px; }
.zl-head b { display: block; font-family: 'Baloo 2'; font-weight: 800; font-size: 20px; line-height: 1.2; }
.zl-head .small-t { display: block; line-height: 1.35; }
.zl-logo { flex: none; width: 44px; height: 44px; border-radius: 12px; background: #0068FF; color: #fff; font: 800 13px/44px 'Nunito', sans-serif; text-align: center; letter-spacing: -.2px; }
.zl-steps { margin: 0; padding: 0; list-style: none; counter-reset: zl; display: grid; gap: 8px; font-size: 15px; }
.zl-steps li { counter-increment: zl; position: relative; padding-left: 32px; line-height: 1.45; }
.zl-steps li::before { content: counter(zl); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: #E6F0FF; color: #0068FF; font-weight: 800; font-size: 13px; line-height: 22px; text-align: center; }
.zl-kw { display: inline-block; padding: 0 8px; border-radius: 8px; background: #FFF1D6; border: 1px dashed var(--orange); font-weight: 800; }
.zl-foot { margin: 0; }
.btn.zalo { --c: #0068FF; --cd: #0050C4; }

/* ---------- profile picker ---------- */
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; margin-top: 18px; }
.profile-card { text-align: center; cursor: pointer; padding: 18px 10px; }
.profile-card .ava {
  width: 96px; height: 96px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; font-size: 54px;
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.12);
}
.profile-card .nm { font-family: 'Baloo 2'; font-weight: 800; font-size: 21px; }
.profile-card.add .ava { background: #fff; border: 3px dashed var(--muted); box-shadow: none; color: var(--muted); font-size: 40px; }
.ava-sm { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
/* trang chu: bam hinh be = doi be (huy hieu 🔄 goc duoi) */
.ava-switch { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.ava-switch:active .ava-sm { transform: scale(.94); }
.ava-swap { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 12px; line-height: 1; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.pick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.pick-grid button {
  aspect-ratio: 1; border: 3px solid transparent; border-radius: 16px; background: #fff; font-size: 30px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(43,45,66,.08);
}
.pick-grid button.on { border-color: var(--orange); background: #FFF1DA; transform: scale(1.06); }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #fff; cursor: pointer; box-shadow: 0 0 0 2px var(--line); }
.colors button.on { box-shadow: 0 0 0 3px var(--ink); }
.books { display: grid; gap: 10px; }
.book-opt {
  display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 18px; border: 3px solid var(--line);
  background: #fff; cursor: pointer; width: 100%;
}
.book-opt .cv { font-size: 30px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #FFF1DA; flex: none; }
.book-opt b { display: block; font-family: 'Baloo 2'; font-size: 17px; }
.book-opt small { color: var(--muted); }
.book-opt.on { border-color: var(--teal); background: #E9FBF8; }

/* ---------- inputs ---------- */
label.lbl { display: block; font-weight: 800; margin: 0 0 8px 4px; font-family: 'Baloo 2'; font-size: 18px; }
.inp, textarea.inp, select.inp {
  width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 12px 14px; font: inherit; font-size: 18px; background: #fff;
  outline: none; color: var(--ink);
}
.inp:focus { border-color: var(--blue); }
textarea.inp { min-height: 86px; resize: vertical; }

/* ---------- home ---------- */
.hello { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.tile {
  position: relative; border: 0; border-radius: 24px; padding: 18px 14px 16px; min-height: 128px; color: #fff; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; justify-content: space-between; box-shadow: 0 6px 0 var(--cd); background: var(--c);
  --c: var(--orange); --cd: var(--orange-d); overflow: hidden;
}
.tile:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--cd); }
.tile .em { font-size: 40px; line-height: 1; }
.tile b { font-family: 'Baloo 2'; font-size: 21px; font-weight: 800; line-height: 1.1; }
.tile small { display: block; opacity: .9; font-weight: 700; font-size: 14px; }
.tile.wide { grid-column: span 2; min-height: 112px; flex-direction: row; align-items: center; gap: 14px; justify-content: flex-start; }
.tile.wide .em { font-size: 52px; }
.tile::after { content: ''; position: absolute; right: -24px; top: -24px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.14); }
.tile .badge { position: absolute; top: 10px; right: 10px; background: #fff; color: var(--red); border-radius: 999px; min-width: 30px; padding: 2px 9px; font-weight: 900; font-family: 'Baloo 2'; font-size: 17px; text-align: center; z-index: 1; }
.t-teal { --c: var(--teal); --cd: var(--teal-d); }
.t-purple { --c: var(--purple); --cd: var(--purple-d); }
.t-pink { --c: var(--pink); --cd: var(--pink-d); }
.t-blue { --c: var(--blue); --cd: var(--blue-d); }
.t-green { --c: var(--green); --cd: var(--green-d); }

.hscroll { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.hscroll::-webkit-scrollbar { display: none; }
.thumb-card { flex: none; width: 150px; scroll-snap-align: start; padding: 0; overflow: hidden; }
.thumb-card .ph { height: 110px; background: #EEE center/cover no-repeat; }
.thumb-card .tx { padding: 10px 12px; font-weight: 800; font-size: 14px; line-height: 1.25; }
.status-pill { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #FFF1DA; color: var(--orange-d); }
.status-pill.ok { background: #E3F7EC; color: var(--green-d); }
.status-pill.bad { background: #FDE5EB; color: var(--red-d); }

.banner { display: flex; gap: 12px; align-items: center; border-radius: 20px; padding: 14px 16px; background: #EAF2FF; font-weight: 700; }
.banner.warn { background: #FFF1DA; }
.banner.ok { background: #E3F7EC; }
.banner .em { font-size: 28px; }

/* ---------- waiting ---------- */
.waiting { text-align: center; padding-top: 8vh; }
.waiting h2 { margin-top: 10px; }
.dots span { display: inline-block; width: 12px; height: 12px; margin: 0 4px; border-radius: 50%; background: var(--orange); animation: dot 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; background: var(--teal); }
.dots span:nth-child(3) { animation-delay: .3s; background: var(--purple); }
@keyframes dot { 0%, 80%, 100% { transform: scale(.5); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.fact { margin-top: 24px; background: #fff; border-radius: 20px; padding: 16px; box-shadow: var(--shadow); font-weight: 600; text-align: left; }
.fact b { color: var(--purple); }
.progress { height: 14px; background: #fff; border-radius: 999px; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0,0,0,.06); }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--yellow), var(--orange)); border-radius: 999px; transition: width .4s; }

/* ---------- exercise ---------- */
.ex-head { background: linear-gradient(135deg, #8B5CF6, #3A86FF); color: #fff; border-radius: var(--radius); padding: 18px; box-shadow: 0 6px 0 #5B3FC4; }
.ex-head .ins { font-family: 'Baloo 2'; font-size: 20px; font-weight: 700; line-height: 1.25; }
.ex-head .vi { margin-top: 8px; opacity: .92; font-weight: 600; font-size: 15px; }
.passage { background: #FFFBF0; border: 2px dashed #F3D9A4; border-radius: 18px; padding: 14px 16px; white-space: pre-wrap; font-size: 16px; }
.item { padding: 16px; }
.item .q { display: flex; gap: 10px; align-items: flex-start; }
.qno { flex: none; width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; background: var(--yellow); font-family: 'Baloo 2'; font-weight: 800; }
.q .txt { flex: 1; font-size: 18px; font-weight: 600; padding-top: 3px; white-space: pre-wrap; }
.speak { border: 0; background: #EAF2FF; border-radius: 12px; width: 36px; height: 36px; font-size: 18px; cursor: pointer; flex: none; }
.opts { display: grid; gap: 8px; margin-top: 12px; }
.opts.two { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; gap: 10px; align-items: center; text-align: left; border: 3px solid var(--line); border-radius: 16px; background: #fff;
  padding: 10px 12px; font-weight: 700; font-size: 17px; cursor: pointer; min-height: 52px;
}
.opt .l { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: #F4EEE2; font-family: 'Baloo 2'; font-weight: 800; }
.opt.on { border-color: var(--blue); background: #EAF2FF; }
.opt.on .l { background: var(--blue); color: #fff; }
.item .ans { margin-top: 12px; }
.hint-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.hint-btn { border: 0; background: #FFF1DA; color: var(--orange-d); border-radius: 999px; padding: 6px 14px; font-weight: 800; cursor: pointer; font-size: 15px; }
.hints { display: grid; gap: 8px; margin-top: 10px; }
.hint { background: #FFFBEA; border-left: 5px solid var(--yellow); border-radius: 12px; padding: 10px 12px; font-size: 15px; font-weight: 600; animation: pop .25s; }
.hint .lv { font-size: 12px; font-weight: 900; color: var(--orange-d); text-transform: uppercase; letter-spacing: .5px; }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(rgba(255,247,230,0), var(--bg) 30%);
}
.sticky-actions .inner { max-width: 640px; margin: 0 auto; display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.sticky-actions .inner.one { grid-template-columns: 1fr; }

/* ---------- result ---------- */
.score-hero { text-align: center; padding: 24px 16px; border-radius: 28px; color: #fff; background: linear-gradient(135deg, var(--teal), var(--green)); box-shadow: 0 6px 0 var(--green-d); }
.score-hero.mid { background: linear-gradient(135deg, var(--yellow), var(--orange)); box-shadow: 0 6px 0 var(--orange-d); }
.score-hero.low { background: linear-gradient(135deg, var(--pink), var(--purple)); box-shadow: 0 6px 0 var(--purple-d); }
.score-hero .num { font-family: 'Baloo 2'; font-size: 64px; font-weight: 800; line-height: 1; }
.score-hero .stars { font-size: 34px; letter-spacing: 4px; margin: 6px 0; }
.score-hero .stars span { display: inline-block; animation: starIn .5s both; }
.score-hero .stars span:nth-child(2) { animation-delay: .2s; }
.score-hero .stars span:nth-child(3) { animation-delay: .4s; }
.score-hero .stars .off { filter: grayscale(1) opacity(.35); }
@keyframes starIn { from { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3); } to { transform: scale(1); } }
.res-item { padding: 14px 16px; border-left: 8px solid var(--green); }
.res-item.bad { border-left-color: var(--red); }
.res-item.unk { border-left-color: var(--muted); }
.res-item .line { margin-top: 6px; font-size: 16px; }
.res-item .you { color: var(--red-d); font-weight: 800; text-decoration: line-through; text-decoration-thickness: 2px; }
.res-item .you.okk { color: var(--green-d); text-decoration: none; }
.res-item .exp { color: var(--green-d); font-weight: 800; }
.res-item .why { margin-top: 8px; background: #F7F3FF; border-radius: 12px; padding: 10px 12px; font-size: 15px; font-weight: 600; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #F1ECFF; color: var(--purple-d); }

/* ---------- history ---------- */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; border: 0; border-radius: 999px; padding: 8px 14px; background: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 3px 0 rgba(43,45,66,.08); font-size: 15px; }
.fchip.on { background: var(--ink); color: #fff; }
.day-h { font-family: 'Baloo 2'; font-weight: 800; color: var(--ink-2); margin: 18px 4px 8px; }
.hist { display: flex; gap: 12px; align-items: center; padding: 10px; }
.hist .ph { width: 64px; height: 64px; border-radius: 14px; background: #EEE center/cover no-repeat; flex: none; display: grid; place-items: center; font-size: 28px; }
.hist .tx { flex: 1; min-width: 0; }
.hist .tx b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-badge { flex: none; min-width: 58px; text-align: center; border-radius: 14px; padding: 6px 8px; font-family: 'Baloo 2'; font-weight: 800; font-size: 18px; color: #fff; background: var(--green); }
.score-badge.mid { background: var(--orange); }
.score-badge.low { background: var(--red); }
.score-badge.wait { background: var(--muted); font-size: 14px; }

/* ---------- review ---------- */
.flash { min-height: 240px; display: flex; flex-direction: column; justify-content: center; }
.box-dots { display: inline-flex; gap: 4px; }
.box-dots i { width: 10px; height: 10px; border-radius: 50%; background: #E6DCC8; }
.box-dots i.on { background: var(--green); }
.feedback { border-radius: 18px; padding: 14px 16px; font-weight: 700; animation: pop .25s; }
.feedback.ok { background: #E3F7EC; color: var(--green-d); }
.feedback.no { background: #FDE5EB; color: var(--red-d); }

/* ---------- stats ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: #fff; border-radius: 18px; padding: 12px; text-align: center; box-shadow: var(--shadow); }
.kpi b { display: block; font-family: 'Baloo 2'; font-size: 28px; font-weight: 800; line-height: 1.1; }
.kpi small { color: var(--ink-2); font-weight: 700; font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.bars .b i { display: block; width: 100%; max-width: 26px; border-radius: 8px 8px 4px 4px; background: var(--teal); min-height: 4px; }
.bars .b i.empty { background: #EFE7D6; }
.bars .b small { font-size: 11px; color: var(--muted); font-weight: 700; }
.tagbar { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-weight: 700; font-size: 15px; }
.tagbar .nm { width: 46%; flex: none; }
.tagbar .tr { flex: 1; height: 12px; background: #F2EBDD; border-radius: 999px; overflow: hidden; }
.tagbar .tr i { display: block; height: 100%; background: var(--pink); border-radius: 999px; }

/* ---------- parent ---------- */
.tabs { display: flex; gap: 6px; background: #fff; padding: 6px; border-radius: 18px; box-shadow: var(--shadow); overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; border-radius: 13px; padding: 10px 8px; font-weight: 800; cursor: pointer; white-space: nowrap; font-size: 15px; }
.tabs button.on { background: var(--ink); color: #fff; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days button { width: 44px; height: 44px; border-radius: 14px; border: 3px solid var(--line); background: #fff; font-weight: 800; cursor: pointer; }
.days button.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #DDD3BF; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 24px; height: 24px; left: 4px; top: 4px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(24px); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 2px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.kbd-pin { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 280px; margin: 16px auto 0; }
.kbd-pin button { height: 62px; border: 0; border-radius: 18px; background: #fff; font-family: 'Baloo 2'; font-size: 26px; font-weight: 800; box-shadow: 0 4px 0 rgba(43,45,66,.1); cursor: pointer; }
.kbd-pin button:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(43,45,66,.1); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-top: 16px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }

/* ---------- misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 700; max-width: calc(100% - 32px);
  transition: .25s; pointer-events: none; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.modal-bg { position: fixed; inset: 0; background: rgba(43,45,66,.45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.modal { background: var(--bg); width: 100%; max-width: 640px; border-radius: 28px 28px 0 0; padding: 22px 16px calc(22px + var(--safe-b)); max-height: 92vh; overflow-y: auto; animation: up .25s; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(60px); } }
.zoom-img { width: 100%; border-radius: 18px; background: #fff; }
.empty { text-align: center; padding: 30px 10px; color: var(--ink-2); font-weight: 700; }
.empty .em { font-size: 54px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.spin { display: inline-block; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.json-edit { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 300px; }
.answer-key { background: #E9FBF8; border-radius: 12px; padding: 8px 12px; margin-top: 10px; font-size: 15px; font-weight: 700; color: var(--teal-d); }
@media (min-width: 560px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tile.wide { grid-column: span 4; }
}
@media print {
  body { background: #fff; }
  .topbar, .sticky-actions, .noprint, .hint-row, .speak { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .ex-head { background: none; color: #000; box-shadow: none; border: 2px solid #000; }
  #app { padding-bottom: 0; }
  .print-line { display: block !important; border-bottom: 1px dotted #888; height: 28px; margin-top: 8px; }
}
.print-line { display: none; }

/* ---------- huong dan bang hinh ---------- */
.guide { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 12px; margin-top: 12px; }
.guide::-webkit-scrollbar { display: none; }
.g-step { flex: 0 0 72%; max-width: 230px; scroll-snap-align: center; background: #fff; border-radius: 20px; padding: 14px 12px; box-shadow: var(--shadow); position: relative; text-align: center; }
.g-num { position: absolute; top: 10px; left: 10px; width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff; font-family: 'Baloo 2'; font-weight: 800; display: grid; place-items: center; z-index: 1; }
.g-phone { width: 100%; max-width: 150px; height: auto; display: block; margin: 0 auto; }
.g-cap { margin-top: 10px; font-weight: 800; font-size: 15px; line-height: 1.3; }
.g-pulse { animation: gpulse 1.4s ease-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes gpulse { 0% { opacity: 1; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.5); } }
.g-hand { animation: ghand 1.4s ease-in-out infinite; }
@keyframes ghand { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.stack > *, .guide { min-width: 0; max-width: 100%; }

/* ---------- nhieu anh ---------- */
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shot { position: relative; aspect-ratio: 3/4; border-radius: 16px; overflow: hidden; background: #fff; box-shadow: var(--shadow); border: 0; padding: 0; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.shot .no { position: absolute; left: 6px; top: 6px; background: var(--ink); color: #fff; border-radius: 10px; min-width: 24px; height: 24px; display: grid; place-items: center; font-weight: 900; font-size: 13px; padding: 0 6px; }
.shot .rm, .shot .rt { position: absolute; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); font-size: 15px; font-weight: 900; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.shot .rm { right: 6px; top: 6px; color: var(--red-d); }
.shot .rt { right: 6px; bottom: 6px; }
.shot.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 34px; color: var(--orange-d); border: 3px dashed #F3D9A4; background: #FFFBF0; box-shadow: none; cursor: pointer; font-family: 'Baloo 2'; font-weight: 800; }
.shot.add small { font-size: 14px; }
.img-count { position: absolute; right: 10px; bottom: 10px; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; }
.evidence { margin-top: 8px; background: #EAF7FF; border-left: 5px solid var(--blue); border-radius: 12px; padding: 8px 12px; font-size: 15px; }
.evidence b { font-size: 13px; color: var(--blue-d); }
.evidence .q-en { margin-top: 4px; font-style: italic; font-weight: 600; color: var(--ink); }
.fix3 { display: grid; gap: 6px; margin-top: 8px; }
.fix3 .evidence { margin-top: 0; }
.ev-vi { background: #FFF6E0; border-left: 5px solid var(--orange); border-radius: 12px; padding: 8px 12px; font-size: 15px; font-weight: 600; }
.ev-vi b, .fix3 .why b { display: block; font-size: 13px; margin-bottom: 2px; }
.ev-vi b { color: var(--orange-d); }
.fix3 .why { margin-top: 0; border-left: 5px solid var(--purple); }
.fix3 .why b { color: var(--purple-d); }

/* ---------- thong bao trong app ---------- */
#nt-box { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); left: 0; right: 0; z-index: 150; display: grid; gap: 8px; justify-items: center; pointer-events: none; padding: 0 12px; }
.nt-card { pointer-events: auto; width: 100%; max-width: 560px; display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 18px; padding: 12px 12px 12px 14px;
  box-shadow: 0 10px 30px rgba(43,45,66,.22), 0 0 0 3px var(--green); cursor: pointer; transform: translateY(-120%); opacity: 0; transition: transform .35s cubic-bezier(.2,1.4,.4,1), opacity .25s; }
.nt-card.show { transform: translateY(0); opacity: 1; }
.nt-card.warn { box-shadow: 0 10px 30px rgba(43,45,66,.22), 0 0 0 3px var(--orange); }
.nt-card b { font-family: 'Baloo 2'; font-size: 17px; display: block; line-height: 1.2; }
.nt-ic { font-size: 30px; animation: ntwig 1s ease-in-out 2; }
.nt-go { font-weight: 900; color: var(--green-d); white-space: nowrap; }
.nt-card.warn .nt-go { color: var(--orange-d); }
.nt-x { border: 0; background: #F2EBDD; border-radius: 50%; width: 28px; height: 28px; cursor: pointer; flex: none; }
@keyframes ntwig { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-15deg); } 75% { transform: rotate(15deg); } }

/* ================= Nhieu mon (Anh / Toan / Tieng Viet) + lop ================= */
.subj-tabs { display: flex; gap: 8px; margin: 2px 0 10px; }
.subj-tab { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 3px solid transparent; border-radius: 18px;
  background: #fff; padding: 8px 4px; font-family: 'Baloo 2'; font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 rgba(43,45,66,.08); }
.subj-tab .si { font-size: 24px; line-height: 1; }
.subj-tab .sb { position: absolute; top: -6px; right: -4px; background: var(--red); color: #fff; border-radius: 999px; min-width: 22px; padding: 0 6px; font-size: 13px; }
.subj-tab.on.s-en { border-color: var(--orange); background: #FFF1DA; }
.subj-tab.on.s-math { border-color: var(--blue); background: #EAF2FF; }
.subj-tab.on.s-vi { border-color: var(--purple); background: #F1ECFF; }
.grade-chip { margin-left: 8px; font-size: 13px; font-weight: 800; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 9px; vertical-align: middle; }
.s-math-tile { --c: var(--blue); --cd: var(--blue-d); }
.s-vi-tile { --c: var(--purple); --cd: var(--purple-d); }
body[data-subj="math"] .ex-head { background: linear-gradient(135deg, #3A86FF, #2EC4B6); box-shadow: 0 6px 0 #1F66D6; }
body[data-subj="vi"] .ex-head { background: linear-gradient(135deg, #8B5CF6, #F15BB5); box-shadow: 0 6px 0 #6D3FE0; }
/* Lop 1-2: chu to, nut doc to */
body[data-band="g12"] { font-size: 19px; }
body[data-band="g12"] .q .txt { font-size: 21px; }
body[data-band="g12"] .speak { width: 46px; height: 46px; font-size: 24px; }
body[data-band="g12"] .opt { min-height: 60px; font-size: 20px; }
/* Toan: cong thuc + hinh cat tu anh */
.katex { font-size: 1.08em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
canvas.fig { display: block; max-width: 100%; margin: 10px auto 0; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: zoom-in; }
.msteps { background: #F7F9FF; border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; }
.mstep { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 10px; background: #fff; }
.mstep .sn { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; color: #fff; background: var(--green); }
.mstep.bad .sn { background: var(--red); }
.mstep.first { outline: 3px solid var(--red); }
.mstep .sc { margin-top: 3px; font-size: 14px; font-weight: 700; color: var(--red-d); }
/* gop y 23/10: buoc sai gach + buoc dung (PA2); cau tra loi dai gach dung tu sai (diff.js, PA3) */
.mstep .sw s { color: var(--red-d); text-decoration-thickness: 2px; }
.mstep .sfix { margin-top: 3px; color: var(--green-d); font-weight: 800; }
.adiff .adl { margin-top: 4px; line-height: 1.7; font-size: 17px; }
.adiff .adl.ok { color: var(--green-d); }
.adiff s.dw { color: var(--red-d); text-decoration-thickness: 2px; }
.adiff b.di, .line b.di { color: var(--green-d); background: #E3F8EC; border-radius: 6px; padding: 0 4px; }
.adiff .dq { text-decoration: underline dotted var(--red); }
/* Tieng Viet: chinh ta, thang diem tap lam van, sua tung cau */
.spell { background: #FFF6E0; border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; }
.spell .sp s { color: var(--red-d); }
.spell .sp b { color: var(--green-d); }
.rubric { background: #F1ECFF; border-radius: 16px; padding: 12px 14px; }
.rubric .rcrit { margin-top: 8px; font-weight: 700; font-size: 15px; }
.rubric .rtr { height: 10px; background: #fff; border-radius: 999px; overflow: hidden; margin: 4px 0 2px; }
.rubric .rtr i { display: block; height: 100%; background: var(--purple); border-radius: 999px; }
.rubric ul { margin: 4px 0 0; padding-left: 20px; font-size: 15px; font-weight: 600; }
.edits { display: grid; gap: 8px; }
.edits .ed { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: 15px; }
.edits .ed s { color: var(--red-d); }
.edits .ed .better { color: var(--green-d); font-weight: 800; margin-top: 2px; }

/* ================= Trang tong cua be + phong hoc tung mon ================= */
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.door { position: relative; border: 0; border-radius: 22px; padding: 16px 6px 12px; color: #fff; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 132px; justify-content: center; box-shadow: 0 6px 0 var(--dd); background: var(--dc); }
.door:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--dd); }
.door .dic { font-size: 42px; line-height: 1; }
.door b { font-family: 'Baloo 2'; font-size: 19px; font-weight: 800; line-height: 1.1; }
.door small { font-size: 12.5px; font-weight: 700; opacity: .95; line-height: 1.2; }
.door .badge { position: absolute; top: 8px; right: 8px; background: #fff; color: var(--red); border-radius: 999px; min-width: 24px; padding: 0 7px; font-weight: 900; font-family: 'Baloo 2'; }
.door-en { --dc: var(--orange); --dd: var(--orange-d); }
.door-math { --dc: var(--blue); --dd: var(--blue-d); }
.door-vi { --dc: var(--purple); --dd: var(--purple-d); }
body[data-band="g12"] .door { min-height: 150px; }
body[data-band="g12"] .door .dic { font-size: 52px; }
.mascot-wrap { position: relative; }
.owl-prop { position: absolute; left: 62px; top: 52px; font-size: 30px; transform: rotate(-12deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
/* Nhan mon tren thanh tieu de cua moi trang ben trong */
.subj-chip { display: inline-block; font-size: 13px; font-weight: 800; color: #fff; border-radius: 999px; padding: 2px 10px; margin-right: 8px; vertical-align: middle; }
.subj-chip-en { background: var(--orange); } .subj-chip-math { background: var(--blue); } .subj-chip-vi { background: var(--purple); }
/* Nen rieng tung phong: Anh = cham + ABC, Toan = giay o li, Van = giay ke dong */
body[data-subj="en"] { background-color: #FFF4E2; background-image: radial-gradient(rgba(255,159,28,.16) 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="math"] { background-color: #F1F6FF;
  background-image: linear-gradient(rgba(58,134,255,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(58,134,255,.13) 1px, transparent 1px);
  background-size: 20px 20px; }
body[data-subj="vi"] { background-color: #F8F3FF;
  background-image: linear-gradient(transparent 30px, rgba(139,92,246,.16) 31px, transparent 32px), linear-gradient(90deg, transparent 38px, rgba(241,91,181,.28) 39px, transparent 40px);
  background-size: 100% 32px, 100% 100%; }
body[data-subj="math"] .topbar { background: linear-gradient(#F1F6FF 75%, rgba(241,246,255,0)); }
body[data-subj="vi"] .topbar { background: linear-gradient(#F8F3FF 75%, rgba(248,243,255,0)); }
body[data-subj="en"] .topbar { background: linear-gradient(#FFF4E2 75%, rgba(255,244,226,0)); }
/* Lich su: vach mau theo mon */
.hist { border-left: 6px solid var(--orange); }
.hist.hist-math { border-left-color: var(--blue); }
.hist.hist-vi { border-left-color: var(--purple); }

/* Phan hoi ngay khi cham (dien thoai): nut lun xuong, khong cho tre 300ms, thanh chay khi cho may chu */
button, a, .tap, .tile, .door, .card[onclick] { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tile:active, .door:active, .tap:active, .card[onclick]:active { transform: scale(.96); filter: brightness(.95); transition: transform .06s; }
.profile-card.picked { transform: scale(.96); outline: 4px solid var(--blue, #3b82f6); }
#busy-bar { position: fixed; top: 0; left: 0; height: 4px; width: 100%; z-index: 9999; pointer-events: none; opacity: 0; transition: opacity .15s;
  background: linear-gradient(90deg, transparent, var(--blue, #3b82f6), var(--orange, #f59e0b), transparent); background-size: 50% 100%; background-repeat: no-repeat; }
#busy-bar.on { opacity: 1; animation: busy-run 1s linear infinite; }
@keyframes busy-run { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* Khu bo me: The "Hom nay cua cac con" */
.pt-card { border: 3px solid var(--line); }
.pt-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: 16px; background: #F7F4EC; }
.pt-row.on { background: #E9F9EF; }
.pt-row .ava-sm { width: 40px; height: 40px; font-size: 22px; flex: none; }
.pt-row .icon-btn { width: 36px; height: 36px; font-size: 20px; flex: none; }

/* Thanh % thoi gian cho (etaHtml) */
.eta { max-width: 340px; margin-left: auto; margin-right: auto; }
.waiting .eta, .card .eta { text-align: center; }
.eta .progress > i { transition: width .5s linear; }
.eta-t { margin-top: 6px; color: var(--ink2, #5c5f7a); }

/* Dang nhap bang email + mat khau */
.pw-login { text-align: left; max-width: 360px; margin-left: auto; margin-right: auto; }
.pw-login summary { cursor: pointer; font-weight: 800; }
.check-tile { --c: var(--green); --cd: var(--green-d); }   /* o "Cham bai" trong phong mon */

/* ===== Góp ý ver2 (21/10/2026) ===== */
/* Tooltip hướng dẫn (coach() trong app.js) */
.coach-bg { position: fixed; inset: 0; z-index: 95; cursor: pointer; animation: fade .2s; }
.coach-ring { position: fixed; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(43,45,66,.55), 0 0 0 4px var(--yellow); pointer-events: none; transition: all .15s; }
.coach-ring::after { content: ''; position: absolute; inset: -6px; border-radius: 22px; border: 3px solid var(--yellow); animation: coachPulse 1.4s ease-out infinite; }
@keyframes coachPulse { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.08); } }
.coach-tip { position: fixed; background: #fff; border-radius: 18px; padding: 14px 16px 12px; font-weight: 700; font-size: 16px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,.25); cursor: default; }
.coach-tip::before { content: ''; position: absolute; left: calc(var(--cx, 50%) - 10px); top: -9px; border: 10px solid transparent; border-bottom-color: #fff; border-top: 0; }
.coach-tip.up::before { top: auto; bottom: -9px; border-bottom: 0; border-top: 10px solid #fff; }
.coach-owl { font-size: 26px; line-height: 1; }
.coach-ok { text-align: right; margin-top: 8px; }

/* Trang chủ: icon môn nét mảnh + tên tiếng Anh + dấu đã học hôm nay */
.door .dic { display: grid; place-items: center; height: 46px; }
.door .dic svg { width: 44px; height: 44px; }
body[data-band="g12"] .door .dic svg { width: 54px; height: 54px; }
.door small { letter-spacing: .3px; opacity: .9; }
.door-done { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.95); color: var(--green-d); font-weight: 900; display: grid; place-items: center; font-size: 14px; }

/* Phòng môn: 4 bước chính xếp dọc */
.rsteps { display: grid; gap: 10px; }
.rstep { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 20px; padding: 14px 14px; cursor: pointer; font: inherit; color: #fff;
  background: var(--c, var(--orange)); box-shadow: 0 5px 0 var(--cd, var(--orange-d)); }
.rstep[data-step="1"] { --c: var(--orange); --cd: var(--orange-d); }
.rstep[data-step="2"] { --c: var(--blue); --cd: var(--blue-d); }
.rstep[data-step="3"] { --c: var(--green); --cd: var(--green-d); }
.rstep[data-step="4"] { --c: var(--teal); --cd: var(--teal-d); }
.rstep b { display: block; font-family: 'Baloo 2'; font-size: 20px; font-weight: 800; line-height: 1.15; }
.rstep small { display: block; font-size: 14px; font-weight: 700; opacity: .95; line-height: 1.35; }
.rstep .rs-no { flex: none; width: 30px; height: 30px; border-radius: 50%; background: rgba(255,255,255,.25); display: grid; place-items: center; font-weight: 900; }
.rstep .rs-em { flex: none; font-size: 34px; line-height: 1; }
.rstep .rs-go { flex: none; display: grid; place-items: center; font-size: 26px; font-weight: 900; opacity: .9; }
.rstep.cur { outline: 4px solid var(--yellow); outline-offset: 2px; }
.rstep.done .rs-no { background: #fff; color: var(--cd); }
.rstep.off { background: #ECE6D8; color: #A7A291; box-shadow: 0 5px 0 #DDD5C2; cursor: not-allowed; }
.rstep.off .rs-em { filter: grayscale(1); opacity: .5; }
.rstep.off .rs-no { background: #fff; }
.rstep.off .rs-go { font-size: 18px; }
/* ô phụ cuối phòng: nhỏ, màu nhạt */
.tiles.mini { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles.mini .tile { min-height: 0; padding: 10px 6px; border-radius: 16px; align-items: center; text-align: center; gap: 4px; color: var(--cd);
  background: #fff; box-shadow: 0 3px 0 var(--line);
  background: color-mix(in srgb, var(--c) 14%, #fff); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 28%, #fff); }
.tiles.mini .tile::after { display: none; }
.tiles.mini .tile .em { font-size: 24px; }
.tiles.mini .tile b { font-family: 'Nunito', sans-serif; font-size: 13.5px; font-weight: 800; line-height: 1.2; }
@media (min-width: 700px) { .tiles.mini { grid-template-columns: repeat(4, 1fr); } }

/* Chụp đề: nút xếp dọc + cảnh báo chất lượng ảnh */
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 800; font-size: 14px; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 2px; background: var(--line); }
.shot.q-bad { outline: 3px solid var(--orange); }
.shot .q-warn { position: absolute; left: 6px; bottom: 6px; background: #FFF1DA; border-radius: 10px; padding: 1px 6px; font-size: 15px; }
.q-banner { align-items: flex-start; }
.q-banner .row + .row { margin-top: 6px; }

/* Hiểu đề: 2 bong bóng (đã nhận đề → tóm tắt), nghĩa từng lựa chọn, mục gập */
.bubbles { flex: 1; display: grid; gap: 8px; min-width: 0; margin-bottom: 18px; }
.bubbles .bubble { margin-bottom: 0; }
.bubbles .bubble:not(:last-child)::after { display: none; }
.bubbles .bubble.b2 { animation: bubbleIn .35s .9s both; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.opt-vi { color: var(--ink-2); font-weight: 600; font-size: 15px; }
.line-vi.q-vi { margin: 4px 0 2px; }
.more-sec summary { cursor: pointer; }
.more-sec .list-row:last-child { border-bottom: 0; }
.peek { background: #F7F3FF; border-radius: 12px; padding: 10px 12px; }

/* Chọn thời gian: gợi ý đang chọn viền xanh, ô tự chọn nổi màu */
.sug-card.picked { box-shadow: 0 0 0 3px var(--green), var(--shadow); }
.own-time { background: #FFF4D6; border: 2px solid var(--yellow); }
.own-time summary { color: var(--orange-d); }
.q-banner .btn { flex: none; white-space: nowrap; }
.rstep small b { display: inline; font-family: inherit; font-size: inherit; font-weight: 900; }

/* ===== v0.14 "Chấm và chữa" ===== */
.cc-card { background: var(--green); color: #fff; border-radius: 26px; padding: 20px 18px 18px; box-shadow: 0 6px 0 var(--green-d); display: grid; gap: 14px; }
.cc-head { display: flex; align-items: center; gap: 12px; }
.cc-head b { font-family: 'Baloo 2'; font-weight: 800; font-size: 27px; line-height: 1.05; }
.cc-ic { width: 58px; height: 58px; flex: none; border-radius: 18px; background: rgba(255,255,255,.2); display: grid; place-items: center; }
.cc-btn { border: 0; cursor: pointer; background: #fff; color: #1F6B43; border-radius: 16px; padding: 14px; min-height: 54px; font-family: 'Baloo 2'; font-weight: 800; font-size: 20px; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.cc-btn:active { transform: translateY(3px); box-shadow: none; }
.guide-card b { font-family: 'Baloo 2'; font-weight: 800; font-size: 18px; line-height: 1.25; display: block; }
.guide-btn { --c: #FFF1DA; --cd: #F3D9A4; color: #8A4B00; }
.subj-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.subj-go, .subj-pick { position: relative; border: 3px solid transparent; cursor: pointer; border-radius: 16px; padding: 14px 6px; font: inherit; font-weight: 800; font-size: 15px; min-height: 52px; }
.subj-go .badge { position: absolute; top: -6px; right: -4px; background: var(--red); color: #fff; border-radius: 999px; min-width: 22px; padding: 0 6px; font-size: 13px; }
.subj-go .door-done { top: -6px; left: -4px; }
/* nen dam hon + vien cung mau de noi tren nen kem (#FFF7E6); chu dat >= 4.5:1 */
.subj-go-en { background: #FFDFA8; border-color: #BA730C; color: #6E3A00; box-shadow: 0 3px 0 #BA730C; }
.subj-go-math { background: #CFE1FF; border-color: #3F78D0; color: #163F87; box-shadow: 0 3px 0 #3F78D0; }
.subj-go-vi { background: #E2D6FF; border-color: #8063D8; color: #43259B; box-shadow: 0 3px 0 #8063D8; }
.subj-row { gap: 12px; }
.subj-pick.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.subj-pick { display: flex; align-items: center; gap: 8px; text-align: left; font-size: 18px; padding: 12px 16px; min-height: 58px; }
.subj-pick small { font-size: 12px; font-weight: 800; opacity: .85; }
.subj-pick.on { border-color: var(--ink); }
.cc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cc-stats .cs { border-radius: 14px; padding: 10px 4px; text-align: center; }
.cc-stats .cs b { display: block; font-family: 'Baloo 2'; font-weight: 800; font-size: 24px; line-height: 1.1; }
.cc-stats .cs small { font-size: 12px; font-weight: 800; }
.cc-stats .ok { background: #E9F7EF; color: #1F6B43; }
.cc-stats .bad { background: #FDECEF; color: #A3243F; }
.cc-stats .tag { background: #FFF1DA; color: #8A4B00; }
.ok-list summary { cursor: pointer; }
.cc-card + .or-sep { margin: 16px 0 12px; }
.subj-go { border-width: 2px; }

/* do tuong phan (gop y 22/10): chu "Hoac" + link nho trang chu dat >= 4.5:1 tren nen kem */
.cc-card + .or-sep { color: #6B6E8A; }
.home-links a { color: #1F66D6; }

/* do tuong phan 22/10: nen cam sang giu nguyen, chu trang -> chu dam (trang tren cam chi ~2:1) */
.btn:not(.ghost):not(.green):not(.blue):not(.teal):not(.purple):not(.pink):not(.red):not(.zalo) { color: var(--ink); }
.tile:not(.t-teal):not(.t-purple):not(.t-pink):not(.t-blue):not(.t-green):not(.check-tile) { color: var(--ink); }
.tiles.mini .tile { color: #2B2D42; }
.door-en { color: var(--ink); }
.grade-chip, .badge { font-weight: 900; }
.subj-chip-en { color: var(--ink); }

/* ===== gop y 22/10 (Tuyen Ta) ===== */
/* tag "Mới" canh tinh nang moi (thay the "Co gi moi" tren trang tong) */
.new-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #C8283F; color: #fff; font-family: inherit; font-size: 11px; font-weight: 900; line-height: 1.6; vertical-align: middle; letter-spacing: .2px; }
/* tooltip huong dan co nut dong */
.coach-tip { padding-right: 40px; }
.coach-x { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #F1EEE6; color: #4A4D63; font-size: 15px; font-weight: 900; cursor: pointer; }
/* hop chon mon: chua chon = nen nhat, chon = nen dam + dau ✓ (chu van >= 4.5:1) */
.subj-pick { box-shadow: none; border-width: 2px; }
.subj-pick.subj-go-en:not(.on) { background: #FFF6E6; border-color: #EBCB94; color: #6E3A00; box-shadow: none; }
.subj-pick.subj-go-math:not(.on) { background: #F0F5FF; border-color: #BCD0F2; color: #163F87; box-shadow: none; }
.subj-pick.subj-go-vi:not(.on) { background: #F6F2FF; border-color: #D3C7F3; color: #43259B; box-shadow: none; }
.subj-pick.on { box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.subj-pick.subj-go-en.on { background: #F5A524; border-color: #B86E00; color: #2E1700; }
.subj-pick.subj-go-math.on { background: #2F66BF; border-color: #1F4A93; color: #fff; }
.subj-pick.subj-go-vi.on { background: #6A4BD0; border-color: #4A2FA8; color: #fff; }
.subj-pick.on::after { content: '✓'; margin-left: auto; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.9); color: #1F6B43; display: grid; place-items: center; font-size: 17px; font-weight: 900; flex: none; }
.subj-pick .grow { flex: 1; }
/* ket qua cham: nut phu ghi ro khac nhau */
.more-btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 12px 16px; }
.more-btn small { font-weight: 700; font-size: 13px; color: #55586F; }

/* "Em hiểu chưa?" dưới Hướng làm / gợi ý / lời giải mẫu / giải thích (help.log) */
.hvote { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--ink2, #6B6457); }
.hvote button { border: 1.5px solid #E8E1D2; background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-weight: 800; color: inherit; cursor: pointer; }
.hvote button:active { transform: scale(.96); }
/* "Chua hieu" -> Cu Bo giai thich cach khac ngay trong o (rehelp.js) */
.hvote.rh-box { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
.rh-wait { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: #FFF8E6; border-radius: 12px; font-weight: 700; }
.rh-card { background: #EEF6FF; border: 2px solid #CFE3FF; border-radius: 14px; padding: 10px 12px; }
.rh-card > b { display: block; margin-bottom: 4px; color: #2A5BB8; }
.rh-text { line-height: 1.6; }
.rh-vote, .rh-why { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; color: var(--ink2, #6B6457); }
.rh-why { display: block; }
.rh-vote button, .hvote [data-rhw] { border: 1.5px solid #E8E1D2; background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-weight: 800; color: inherit; cursor: pointer; }
/* Toán: 🔖 lưu dạng bài */
.dang-row { margin-top: 10px; }
.dang-btn { border: 1.5px dashed #CDBEF7; background: #F7F3FF; color: #6D3FE0; border-radius: 12px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-align: left; }
.dang-btn.on { border-style: solid; background: #EDE5FF; }
.dang-btn span { font-weight: 900; }
.modal mark { background: #FFE58F; border-radius: 4px; padding: 0 2px; }

/* ===== Mon them 10/2026 (Khoa hoc, Ly, Hoa, Sinh, Su, Dia, GDCD, Tin, Cong nghe): mau cua / chon mon / tab / nen phong ===== */
.subj-go-sci { background: #D6F2E6; border-color: #2E8B6B; color: #11503A; box-shadow: 0 3px 0 #2E8B6B; }
.subj-pick.subj-go-sci:not(.on) { background: #EFFAF4; border-color: #D6F2E6; color: #11503A; box-shadow: none; }
.subj-pick.subj-go-sci.on { background: #2E8B6B; border-color: #11503A; color: #fff; }
.subj-chip-sci { background: #2E8B6B; } .subj-tab.on.s-sci { border-color: #2E8B6B; background: #D6F2E6; color: #11503A; }
body[data-subj="sci"] { background-color: #EFFAF4; background-image: radial-gradient(#2E8B6B22 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="sci"] .topbar { background: linear-gradient(#EFFAF4 75%, #EFFAF400); }
body[data-subj="sci"] .ex-head { background: linear-gradient(135deg, #2E8B6B, #2E8B6B); box-shadow: 0 6px 0 #11503A; }
.hist.hist-sci { border-left-color: #2E8B6B; }
.subj-go-phys { background: #FFEFB0; border-color: #A98200; color: #4F3C00; box-shadow: 0 3px 0 #A98200; }
.subj-pick.subj-go-phys:not(.on) { background: #FFFBEA; border-color: #FFEFB0; color: #4F3C00; box-shadow: none; }
.subj-pick.subj-go-phys.on { background: #B88E00; border-color: #4F3C00; color: #fff; }
.subj-chip-phys { background: #B88E00; } .subj-tab.on.s-phys { border-color: #A98200; background: #FFEFB0; color: #4F3C00; }
body[data-subj="phys"] { background-color: #FFFBEA; background-image: radial-gradient(#A9820022 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="phys"] .topbar { background: linear-gradient(#FFFBEA 75%, #FFFBEA00); }
body[data-subj="phys"] .ex-head { background: linear-gradient(135deg, #B88E00, #A98200); box-shadow: 0 6px 0 #4F3C00; }
.hist.hist-phys { border-left-color: #A98200; }
.subj-go-chem { background: #FFDCE6; border-color: #C2416B; color: #6E1530; box-shadow: 0 3px 0 #C2416B; }
.subj-pick.subj-go-chem:not(.on) { background: #FFF3F6; border-color: #FFDCE6; color: #6E1530; box-shadow: none; }
.subj-pick.subj-go-chem.on { background: #C2416B; border-color: #6E1530; color: #fff; }
.subj-chip-chem { background: #C2416B; } .subj-tab.on.s-chem { border-color: #C2416B; background: #FFDCE6; color: #6E1530; }
body[data-subj="chem"] { background-color: #FFF3F6; background-image: radial-gradient(#C2416B22 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="chem"] .topbar { background: linear-gradient(#FFF3F6 75%, #FFF3F600); }
body[data-subj="chem"] .ex-head { background: linear-gradient(135deg, #C2416B, #C2416B); box-shadow: 0 6px 0 #6E1530; }
.hist.hist-chem { border-left-color: #C2416B; }
.subj-go-bio { background: #E2F2CF; border-color: #5B8C23; color: #2E4F0B; box-shadow: 0 3px 0 #5B8C23; }
.subj-pick.subj-go-bio:not(.on) { background: #F5FBEE; border-color: #E2F2CF; color: #2E4F0B; box-shadow: none; }
.subj-pick.subj-go-bio.on { background: #5B8C23; border-color: #2E4F0B; color: #fff; }
.subj-chip-bio { background: #5B8C23; } .subj-tab.on.s-bio { border-color: #5B8C23; background: #E2F2CF; color: #2E4F0B; }
body[data-subj="bio"] { background-color: #F5FBEE; background-image: radial-gradient(#5B8C2322 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="bio"] .topbar { background: linear-gradient(#F5FBEE 75%, #F5FBEE00); }
body[data-subj="bio"] .ex-head { background: linear-gradient(135deg, #5B8C23, #5B8C23); box-shadow: 0 6px 0 #2E4F0B; }
.hist.hist-bio { border-left-color: #5B8C23; }
.subj-go-hist { background: #F6E0CB; border-color: #A8662B; color: #5C3210; box-shadow: 0 3px 0 #A8662B; }
.subj-pick.subj-go-hist:not(.on) { background: #FCF5EE; border-color: #F6E0CB; color: #5C3210; box-shadow: none; }
.subj-pick.subj-go-hist.on { background: #A8662B; border-color: #5C3210; color: #fff; }
.subj-chip-hist { background: #A8662B; } .subj-tab.on.s-hist { border-color: #A8662B; background: #F6E0CB; color: #5C3210; }
body[data-subj="hist"] { background-color: #FCF5EE; background-image: radial-gradient(#A8662B22 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="hist"] .topbar { background: linear-gradient(#FCF5EE 75%, #FCF5EE00); }
body[data-subj="hist"] .ex-head { background: linear-gradient(135deg, #A8662B, #A8662B); box-shadow: 0 6px 0 #5C3210; }
.hist.hist-hist { border-left-color: #A8662B; }
.subj-go-geo { background: #D3EEFA; border-color: #2479A8; color: #0E3F5E; box-shadow: 0 3px 0 #2479A8; }
.subj-pick.subj-go-geo:not(.on) { background: #EEF8FD; border-color: #D3EEFA; color: #0E3F5E; box-shadow: none; }
.subj-pick.subj-go-geo.on { background: #2479A8; border-color: #0E3F5E; color: #fff; }
.subj-chip-geo { background: #2479A8; } .subj-tab.on.s-geo { border-color: #2479A8; background: #D3EEFA; color: #0E3F5E; }
body[data-subj="geo"] { background-color: #EEF8FD; background-image: radial-gradient(#2479A822 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="geo"] .topbar { background: linear-gradient(#EEF8FD 75%, #EEF8FD00); }
body[data-subj="geo"] .ex-head { background: linear-gradient(135deg, #2479A8, #2479A8); box-shadow: 0 6px 0 #0E3F5E; }
.hist.hist-geo { border-left-color: #2479A8; }
.subj-go-civic { background: #ECE5DB; border-color: #7A6A58; color: #3F3427; box-shadow: 0 3px 0 #7A6A58; }
.subj-pick.subj-go-civic:not(.on) { background: #F8F5F1; border-color: #ECE5DB; color: #3F3427; box-shadow: none; }
.subj-pick.subj-go-civic.on { background: #7A6A58; border-color: #3F3427; color: #fff; }
.subj-chip-civic { background: #7A6A58; } .subj-tab.on.s-civic { border-color: #7A6A58; background: #ECE5DB; color: #3F3427; }
body[data-subj="civic"] { background-color: #F8F5F1; background-image: radial-gradient(#7A6A5822 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="civic"] .topbar { background: linear-gradient(#F8F5F1 75%, #F8F5F100); }
body[data-subj="civic"] .ex-head { background: linear-gradient(135deg, #7A6A58, #7A6A58); box-shadow: 0 6px 0 #3F3427; }
.hist.hist-civic { border-left-color: #7A6A58; }
.subj-go-it { background: #E0E5F1; border-color: #4A5878; color: #222B40; box-shadow: 0 3px 0 #4A5878; }
.subj-pick.subj-go-it:not(.on) { background: #F3F5FA; border-color: #E0E5F1; color: #222B40; box-shadow: none; }
.subj-pick.subj-go-it.on { background: #4A5878; border-color: #222B40; color: #fff; }
.subj-chip-it { background: #4A5878; } .subj-tab.on.s-it { border-color: #4A5878; background: #E0E5F1; color: #222B40; }
body[data-subj="it"] { background-color: #F3F5FA; background-image: radial-gradient(#4A587822 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="it"] .topbar { background: linear-gradient(#F3F5FA 75%, #F3F5FA00); }
body[data-subj="it"] .ex-head { background: linear-gradient(135deg, #4A5878, #4A5878); box-shadow: 0 6px 0 #222B40; }
.hist.hist-it { border-left-color: #4A5878; }
.subj-go-tech { background: #FBDFCB; border-color: #C0602A; color: #6A2A08; box-shadow: 0 3px 0 #C0602A; }
.subj-pick.subj-go-tech:not(.on) { background: #FEF4EC; border-color: #FBDFCB; color: #6A2A08; box-shadow: none; }
.subj-pick.subj-go-tech.on { background: #C0602A; border-color: #6A2A08; color: #fff; }
.subj-chip-tech { background: #C0602A; } .subj-tab.on.s-tech { border-color: #C0602A; background: #FBDFCB; color: #6A2A08; }
body[data-subj="tech"] { background-color: #FEF4EC; background-image: radial-gradient(#C0602A22 1.5px, transparent 1.6px); background-size: 22px 22px; }
body[data-subj="tech"] .topbar { background: linear-gradient(#FEF4EC 75%, #FEF4EC00); }
body[data-subj="tech"] .ex-head { background: linear-gradient(135deg, #C0602A, #C0602A); box-shadow: 0 6px 0 #6A2A08; }
.hist.hist-tech { border-left-color: #C0602A; }
/* phong KHTN 6-9 / LS&DL 4-9: tab doi phan mon */
.subj-tabs { display: flex; gap: 8px; margin: 4px 0 12px; }
.subj-tabs .subj-tab { flex-direction: row; justify-content: center; gap: 6px; font-size: 15px; padding: 10px 6px; min-height: 48px; }
.subj-go-grp { font-size: 14px; line-height: 1.15; }
/* hop chon mon khi nhieu mon (lop 4-12): 2 cot */
.subj-pick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.subj-pick-grid .subj-pick { font-size: 15px; padding: 10px 12px; min-height: 52px; }
.subj-pick .subj-grp { display: block; font-size: 11px; font-weight: 800; opacity: .8; }
/* Tin hoc: o go code */
textarea.code-inp { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 15px; min-height: 160px; white-space: pre; tab-size: 4; line-height: 1.45; }
body[data-subj="it"] .q .txt, body[data-subj="it"] .passage { white-space: pre-wrap; }

/* "Cú Bơ chấm sai?" (báo 1 câu + lý do, lib/dispute.php) */
.dsp-open { display: inline-block; margin-top: 10px; border: 1.5px dashed #E0D3B8; background: transparent; border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; font-weight: 800; color: var(--ink-2); cursor: pointer; }
.dsp-open:active { transform: scale(.96); }
.dsp { display: flex; gap: 10px; align-items: flex-start; margin-top: 10px; border-radius: 16px; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.dsp.wait { background: #EAF2FF; }
.dsp.wait .spin { font-size: 22px; }
.dsp.ok { background: #E3F7EC; }
.dsp.kept { background: #FFF1DA; }
.dsp .mt-s, .mt-s { margin-top: 4px; }
.dsp-link { display: block; margin-top: 6px; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 800; color: var(--blue); text-decoration: underline; cursor: pointer; }
.dsp-was { background: #F7F2E8; border-radius: 14px; padding: 10px 12px; }
.dsp-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dsp-chip { border: 2px solid #E8E1D2; background: #fff; border-radius: 14px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 800; color: var(--ink); cursor: pointer; text-align: left; }
.dsp-chip.on { border-color: var(--blue); background: #EAF2FF; }
.dsp-note { position: relative; margin-top: 6px; }
.dsp-note textarea.inp { padding-right: 64px; }
.dsp-mic { position: absolute; right: 8px; bottom: 10px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; font-size: 22px; cursor: pointer; box-shadow: 0 3px 0 var(--orange-d); }
.dsp-mic.on { background: var(--red); box-shadow: 0 3px 0 var(--red-d); animation: dspPulse 1s ease-in-out infinite; }
.dsp-mic:disabled { opacity: .5; }
@keyframes dspPulse { 50% { transform: scale(1.08); } }
