:root {
  color-scheme: light;
  --nen: #FBF3EA; --the: #FFFDF9; --vang: #D9A531; --vang-dam: #A87818; --vang-nhat: #FFF4D6;
  --chu: #4A3A2C; --mo: #9B8A78; --xanh: #4F9A6B; --xanh-nhat: #DCEFE2; --do: #D0605A; --do-nhat: #F8DCD9;
  --vien: #EFE1CF; --cam-nhat: #FBE6C8;
  --tren: env(safe-area-inset-top, 0px); --duoi: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--nen); color: var(--chu); }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--chu); width: 100%; padding: 11px 12px; border: 1px solid var(--vien); border-radius: 12px; background: #fff; margin-top: 4px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--vang); border-color: transparent; }
input:disabled { background: #f4ede4; color: var(--mo); }
select { -webkit-appearance: none; appearance: none; }
label { display: block; font-size: 14px; color: var(--mo); margin: 10px 0 0; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 15px; color: var(--vang-dam); margin: 20px 4px 8px; }
p { margin: 8px 0; }

main { padding: 12px 14px 32px; max-width: 560px; margin: 0 auto; }
main.co-duoi { padding-top: calc(12px + var(--tren)); padding-bottom: calc(96px + var(--duoi)); }
.dau { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--tren)) 10px 8px; background: var(--nen); border-bottom: 1px solid var(--vien); }
.dau h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lui { font-size: 30px; line-height: 1; width: 40px; height: 40px; color: var(--vang-dam); }
.tieu-de-tab { font-size: 22px; margin: 4px 2px 12px; }

.chao { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chao img { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; }
.chao b { font-size: 20px; }

.the { background: var(--the); border: 1px solid var(--vien); border-radius: 16px; overflow: hidden; margin-bottom: 10px; }
.the.form, .the.noi { padding: 4px 14px 14px; }
.the.noi { padding-top: 12px; display: grid; gap: 8px; }
.the.noi textarea { margin: 0; resize: none; }
.the.anh { padding: 10px; text-align: center; }
.the.anh img { max-width: 100%; max-height: 360px; border-radius: 10px; display: block; margin: 0 auto 6px; }
.the-vang { background: linear-gradient(135deg, #F7DC8F, #E9B84A); border-radius: 20px; padding: 16px 18px; margin-bottom: 6px; box-shadow: 0 6px 18px rgba(169, 120, 24, .18); }
.the-vang.nho-hon { margin-bottom: 12px; }
.the-vang .nho { font-size: 13px; }
.so-to { font-size: 26px; font-weight: 700; letter-spacing: .2px; }
.so-vua { font-size: 22px; font-weight: 700; }
.vach { height: 1px; background: rgba(255, 255, 255, .6); margin: 10px 0; }
.ghi-chu { font-size: 11px; margin-top: 6px; }
.mat { width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .55); font-size: 20px; }

.hang { display: flex; align-items: center; gap: 8px; }
.gian { flex: 1; min-width: 0; }
.dong { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border-top: 1px solid var(--vien); min-height: 52px; }
.dong:first-child { border-top: 0; }
.dong[data-k]:active, .dong .trai[data-k]:active { background: var(--vang-nhat); }
.dong .trai { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dong .phai { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dong .phu { font-size: 12.5px; color: var(--mo); margin-top: 2px; }
.mui { color: var(--mo); font-size: 20px; margin-left: -4px; }
.nhan { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: var(--vang-nhat); color: var(--vang-dam); margin-left: 6px; vertical-align: 2px; font-weight: 600; }
.nhan.xanh { background: var(--xanh-nhat); color: var(--xanh); }
.nhan.cam { background: var(--cam-nhat); color: #B5651D; }
.xanh { color: var(--xanh); }
.do { color: var(--do); }
.mo { color: var(--mo); }
.nho { font-size: 13px; }
.giua { text-align: center; }
.cham { letter-spacing: 1px; font-size: 10px; }
.ngay-nhom { font-size: 13px; color: var(--mo); margin: 14px 4px 6px; font-weight: 600; }

.nut-vang { display: block; width: 100%; padding: 14px; border-radius: 14px; background: var(--vang); color: #fff; font-weight: 700; margin: 12px 0; box-shadow: 0 3px 10px rgba(169, 120, 24, .25); }
.nut-vang.nho { padding: 10px; margin: 0; }
.nut-vang:active, .nut-tron:active, .nut-vien:active { transform: scale(.98); }
.nut-vien { display: block; width: 100%; padding: 12px; border-radius: 14px; border: 1.5px dashed var(--vang); color: var(--vang-dam); font-weight: 600; margin: 4px 0 8px; }
.nut-tron { padding: 12px 8px; border-radius: 14px; background: var(--the); border: 1px solid var(--vien); font-size: 15px; }
.nut-tron.vuong { width: 42px; height: 42px; padding: 0; font-size: 20px; }
.nut-chu { color: var(--vang-dam); padding: 8px; font-weight: 600; }
.nut-chu.do { color: var(--do); }
.nut-chu.giua { display: block; margin: 4px auto; }
.luoi2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.luoi3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 8px 0; }
.the .luoi2 { margin: 0; }
.tom .o-so { background: var(--the); border: 1px solid var(--vien); border-radius: 14px; padding: 10px; text-align: center; }
.tom .o-so b { display: block; font-size: 14.5px; margin-top: 2px; overflow-wrap: anywhere; }
.tom .o-so .mo { font-size: 12px; }
.so-nguoi { min-width: 28px; text-align: center; font-size: 18px; }
.hang.nguoi { margin-top: 8px; }
.hang.nguoi input { margin: 0; }
.tien.hep { width: 130px; flex: none; text-align: right; }
.form > .hang { margin-top: 12px; }

.chon2 { display: grid; grid-template-columns: 1fr 1fr; background: #F1E6D7; border-radius: 14px; padding: 4px; margin: 10px 0; }
.chon2 button { padding: 10px; border-radius: 11px; font-weight: 600; color: var(--mo); }
.chon2 button.chon.chi { background: var(--do); color: #fff; }
.chon2 button.chon.thu { background: var(--xanh); color: #fff; }
.chon2.khoa { opacity: .7; }
.chip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip button { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--vien); background: #fff; font-size: 14px; }
.chip button.chon { background: #F7DC8F; border-color: var(--vang); font-weight: 600; }
.chip.hai { display: grid; grid-template-columns: 1fr 1fr; }
.chip.hai button { border-radius: 12px; padding: 10px 6px; }

.bao { background: var(--vang-nhat); border: 1px solid #F1D9A0; border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14px; }
.bao.vang { background: #FFF8E6; }
.bao.xanh { background: var(--xanh-nhat); border-color: #BFDFC9; color: var(--xanh); text-align: center; }
.chuyen-thang { display: flex; align-items: center; justify-content: space-between; background: var(--the); border: 1px solid var(--vien); border-radius: 14px; padding: 4px; }
.chuyen-thang button { width: 44px; height: 40px; font-size: 24px; color: var(--vang-dam); }
.o-tick { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 2px solid var(--vang); color: #fff; font-weight: 700; }
.o-tick.da { background: var(--xanh); border-color: var(--xanh); }

/* Thanh duoi */
.duoi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: rgba(255, 253, 249, .96); border-top: 1px solid var(--vien); padding: 6px 4px calc(6px + var(--duoi)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.tab { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--mo); padding: 2px 0; }
.tab span { font-size: 21px; filter: grayscale(.6); opacity: .8; }
.tab.chon { color: var(--vang-dam); font-weight: 700; }
.tab.chon span { filter: none; opacity: 1; }
.cong { justify-self: center; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #F7DC8F, #E9B84A); color: #fff; font-size: 30px; font-weight: 700; box-shadow: 0 4px 14px rgba(169, 120, 24, .35); margin-top: -22px; }

/* Hop thoai */
#lop:empty { display: none; }
.man-mo { position: fixed; inset: 0; background: rgba(60, 40, 20, .35); z-index: 20; }
.hop { position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--nen); border-radius: 22px 22px 0 0; padding: 18px 16px calc(14px + var(--duoi)); max-height: 88vh; overflow-y: auto; max-width: 560px; margin: 0 auto; animation: len .18s ease-out; }
@keyframes len { from { transform: translateY(30px); opacity: .6; } }
.hop h3 { font-size: 18px; margin-bottom: 6px; }
.nut-hop { display: flex; gap: 8px; margin-top: 16px; }
.nut-hop button { flex: 1; padding: 13px; border-radius: 14px; background: var(--the); border: 1px solid var(--vien); font-weight: 600; }
.nut-hop button.chinh { background: var(--vang); border-color: var(--vang); color: #fff; }
.nut-hop button.do { background: var(--do); border-color: var(--do); color: #fff; }
.ds-chon { display: grid; gap: 8px; margin-top: 8px; }
.ds-chon button { display: flex; justify-content: space-between; gap: 8px; padding: 14px; border-radius: 14px; background: var(--the); border: 1px solid var(--vien); text-align: left; }
.ds-chon.to button { font-size: 17px; padding: 16px; }
.buoc { padding-left: 22px; }
.buoc li { margin: 6px 0; }

/* Khoa va che man hinh */
#khoa { display: none; }
#khoa.hien { display: block; position: fixed; inset: 0; z-index: 50; background: var(--nen); }
.man-khoa { max-width: 340px; margin: 0 auto; padding: calc(70px + var(--tren)) 24px 24px; text-align: center; }
.man-khoa img { width: 110px; height: 110px; border-radius: 26px; object-fit: cover; box-shadow: 0 8px 24px rgba(169, 120, 24, .25); }
.man-khoa h2 { color: var(--chu); font-size: 22px; margin: 14px 0 22px; }
.man-khoa .ma input { margin: 0; text-align: center; letter-spacing: 6px; }
.man-khoa .ma .nut-tron { padding: 11px 18px; }
#che { display: none; }
#che.hien { display: flex; position: fixed; inset: 0; z-index: 60; background: var(--nen); align-items: center; justify-content: center; }
#che img { width: 120px; height: 120px; border-radius: 28px; }
#bao { position: fixed; left: 50%; bottom: calc(100px + var(--duoi)); transform: translate(-50%, 20px); background: rgba(74, 58, 44, .92); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: 86vw; text-align: center; }
#bao.hien { opacity: 1; transform: translate(-50%, 0); }
.nut-sao-luu { display: flex; flex-direction: column; align-items: center; padding: 7px 12px; border-radius: 14px; background: var(--the); border: 1.5px solid var(--vang); color: var(--vang-dam); font-weight: 700; font-size: 14px; line-height: 1.2; }
.nut-sao-luu small { font-weight: 400; font-size: 10.5px; color: var(--mo); margin-top: 2px; }
.nut-sao-luu:active { background: var(--vang-nhat); }
