:root{
  --nen: #2b1a10;
  --nen-the: #fbf3e3;
  --go1: #e7c69a;
  --go2: #d9b482;
  --vien-go: #7a4a22;
  --chu: #2b1a10;
  --chu-mo: #6b5138;
  --chinh: #c9711f;
  --chinh-dam: #a4590f;
  --chinh-nhat: #fbe4c8;
  --xanh: #1f7a4d;
  --xanh-nhat: #e6f5ec;
  --do: #b3261e;
  --do-nhat: #fbe9e7;
  --vang: #e8b923;
  --r: 12px;
  --font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background: radial-gradient(circle at top, #3a2415 0%, var(--nen) 60%);
  color: var(--chu);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.trang{
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.dau{
  display:flex; align-items:center; gap:10px;
  padding: 14px 4px 18px;
  color: #f6e9d4;
}
.dau .bieu{font-size:28px;}
.dau h1{font-size:20px; margin:0; font-weight:700;}
.dau .phu{font-size:12px; color:#c9a876; margin-top:2px;}

.the{
  background: var(--nen-the);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
  margin-bottom: 14px;
}

h2{font-size:15px; margin:0 0 12px; color:var(--chu-mo); font-weight:700; text-transform:uppercase; letter-spacing:.03em;}

label{display:block; font-size:13px; color:var(--chu-mo); margin:10px 0 4px;}
input[type=text],input[type=password]{
  width:100%; padding:11px 12px; border-radius:8px; border:1px solid #d8c6a8;
  font-size:16px; background:#fff; color:var(--chu);
}
input:focus{outline:2px solid var(--chinh); border-color:var(--chinh);}

button{
  font-family:inherit; cursor:pointer; border:none; border-radius:10px;
  font-size:15px; font-weight:600; padding:12px 16px;
  transition: transform .05s ease, opacity .15s ease;
}
button:active{transform: scale(.97);}
button:disabled{opacity:.5; cursor:not-allowed;}
.nut-chinh{background:var(--chinh); color:#fff; width:100%;}
.nut-chinh:hover{background:var(--chinh-dam);}
.nut-phu{background:#efe3cf; color:var(--chu);}
.nut-do{background:var(--do); color:#fff;}
.nut-xanh{background:var(--xanh); color:#fff;}
.nut-nho{padding:8px 12px; font-size:13px; border-radius:8px;}

.loi{color:var(--do); font-size:13px; margin-top:10px; min-height:1em;}
.mo{color:var(--chu-mo); font-size:13px;}

.hang{display:flex; gap:10px; align-items:center;}
.hang.giua{justify-content:center;}
.hang.day{justify-content:space-between;}

/* ---------- avatar ---------- */
.dt-anh{
  position:relative; display:inline-flex; align-items:center; justify-content:center;
  border-radius:50%; overflow:hidden; flex:none;
  background: hsl(var(--h,210) 55% 42%);
  color:#fff; font-weight:700; line-height:1;
}
.dt-anh::before{ content: attr(data-chu); position:relative; z-index:0; }
.dt-anh img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; z-index:1; background:#eee; }
.dt-anh-nho{ width:26px; height:26px; font-size:12px; }
.dt-anh-vua{ width:38px; height:38px; font-size:15px; }
.dt-anh-lon{ width:52px; height:52px; font-size:20px; box-shadow:0 0 0 3px rgba(255,255,255,.5); }

/* ---------- sanh ---------- */
#tenHienChao{font-weight:700; color:var(--chinh-dam);}
.ds-van{display:flex; flex-direction:column; gap:8px; margin-top:8px;}
.dong-van{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:12px 14px; border-radius:10px; background:#f3e6cd;
  cursor:pointer; border:1px solid #e3cfa4;
}
.dong-van:hover{background:#eedcb8;}
.dong-van .trai{display:flex; align-items:center; gap:10px; min-width:0;}
.dong-van .doi{font-weight:600;}
.dong-van .tt{font-size:12px; padding:3px 8px; border-radius:20px; font-weight:700;}
.tt-cho{background:#fdf0d5; color:#8a6100;}
.tt-luot-ban{background:var(--xanh-nhat); color:var(--xanh);}
.tt-luot-doi{background:#eee; color:#777;}
.tt-thang{background:var(--xanh-nhat); color:var(--xanh);}
.tt-thua{background:var(--do-nhat); color:var(--do);}
.tt-hoa{background:#eee; color:#666;}
.rong{color:var(--chu-mo); font-size:14px; padding:10px 2px;}

.hop-link{
  display:flex; gap:8px; margin-top:12px;
}
.hop-link input{flex:1; font-size:14px; background:#fff;}

/* ---------- ván ---------- */
.thanh-doi{
  display:flex; justify-content:space-between; align-items:center; gap:8px;
  background: var(--nen-the); border-radius: var(--r); padding:12px 14px; margin-bottom:12px;
}
.the-nguoi{display:flex; align-items:center; gap:8px; font-weight:700; min-width:0;}
.the-nguoi .ten{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.the-nguoi .quan-mini{width:16px; height:16px; flex:none;}
.the-nguoi.mo{opacity:.4;}
.the-nguoi.luot{box-shadow:0 0 0 2px var(--chinh); border-radius:999px; padding:4px 8px 4px 4px; margin:-4px -8px -4px -4px;}
.quan-mini{border-radius:50%;}
.quan-mini.den{background:radial-gradient(circle at 35% 30%, #555, #000 70%);}
.quan-mini.trang{background:radial-gradient(circle at 35% 30%, #fff, #d8d8d8 75%); border:1px solid #bbb;}
.vs-giua{display:flex; flex-direction:column; align-items:center; gap:2px; flex:none;}
.vs-giua .vs{color:var(--chu-mo); font-size:11px;}
.ti-so{font-size:20px; font-weight:800; color:var(--chinh-dam); letter-spacing:.02em; white-space:nowrap;}

#thongBao{
  text-align:center; font-size:14px; font-weight:600; color:#f6e9d4;
  min-height:20px; margin-bottom:10px;
}

.khung-ban{
  background: linear-gradient(135deg, var(--go1), var(--go2));
  border: 8px solid var(--vien-go);
  border-radius:8px;
  padding:4px;
  box-shadow: 0 8px 26px rgba(0,0,0,.4);
  touch-action: manipulation;
}
#banCo{
  display:grid;
  grid-template-columns: repeat(15, 1fr);
  aspect-ratio: 1/1;
  width:100%;
  background-image:
    linear-gradient(to right, var(--vien-go) 1px, transparent 1px),
    linear-gradient(to bottom, var(--vien-go) 1px, transparent 1px);
  background-size: calc(100% / 15) calc(100% / 15);
}
.o{
  position:relative;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
}
.o .quan{
  width:82%; height:82%; border-radius:50%;
  animation: dat .12s ease-out;
}
.o .quan.den{background:radial-gradient(circle at 35% 28%, #6b6b6b, #0a0a0a 70%); box-shadow:0 2px 3px rgba(0,0,0,.5);}
.o .quan.trang{background:radial-gradient(circle at 35% 28%, #ffffff, #cfcfcf 78%); box-shadow:0 2px 3px rgba(0,0,0,.35);}
.o.thang{background: rgba(232,185,35,.55); box-shadow: inset 0 0 0 2px var(--vang);}
.o.moi .quan{box-shadow: 0 0 0 3px rgba(201,113,31,.8), 0 2px 3px rgba(0,0,0,.5);}
@keyframes dat{ from{ transform:scale(.3); opacity:.2;} to{ transform:scale(1); opacity:1;} }

.thanh-nut{display:flex; gap:10px; margin-top:14px;}
.thanh-nut button{flex:1;}

.man-ket{
  position:fixed; inset:0; background:rgba(20,10,4,.72);
  display:flex; align-items:center; justify-content:center; padding:20px;
  z-index:20;
}
.hop-ket{
  background:var(--nen-the); border-radius:16px; padding:26px 24px; text-align:center;
  max-width:340px; width:100%;
  box-shadow:0 10px 40px rgba(0,0,0,.5);
}
.hop-ket .bieu-lon{font-size:44px; margin-bottom:8px;}
.hop-ket h3{margin:0 0 6px; font-size:20px;}
.hop-ket p{margin:0 0 18px; color:var(--chu-mo); font-size:14px;}
.hop-ket .thanh-nut{margin-top:0;}

@media (max-width:480px){
  .the{padding:14px;}
  .dau h1{font-size:18px;}
}
