/* Vocabulary On — mau va font thuong hieu EnglishOn (dong bo voi GrammarOn). */
:root {
  --paper: #fbfcff;
  --grid: #e4e7f6;
  --ink: #1f2a56;
  --ink-soft: #5a6488;
  --line: #d5daef;
  --blue: #2f6feb;
  --green: #23a046;
  --purple: #8a3fc7;
  --orange: #ef8a1f;
  --red: #e0414b;
  --yellow: #e9b600;
  --card: #ffffff;
  --radius: 22px;
  --shadow: 0 1px 0 rgba(31, 42, 86, .06), 0 8px 24px -12px rgba(31, 42, 86, .25);
  --display: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }

body {
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
}

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }

.wrap { max-width: 880px; margin: 0 auto; padding: 20px 16px 64px; }
.brand { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.5px; text-decoration: none; color: var(--ink); }
.brand b { color: var(--orange); }
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
h1 { font-family: var(--display); font-size: clamp(30px, 6vw, 42px); line-height: 1.15; margin: 0 0 .4em; }
.muted { color: var(--ink-soft); }
a:not(.btn):not(.brand) { color: var(--blue); font-weight: 700; text-underline-offset: 3px; }

/* ---------- Thanh tren ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Nut: to, de bam, khong phu thuoc hover ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 10px 22px; border-radius: 999px; border: 0;
  background: var(--blue); color: #fff; font: 800 19px/1.2 var(--body); text-decoration: none; cursor: pointer;
  box-shadow: 0 3px 0 rgba(31, 42, 86, .25);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(31, 42, 86, .25); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-big { min-height: 68px; font-size: 23px; padding: 14px 30px; }
.btn-green { background: var(--green); }
.btn-orange { background: var(--orange); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: none; min-height: 44px; padding: 8px 14px; font-size: 16px; border: 2px solid var(--line); }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 16px; }
.btn-block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 14px; }
.stack > a:not(.btn) { display: block; width: fit-content; }

/* ---------- Form ---------- */
label { display: block; font-weight: 700; margin: 12px 0 6px; }
input, select { width: 100%; min-height: 50px; padding: 10px 14px; font: 600 18px var(--body); color: var(--ink); border: 2px solid var(--line); border-radius: 14px; background: #fff; }
input:focus, select:focus { border-color: var(--blue); outline: none; }
.error { color: var(--red); font-weight: 700; min-height: 1.4em; margin: 8px 0 0; }
.hint { color: var(--ink-soft); font-size: 15px; }

/* ---------- The tu ---------- */
.section-title { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 24px; margin: 26px 0 10px; }
.count { background: var(--orange); color: #fff; border-radius: 999px; padding: 0 12px; font-size: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.word-card { display: block; background: #fff; border: 3px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.word-card img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 14px; background: var(--paper); }
.word-card .w { font-family: var(--display); font-size: 22px; font-weight: 800; margin-top: 6px; }
.word-card .meta { font-size: 14px; color: var(--ink-soft); }
.word-card.due { border-color: var(--orange); }
.word-card.done { opacity: .75; }
.stars { color: var(--yellow); letter-spacing: 1px; font-size: 15px; }
.empty { text-align: center; color: var(--ink-soft); padding: 18px; border: 2px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.7); }
.banner { border-radius: var(--radius); padding: 16px 18px; font-weight: 700; margin: 12px 0; }
.banner-info { background: #eaf1ff; color: var(--ink); }
.banner-warn { background: #fff4e0; color: #7a4a00; }
.banner-ok { background: #e7f7ec; color: #145a2a; }

/* ---------- Bai hoc ---------- */
.hero { text-align: center; }
.hero img { width: min(420px, 100%); aspect-ratio: 1; object-fit: contain; border-radius: var(--radius); background: #fff; border: 3px solid var(--line); }
.hero .word { font-family: var(--display); font-size: clamp(42px, 10vw, 64px); font-weight: 800; line-height: 1.1; margin: 10px 0 0; }
.ipa { color: var(--ink-soft); font-size: 20px; }
.meaning { font-size: 20px; font-weight: 700; color: var(--purple); }
.speak { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--orange); color: #fff; font-size: 34px; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
.speak:active { transform: translateY(2px); }
.speak-small { width: 52px; height: 52px; font-size: 24px; flex: none; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #1f2a56; }
.video iframe, .video button { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video button { background: #1f2a56; color: #fff; font: 800 22px var(--body); cursor: pointer; }
.phrase { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 10px; }
.phrase img { width: 96px; height: 96px; object-fit: contain; border-radius: 12px; background: var(--paper); flex: none; }
.phrase .p { font-family: var(--display); font-size: 22px; font-weight: 800; }

/* ---------- Kiem tra: nghe -> chon hinh (luoi 2x2) ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.progress-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.progress-dots span.ok { background: var(--green); }
.progress-dots span.bad { background: var(--red); }
.progress-dots span.now { outline: 3px solid var(--blue); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.choice { position: relative; padding: 0; border: 4px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; aspect-ratio: 1; overflow: hidden; }
.choice img { width: 100%; height: 100%; object-fit: contain; }
.choice.picked-ok { border-color: var(--green); }
.choice.picked-bad { border-color: var(--red); }
/* Dung/sai co ca bieu tuong, khong chi dung mau */
.choice .mark { position: absolute; top: 8px; right: 8px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 900; color: #fff; }
.choice.picked-ok .mark { background: var(--green); }
.choice.picked-bad .mark { background: var(--red); }
.result { text-align: center; }
.result .big { font-size: 84px; line-height: 1; }

/* ---------- Thong bao ---------- */
.offline { position: sticky; top: 0; z-index: 10; background: var(--red); color: #fff; text-align: center; font-weight: 800; padding: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 700; z-index: 20; max-width: calc(100% - 32px); }
.toast-error { background: var(--red); }
.loading { text-align: center; padding: 40px 0; color: var(--ink-soft); font-weight: 700; }

/* ---------- Thanh toan ---------- */
.price { font-family: var(--display); font-size: 40px; font-weight: 800; color: var(--orange); }
.price s { color: var(--ink-soft); font-size: 22px; }
.qr { display: block; width: min(320px, 100%); margin: 10px auto; border-radius: 16px; border: 2px solid var(--line); background: #fff; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 24px; background: #fff4e0; padding: 2px 10px; border-radius: 8px; }

/* ---------- Giao vien: trinh chieu man hinh lon ---------- */
.slide { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.slide img { max-width: min(70vh, 92vw); max-height: 60vh; aspect-ratio: 1; object-fit: contain; border-radius: var(--radius); background: #fff; border: 4px solid var(--line); cursor: pointer; }
.slide .word { font-family: var(--display); font-size: clamp(48px, 8vw, 96px); font-weight: 800; }
.mark-row .btn { min-width: 160px; }

/* ---------- Quan tri ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; background: #fff; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; border-radius: 14px; border: 2px solid var(--line); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--grid); }

@media (max-width: 480px) {
  .btn-big { width: 100%; }
  .choices { gap: 8px; }
  .brand { font-size: 23px; }
  .topbar .btn-ghost, .topbar .btn-small { min-height: 40px; padding: 6px 11px; font-size: 15px; }
}
