/* ================================================================ nền tảng */
:root {
  --bg: #0b0f14; --bg-2: #10161d; --panel: #141b24; --line: #223040;
  --text: #e8eef5; --muted: #93a4b8; --dim: #6f8196;
  --green: #7cff6b; --teal: #22d3ee; --gold: #fbbf24; --red: #f87171;
  --header-h: 60px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.6;
}
a { color: var(--teal); }
.container { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: 8px; }
section[id], #choi { scroll-margin-top: 12px; }

/* ================================================================ header */
.site-header { height: var(--header-h); background: rgba(11,15,20,0.92); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 900; font-size: 22px; letter-spacing: -0.5px; }
.brand b { color: var(--green); }
.site-nav { display: flex; gap: 4px; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 10px; }
.site-nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.site-nav a:first-child { color: #062014; background: var(--green); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); color: var(--text); font-size: 20px; border-radius: 10px; width: 42px; height: 38px; cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .site-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column;
    background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 8px 16px 14px; }
  .site-nav.open { display: flex; }
}

/* ================================================================ khung game */
.game-wrap {
  position: relative; overflow: hidden; background: #0d1116;
  height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); min-height: 520px;
  -webkit-user-select: none; user-select: none;
}
.game-wrap:fullscreen { height: 100vh; min-height: 0; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
#hud, #boostBtn { touch-action: none; }
.fs-btn { position: absolute; left: 12px; top: 12px; z-index: 6; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15); background: rgba(10,14,19,0.55); color: #fff; font-size: 18px; cursor: pointer; }
.fs-btn:hover { background: rgba(10,14,19,0.8); }

.game-wrap .overlay {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(8, 11, 15, 0.45);
}
.game-wrap .card {
  width: 100%; max-width: 380px; text-align: center; max-height: 100%; overflow-y: auto;
  background: rgba(20, 27, 35, 0.9); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); backdrop-filter: blur(6px);
}
.game-wrap .card.wide { max-width: 460px; }
.logo-big { font-size: 52px; font-weight: 900; letter-spacing: -1px; line-height: 1.1; margin-bottom: 14px;
  background: linear-gradient(90deg, #7cff6b, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-big span { color: var(--text); -webkit-text-fill-color: var(--text); font-weight: 700; font-size: 32px; }
.card-title { font-size: 26px; font-weight: 800; margin: 0 0 8px; }
.game-wrap input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid #2b3846;
  background: #0f151c; color: #fff; font-size: 16px; outline: none; margin-bottom: 10px; -webkit-user-select: text; user-select: text; }
.game-wrap input:focus { border-color: var(--teal); }
#name { text-align: center; font-size: 17px; }

.btn { width: 100%; padding: 13px; border: 0; border-radius: 12px; cursor: pointer; font-size: 18px; font-weight: 800; color: #062014;
  background: linear-gradient(90deg, #7cff6b, #34d399); box-shadow: 0 6px 20px rgba(52, 211, 153, 0.35); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border: 2px solid #334255; box-shadow: none; font-weight: 700; }
.btn.sm { padding: 9px; font-size: 14px; }
.link { margin-top: 10px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; text-decoration: underline; }
.row { display: flex; gap: 8px; }
.row .btn { flex: 1; }
.help { margin: 14px 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.6; }
#status { margin: 8px 0 0; color: var(--gold); font-size: 13px; min-height: 1em; }
.muted { color: #8595a7; font-size: 12.5px; }
.small { font-size: 12px; margin: 0 0 10px; }
.warn { color: var(--gold); font-size: 13.5px; }

/* chọn mẫu rắn */
#skins { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 4px 0 6px; }
.skin { border-radius: 12px; padding: 4px 2px 6px; cursor: pointer; border: 2px solid #243040; background: #0f151c;
  color: #9fb0c2; display: flex; flex-direction: column; align-items: center; }
.skin canvas { width: 100%; height: 44px; display: block; }
.skin span { font-size: 10.5px; font-weight: 700; line-height: 1.2; }
.skin:hover { border-color: #3a4a5e; }
.skin.sel { border-color: var(--green); background: rgba(124,255,107,0.08); color: #fff; }
#hues { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 8px 0 4px; }
.hue { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; cursor: pointer; }
.hue.sel { border-color: #fff; transform: scale(1.15); }
@media (max-width: 440px) { #skins { grid-template-columns: repeat(3, 1fr); } }

/* 2 chế độ trong sảnh */
.mode { text-align: left; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 14px; padding: 14px; margin-top: 12px; }
.mode.paid { border-color: rgba(251,191,36,0.25); background: rgba(251,191,36,0.04); }
.mode-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.mode-title { font-size: 16px; font-weight: 800; }
.balance { font-size: 13px; color: #cbd5e1; }
.balance b { color: var(--gold); font-size: 16px; }
.small-btns { margin-top: 10px; }
#tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tier { border: 2px solid rgba(251,191,36,0.4); background: rgba(251,191,36,0.08); color: #fff; border-radius: 12px; padding: 10px 6px; cursor: pointer; text-align: center; line-height: 1.35; }
.tier:hover { background: rgba(251,191,36,0.16); }
.tier b { display: block; font-size: 18px; color: var(--gold); }
.tier span { display: block; font-size: 11.5px; color: #cbd5e1; margin-top: 2px; }

/* modal phòng / ví */
#roomList { max-height: 240px; overflow-y: auto; margin: 10px 0 12px; text-align: left; }
.roomItem { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.04); margin-bottom: 6px; }
.roomItem button { padding: 6px 14px; width: auto; font-size: 14px; }
#roomCode { text-transform: uppercase; text-align: center; margin: 0; }
#createRoom { margin-top: 10px; }
.tabs { display: flex; gap: 6px; margin: 12px 0 14px; }
.tabs button { flex: 1; padding: 9px; border-radius: 10px; border: 0; background: #1c2631; color: #9fb0c2; cursor: pointer; font-weight: 700; }
.tabs button.on { background: var(--teal); color: #062030; }
#historyList { list-style: none; padding: 0; margin: 0; max-height: 280px; overflow-y: auto; text-align: left; font-size: 13px; }
#historyList li { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
#historyList .plus { color: #4ade80; } #historyList .minus { color: var(--red); }

/* hàng chờ, chết */
#qCount { font-size: 40px; font-weight: 900; margin: 8px 0; }
.qbar { height: 10px; border-radius: 6px; background: #1c2631; overflow: hidden; margin-bottom: 14px; }
#qFill { height: 100%; width: 0; background: linear-gradient(90deg, #fbbf24, #f97316); transition: width .3s; }
#qPrize { color: #cbd5e1; }
#deathText { color: #cbd5e1; font-size: 16px; margin: 0 0 18px; }
#death .btn { margin-top: 8px; }

/* HUD trong trận */
#score { position: absolute; left: 16px; bottom: 16px; font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6); pointer-events: none; }
#score b { font-size: 26px; color: #fff; }
#lb { position: absolute; right: 16px; top: 16px; width: 200px; pointer-events: none; line-height: 1.5;
  background: rgba(10, 14, 19, 0.45); border-radius: 12px; padding: 10px 12px; font-size: 13px; }
.lb-title { margin: 0 0 6px; font-size: 13px; color: #9fb0c2; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
#lbList { margin: 0; padding-left: 22px; }
#lbList li { color: rgba(255,255,255,0.75); }
#lbList li.me { color: var(--green); font-weight: 700; }
#lbList li span.n { display: inline-block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
#lbList li span.m { float: right; font-variant-numeric: tabular-nums; }
#rank { margin-top: 6px; color: var(--gold); font-weight: 700; }
#minimap { position: absolute; right: 16px; bottom: 16px; width: 140px; height: 140px; pointer-events: none; }
#boostBtn { display: none; position: absolute; left: 20px; bottom: 60px; width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); background: rgba(34, 211, 238, 0.25); color: #fff; font-size: 30px; }
#paidBar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); pointer-events: none;
  background: rgba(10,14,19,0.6); border: 1px solid rgba(251,191,36,0.35); border-radius: 12px;
  padding: 8px 16px; font-size: 14px; font-weight: 700; white-space: nowrap; }
#paidBar .gold { color: var(--gold); }
#paidBar .red { color: var(--red); }
#toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: #1c2631; border: 1px solid #334255; padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100% - 32px); }
#toast.err { border-color: var(--red); }
@media (pointer: coarse) {
  #boostBtn { display: block; }
  #lb { width: 160px; font-size: 11.5px; padding: 8px 10px; }
  #lbList li span.n { max-width: 80px; }
  #minimap { width: 100px; height: 100px; }
  #score { left: auto; right: 124px; font-size: 13px; }
  #score b { font-size: 20px; }
}
@media (max-width: 600px) { #paidBar { top: auto; bottom: 130px; font-size: 12px; white-space: normal; text-align: center; width: calc(100% - 32px); } }

/* ================================================================ nội dung */
.content { padding-top: 48px; padding-bottom: 32px; }
.content section { padding: 32px 0; border-bottom: 1px solid var(--line); }
.content section:last-child { border-bottom: 0; }
.content h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.2; margin: 0 0 14px; letter-spacing: -0.5px; }
.content h2 { font-size: clamp(22px, 3vw, 28px); line-height: 1.25; margin: 0 0 16px; }
.content h3 { font-size: 18px; margin: 0 0 6px; }
.content p { color: #c6d2df; margin: 0 0 12px; }
.lead { font-size: 17px; max-width: 820px; }
.highlights { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.highlights li { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.highlights b { display: block; color: var(--green); font-size: 16px; }
.highlights span { color: var(--muted); font-size: 14px; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .highlights, .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .highlights, .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: step; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 14px; }
.steps li::before { content: counter(step); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--green); color: #062014; font-weight: 900; margin-bottom: 10px; }
.steps p { font-size: 14.5px; margin: 0; }
.keys { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; color: var(--muted); font-size: 14px; }
kbd { display: inline-block; background: #1c2631; border: 1px solid #334255; border-bottom-width: 3px; border-radius: 6px; padding: 1px 8px; color: var(--text); font-family: inherit; font-size: 13px; }

.modes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.mode-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.mode-card.paid { border-color: rgba(251,191,36,0.35); }
.mode-card ul { margin: 6px 0 0; padding-left: 20px; color: var(--muted); font-size: 14.5px; }

.skins-gallery { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 900px) { .skins-gallery { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .skins-gallery { grid-template-columns: repeat(2, 1fr); } }
.skin-card { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.skin-card canvas { width: 100%; height: 110px; display: block; background: #10151b; }
.skin-card figcaption { padding: 10px 12px 12px; }
.skin-card b { display: block; }
.skin-card span { color: var(--muted); font-size: 13px; line-height: 1.45; display: block; }

.tips { padding-left: 20px; margin: 0; }
.tips li { margin-bottom: 8px; color: #c6d2df; }
.tips b { color: var(--text); }

details { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 700; padding: 14px 0; }
details p { margin: 0 0 14px; }

/* ================================================================ footer */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--line); margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 24px; padding-top: 36px; padding-bottom: 24px; }
.footer-grid p { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.footer-grid nav { display: flex; flex-direction: column; gap: 6px; }
.footer-grid nav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.footer-grid nav a:hover { color: var(--text); }
.footer-title { font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.footer-bottom { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 20px; color: var(--dim); font-size: 13px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand, .footer-note { grid-column: 1 / -1; } }

/* ================================================================ GEO: thông tin nhanh, so sánh, ngôn ngữ */
.updated { color: var(--dim); font-size: 13px; margin: -6px 0 12px; }
.content h2#quick-facts { margin-top: 36px; }
.facts-wrap { overflow-x: auto; }
.facts { border-collapse: collapse; width: 100%; max-width: 820px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 15px; }
.facts th, .facts td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }
.facts th { color: var(--muted); font-weight: 600; width: 190px; white-space: nowrap; }
.facts td { color: #c6d2df; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0 12px; }
.compare-col { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.compare-col ul { margin: 6px 0 0; padding-left: 20px; color: #c6d2df; }
.compare-col li { margin-bottom: 6px; }
@media (max-width: 760px) { .compare { grid-template-columns: 1fr; } .facts th { width: auto; white-space: normal; } }
.muted-note { color: var(--dim) !important; font-size: 13.5px; }
.disclaimer { margin: 8px 0 0; color: var(--dim); font-size: 12.5px; line-height: 1.5; }
.footer-bottom a { color: var(--muted); }
.site-nav a.lang-switch { color: var(--text); border: 1px solid var(--line); }

/* ================================================================ đa ngôn ngữ */
.lang-menu { position: relative; }
.lang-menu summary { list-style: none; cursor: pointer; color: var(--text); font-weight: 600; font-size: 15px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; white-space: nowrap; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-list { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 30; min-width: 190px; max-height: 70vh; overflow-y: auto;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: grid; gap: 2px; box-shadow: 0 12px 30px rgba(0,0,0,0.45); }
.site-nav .lang-list a { color: var(--muted); background: none; padding: 7px 10px; border-radius: 8px; }
.site-nav .lang-list a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.site-nav .lang-list a[aria-current="page"] { color: #062014; background: var(--green); }
@media (max-width: 760px) { .lang-list { position: static; box-shadow: none; margin-top: 6px; } }
.footer-langs { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-bottom: 14px; font-size: 13.5px; }
.footer-langs a { color: var(--muted); text-decoration: none; }
.footer-langs a:hover, .footer-langs a[aria-current="page"] { color: var(--text); }

/* tiếng Ả Rập: viết từ phải sang trái (khung game vẫn giữ trái→phải) */
[dir="rtl"] .facts th, [dir="rtl"] .facts td { text-align: right; }
[dir="rtl"] .mode, [dir="rtl"] #roomList, [dir="rtl"] #historyList { text-align: right; }
[dir="rtl"] .compare-col ul, [dir="rtl"] .mode-card ul, [dir="rtl"] .tips { padding-left: 0; padding-right: 20px; }
