:root {
  --nen: #f4f2fb;
  --the: #ffffff;
  --chu: #26233a;
  --mo: #6e6a86;
  --chinh: #3b3486;
  --chinh-nhat: #e6e3fa;
  --cua-toi: #5b51d8;
  --xanh: #2f9e6f;
  --do: #d9485f;
  --vien: #e3e0ef;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--nen); color: var(--chu); font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body { overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { height: 100dvh; max-width: 640px; margin: 0 auto; position: relative; overflow: hidden; background: var(--nen); }

.man { display: none; height: 100%; flex-direction: column; overflow-y: auto; }
.man.hien { display: flex; }
.giua { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 12px; text-align: center; }
.logo { font-size: 56px; }
.ten-app { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: .2px; }
.ten-app span:nth-child(1) { color: #5b51d8; }
.ten-app span:nth-child(2) { color: #d9485f; }
.ten-app span:nth-child(3) { color: #2f9e6f; }
.ten-app span:nth-child(4) { color: #e08a1e; }
.ten-app.nho { font-size: 21px; flex: 1; }
.mo-ta { color: var(--mo); margin: 0 0 12px; max-width: 320px; }

.nut { display: block; width: 100%; max-width: 340px; border: 0; border-radius: 14px; padding: 14px 16px; font-weight: 700; font-size: 17px; }
.nut.chinh { background: var(--chinh); color: #fff; }
.nut.phu { background: var(--chinh-nhat); color: var(--chinh); }
.nut:disabled { opacity: .6; }
.nut-nho { border: 0; border-radius: 10px; padding: 7px 12px; background: var(--chinh); color: #fff; font-weight: 600; font-size: 14px; }
.nut-nho.phu { background: var(--chinh-nhat); color: var(--chinh); }
.nut-nho.do { background: var(--do); }
.nut-icon { border: 0; background: none; font-size: 22px; padding: 6px 8px; line-height: 1; display: inline-flex; align-items: center; }
.nut-ve { border: 0; background: none; font-size: 34px; line-height: 1; padding: 0 10px 4px 0; color: var(--chinh); }

.dau { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--the); border-bottom: 1px solid var(--vien); position: sticky; top: 0; z-index: 2; min-height: 56px; }
.dau h2 { margin: 0; font-size: 19px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bieu-mau { display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; width: 100%; max-width: 420px; margin: 0 auto; text-align: left; }
.bieu-mau.hep { max-width: 340px; padding: 8px 0; }
.bieu-mau label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.bieu-mau input { width: 100%; border: 1.5px solid var(--vien); border-radius: 12px; padding: 12px; background: var(--the); font-size: 17px; }
.bieu-mau input:focus { outline: none; border-color: var(--cua-toi); }
.o-mk { position: relative; display: block; }
.o-mk input { padding-right: 48px; }
.mat { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 20px; padding: 6px; }
.ghi { margin: -4px 0 4px; color: var(--mo); font-size: 14px; }
.canh-bao { margin: 4px 0; padding: 10px 12px; border-radius: 12px; background: #fff4e0; color: #8a5300; font-size: 14px; }
.loi { margin: 0; color: var(--do); font-weight: 600; }

.luat { padding: 8px 20px 28px; color: var(--mo); font-size: 14px; }
.luat h2 { font-size: 16px; color: var(--chu); margin: 0 0 6px; }
.luat ul { margin: 0; padding-left: 18px; }

.bang { margin: 10px 12px 0; padding: 10px 12px; border-radius: 12px; background: var(--chinh-nhat); color: var(--chinh); font-size: 14px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.ds { display: flex; flex-direction: column; padding: 6px 0 90px; }
.ban { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: none; border: 0; text-align: left; width: 100%; border-bottom: 1px solid var(--vien); }
.anh-dai-dien { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 19px; flex: none; text-transform: uppercase; }
.ban-chu { flex: 1; min-width: 0; }
.ban-ten { font-weight: 700; }
.ban-xem { color: var(--mo); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ban.moi .ban-xem { color: var(--chu); font-weight: 600; }
.cham { width: 11px; height: 11px; border-radius: 50%; background: var(--do); flex: none; }
.loi-moi { margin: 10px 12px 0; padding: 12px; border-radius: 12px; background: var(--the); border: 1px solid var(--vien); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.loi-moi b { flex: 1; }
.trong { text-align: center; color: var(--mo); padding: 40px 24px; }
.nut-noi { position: absolute; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 28px; padding: 14px 20px; background: var(--chinh); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 6px 18px rgba(59,52,134,.3); }

#man-chat { overflow: hidden; }
.ds-tin { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.tin { max-width: 80%; align-self: flex-start; display: flex; flex-direction: column; align-items: flex-start; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tin.cua-toi { align-self: flex-end; align-items: flex-end; }
.bong { padding: 8px 12px; border-radius: 18px; background: var(--the); border: 1px solid var(--vien); white-space: pre-wrap; word-break: break-word; }
.tin.cua-toi .bong { background: var(--cua-toi); color: #fff; border-color: var(--cua-toi); }
.tin.thu-hoi .bong { background: none; color: var(--mo); font-style: italic; border: 1px dashed var(--vien); }
.tin.chon .bong { outline: 3px solid #f2b705; }
.bong .anh { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); margin: 2px 0; }
.bong .anh img { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; display: block; }
.phu-de { font-size: 11px; color: var(--mo); margin: 1px 6px 4px; display: flex; gap: 6px; }
.da-sua { color: var(--do); font-weight: 700; }
.ngay { align-self: center; font-size: 12px; color: var(--mo); background: var(--chinh-nhat); border-radius: 10px; padding: 2px 10px; margin: 8px 0; }
.thanh-chon, .thanh-sua { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff7d6; border-top: 1px solid var(--vien); }
.thanh-chon span, .thanh-sua { flex: 1; font-weight: 600; }
.thanh-sua { justify-content: space-between; }
.anh-cho { display: flex; gap: 6px; padding: 0 10px; }
.anh-cho:not(:empty) { padding: 8px 10px 0; background: var(--the); border-top: 1px solid var(--vien); }
.anh-cho div { position: relative; }
.anh-cho img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; display: block; }
.anh-cho button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--do); color: #fff; font-size: 12px; line-height: 22px; padding: 0; }
.bang-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 8px; background: var(--the); border-top: 1px solid var(--vien); max-height: 190px; overflow-y: auto; }
.bang-emoji button { border: 0; background: none; font-size: 26px; padding: 4px 0; }
.o-gui { display: flex; align-items: flex-end; gap: 2px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--the); border-top: 1px solid var(--vien); }
.o-gui textarea { flex: 1; resize: none; border: 1.5px solid var(--vien); border-radius: 20px; padding: 9px 14px; max-height: 120px; background: var(--nen); font-size: 16px; }
.o-gui textarea:focus { outline: none; border-color: var(--cua-toi); }
.nut-gui { border: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--cua-toi); color: #fff; font-size: 19px; flex: none; margin-left: 4px; }

.lop-goi { position: absolute; inset: 0; z-index: 20; background: linear-gradient(180deg, #2b2566, #3b3486 60%, #5b51d8); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; }
.lop-goi[hidden], .lop-anh[hidden], .lop-menu[hidden], .toast[hidden], .bang[hidden], .thanh-chon[hidden], .thanh-sua[hidden], .bang-emoji[hidden] { display: none; }
.goi-ten { font-size: 32px; font-weight: 800; color: #ffd46b; }
.goi-trang-thai { font-size: 18px; opacity: .9; min-height: 26px; }
.goi-nut { display: flex; gap: 34px; margin-top: 70px; }
.goi-nhan { display: flex; gap: 34px; font-size: 14px; opacity: .85; }
.goi-nhan span { width: 72px; text-align: center; }
.tron { width: 72px; height: 72px; border-radius: 50%; border: 0; font-size: 28px; color: #fff; }
.tron.xanh { background: #2fb36f; animation: rung 1s infinite; }
.tron.do { background: var(--do); }
.tron.xam { background: rgba(255,255,255,.2); }
.tron.xam.tat { background: #fff; color: var(--do); }
@keyframes rung { 0%,100% { transform: rotate(0); } 20% { transform: rotate(-12deg); } 40% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } }

.lop-anh { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lop-anh img { max-width: 100%; max-height: 100%; }
.lop-menu { position: absolute; inset: 0; z-index: 25; background: rgba(20,16,50,.35); display: flex; align-items: flex-end; }
.menu { width: 100%; background: var(--the); border-radius: 18px 18px 0 0; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
.menu .tieu-de { padding: 8px 18px 10px; color: var(--mo); font-size: 14px; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 14px 20px; font-size: 17px; }
.menu button.do { color: var(--do); font-weight: 600; }
.menu input { margin: 0 16px 8px; width: calc(100% - 32px); border: 1.5px solid var(--vien); border-radius: 12px; padding: 12px; font-size: 17px; }
.toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 40; background: #26233a; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: 90%; text-align: center; }
.chia-se { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--chinh-nhat); color: #1c7ed6; padding: 0; }
.dau.trong-suot { background: none; border: 0; }
.gian { flex: 1; }
