/* Màu & font dùng chung: index.html và 3 kiểu trang bài (lesson.css, reader.css, shadow.css @import file này).
   5 app.html cũ có giao diện riêng, KHÔNG nạp file này (chúng tự đặt --bg, --primary… trùng tên). */
@import url("https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;600;700;800&family=Noto+Sans:wght@400;600&display=swap");

:root {
  --bg: #f7f5f3;
  --card: #ffffff;
  --surface-2: #f0edeb;
  --text: #211d24;
  --muted: #716b74;
  --border: #e5e0e3;
  --rule: #e7c4d0;
  --accent: #9e2850;
  --accent-bright: #cf3e70;
  --accent-soft: #f8e7ed;
  --listening: #a14815;
  --listening-soft: #fcebdc;
  --reading: #176c66;
  --reading-soft: #dff2ef;
  --writing: #5b49a8;
  --writing-soft: #ece8fb;
  --speaking: #0284c7;
  --speaking-soft: #e0f2fe;
  --focus: #1d4ed8;
  --green: #15803d;
  --red: #b91c1c;
  --red-soft: rgba(220, 38, 38, 0.08);
  --code: #f1f1f4;
  --shadow-sm: 0 1px 2px rgba(39, 28, 36, 0.05);
  --shadow-md: 0 12px 30px rgba(39, 28, 36, 0.09);
  --shadow-lg: 0 26px 60px rgba(39, 28, 36, 0.17);
  --shadow: var(--shadow-md);
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 28px;
  /* Noto Sans đỡ các ký tự IPA mà Be Vietnam Pro không có */
  --font-ui: "Be Vietnam Pro", "Noto Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ipa: "Noto Sans", "DejaVu Sans", "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171519;
    --card: #211e23;
    --surface-2: #29252b;
    --text: #ececee;
    --muted: #9a9ca3;
    --border: #3b353d;
    --rule: #4a2e39;
    --accent: #f07da5;
    --accent-bright: #f25f91;
    --accent-soft: #3d222d;
    --listening: #f4a261;
    --listening-soft: #3b2a20;
    --reading: #5fc7bc;
    --reading-soft: #1e3432;
    --writing: #aaa0ed;
    --writing-soft: #2e2947;
    --speaking: #38bdf8;
    --speaking-soft: #082f49;
    --focus: #93c5fd;
    --green: #4ade80;
    --red: #f87171;
    --red-soft: rgba(248, 113, 113, 0.1);
    --code: #111214;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.34);
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.48);
    --shadow: var(--shadow-md);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171519;
  --card: #211e23;
  --surface-2: #29252b;
  --text: #ececee;
  --muted: #9a9ca3;
  --border: #3b353d;
  --rule: #4a2e39;
  --accent: #f07da5;
  --accent-bright: #f25f91;
  --accent-soft: #3d222d;
  --listening: #f4a261;
  --listening-soft: #3b2a20;
  --reading: #5fc7bc;
  --reading-soft: #1e3432;
  --writing: #aaa0ed;
  --writing-soft: #2e2947;
  --speaking: #38bdf8;
  --speaking-soft: #082f49;
  --focus: #93c5fd;
  --green: #4ade80;
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.1);
  --code: #111214;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.48);
  --shadow: var(--shadow-md);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Component tab dùng chung cho trang chủ, thanh điều hướng và nội dung bài Reading. */
.ui-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  scrollbar-width: none;
}
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 13px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.ui-tab:hover { color: var(--text); background: var(--surface-2); }
.ui-tab[aria-selected="true"],
.ui-tab[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (prefers-reduced-motion: no-preference) {
  a, button, input, .lesson-card, .resume-card { transition: color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
}
