:root {
  --bg0: #071018;
  --bg1: #0c1c28;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.14);
  --stroke: rgba(255, 255, 255, 0.22);
  --text: #f4fbff;
  --muted: rgba(220, 236, 245, 0.68);
  --accent: #3ee0c5;
  --accent-2: #6aa8ff;
  --danger: #ff7b7b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  --radius: 28px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 700px at 10% -10%, #16364a 0%, transparent 55%),
    radial-gradient(900px 600px at 100% 0%, #1a3d55 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 45%, #08141d);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 85%);
  opacity: 0.35;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}
.orb-a { width: 280px; height: 280px; left: -60px; top: 80px; background: rgba(62, 224, 197, 0.22); }
.orb-b { width: 340px; height: 340px; right: -80px; top: -40px; background: rgba(106, 168, 255, 0.2); animation-delay: -4s; }
.orb-c { width: 260px; height: 260px; left: 30%; bottom: -80px; background: rgba(120, 255, 214, 0.12); animation-delay: -7s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.05); }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 48px;
  display: grid;
  gap: 14px;
}

.glass {
  background: linear-gradient(145deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.25);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
}

.brand-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
}
.brand-mark {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 30px rgba(62, 224, 197, 0.25);
  background: #041018;
}
.brand-text {
  min-width: 0;
  flex: 1;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.brand-sub { color: var(--muted); font-size: 0.85rem; }

.hero {
  text-align: center;
  padding: 28px 20px 24px;
  animation: rise 0.7s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.08);
}
.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.avatar-wrap img.show { display: block; }
.avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
}
.avatar-wrap img.show + .avatar-fallback { display: none; }

.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tag {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 500;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.stat {
  padding: 16px;
  display: grid;
  gap: 6px;
  animation: rise 0.8s ease both;
}
.stat:nth-child(2) { animation-delay: 0.05s; }
.stat:nth-child(3) { animation-delay: 0.1s; }
.stat:nth-child(4) { animation-delay: 0.15s; }
.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat strong {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
}
.stat em {
  font-style: normal;
  color: var(--muted);
  font-size: 0.85rem;
}
.rank-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin-top: 4px;
}
.rank-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.6s ease;
}

.panel { padding: 16px 16px 12px; }
.panel-head h2, .admin-grid h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}
.admin-grid h3 { margin-top: 8px; font-size: 0.95rem; color: var(--muted); }
.list { display: grid; gap: 8px; }
.list.compact { gap: 6px; }
.item {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  display: grid;
  gap: 4px;
}
.item a { color: var(--accent); text-decoration: none; }
.item .meta { color: var(--muted); font-size: 0.82rem; }

.admin-grid { display: grid; gap: 16px; }
.admin-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}
.admin-form input, .admin-form button {
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  font: inherit;
}
.admin-form input {
  background: rgba(0,0,0,0.25);
  color: var(--text);
  outline: none;
}
.admin-form button {
  background: linear-gradient(135deg, var(--accent), #2bb8d8);
  color: #041018;
  font-weight: 700;
  cursor: pointer;
  border: none;
}
.admin-form button.ghost {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid var(--stroke);
}

.hidden { display: none !important; }

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
}
.tab {
  flex: 1;
  border: none;
  border-radius: 18px;
  padding: 12px 10px;
  font: inherit;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.tab.active {
  color: #041018;
  background: linear-gradient(135deg, var(--accent), #2bb8d8);
}
.tab-panels { display: grid; gap: 14px; }
.tab-panel { display: none; gap: 14px; }
.tab-panel.active { display: grid; animation: rise 0.45s ease both; }

.account-panel { display: grid; gap: 14px; }
.account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.account-head h2 { margin: 0; }
.account-identity {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.account-identity strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}
.account-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-status .badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  font-weight: 600;
}
.account-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.account-status .dot.ok { background: var(--accent); }

.login-hint {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.login-form { margin-top: 0; }
.login-error {
  min-height: 1.2em;
  color: var(--danger) !important;
  margin: 8px 0 0;
}
.btn-ghost, .login-cancel {
  border-radius: 14px;
  border: 1px solid var(--stroke);
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}
.login-cancel { width: 100%; margin-top: 8px; }

@media (min-width: 760px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1.1fr 1fr 1.1fr; }
}
