:root {
  --bg: #0a0f1d;
  --bg-2: #111827;
  --surface: rgba(255,255,255,.08);
  --surface-strong: rgba(255,255,255,.12);
  --border: rgba(255,255,255,.12);
  --text: #eff6ff;
  --muted: #a7b4cb;
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --success: #22c55e;
  --warning: #f59e0b;
  --pink: #ec4899;
  --shadow: 0 24px 60px rgba(0, 0, 0, .35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(79,70,229,.35), transparent 28%),
    radial-gradient(circle at top left, rgba(34,197,94,.18), transparent 30%),
    linear-gradient(180deg, var(--bg) 0%, #07101e 100%);
  color: var(--text);
}
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }

.shell { min-height: 100vh; }
.wrap { width: min(1120px, calc(100% - 28px)); margin: 0 auto; }
.content-spacer { padding: 10px 0 96px; }
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: var(--radius);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
}
.eyebrow { color: #9ec5ff; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.4rem, 3vw, 2rem); margin-top: 6px; }
.subtext, .section-head p, .hero-card p, .hero-panel p, .list-card span, .history-meta, .empty-state, .helper-box span { color: var(--muted); }

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr .9fr;
  gap: 22px;
  align-items: start;
  padding: 24px 0 30px;
}
.hero-card, .form-card, .hero-panel, .panel-card { padding: 24px; }
.hero-card h1 { font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.04; margin: 14px 0 14px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #e5ecff;
  font-size: 13px;
  font-weight: 600;
}
.pill.success { background: rgba(34,197,94,.16); color: #d9ffe6; }
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 24px;
}
.hero-stats div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
}
.hero-stats strong { display: block; font-size: 1.1rem; }
.hero-stats span { color: var(--muted); font-size: 13px; }
.auth-grid { display: grid; gap: 18px; }
.section-head { display: grid; gap: 6px; margin-bottom: 18px; }
.section-head.inline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}
label { display: block; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  background: rgba(9,14,28,.75);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
  transition: .18s ease;
}
textarea { min-height: 112px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: rgba(99,102,241,.7);
  box-shadow: 0 0 0 4px rgba(99,102,241,.15);
}
.form-card { display: grid; gap: 12px; }
.helper-box {
  display: grid;
  gap: 4px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(79,70,229,.12);
  border: 1px solid rgba(99,102,241,.25);
}
.primary-btn, .dark-btn, .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 18px;
  border: none;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease, background .16s ease;
}
.primary-btn:active, .dark-btn:active, .ghost-btn:active { transform: scale(.985); }
.primary-btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: white;
}
.dark-btn {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: white;
}
.ghost-btn {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--text);
}
.small-btn { min-height: 42px; padding: 10px 14px; border-radius: 14px; }
.inline-form { display: inline-flex; }
.alert {
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert.success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.28); color: #ddffe5; }
.alert.error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.28); color: #ffdfe2; }
.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
.hero-panel h2 { margin: 14px 0 8px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.stat-card { padding: 20px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.stat-card strong { font-size: clamp(1.35rem, 3vw, 2rem); }
.accent-blue { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(96,165,250,.16); }
.accent-green { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(34,197,94,.16); }
.accent-orange { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(245,158,11,.16); }
.accent-pink { box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 0 0 1px rgba(236,72,153,.16); }
.two-col {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  margin-top: 18px;
}
.panel-card { margin-top: 18px; }
.chart-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
  align-items: end;
  min-height: 215px;
}
.bar-item { text-align: center; }
.bar-wrap {
  height: 150px;
  display: flex;
  align-items: end;
  justify-content: center;
  margin-bottom: 12px;
}
.bar {
  width: min(46px, 100%);
  border-radius: 16px 16px 10px 10px;
  background: linear-gradient(180deg, #8b5cf6 0%, #4f46e5 100%);
  box-shadow: 0 14px 30px rgba(79,70,229,.35);
}
.bar-item strong { display: block; font-size: 13px; margin-bottom: 4px; }
.bar-item span { color: var(--muted); font-size: 12px; }
.stack-sm, .stack-md, .list-stack { display: grid; gap: 14px; }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row input { width: auto; }
.mini-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #edf2ff;
}
.mini-tag.dark { background: rgba(15,23,42,.78); }
.text-link { color: #c7d2fe; font-weight: 600; }
.list-card, .history-card, .leader-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-radius: 20px;
  padding: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.09);
}
.list-card.vertical { align-items: stretch; flex-direction: column; }
.right-meta { text-align: right; }
.right-meta strong, .list-card strong, .history-card strong { display: block; }
.right-meta span, .list-card span, .leader-main span { font-size: 13px; }
.empty-state {
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  background: rgba(255,255,255,.04);
  border: 1px dashed rgba(255,255,255,.13);
}
.form-panel { max-width: 860px; margin-inline: auto; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.input-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}
.fill-btn { white-space: nowrap; }
.history-card { align-items: start; flex-direction: column; }
.history-top { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-card p { color: #d7e0f3; line-height: 1.6; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.leaderboard-stack { display: grid; gap: 12px; }
.leader-row.me { border-color: rgba(99,102,241,.44); background: rgba(99,102,241,.12); }
.rank-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  font-weight: 800;
}
.leader-main { min-width: 0; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.danger-text { color: #fecaca; }
.leader-head-note { color: var(--muted); font-size: 13px; margin-top: 12px; }
.range-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 16px;
}
.range-tab {
  min-height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color: var(--muted);
  font-weight: 700;
}
.range-tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(79,70,229,.42), rgba(124,58,237,.42));
  border-color: rgba(124,58,237,.45);
}
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  width: min(1120px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 26px;
  background: rgba(7, 10, 20, .86);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  transition: transform .28s ease, opacity .22s ease, visibility .22s ease;
  will-change: transform, opacity;
  z-index: 1200;
  visibility: visible;
}
.bottom-nav.nav-hidden {
  transform: translateX(-50%) translateY(calc(100% + 32px));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.nav-item {
  min-height: 62px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(79,70,229,.32), rgba(124,58,237,.32));
  color: white;
}
.nav-item span { font-size: 1.15rem; }

@media (max-width: 980px) {
  .hero-grid, .two-col, .stat-grid { grid-template-columns: 1fr; }
  .hero-panel { flex-direction: column; align-items: start; }
}

@media (max-width: 640px) {
  .wrap { width: min(100%, calc(100% - 18px)); }
  .topbar { align-items: start; flex-direction: column; }
  .hero-card, .form-card, .hero-panel, .panel-card { padding: 18px; }
  .hero-card h1 { font-size: 2rem; }
  .hero-stats, .field-grid, .range-tabs { grid-template-columns: 1fr 1fr; }
  .chart-bars { gap: 10px; }
  .input-action { grid-template-columns: 1fr; }
  .list-card, .leader-row { align-items: start; flex-direction: column; }
  .right-meta { text-align: left; }
  .bottom-nav {
    width: calc(100% - 18px);
    left: 50%;
    right: auto;
    bottom: 10px;
    transform: translateX(-50%);
    gap: 8px;
    padding: 8px;
    border-radius: 22px;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  }
  .nav-item { min-height: 56px; font-size: 12px; }
}

@media (max-width: 420px) {
  .range-tabs { grid-template-columns: 1fr; }
}
