:root {
  --nen: #f6f7f4; --the: #ffffff; --chu: #1d2526; --phu: #4f5d60; --vien: #dfe5e3; --mem: #e7f2f1;
  --chinh: #0e6b73; --chinh-dam: #0a5259; --tren-chinh: #ffffff; --vang: #b07a12; --vang-mem: #fbf1dc;
  --do: #b3261e; --xanh: #2b7a4b; --bong: 0 1px 3px rgba(20,40,40,.08);
  --cau-a: #0e6b73; --cau-b: #2a4f86;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #141a1b; --the: #1d2526; --chu: #eef3f2; --phu: #b4c2c0; --vien: #33403f; --mem: #203234;
    --chinh: #5fc4cb; --chinh-dam: #8fd9de; --tren-chinh: #062a2d; --vang: #e8b75a; --vang-mem: #3a2f19;
    --do: #ff8a80; --xanh: #7fd3a1; --bong: none; --cau-a: #0b4b51; --cau-b: #1c335a;
  }
}
:root[data-theme="dark"] {
  --nen: #141a1b; --the: #1d2526; --chu: #eef3f2; --phu: #b4c2c0; --vien: #33403f; --mem: #203234;
  --chinh: #5fc4cb; --chinh-dam: #8fd9de; --tren-chinh: #062a2d; --vang: #e8b75a; --vang-mem: #3a2f19;
  --do: #ff8a80; --xanh: #7fd3a1; --bong: none; --cau-a: #0b4b51; --cau-b: #1c335a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--nen); color: var(--chu); }
body { font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; padding-bottom: calc(72px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
a { color: var(--chinh-dam); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.dau { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: color-mix(in srgb, var(--nen) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--vien); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; text-decoration: none; color: var(--chu); letter-spacing: -.01em; }
.logo img { width: 30px; height: 30px; border-radius: 8px; }
.dau-phai { display: flex; gap: 4px; align-items: center; }
.nut-tron { position: relative; border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; font-size: 1.15rem; cursor: pointer; }
.nut-tron:hover { background: var(--mem); }
.cham-do { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--do); color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; }
.nut-nn { border: 1px solid var(--vien); background: var(--the); border-radius: 999px; padding: 4px 10px; font-size: .8rem; font-weight: 700; cursor: pointer; }

main { max-width: 600px; margin: 0 auto; padding: 14px 14px 24px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 6px 0 12px; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
.phu { color: var(--phu); }
.nho { font-size: .86rem; }

.the { background: var(--the); border: 1px solid var(--vien); border-radius: 16px; padding: 16px; box-shadow: var(--bong); margin-bottom: 12px; }
.hang { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gian { justify-content: space-between; }
.cot2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cot3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--vien); background: var(--the); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--chu); }
.nut:hover { border-color: var(--chinh); }
.nut.chinh { background: var(--chinh); border-color: var(--chinh); color: var(--tren-chinh); }
.nut.chinh:hover { background: var(--chinh-dam); }
.nut.nhe { border-color: transparent; background: var(--mem); }
.nut.do { color: var(--do); }
.nut.rong { width: 100%; }
.nut.nho { min-height: 34px; padding: 4px 10px; font-size: .85rem; border-radius: 10px; }
.nut:disabled { opacity: .5; cursor: default; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--vien); border-radius: 12px; background: var(--the); }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--chinh); outline-offset: 1px; }
.o-tick { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.o-tick input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.bao-loi { color: var(--do); font-weight: 600; min-height: 1.2em; margin: 8px 0; }

/* Thanh dưới */
.thanh-duoi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--the); border-top: 1px solid var(--vien); padding-bottom: env(safe-area-inset-bottom); }
.thanh-duoi a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px 7px; text-decoration: none; color: var(--phu); font-size: .72rem; font-weight: 600; }
.thanh-duoi a span:first-child { font-size: 1.3rem; line-height: 1.2; }
.thanh-duoi a.dang { color: var(--chinh); }

/* Câu ngày */
.cau { position: relative; border-radius: 20px; padding: 22px 20px 18px; color: #fff; overflow: hidden;
  background: linear-gradient(140deg, var(--cau-a), var(--cau-b)); box-shadow: var(--bong); margin-bottom: 12px; }
.cau::after { content: "“"; position: absolute; right: 14px; top: -18px; font: 900 7rem/1 Georgia, serif; opacity: .14; }
.cau .nhan { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; font-weight: 700; }
.cau .en { font: 600 1.28rem/1.42 Georgia, "Times New Roman", serif; margin: 10px 0 8px; }
.cau .vi { opacity: .92; }
.cau .nguon { font-size: .78rem; opacity: .7; margin-top: 8px; }
.cau .hang { margin-top: 14px; }
.cau .nut { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.3); color: #fff; min-height: 38px; padding: 6px 12px; }
.cau .nut:hover { background: rgba(255,255,255,.26); }

.man-chao { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: center; padding: 32px 24px;
  background: linear-gradient(160deg, var(--cau-a), var(--cau-b)); color: #fff; text-align: center; animation: hien .5s ease; }
.man-chao .ngay { opacity: .8; font-weight: 600; }
.man-chao .en { font: 600 1.6rem/1.4 Georgia, serif; margin: 22px auto 14px; max-width: 560px; }
.man-chao .vi { font-size: 1.05rem; opacity: .92; max-width: 520px; margin: 0 auto; }
.man-chao .nut { margin: 32px auto 0; background: #fff; color: #0e3d42; border: 0; min-width: 220px; }
@keyframes hien { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.so-lieu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.so-lieu div { background: var(--the); border: 1px solid var(--vien); border-radius: 14px; padding: 10px; text-align: center; }
.so-lieu b { display: block; font-size: 1.35rem; }
.so-lieu span { font-size: .78rem; color: var(--phu); }

.viec { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--vien); text-decoration: none; color: var(--chu); }
.viec:last-child { border-bottom: 0; }
.viec .o { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--vien); display: grid; place-items: center; flex: none; font-size: .8rem; }
.viec.xong .o { background: var(--xanh); border-color: var(--xanh); color: #fff; }
.viec.xong .ten { color: var(--phu); text-decoration: line-through; }
.viec .diem { margin-left: auto; color: var(--vang); font-weight: 700; font-size: .85rem; }

.tu-ngay .tu { font-size: 1.4rem; font-weight: 800; }
.ipa { color: var(--chinh-dam); font-family: "Segoe UI", "Lucida Sans Unicode", "Arial Unicode MS", sans-serif; }

/* Cộng đồng */
.tab-nhom { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.tab-nhom button { flex: none; border: 1px solid var(--vien); background: var(--the); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.tab-nhom button.dang { background: var(--chinh); border-color: var(--chinh); color: var(--tren-chinh); }
.soan textarea { min-height: 70px; border: 0; padding: 4px 0; background: transparent; }
.soan textarea:focus { outline: 0; }
.xem-truoc-anh { position: relative; margin-top: 8px; }
.xem-truoc-anh img { border-radius: 12px; max-height: 260px; }
.xem-truoc-anh button { position: absolute; top: 6px; left: 6px; }
.bai .dau-bai { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.anh-dd { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; flex: none; text-decoration: none; }
.bai .ten { font-weight: 700; color: var(--chu); text-decoration: none; }
.bai .meta { font-size: .78rem; color: var(--phu); }
.bai .noi-dung { white-space: pre-wrap; overflow-wrap: anywhere; }
.bai .anh { margin-top: 10px; border-radius: 12px; width: 100%; max-height: 520px; object-fit: cover; background: var(--mem); }
.bai audio { width: 100%; margin-top: 10px; }
.ghim { color: var(--vang); font-weight: 700; font-size: .78rem; }
.nhan-nhom { display: inline-block; background: var(--mem); color: var(--chinh-dam); border-radius: 999px; padding: 0 8px; font-size: .72rem; font-weight: 700; }
.cam-xuc { display: flex; gap: 6px; margin-top: 10px; border-top: 1px solid var(--vien); padding-top: 8px; flex-wrap: wrap; }
.cam-xuc button, .cam-xuc a { border: 0; background: transparent; border-radius: 10px; padding: 6px 10px; cursor: pointer; color: var(--phu); font-weight: 600; text-decoration: none; font-size: .9rem; }
.cam-xuc button:hover, .cam-xuc a:hover { background: var(--mem); }
.cam-xuc button.chon { color: var(--chinh-dam); background: var(--mem); }
.menu-bai { margin-left: auto; position: relative; }
.binh-luan { display: flex; gap: 8px; margin-top: 12px; }
.binh-luan .bong { background: var(--mem); border-radius: 14px; padding: 8px 12px; flex: 1; }
.binh-luan .bong b { font-size: .88rem; }
.binh-luan .bong p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.anh-dd.nho { width: 32px; height: 32px; font-size: .8rem; }
.ghi-am { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.dang-ghi { color: var(--do); font-weight: 700; animation: nhap 1s infinite; }
@keyframes nhap { 50% { opacity: .4; } }

/* Học */
.buoi { display: flex; gap: 12px; align-items: center; padding: 12px; text-decoration: none; color: var(--chu); border-bottom: 1px solid var(--vien); }
.buoi:last-child { border-bottom: 0; }
.buoi .so { width: 42px; height: 42px; border-radius: 12px; background: var(--mem); color: var(--chinh-dam); display: grid; place-items: center; font-weight: 800; flex: none; }
.buoi.xong .so { background: var(--xanh); color: #fff; }
.buoi .tt { font-weight: 600; line-height: 1.35; }
.khung-video { position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden; background: #000; margin-bottom: 12px; }
.khung-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.thanh-tien-do { height: 8px; border-radius: 4px; background: var(--mem); overflow: hidden; }
.thanh-tien-do i { display: block; height: 100%; background: var(--chinh); }

/* Luyện */
.the-tu { min-height: 280px; display: flex; flex-direction: column; justify-content: center; text-align: center; cursor: pointer; }
.the-tu .tu { font-size: 1.9rem; font-weight: 800; }
.the-tu .mat-sau { margin-top: 14px; }
.chu-cham span { padding: 1px 2px; border-radius: 4px; }
.chu-cham .dung { background: color-mix(in srgb, var(--xanh) 22%, transparent); }
.chu-cham .sai { background: color-mix(in srgb, var(--do) 20%, transparent); }
.diem-to { font-size: 2.4rem; font-weight: 800; }

.bxh li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--vien); }
.bxh li.toi { font-weight: 800; color: var(--chinh-dam); }
.bxh ol { padding: 0; margin: 0; list-style: none; }
.bxh .hang-so { width: 28px; text-align: center; font-weight: 800; }

.bang-qt { width: 100%; border-collapse: collapse; font-size: .88rem; }
.bang-qt td, .bang-qt th { border-bottom: 1px solid var(--vien); padding: 8px 6px; text-align: left; vertical-align: top; }
.tb { display: block; padding: 10px 0; border-bottom: 1px solid var(--vien); text-decoration: none; color: var(--chu); }
.tb.moi { font-weight: 700; }

.thong-diep { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--chu); color: var(--nen); padding: 10px 16px; border-radius: 12px; font-weight: 600; max-width: 92vw; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
.trong { text-align: center; color: var(--phu); padding: 30px 10px; }
.cong-tac { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--vien); }
.man-chao .nut.nhe { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); min-width: 0; margin: 0; }
.trinh-phat audio { width: 100%; margin-top: 8px; }
.nut.nhe.chinh { background: var(--chinh); color: var(--tren-chinh); }

/* ===== Trang chủ: câu nói trên ảnh phong cảnh tràn màn hình ===== */
body.o-trang-chu { overflow: hidden; }
body.o-trang-chu .dau { background: linear-gradient(rgba(0,0,0,.35), transparent); border-bottom: 0; backdrop-filter: none; }
body.o-trang-chu .logo { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
body.o-trang-chu .nut-nn { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.4); }
body.o-trang-chu .nut-tron { color: #fff; }
.trang-cau { position: fixed; inset: 0; z-index: 1; overflow: hidden; background: #123a40; touch-action: pan-y; user-select: none; }
.lop-anh { position: absolute; inset: 0; background: center / cover no-repeat; opacity: 0; transform: scale(1.04); transition: opacity .8s ease, transform 8s ease-out; }
.lop-anh.hien { opacity: 1; transform: scale(1); }
.trang-cau::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.05) 30%, rgba(0,0,0,.35) 60%, rgba(0,0,0,.72) 100%); }
.lop-chu { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(112px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 680px;
  padding: 0 26px; border: 0; background: none; text-align: left; color: #fff; cursor: pointer; text-shadow: 0 2px 10px rgba(0,0,0,.55); }
.lop-chu .en { display: block; font: 600 clamp(1.4rem, 5.6vw, 2.1rem)/1.38 Georgia, "Times New Roman", serif; }
.lop-chu .vi { display: block; margin-top: 14px; font-size: clamp(1rem, 4vw, 1.2rem); line-height: 1.5; opacity: .93; }
.lop-chu.vao { animation: chu-vao .55s ease both; }
@keyframes chu-vao { from { opacity: 0; transform: translateX(var(--tu, 0)); } to { opacity: 1; transform: none; } }
.goi-y-vuot { position: absolute; z-index: 2; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); text-align: center;
  color: rgba(255,255,255,.75); font-size: .8rem; animation: nhap 2.4s ease-in-out 3; }
@media (prefers-reduced-motion: reduce) { .lop-anh, .lop-chu.vao { transition: none; animation: none; transform: none; } }
