/* =====================================================================
   GIAO DIỆN DÙNG CHUNG — Bee Duel
   * Màu của Bee: nền #0E1526, vàng #FDBE21, chữ vàng đậm trên nền sáng #8a6a00 (đạt AA).
   * Sáng/tối: theo hệ thống (prefers-color-scheme), hoặc ép bằng thuộc tính data-theme trên <html>.
   * Chữ >= 15px, vùng chạm >= 44px, KHÔNG phụ thuộc hover, tôn trọng giảm hiệu ứng.
   * Không phông ngoài, không CDN: dùng phông hệ thống.
   ===================================================================== */
:root {
  --nen: #fbf9f3;
  --nen-2: #f7f4ec; /* sáng hơn #f1ede2 để chữ vàng đậm #8a6a00 trên nền này đạt AA (4,61:1) */
  --the: #ffffff;
  --chu: #14203a;
  --chu-phu: #4a5572;
  --vien: #cdc6b2;
  --vang: #fdbe21;
  --vang-chu: #8a6a00;
  --tren-vang: #14203a;
  --xanh: #0b7a3b;
  --xanh-nen: #e3f5ea;
  --do: #b3261e;
  --do-nen: #fdecea;
  --xam-nen: #e9e5d8;
  --bong: 0 2px 10px rgba(20, 32, 58, 0.14);
  --ban-kinh: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #0e1526;
    --nen-2: #141d33;
    --the: #17213a;
    --chu: #f4f6fb;
    --chu-phu: #b4bdd3;
    --vien: #34405f;
    --vang-chu: #fdbe21;
    --xanh: #6fe39b;
    --xanh-nen: #11301f;
    --do: #ff9a92;
    --do-nen: #3a1816;
    --xam-nen: #1f2a46;
    --bong: 0 2px 12px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --nen: #0e1526;
  --nen-2: #141d33;
  --the: #17213a;
  --chu: #f4f6fb;
  --chu-phu: #b4bdd3;
  --vien: #34405f;
  --vang-chu: #fdbe21;
  --xanh: #6fe39b;
  --xanh-nen: #11301f;
  --do: #ff9a92;
  --do-nen: #3a1816;
  --xam-nen: #1f2a46;
  --bong: 0 2px 12px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--nen);
  color: var(--chu);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.6rem, 4.2vmin, 2.3rem); }
h2 { font-size: clamp(1.25rem, 3vmin, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .6em; }
a { color: var(--vang-chu); font-weight: 600; }
.chi-doc-man-hinh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- nút ---------- */
.nut {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  min-width: 48px;
  padding: 10px 20px;
  border-radius: var(--ban-kinh);
  border: 2px solid var(--vien);
  background: var(--the);
  color: var(--chu);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.nut:focus-visible, .chip:focus-visible, .the-chon:focus-visible, .lua-chon:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--vang);
  outline-offset: 2px;
}
.nut:active, .nut.dang-nhan { transform: translateY(1px); filter: brightness(0.95); }
.nut-chinh { background: var(--vang); border-color: #c99100; color: var(--tren-vang); font-size: 1.15rem; }
.nut-to { min-height: 64px; font-size: 1.3rem; padding: 14px 32px; }
.nut-nhe { background: transparent; }
.nut[disabled], .nut[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.nut-icon { padding: 0; width: 48px; }

/* ---------- ô chọn kiểu viên thuốc ---------- */
.nhom-chip { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  appearance: none;
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--vien);
  background: var(--the);
  color: var(--chu);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .45em;
  touch-action: manipulation;
}
.chip[aria-pressed="true"], .chip.chon {
  background: var(--vang);
  border-color: #c99100;
  color: var(--tren-vang);
}
.chip[disabled] { opacity: .5; cursor: not-allowed; }
.chip:active { filter: brightness(.95); }

/* ---------- thẻ ---------- */
.the {
  background: var(--the);
  border: 1px solid var(--vien);
  border-radius: calc(var(--ban-kinh) + 2px);
  padding: 16px;
  box-shadow: var(--bong);
}
.nhan-nho {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--xam-nen);
  color: var(--chu);
  font-size: .9375rem;
  font-weight: 600;
}
.chu-phu { color: var(--chu-phu); }
.luu-y-luyen-tap {
  margin: 12px auto 0;
  padding: 8px 14px;
  max-width: 62rem;
  font-size: .9375rem;
  line-height: 1.4;
  color: var(--chu-phu);
  text-align: center;
}

/* ---------- ô nhập ---------- */
.o-nhap {
  font: inherit;
  min-height: 48px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--vien);
  background: var(--the);
  color: var(--chu);
  width: 100%;
}

/* ---------- thông báo nhỏ ---------- */
.thong-bao-nhe {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--xam-nen);
  font-size: 1rem;
}
.thong-bao-nhe.loi { background: var(--do-nen); color: var(--do); border: 1px solid var(--do); }
.thong-bao-nhe.tot { background: var(--xanh-nen); color: var(--xanh); border: 1px solid var(--xanh); }

/* ---------- giảm hiệu ứng ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
