:root {
  --ink: #0a1620;
  --ink-soft: #1c2e3a;
  --paper: #eef2f5;
  --paper-2: #e2e8ee;
  --line: rgba(10, 22, 32, 0.12);
  --signal: #0f8f8a;
  --signal-2: #12b3ac;
  --amber: #e2a008;
  --danger: #c23b2a;
  --ok: #1f8a4c;
  --shadow: 0 24px 60px rgba(10, 22, 32, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
  --radius: 4px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 143, 138, 0.16), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(226, 160, 8, 0.12), transparent 50%),
    linear-gradient(180deg, #f7f9fb 0%, var(--paper) 40%, #e7edf2 100%);
  min-height: 100vh;
  line-height: 1.5;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.045;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .topbar, .footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(10,22,32,0.06);
  padding: 0.15em 0.4em;
  border-radius: 3px;
}

.topbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 190px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #f4f7f8;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.02em;
  border-radius: var(--radius);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.brand-text small {
  color: var(--ink-soft);
  opacity: 0.75;
  font-size: 0.78rem;
}

.nav {
  display: flex;
  gap: 1.1rem;
  flex: 1;
}
.nav a {
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0.72;
  position: relative;
}
.nav a:hover, .nav a.is-active { opacity: 1; }
.nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.45rem;
  height: 2px;
  background: var(--signal);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.72rem 1.1rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, border-color .2s ease, color .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: #f5f8fa;
}
.btn-primary:hover { background: #132737; }
.btn-signal {
  background: var(--signal);
  color: #041816;
}
.btn-signal:hover { background: var(--signal-2); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-amber {
  background: var(--amber);
  color: #1a1400;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem 0.3rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
}
.user-chip img {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
}

.nav-toggle {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--radius);
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
}
.nav-toggle span {
  display: block; height: 2px; background: var(--ink);
}

/* HERO */
.hero {
  min-height: calc(100vh - 84px);
  display: grid;
  align-items: end;
  position: relative;
  overflow: hidden;
  color: #f3f6f8;
  isolation: isolate;
}
.hero-media {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-color: #0a1620;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
  animation: heroDrift 18s ease-in-out infinite alternate;
  transition: background-image 0.6s ease;
}
.hero-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(243,246,248,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243,246,248,0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, #000 35%, transparent 95%);
  pointer-events: none;
}
@keyframes heroDrift {
  from { transform: scale(1.02) translate3d(0,0,0); }
  to { transform: scale(1.06) translate3d(-1.5%, -1%, 0); }
}

.hero-inner {
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 3.5rem;
}
.hero-brand {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 10vw, 7.5rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
  animation: rise 0.9s ease both;
}
.hero h1 {
  margin: 0 0 0.8rem;
  max-width: 14ch;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  line-height: 1.1;
  font-weight: 700;
  animation: rise 1s ease both;
  animation-delay: 0.08s;
}
.hero p {
  max-width: 38ch;
  margin: 0 0 1.6rem;
  font-size: 1.05rem;
  opacity: 0.88;
  animation: rise 1.05s ease both;
  animation-delay: 0.14s;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  animation: rise 1.1s ease both;
  animation-delay: 0.2s;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(243,246,248,0.2);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  animation: rise 0.8s ease both;
}
.live-pill .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(31,138,76,0.6);
  animation: pulse 1.8s infinite;
}
.live-pill.is-off .dot {
  background: #9aa4ad;
  animation: none;
  box-shadow: none;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(31,138,76,0.55); }
  70% { box-shadow: 0 0 0 10px rgba(31,138,76,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,138,76,0); }
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3.5rem 1.25rem;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  letter-spacing: 0.01em;
}
.section-head p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  opacity: 0.8;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.metric {
  padding: 1.2rem 1.25rem;
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  transition: transform .25s ease, border-color .25s ease;
}
.metric:hover { transform: translateY(-3px); border-color: rgba(15,143,138,0.45); }
.metric span {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.65;
  margin-bottom: 0.4rem;
}
.metric strong {
  font-family: var(--font-display);
  font-size: 1.9rem;
  line-height: 1;
}

.panel {
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap { overflow-x: auto; }
table.stats {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
table.stats th,
table.stats td {
  padding: 0.9rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
table.stats th {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
  font-weight: 700;
  background: rgba(10,22,32,0.03);
}
table.stats tr:hover td { background: rgba(15,143,138,0.05); }
table.stats .rank {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--signal);
}
table.stats a.player-link { font-weight: 700; }
table.stats a.player-link:hover { color: var(--signal); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.search {
  flex: 1;
  min-width: 220px;
  display: flex;
  gap: 0.5rem;
}
.search input, .select, .field input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.8);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  font: inherit;
  color: var(--ink);
}
.search input:focus, .field input:focus, .select:focus {
  outline: 2px solid rgba(15,143,138,0.35);
  border-color: var(--signal);
}

.profile {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.2rem;
}
.profile-card, .stat-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
}
.profile-top {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.2rem;
}
.profile-top img {
  width: 84px; height: 84px; border-radius: 8px; object-fit: cover;
  background: var(--ink);
}
.profile-top h1 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.8rem;
}
.muted { opacity: 0.68; }
.grid-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.grid-stats div {
  padding: 0.85rem;
  background: rgba(10,22,32,0.03);
  border-radius: var(--radius);
}
.grid-stats span {
  display: block;
  font-size: 0.78rem;
  opacity: 0.65;
  margin-bottom: 0.2rem;
}
.grid-stats strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.progress {
  height: 10px;
  background: rgba(10,22,32,0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.6rem;
}
.progress > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--signal), var(--amber));
  width: 0;
  transition: width 1s ease;
}

.login-box {
  max-width: 460px;
  margin: 4rem auto;
  padding: 2rem;
  text-align: center;
}
.login-box h1 {
  font-family: var(--font-display);
  margin: 0 0 0.6rem;
}
.login-box p { margin: 0 0 1.4rem; opacity: 0.75; }

.empty {
  padding: 2rem 1.25rem;
  text-align: center;
  opacity: 0.75;
}

.footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.35);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.6rem 1.25rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.footer p { margin: 0.2rem 0; }

.alert {
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: rgba(226,160,8,0.12);
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.shop-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform .2s ease, border-color .2s ease;
}
.shop-card:hover { transform: translateY(-3px); border-color: rgba(15,143,138,.45); }
.shop-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}
.shop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.85rem;
  opacity: 0.75;
}
.shop-price {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-top: auto;
}
.shop-card .btn { width: 100%; }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.admin-nav a {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.75;
}
.admin-nav a.is-active,
.admin-nav a:hover {
  opacity: 1;
  border-color: var(--signal);
  background: rgba(15,143,138,0.08);
}

@media (max-width: 900px) {
  .shop-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .profile { grid-template-columns: 1fr; }
  .nav, .top-actions { display: none; }
  .topbar.is-open .nav,
  .topbar.is-open .top-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  .topbar.is-open {
    flex-wrap: wrap;
  }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .hero { min-height: 86vh; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
