:root{
  --bg0:#020617; /* slate-950 */
  --bg1:#001630;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --card:rgba(255,255,255,0.06);
  --stroke:rgba(255,255,255,0.10);
  --accent:#00d4ff;
  --accent2:#0077ff;
  --purple:#7c3aed;
  --success:#34d399;
  --warn:#fbbf24;
  --danger:#fb7185;
  --shadow:0 18px 50px rgba(0,0,0,0.38);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  color:var(--text);
  background:var(--bg0);
  line-height:1.45;
}

a{ color:inherit; }

.bg{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-2;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(0,212,255,0.16), transparent 65%),
    radial-gradient(800px 520px at 80% 20%, rgba(124,58,237,0.14), transparent 65%),
    radial-gradient(900px 700px at 50% 90%, rgba(0,119,255,0.10), transparent 70%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  filter:saturate(1.12);
}

.bg-canvas{
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:-1;
  opacity:0.85;
}

.container{
  max-width:1120px;
  margin:0 auto;
  padding:24px;
}
.container.narrow{ max-width:980px; }

/* ---------- Navbar ---------- */
.navbar{
  position:sticky;
  top:0;
  z-index:30;
  backdrop-filter: blur(12px);
  background:rgba(2,6,23,0.62);
  border-bottom:1px solid var(--stroke);
}
.nav-inner{
  max-width:1120px;
  margin:0 auto;
  padding:14px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
}
.brand-mark{
  width:34px;
  height:34px;
  border-radius:12px;
  background:linear-gradient(135deg, var(--accent), var(--purple));
  box-shadow:0 16px 50px rgba(0,212,255,0.14);
}
.brand-text{
  font-weight:900;
  letter-spacing:0.2px;
}
.brand-tag{
  margin-left:8px;
  font-size:12px;
  color:var(--muted);
  font-weight:600;
}

.nav{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  justify-content:center;
}
.nav-link{
  display:inline-flex;
  align-items:center;
  padding:8px 10px;
  border-radius:12px;
  text-decoration:none;
  color:var(--muted);
  border:1px solid transparent;
  transition: 160ms ease;
}
.nav-link:hover{
  color:var(--text);
  border-color:var(--stroke);
  background:rgba(255,255,255,0.03);
}
.nav-link.active{
  color:var(--text);
  border-color:rgba(0,212,255,0.38);
  background:rgba(0,212,255,0.10);
}
.nav-ico{ margin-right:6px; }

.nav-user{
  display:flex;
  align-items:center;
  gap:10px;
}

.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:14px;
  background:rgba(255,255,255,0.03);
  text-decoration:none;
}
.user-chip:hover{ border-color:rgba(0,212,255,0.35); }
.user-meta{ display:flex; flex-direction:column; line-height:1.05; }
.user-name{ font-weight:900; }
.user-sub{ font-size:12px; color:var(--muted); }
.user-actions{ display:flex; gap:8px; }

/* ---------- Common UI ---------- */
.card{
  background:var(--card);
  border:1px solid var(--stroke);
  border-radius:var(--radius);
  padding:16px;
  box-shadow:var(--shadow);
}
.card + .card{ margin-top:16px; }
.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.card-head h3{ margin:0; font-size:18px; }
.muted{ color:var(--muted); }
.link{ color:var(--accent); text-decoration:none; }
.link:hover{ text-decoration:underline; }

.alert{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--stroke);
  margin-bottom:14px;
  background:rgba(255,255,255,0.03);
}
.alert.success{ border-color:rgba(52,211,153,0.50); background:rgba(52,211,153,0.10); }
.alert.error{ border-color:rgba(251,113,133,0.50); background:rgba(251,113,133,0.12); }
.alert.warn{ border-color:rgba(251,191,36,0.50); background:rgba(251,191,36,0.12); }

.grid{ display:grid; gap:16px; }
.grid-2{ display:grid; gap:16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 920px){
  .grid-2{ grid-template-columns:1fr; }
}

.list{ display:flex; flex-direction:column; gap:10px; }
.item{
  padding:12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.03);
}
.rowline{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.rowline-left{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:10px; }
.inline{ display:inline; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:14px;
  border:1px solid rgba(0,212,255,0.45);
  background:linear-gradient(135deg, rgba(0,212,255,0.22), rgba(0,119,255,0.18));
  color:var(--text);
  text-decoration:none;
  font-weight:900;
  cursor:pointer;
  transition:160ms ease;
  box-shadow:0 16px 40px rgba(0,212,255,0.12);
}
.btn:hover{ transform:translateY(-1px); box-shadow:0 22px 52px rgba(0,212,255,0.18); }
.btn:active{ transform:translateY(0); }
.btn.secondary{
  border-color:var(--stroke);
  background:rgba(255,255,255,0.03);
  box-shadow:none;
  color:var(--text);
}
.btn.ghost{
  border-color:transparent;
  background:transparent;
  box-shadow:none;
  color:var(--muted);
}
.btn.small{ padding:8px 10px; border-radius:12px; font-size:13px; }

/* ---------- Forms ---------- */
label{ display:block; font-size:13px; color:var(--muted); margin-bottom:6px; }
input,select,textarea{
  width:100%;
  background:rgba(0,0,0,0.25);
  color:var(--text);
  border:1px solid var(--stroke);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
textarea{ resize:vertical; }
input:focus,select:focus,textarea:focus{
  border-color:rgba(0,212,255,0.55);
  box-shadow:0 0 0 3px rgba(0,212,255,0.14);
}

.form-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}
.form-grid > div{ min-width:0; }
.form-grid textarea{ grid-column:1/-1; }
.form-actions{
  grid-column:1/-1;
  display:flex;
  justify-content:flex-end;
  gap:10px;
  align-items:center;
  margin-top:6px;
}
.inline-form{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
.check{ display:flex; align-items:center; gap:8px; cursor:pointer; }
.check input{ width:auto; }

/* ---------- Hero ---------- */
.hero{
  display:flex;
  gap:16px;
  align-items:stretch;
}
.hero-left{ flex:1; }
.hero-right{ width:360px; }
.hero h1{ margin:0 0 8px 0; font-size:34px; line-height:1.1; }
.hero-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top:14px; }
.hero-highlights{ display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }
@media (max-width: 920px){
  .hero{ flex-direction:column; }
  .hero-right{ width:auto; }
}

.chip, .chip-row .chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:999px;
  background:rgba(255,255,255,0.03);
  font-size:13px;
}
.chip.ok{ border-color:rgba(52,211,153,0.42); background:rgba(52,211,153,0.10); }
.chip.warn{ border-color:rgba(251,191,36,0.42); background:rgba(251,191,36,0.10); }
.chip.done{ border-color:rgba(0,212,255,0.38); background:rgba(0,212,255,0.10); }

/* ---------- Avatars & badges ---------- */
.avatar{
  width:44px;
  height:44px;
  border-radius:14px;
  object-fit:cover;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.06);
}
.avatar.sm{ width:34px; height:34px; border-radius:12px; }
.avatar.xl{ width:96px; height:96px; border-radius:22px; }

.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  font-weight:900;
  letter-spacing:0.4px;
  font-size:12px;
}
.badge.tier-rookie{ border-color:rgba(148,163,184,0.45); background:rgba(148,163,184,0.12); }
.badge.tier-bronze{ border-color:rgba(245,158,11,0.45); background:rgba(245,158,11,0.12); }
.badge.tier-silver{ border-color:rgba(192,132,252,0.45); background:rgba(192,132,252,0.12); }
.badge.tier-gold{ border-color:rgba(34,211,238,0.45); background:rgba(34,211,238,0.12); }
.badge.tier-platinum{ border-color:rgba(0,212,255,0.45); background:rgba(0,212,255,0.12); }
.badge.tier-diamond{ border-color:rgba(124,58,237,0.55); background:rgba(124,58,237,0.16); }

/* ---------- Leader cards ---------- */
.leader-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; }
.leader-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:rgba(255,255,255,0.03);
  text-decoration:none;
}
.leader-card:hover{ border-color:rgba(0,212,255,0.35); background:rgba(0,212,255,0.06); }
.leader-card-mid{ display:flex; align-items:center; gap:12px; }
.leader-name{ font-weight:900; }

/* ---------- Tables ---------- */
.table-wrap{
  overflow:auto;
  border:1px solid var(--stroke);
  border-radius:16px;
}
.rank-table,
.schedule{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.rank-table th, .rank-table td,
.schedule th, .schedule td{
  padding:10px;
  border-bottom:1px solid rgba(255,255,255,0.08);
  text-align:left;
}
.rank-table th,
.schedule th{
  position:sticky;
  top:0;
  background:rgba(2,6,23,0.86);
  backdrop-filter: blur(12px);
  z-index:1;
}
.rank-table tr.me{ background:rgba(0,212,255,0.06); }
.player-cell{ display:flex; align-items:center; gap:10px; text-decoration:none; }
.mono{ font-variant-numeric: tabular-nums; }

/* ---------- Courts schedule ---------- */
.schedule .time{ width:92px; color:var(--muted); font-weight:900; }
.slot{ display:flex; flex-direction:column; gap:6px; }
.slot.free{ align-items:flex-start; }
.slot.booked{ }
.booked-by{ font-weight:900; }
.slot-hint{ font-size:12px; }

/* ---------- Messages ---------- */
.msg-layout{ display:grid; grid-template-columns: 320px 1fr; gap:12px; }
@media (max-width: 920px){ .msg-layout{ grid-template-columns:1fr; } }

.msg-left,
.msg-right{
  border:1px solid var(--stroke);
  border-radius:16px;
  background:rgba(255,255,255,0.03);
}
.msg-left{ padding:12px; }
.msg-left-head{ display:flex; align-items:center; justify-content:space-between; }
.msg-thread-list{ display:flex; flex-direction:column; gap:8px; margin-top:10px; }
.msg-thread{ display:flex; gap:10px; padding:10px; border-radius:14px; border:1px solid transparent; text-decoration:none; }
.msg-thread:hover{ border-color:var(--stroke); background:rgba(0,212,255,0.06); }
.msg-thread.active{ border-color:rgba(0,212,255,0.35); background:rgba(0,212,255,0.10); }
.msg-thread-meta{ flex:1; }
.msg-new{ margin-top:12px; }
.details summary{ cursor:pointer; color:var(--accent); }

.unread{
  display:inline-flex;
  min-width:22px;
  height:22px;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  background:rgba(0,212,255,0.18);
  border:1px solid rgba(0,212,255,0.38);
  font-size:12px;
  font-weight:900;
}

.msg-right{ display:flex; flex-direction:column; }
.msg-chat-head{ display:flex; align-items:center; justify-content:space-between; padding:12px; border-bottom:1px solid rgba(255,255,255,0.08); }
.msg-bubble-list{ padding:12px; overflow:auto; max-height:520px; display:flex; flex-direction:column; gap:10px; }
.bubble{ max-width:72%; border:1px solid var(--stroke); border-radius:16px; padding:10px 12px; background:rgba(0,0,0,0.25); }
.bubble.mine{ margin-left:auto; border-color:rgba(0,212,255,0.38); background:rgba(0,212,255,0.12); }
.bubble-top{ display:flex; justify-content:space-between; gap:10px; font-size:12px; margin-bottom:6px; }
.msg-send{ display:flex; gap:10px; padding:12px; border-top:1px solid rgba(255,255,255,0.08); }
.msg-send textarea{ flex:1; }

/* ---------- Auth ---------- */
.auth{ display:grid; grid-template-columns: 1.1fr 0.9fr; gap:16px; align-items:stretch; }
@media (max-width: 920px){ .auth{ grid-template-columns:1fr; } }
.auth-left{ padding:14px 6px; }
.auth-left h1{ margin:0 0 8px 0; font-size:34px; line-height:1.1; }
.auth-bullets{ display:flex; flex-direction:column; gap:10px; margin-top:14px; }
.bullet-row{ display:flex; gap:10px; align-items:flex-start; border:1px solid var(--stroke); border-radius:16px; background:rgba(255,255,255,0.03); padding:10px; }
.auth-right h3{ margin:0 0 12px 0; }

/* ---------- Profile ---------- */
.profile-top{ display:flex; gap:16px; align-items:center; }
@media (max-width: 720px){ .profile-top{ flex-direction:column; align-items:flex-start; } }
.link-container{ margin-top:8px; }
.ic-launch{ opacity:0.85; }

/* ---------- Tabs ---------- */
.tabbar{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.tab{ padding:8px 10px; border-radius:12px; border:1px solid var(--stroke); text-decoration:none; color:var(--muted); background:rgba(255,255,255,0.02); }
.tab:hover{ color:var(--text); }
.tab.active{ color:var(--text); border-color:rgba(0,212,255,0.38); background:rgba(0,212,255,0.10); }

/* ---------- Misc ---------- */
.code-block{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size:13px;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,0.32);
  overflow:auto;
}

/* ---------- Small screen navbar wrap ---------- */
@media (max-width: 720px){
  .nav-inner{ flex-wrap:wrap; }
  .nav{ width:100%; justify-content:flex-start; overflow-x:auto; padding-bottom:6px; }
}

/* =====================================================================
   Compatibility + Page-specific polish (v5)
   ---------------------------------------------------------------------
   v4 delivered a nicer CSS system but some PHP templates used different
   class names (site-header, hero-kicker, dash-hero...).
   This section maps/finishes those classes so the UI actually renders.
   ===================================================================== */

/* --- Header template compatibility --- */
.site-header{
  position:sticky;
  top:0;
  z-index:30;
  backdrop-filter: blur(12px);
  background:rgba(2,6,23,0.62);
  border-bottom:1px solid var(--stroke);
}
.site-header-inner{
  max-width:1120px;
  margin:0 auto;
  padding:14px 24px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.navigation{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  justify-content:center;
}
.nav-right{
  display:flex;
  align-items:center;
  gap:10px;
}
.brand-icon{
  width:34px;
  height:34px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg, var(--accent), var(--purple));
  box-shadow:0 16px 50px rgba(0,212,255,0.14);
}
.nav-userchip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px;
  border:1px solid var(--stroke);
  border-radius:14px;
  background:rgba(255,255,255,0.03);
  text-decoration:none;
}
.nav-userchip:hover{ border-color:rgba(0,212,255,0.35); }
.nav-usertext{ display:flex; flex-direction:column; line-height:1.05; }

@media (max-width: 720px){
  .site-header-inner{ flex-wrap:wrap; }
  .navigation{ width:100%; justify-content:flex-start; overflow-x:auto; padding-bottom:6px; }
  .brand-tag{ display:none; }
}

/* --- Landing page hero details --- */
.hero-kicker{
  display:inline-block;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:0.18em;
  font-weight:900;
  font-size:12px;
  margin-bottom:10px;
}
.hero-title{ margin:0; font-size:clamp(34px, 4.2vw, 52px); line-height:1.05; }
.hero-sub{ margin:10px 0 0 0; color:var(--muted); font-size:15px; max-width:62ch; }
.glow{ color:var(--accent); text-shadow:0 0 18px rgba(0,212,255,0.35); }

.hero-stats{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
  margin-top:16px;
}
@media (max-width: 920px){
  .hero-stats{ grid-template-columns:1fr; }
}
.stat{
  padding:12px;
  border:1px solid var(--stroke);
  border-radius:16px;
  background:rgba(255,255,255,0.03);
}
.stat-num{ font-size:22px; font-weight:900; }
.stat-label{ color:var(--muted); font-size:12px; margin-top:2px; }

.hero-card{ box-shadow:0 18px 60px rgba(0,0,0,0.44); }
.leader-list{ display:flex; flex-direction:column; gap:10px; margin-top:8px; }
.leader-row{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.08);
  background:rgba(0,0,0,0.20);
}
.leader-row:hover{ border-color:rgba(0,212,255,0.25); background:rgba(0,212,255,0.06); }
.leader-rank{ width:42px; font-weight:900; color:var(--muted); }
.leader-points{ width:74px; text-align:right; font-variant-numeric:tabular-nums; font-weight:900; }

.bullet{
  margin:10px 0 0 0;
  padding-left:18px;
  color:var(--muted);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.bullet li{ line-height:1.35; }

.quick-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-top:12px;
}
@media (max-width: 920px){
  .quick-grid{ grid-template-columns:1fr; }
}
.quick{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:14px;
  border-radius:16px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.03);
  text-decoration:none;
  transition:160ms ease;
}
.quick:hover{ transform:translateY(-1px); border-color:rgba(0,212,255,0.35); background:rgba(0,212,255,0.06); }
.quick span{ font-size:18px; }
.quick strong{ font-weight:900; }
.quick small{ color:var(--muted); }

/* --- Dashboard hero polish --- */
.dash-hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px;
  border-radius:var(--radius);
  border:1px solid var(--stroke);
  background:rgba(255,255,255,0.04);
  box-shadow:var(--shadow);
  margin-bottom:16px;
}
@media (max-width: 920px){
  .dash-hero{ flex-direction:column; align-items:flex-start; }
}
.dash-user{ display:flex; gap:16px; align-items:center; }
.dash-user h1{ margin:4px 0 0 0; font-size:28px; }
.chip-row{ display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.dash-actions{ display:flex; gap:10px; flex-wrap:wrap; }
