:root {
  --nen: #f6f6f4;
  --the: #ffffff;
  --chu: #1c1c1e;
  --chu-phu: #6b6b70;
  --vien: #e6e4e0;
  --nhan: #d9480f;          /* một màu nhấn duy nhất */
  --nhan-nhat: #fff1e8;
  --nhan-chu: #ffffff;
  --tot: #2b8a3e;
  --loi: #c92a2a;
  --bong: 0 1px 2px rgba(0,0,0,.04), 0 1px 8px rgba(0,0,0,.03);
  --bo: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #121214; --the: #1c1c1f; --chu: #ececee; --chu-phu: #a0a0a8; --vien: #2e2e33;
    --nhan: #ff7a3d; --nhan-nhat: #3a2418; --nhan-chu: #1a0d05; --bong: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --nen: #121214; --the: #1c1c1f; --chu: #ececee; --chu-phu: #a0a0a8; --vien: #2e2e33;
  --nhan: #ff7a3d; --nhan-nhat: #3a2418; --nhan-chu: #1a0d05; --bong: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--nen); color: var(--chu);
  font: 15px/1.5 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.dang-tai { padding: 80px 16px; text-align: center; color: var(--chu-phu); }
.phu { color: var(--chu-phu); font-size: 13px; }
.an { display: none !important; }

/* ---------- Thanh trên ---------- */
.dau {
  position: sticky; top: 0; z-index: 20; background: var(--the); border-bottom: 1px solid var(--vien);
}
.dau-trong { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.dau-hang { display: flex; align-items: center; gap: 12px; height: 56px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; min-width: 0; }
.logo-o { width: 32px; height: 32px; border-radius: 9px; background: var(--nhan); color: var(--nhan-chu); display: grid; place-items: center; font-size: 15px; flex: none; }
.logo span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dau-phai { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nut-icon { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.nut-icon:hover { background: var(--nen); }
.cham-dem { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--nhan); color: var(--nhan-chu); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 12px 12px; text-decoration: none; color: var(--chu-phu); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; }
.tabs a.dang { color: var(--chu); border-bottom-color: var(--chu); }
.menu { position: absolute; right: 0; top: 46px; background: var(--the); border: 1px solid var(--vien); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.12); min-width: 220px; padding: 6px; z-index: 30; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: none; text-decoration: none; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--nen); }
.menu hr { border: 0; border-top: 1px solid var(--vien); margin: 6px 0; }

/* Thanh tab dưới đáy (điện thoại) */
.day { display: none; }

/* ---------- Bố cục ---------- */
.khung { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
.hai-cot { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.cot-phai { display: grid; gap: 16px; position: sticky; top: 120px; }
.the { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); box-shadow: var(--bong); padding: 16px; }
.the + .the { margin-top: 12px; }
.so-lieu > .the, .luoi > .the, .cot-phai > .the { margin-top: 0; }
.danh-sach > * + * { margin-top: 12px; }
.hang { display: flex; align-items: center; gap: 10px; }
.hang-gian { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.luoi { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* ---------- Nút, ô nhập ---------- */
.nut { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--vien); background: var(--the); cursor: pointer; font-weight: 600; text-decoration: none; }
.nut:hover { background: var(--nen); }
.nut.chinh { background: var(--nhan); border-color: var(--nhan); color: var(--nhan-chu); }
.nut.chinh:hover { filter: brightness(.95); }
.nut.nho { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.nut.nguy { color: var(--loi); }
.nut:disabled { opacity: .5; cursor: default; }
.nut-chu { border: 0; background: none; color: var(--chu-phu); cursor: pointer; padding: 6px 8px; border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.nut-chu:hover { background: var(--nen); color: var(--chu); }
.nut-chu.dang { color: var(--nhan); }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=datetime-local], input[type=search], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--vien); border-radius: 10px; background: var(--the);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--nhan); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 90px; }
.loi-o { color: var(--loi); font-size: 13px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; background: var(--nen); font-size: 12px; font-weight: 600; color: var(--chu-phu); }
.chip.nhan { background: var(--nhan-nhat); color: var(--nhan); }
.chip.tot { background: color-mix(in srgb, var(--tot) 14%, transparent); color: var(--tot); }
.loc { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.loc button { border: 1px solid var(--vien); background: var(--the); padding: 6px 14px; border-radius: 99px; cursor: pointer; font-weight: 500; }
.loc button.dang { background: var(--chu); color: var(--the); border-color: var(--chu); }

/* ---------- Ảnh đại diện ---------- */
.anh-dd { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px; overflow: hidden; }
.anh-dd.nho { width: 32px; height: 32px; font-size: 13px; }
.anh-dd.lon { width: 88px; height: 88px; font-size: 32px; }

/* ---------- Bài viết ---------- */
.o-viet { display: flex; gap: 12px; align-items: center; cursor: text; }
.o-viet .gia { flex: 1; padding: 10px 14px; border-radius: 10px; background: var(--nen); color: var(--chu-phu); }
.bai { cursor: pointer; }
.bai:hover { border-color: color-mix(in srgb, var(--chu) 25%, var(--vien)); }
.bai-dau { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.bai-ten { font-weight: 600; }
.bai-tieu-de { font-weight: 700; font-size: 17px; margin: 0 0 4px; }
.bai-than { white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.bai.rut .bai-than { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bai-anh { margin-top: 10px; border-radius: 10px; max-height: 420px; object-fit: cover; width: 100%; }
.bai-chan { display: flex; gap: 4px; margin-top: 10px; margin-left: -8px; align-items: center; }
.binh-luan { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--vien); }
.binh-luan .noi-dung { flex: 1; min-width: 0; }
.binh-luan.hay { background: color-mix(in srgb, var(--tot) 8%, transparent); border-radius: 10px; padding: 12px; }

/* ---------- Ngọn lửa ---------- */
.lua { text-align: left; }
.lua-ten { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.thanh { height: 10px; background: var(--nen); border-radius: 99px; overflow: hidden; margin: 12px 0 6px; }
.thanh > div { height: 100%; background: var(--nhan); border-radius: 99px; transition: width .4s; }
.bac-moc { display: flex; justify-content: space-between; font-size: 12px; color: var(--chu-phu); }
.so-lieu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.so-lieu .the { padding: 14px; }
.so-lon { font-size: 26px; font-weight: 700; line-height: 1.1; }
.tang { color: var(--tot); font-weight: 600; font-size: 13px; }
.giam { color: var(--chu-phu); font-weight: 600; font-size: 13px; }
.huy-hieu { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: var(--nhan-nhat); color: var(--nhan); font-weight: 700; font-size: 13px; }

/* ---------- Bảng ---------- */
.bang-cuon { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--vien); white-space: nowrap; }
th { font-size: 12px; color: var(--chu-phu); font-weight: 600; }
.den { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.den.Đỏ { background: #e03131; } .den.Vàng { background: #f59f00; } .den.Xanh { background: #2f9e44; } .den.Tím { background: #7048e8; }

/* ---------- Lịch ---------- */
.thang { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--vien); border: 1px solid var(--vien); border-radius: 10px; overflow: hidden; }
.thang > div { background: var(--the); min-height: 84px; padding: 6px; font-size: 12px; }
.thang .thu { min-height: 0; font-weight: 600; color: var(--chu-phu); text-align: center; }
.thang .ngoai { opacity: .4; }
.thang .nay .so { background: var(--nhan); color: var(--nhan-chu); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.thang .sk { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 5px; background: var(--nhan-nhat); color: var(--nhan); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.ngay-o { width: 56px; text-align: center; border-radius: 10px; background: var(--nhan-nhat); color: var(--nhan); padding: 6px 0; flex: none; }
.ngay-o b { display: block; font-size: 20px; line-height: 1.1; }

/* ---------- Kiểu Skool bổ sung ---------- */
.anh-dd.tiny { width: 26px; height: 26px; font-size: 11px; border: 2px solid var(--the); }
.chong-anh { display: flex; align-items: center; margin-left: 6px; text-decoration: none; }
.chong-anh > * + * { margin-left: -8px; }
.dai-su-kien { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 4px; color: var(--chu); text-decoration: none; font-size: 14px; text-align: center; }
.dai-su-kien:hover b { text-decoration: underline; }
.the-cd { padding: 0; overflow: hidden; }
.anh-bia { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; }
.anh-bia.trong { background: linear-gradient(135deg, var(--nhan-nhat), var(--nen)); display: grid; place-items: center; font-size: 12px; color: var(--chu-phu); padding: 8px; text-align: center; }
.ba-so { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; border-top: 1px solid var(--vien); border-bottom: 1px solid var(--vien); padding: 10px 0; text-align: center; }
.ba-so > div + div { border-left: 1px solid var(--vien); }
.ba-so b { display: block; font-size: 17px; }
.ba-so span { font-size: 12px; color: var(--chu-phu); }
.hang-tv { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--vien); text-decoration: none; }
.hang-tv:last-child { border-bottom: 0; }
.cham-xanh { width: 9px; height: 9px; border-radius: 50%; background: var(--tot); display: inline-block; }
.loc button:disabled { cursor: default; opacity: 1; color: var(--chu-phu); }

/* ---------- Thông báo nổi ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; background: var(--chu); color: var(--the); padding: 10px 18px; border-radius: 10px; transition: .25s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
#toast.hien { opacity: 1; transform: translateX(-50%); }
.hop-thoai { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: grid; place-items: center; padding: 16px; }
.hop-thoai .the { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; }
.hop-thoai { align-items: start; overflow-y: auto; }
.hop-thoai .the.rong { max-width: 780px; max-height: none; margin: 40px 0; padding: 24px 28px; }
.trong-hop { border: 0; box-shadow: none; padding: 0; }
.trong-hop .bai-tieu-de { font-size: 22px; }
.nut-dong { position: fixed; top: 14px; left: 14px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); color: #222; font-size: 18px; cursor: pointer; z-index: 41; }
@media (max-width: 820px) { .hop-thoai .the.rong { margin: 56px 0 16px; padding: 16px; } }
.nhap { border: 1px dashed var(--nhan); background: var(--nhan-nhat); color: var(--chu); padding: 10px 12px; border-radius: 10px; font-size: 13px; }

/* ---------- Màn hình đăng nhập ---------- */
.man-don { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.man-don .the { max-width: 420px; width: 100%; text-align: center; padding: 32px 24px; }

/* ---------- Điện thoại ---------- */
@media (max-width: 820px) {
  .hai-cot { grid-template-columns: 1fr; }
  .cot-phai { position: static; order: -1; }
  .cot-phai .chi-may-tinh { display: none; }
  .tabs { display: none; }
  .khung { padding: 12px 12px 90px; }
  .so-lieu { grid-template-columns: 1fr 1fr; }
  .day {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--the); border-top: 1px solid var(--vien);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .day a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11px; text-decoration: none; color: var(--chu-phu); }
  .day a.dang { color: var(--nhan); }
  .thang > div { min-height: 54px; padding: 3px; font-size: 11px; }
  .thang .sk { font-size: 0; height: 6px; padding: 0; }
}

/* ---------- Video + ảnh chụp tự động ---------- */
.hang-video { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--vien); }
.anh-chup { flex: none; width: 72px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--nen); display: grid; place-items: center; font-size: 11px; color: var(--chu-phu); text-align: center; }
.anh-chup img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Khung căn chỉnh ảnh ---------- */
.cat-anh-khung { position: relative; width: 100%; overflow: hidden; border-radius: 10px; background: #111; cursor: grab; touch-action: none; user-select: none; }
.cat-anh-khung:active { cursor: grabbing; }
.cat-anh-khung.tron { max-width: 360px; margin: 0 auto; }
.cat-anh-khung.tron::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0,0,0,.45); pointer-events: none; }
.cat-anh-hinh { display: block; width: 100%; height: 100%; }
.anh-bia.trong img { display: block; }
