/* Noexpired Games: giao diện tối giản, mobile-first */
:root {
  --bg: #0b0e14;
  --bg2: #10141d;
  --card: #141926;
  --card2: #1a2030;
  --line: rgba(255, 255, 255, .08);
  --line2: rgba(255, 255, 255, .16);
  --text: #e8ecf4;
  --muted: #8a93a6;
  --accent: #5eead4;
  --accent2: #60a5fa;
  --ok: #4ade80;
  --bad: #fb7185;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background: radial-gradient(900px 420px at 80% -8%, rgba(96, 165, 250, .12), transparent 70%),
    radial-gradient(700px 380px at 5% -5%, rgba(94, 234, 212, .10), transparent 70%), var(--bg);
  background-attachment: fixed;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------- Thanh trên ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 14, 20, .78); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .2px; min-width: 0; }
.brand img { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand b { color: var(--accent); font-weight: 700; }

/* ---------- Nút, chip ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 18px;
  border: 1px solid transparent; border-radius: 999px; background: var(--accent); color: #06201c;
  font-family: inherit; font-weight: 600; font-size: .95rem; line-height: 1; text-decoration: none; cursor: pointer; transition: transform .12s, filter .12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .chip:focus-visible, .tab:focus-visible, .card:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }
.btn.sm { min-height: 34px; padding: 6px 14px; font-size: .85rem; }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(251, 113, 133, .45); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.user { position: relative; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; max-width: 100%; padding: 4px 14px 4px 4px;
  border: 1px solid var(--line2); border-radius: 999px; background: var(--card); color: var(--text);
  font-family: inherit; font-weight: 600; font-size: .9rem; line-height: 1; cursor: pointer;
}
.chip:hover { background: var(--card2); }
.chip .nm { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ava {
  flex: none; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #2a3350;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; overflow: hidden;
}
.ava.lg { width: 72px; height: 72px; font-size: 1.8rem; }
.ava.sm { width: 28px; height: 28px; font-size: .75rem; }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px; padding: 6px; z-index: 30;
  background: var(--card); border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
}
.pop a, .pop button {
  display: block; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; background: none; color: var(--text);
  font: inherit; font-size: .95rem; text-align: left; text-decoration: none; cursor: pointer;
}
.pop a:hover, .pop button:hover { background: rgba(255, 255, 255, .08); }

/* ---------- Trang chủ ---------- */
.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(1.7rem, 5.5vw, 2.6rem); letter-spacing: -.5px; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 10px 0 0; color: var(--muted); max-width: 560px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin: 8px 0 8px; }
.card {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px; overflow: hidden; cursor: pointer;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 14%, var(--card)), var(--card) 55%);
  border: 1px solid var(--line); border-radius: var(--radius); transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.card.sel { border-color: var(--c); }
.card .head { display: flex; align-items: center; gap: 12px; }
.card .ic {
  flex: none; width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 28px;
  background: color-mix(in srgb, var(--c) 22%, #0b0e14); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent);
}
.card h3 { font-size: 1.08rem; }
.card .tag { margin: 0; color: var(--muted); font-size: .9rem; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #566074; margin-right: 6px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(74, 222, 128, .18); }
.card .acts { display: flex; gap: 8px; }
.card .acts .btn { flex: 1; }
.soon { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #ffd23f; background: rgba(255, 210, 63, .12); border: 1px solid rgba(255, 210, 63, .3); }

/* ---------- Bảng xếp hạng ---------- */
.sec { margin: 34px 0 12px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sec h2 { font-size: 1.25rem; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--line2); background: transparent; color: var(--muted); font-family: inherit; font-weight: 600; font-size: .9rem; line-height: 1; cursor: pointer;
}
.tab.sel { background: var(--card2); color: var(--text); border-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: .93rem; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
td.rk { width: 48px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
tr.top1 td.rk { color: #ffd23f; } tr.top2 td.rk { color: #d5dbe6; } tr.top3 td.rk { color: #e0955a; }
tr.me { background: rgba(94, 234, 212, .08); }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.scroll { overflow-x: auto; }

/* ---------- Hồ sơ / quản trị ---------- */
.page { padding-top: 28px; padding-bottom: 40px; }
.profile { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.profile h1 { font-size: 1.4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.stat b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.gname { display: flex; align-items: center; gap: 10px; }
.gname i { font-style: normal; font-size: 1.3rem; }
.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--bg2);
  color: var(--text); font: inherit;
}
.input:focus { outline: 2px solid var(--accent2); outline-offset: 1px; }
.tagb { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.tagb.bad { color: var(--bad); background: rgba(251, 113, 133, .12); }
.tagb.ok { color: var(--accent); background: rgba(94, 234, 212, .12); }

/* ---------- Đăng nhập ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; padding: 28px 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; text-align: center; }
.login-box img.logo { width: 64px; height: 64px; border-radius: 16px; }
.login-box h1 { font-size: 1.4rem; margin: 14px 0 6px; }
.login-box p { margin: 0 0 18px; color: var(--muted); font-size: .93rem; }
.login-box .gbtn { display: flex; justify-content: center; min-height: 44px; margin-bottom: 8px; }
.sep { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: .8rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.err { margin: 12px 0 0; color: var(--bad); font-size: .9rem; min-height: 1.2em; }
.devbox { display: flex; gap: 8px; }
.devbox .input { flex: 1; min-width: 0; }

.foot { padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: .82rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 8px; }
.foot-links a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.foot-links a:hover, .foot-links a:focus-visible { color: var(--accent); text-decoration: underline; }
.login-wrap { flex-direction: column; }
.login-wrap .foot { padding-bottom: 8px; }
.login-note { margin: 16px 0 0 !important; font-size: .8rem !important; line-height: 1.5; }
.login-note a { color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--card2); border: 1px solid var(--line2); padding: 10px 18px; border-radius: 999px; font-size: .9rem; transition: .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Trang pháp lý ---------- */
.doc { max-width: 800px; padding-top: 28px; padding-bottom: 12px; }
.doc h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); letter-spacing: -.3px; }
.doc .eff { margin: 6px 0 18px; color: var(--muted); font-size: .88rem; }
.doc h2 { font-size: 1.2rem; margin: 30px 0 8px; scroll-margin-top: 76px; }
.doc h3 { font-size: 1.02rem; margin: 18px 0 6px; }
.doc p, .doc li { color: #cdd3e0; overflow-wrap: anywhere; }
.doc p { margin: 8px 0; }
.doc ul, .doc ol { margin: 8px 0; padding-left: 22px; }
.doc li { margin: 4px 0; }
.doc strong { color: var(--text); }
.doc code { padding: 1px 6px; border-radius: 6px; background: var(--card2); font-size: .9em; }
.summary { margin: 0 0 8px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); }
.summary b { display: block; margin-bottom: 4px; color: var(--accent); font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; }
.summary ul { margin: 0; padding-left: 20px; }
.doc .panel { margin: 12px 0; }
.doc .panel table { min-width: 560px; }
.doc td, .doc th { vertical-align: top; }
.doc .panel td { color: #cdd3e0; }
.doc-nav { margin: 30px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .9rem; }

/* ---------- Xóa tài khoản (/me) ---------- */
.danger-zone { margin-top: 34px; padding: 18px; border: 1px solid rgba(251, 113, 133, .35); border-radius: var(--radius); background: rgba(251, 113, 133, .05); }
.danger-zone h2 { font-size: 1.1rem; color: var(--bad); }
.danger-zone p { margin: 8px 0 0; color: var(--muted); font-size: .92rem; }
.danger-zone ul { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: .92rem; }
.danger-zone form { margin-top: 14px; }
.danger-zone label { display: block; margin-bottom: 6px; font-size: .92rem; }
.danger-zone .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn.danger-solid { background: var(--bad); color: #2a0610; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  th, td { padding: 10px 10px; }
  .hide-s { display: none; }
  .chip .nm { max-width: 96px; }
  .profile { flex-direction: column; text-align: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
