/* Hom nay em nen lam gi 今天要做的事 — the viec can lam (public/js/nong-trai-homnay.js)
   May tinh: the goc trai duoi (tren thanh duoi). Dien thoai: the nho nam ngay tren thanh duoi.
   Khong che nong trai: an khi co bang / cau hoi / huong dan / sang tham / thi tran / ho cau. */
.hn-the {
  position: fixed; left: clamp(10px, 2vw, 20px); bottom: 112px; z-index: 48;
  width: min(360px, calc(100vw - 20px)); max-height: min(440px, calc(100vh - 200px)); overflow-y: auto;
  padding: 10px; border-radius: 18px; background: var(--kem); border: 3px solid var(--vien);
  box-shadow: 0 5px 0 var(--vien), 0 12px 26px rgba(0, 0, 0, 0.2);
  font-family: 'Be Vietnam Pro', sans-serif; color: var(--chu);
}
.hn-the[hidden] { display: none; }
body.co-bang .hn-the, body.co-hd .hn-the, body.kt-cd .hn-the, body.dang-tham .hn-the,
body.o-thi-tran .hn-the, body.o-ho-cau .hn-the { display: none !important; }

.hn-dau { display: grid; grid-template-columns: 1fr auto; align-items: start; gap: 2px 8px; margin-bottom: 8px; }
.hn-dau h2 { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.3; }
.hn-zh {
  grid-column: 1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 0; border: 0; background: none;
  font: inherit; color: var(--mo); text-align: left; cursor: pointer;
}
.hn-zh b { font-family: 'Noto Serif SC', serif; font-size: 0.9rem; font-weight: 700; color: #7a2e1f; }
.hn-zh span { font-size: 0.72rem; font-weight: 600; }
.hn-dong {
  grid-column: 2; grid-row: 1 / span 2; width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 2.5px solid var(--vien); background: #fff; box-shadow: 0 2px 0 var(--vien);
  font: 900 1rem/1 'Be Vietnam Pro', sans-serif; color: var(--chu); cursor: pointer;
}
.hn-dong:active { transform: translateY(2px); box-shadow: none; }

.hn-ds { display: flex; flex-direction: column; gap: 6px; }
.hn-viec {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 48px; padding: 6px 8px;
  border-radius: 14px; border: 2.5px solid var(--vien); background: #fff; box-shadow: 0 2px 0 var(--vien);
  font: inherit; color: var(--chu); text-align: left; text-decoration: none; cursor: pointer;
}
.hn-viec:hover { background: #fff8e0; }
.hn-viec:active { transform: translateY(2px); box-shadow: none; }
.hn-hoc { background: #fff3c4; border-width: 3px; }
.hn-hoc:hover { background: #ffeaa0; }
.hn-hinh { width: 36px; height: 36px; flex: none; display: grid; place-items: center; }
.hn-hinh img { width: 36px; height: 36px; object-fit: contain; }
.hn-emo { font-size: 1.5rem; line-height: 1; }
.hn-chu { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.hn-chu > b { font-size: 0.88rem; font-weight: 800; line-height: 1.3; }
.hn-chu small { font-size: 0.75rem; font-weight: 500; color: var(--mo); line-height: 1.35; }
.hn-dong-zh { display: inline-flex; align-items: baseline; gap: 3px; margin-left: 2px; padding: 0 5px; border-radius: 8px; background: #fdecd8; cursor: pointer; white-space: nowrap; }
.hn-dong-zh b { font-family: 'Noto Serif SC', serif; font-weight: 700; color: #7a2e1f; }
.hn-dong-zh i { font-style: normal; font-size: 0.7rem; font-weight: 600; color: var(--mo); }
.hn-di { flex: none; font-size: 1.3rem; font-weight: 900; color: var(--mo); }
.hn-di-hoc {
  font-size: 0.8rem; padding: 7px 10px; border-radius: 999px; border: 2.5px solid var(--vien);
  background: var(--vang); color: var(--chu); box-shadow: 0 2px 0 var(--vien); white-space: nowrap;
}
.hn-gioi { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; padding: 6px 8px; border-radius: 12px; background: #e6f6dc; font-size: 0.85rem; }
.hn-gioi img { width: 28px; height: 28px; flex: none; }
.hn-trong, .hn-them { margin: 4px 2px 0; font-size: 0.8rem; color: var(--mo); text-align: center; }

/* nut mo lai o cot phai */
.hn-nut {
  position: relative; width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 2.5px solid var(--vien); background: var(--kem); box-shadow: 0 3px 0 var(--vien);
  font-size: 1.25rem; line-height: 1; cursor: pointer;
}
.hn-nut[hidden] { display: none; }
.hn-nut:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--vien); }
.hn-nut[aria-expanded="true"] { background: var(--vang); }
.hn-nut-so {
  position: absolute; right: -5px; top: -5px; min-width: 20px; height: 20px; padding: 0 4px; display: grid; place-items: center;
  border-radius: 999px; border: 2px solid var(--vien); background: var(--do); color: #fff;
  font: 900 0.7rem/1 'Be Vietnam Pro', sans-serif; font-style: normal;
}
.hn-nut-so[hidden] { display: none; }

/* vat duoc chi tren ban do (vai giay) */
.nt-vat.hn-chi { outline: 4px solid var(--vang); outline-offset: 0; border-radius: 10px; background: rgba(255, 213, 79, 0.3); z-index: 900 !important; }
body.nt-ng .nt-vat.hn-chi { outline: none; background: none; }
body.nt-ng .nt-vat.hn-chi .nt-dung { outline: 4px solid var(--vang); outline-offset: 2px; border-radius: 12px; background: rgba(255, 213, 79, 0.25); }

@media (prefers-reduced-motion: no-preference) {
  body:not(.nt-nhe) .hn-the.hn-tu:not([hidden]) { animation: hn-vao 0.35s ease-out; }
  body:not(.nt-nhe) .nt-vat.hn-chi { animation: hn-chop 0.9s ease-in-out infinite; }
  body.nt-ng:not(.nt-nhe) .nt-vat.hn-chi { animation: none; }
  body.nt-ng:not(.nt-nhe) .nt-vat.hn-chi .nt-dung { animation: hn-chop 0.9s ease-in-out infinite; }
}
@keyframes hn-vao { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hn-chop { 50% { outline-color: #fff; } }

@media (max-width: 640px) {
  .hn-the {
    left: 8px; right: 8px; width: auto; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 84px);
    max-height: 50vh; padding: 8px; border-radius: 16px;
  }
  .hn-dau { margin-bottom: 6px; }
  .hn-dau h2 { font-size: 0.92rem; }
  .hn-viec { min-height: 46px; padding: 5px 7px; gap: 7px; }
  .hn-hinh, .hn-hinh img { width: 30px; height: 30px; }
  .hn-chu > b { font-size: 0.82rem; }
  .hn-chu small { font-size: 0.7rem; }
  .hn-viec:not(.hn-hoc) .hn-chu small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hn-zh span { font-size: 0.68rem; }
  body.co-hn .hw-fab-stack { display: none !important; } /* nut noi cua trang nam de len goc the */
}
