:root {
  --bg: #111827;
  --bg-panel: #16202e;
  --bg-card: #1f2937;
  --bg-soft: rgba(255, 255, 255, .045);
  --border: #334155;
  --border-soft: rgba(248, 250, 252, .1);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --primary: #E8B93F;
  --primary-hover: #F2C14E;
  --primary-soft: rgba(232, 185, 63, .14);
  --success: #E8B93F;
  --warning: #fbbf24;
  --danger: #fb7185;
  --radius: 10px;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Sora', var(--font);
  --shadow: 0 18px 50px rgba(0, 0, 0, .18);
}

.hidden { display: none !important; }
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  width: 240px;
  height: 100vh;
  flex-shrink: 0;
  flex-direction: column;
  padding: 0 12px 16px;
  overflow-y: auto;
  background: rgba(22, 32, 46, .78);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(20px) saturate(135%);
}
.sidebar .brand {
  display: flex;
  align-items: center;
  min-height: 64px;
  margin: 0 -12px 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
}
.sidebar .brand::before {
  content: 'V';
  display: grid;
  width: 32px;
  height: 32px;
  margin-right: 10px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: var(--bg);
  font-weight: 700;
}
.sidebar nav { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.sidebar nav::before {
  content: 'MENU';
  padding: 0 10px 6px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.sidebar nav a::before {
  content: '';
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 2px;
  background: currentColor;
  opacity: .6;
}
.sidebar nav a:hover { background: var(--bg-soft); color: var(--text); }
.sidebar nav a.active { background: var(--primary-soft); border-color: rgba(232,185,63,.3); color: var(--primary); }
.sidebar nav a.active::before { opacity: 1; }

.mobile-menu-button, .sidebar-scrim { display: none; }
.main { flex: 1; min-width: 0; max-width: 1600px; padding: 28px 32px 48px; }
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 22px;
}
.topbar h1 {
  min-width: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 650;
  line-height: 1.25;
}
.topbar .user-chip {
  padding: 8px 11px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.topbar .user-chip strong { color: var(--primary); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.card, .panel {
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.card { position: relative; min-height: 112px; padding: 17px; overflow: hidden; }
.card::after {
  content: '';
  position: absolute;
  right: 16px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--primary);
  opacity: .7;
}
.card .label { padding-right: 18px; color: var(--text-faint); font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.card .value { margin-top: 12px; font-family: var(--font-display); font-size: clamp(21px, 2vw, 27px); font-weight: 650; line-height: 1.1; overflow-wrap: anywhere; }
.card .delta { margin-top: 7px; color: var(--success); font-size: 11px; }
.panel { padding: 20px; margin-bottom: 18px; overflow-x: auto; }
.panel h2 { margin: 0 0 18px; font-family: var(--font-display); font-size: 16px; font-weight: 600; }
.panel canvas { width: 100% !important; max-height: 320px; }
.card.has-sparkline { min-height: 136px; padding-bottom: 48px; }
.card .sparkline { position: absolute; right: 12px; bottom: 9px; left: 12px; width: calc(100% - 24px) !important; height: 32px !important; }
.dashboard-grid { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(440px, 3fr); gap: 18px; }
.dashboard-grid .panel { min-width: 0; }

 table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: middle; }
th { color: var(--text-faint); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom: 0; }
td strong { color: var(--text); }

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(232,185,63,.4);
  border-radius: 8px;
  padding: 9px 15px;
  background: var(--primary);
  color: var(--bg);
  font-size: 13px;
  font-weight: 750;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: translateY(1px); }
.btn.secondary { border-color: var(--border-soft); background: var(--bg-soft); color: var(--text-muted); }
.btn.secondary:hover { border-color: var(--border); color: var(--text); }
.btn.danger { border-color: rgba(251,113,133,.35); background: rgba(251,113,133,.15); color: var(--danger); }
.btn.small { min-height: 32px; padding: 7px 10px; font-size: 11px; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid transparent; border-radius: 999px; font-size: 10px; font-weight: 700; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.success { background: rgba(232,185,63,.1); border-color: rgba(232,185,63,.22); color: var(--success); }
.badge.warning { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.2); color: var(--warning); }
.badge.danger { background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.2); color: var(--danger); }
.badge.neutral { background: rgba(148,163,184,.1); border-color: rgba(148,163,184,.18); color: var(--text-muted); }

.link-row { display: flex; align-items: center; gap: 14px; padding: 13px 14px; margin-bottom: 10px; border: 1px solid var(--border-soft); border-radius: 8px; background: rgba(17,24,39,.45); }
.link-row code, code { color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-bottom: 18px; }
.game-card { overflow: hidden; border: 1px solid var(--border-soft); border-radius: var(--radius); background: rgba(255,255,255,.04); box-shadow: var(--shadow); }
.game-banner { display: block; width: 100%; aspect-ratio: 16 / 6; object-fit: cover; background: var(--bg-card); }
.game-banner-placeholder { display: grid; place-items: center; color: var(--text-faint); font-family: var(--font-display); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.game-card-body { padding: 16px; }
.game-card-title { margin: 0 0 12px; font-family: var(--font-display); font-size: 16px; font-weight: 650; }
.game-link { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.game-link code { min-width: 0; flex: 1; padding: 9px 10px; overflow: hidden; border: 1px solid var(--border-soft); border-radius: 7px; background: rgba(17,24,39,.45); text-overflow: ellipsis; white-space: nowrap; }
.game-metrics { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.game-metric { min-width: 0; padding: 11px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg-soft); }
.game-metric .label { color: var(--text-faint); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.game-metric .value { margin-top: 7px; font-family: var(--font-display); font-size: 17px; font-weight: 650; overflow-wrap: anywhere; }

.auth-wrapper {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 0%, rgba(232,185,63,.13), transparent 40%);
}
.auth-box { position: relative; width: 100%; max-width: 420px; padding: 32px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(31,41,55,.72); backdrop-filter: blur(20px) saturate(135%); box-shadow: 0 28px 80px rgba(0,0,0,.32); }
.auth-box::before { content: 'V'; display: grid; width: 40px; height: 40px; margin-bottom: 24px; place-items: center; border-radius: 10px; background: var(--primary); color: var(--bg); font-family: var(--font-display); font-weight: 700; }
.auth-box h1 { margin: 0 0 7px; font-family: var(--font-display); font-size: 23px; font-weight: 650; }
.auth-box p.sub { margin: 0 0 26px; color: var(--text-muted); font-size: 13px; }
.auth-box > .text-muted:last-child { margin-bottom: 0; text-align: center; line-height: 1.8; }
.auth-box a { color: var(--primary); font-weight: 650; }

label { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; margin-bottom: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; outline: none; background: rgba(17,24,39,.7); color: var(--text); font-size: 13px; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: rgba(17,24,39,.9); box-shadow: 0 0 0 3px rgba(232,185,63,.12); }
input:disabled { opacity: .62; cursor: not-allowed; }
input[type="checkbox"] { accent-color: var(--primary); }
.alert { padding: 11px 13px; border: 1px solid; border-radius: 8px; margin-bottom: 16px; font-size: 12px; line-height: 1.5; }
.alert.error { background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.25); color: #fda4af; }
.alert.success { background: rgba(232,185,63,.1); border-color: rgba(232,185,63,.25); color: var(--primary); }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }

@media (max-width: 1100px) {
  .main { padding: 24px; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  body.menu-open { overflow: hidden; }
  .layout { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(82vw, 280px); transform: translateX(-105%); box-shadow: 24px 0 70px rgba(0,0,0,.38); transition: transform .2s ease; }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 20; display: block; border: 0; background: rgba(2,6,23,.68); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  body.menu-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .mobile-menu-button { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(232,185,63,.45); border-radius: 12px; background: var(--primary); color: var(--bg); box-shadow: 0 12px 30px rgba(0,0,0,.35); cursor: pointer; }
  .mobile-menu-button span, .mobile-menu-button::before, .mobile-menu-button::after { content: ''; display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
  .mobile-menu-button span { margin: 4px 0; }
  .main { width: 100%; padding: 22px 16px 82px; }
  .topbar { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .topbar .user-chip { width: max-content; max-width: 100%; white-space: normal; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .card { min-height: 105px; padding: 14px; }
  .card .value { font-size: 20px; }
  .panel { padding: 16px; }
  .link-row { flex-wrap: wrap; }
  .link-row .btn { width: 100%; }
  .game-grid { grid-template-columns: minmax(0,1fr); }
  .game-link { align-items: stretch; flex-direction: column; }
  .game-link .btn { width: 100%; }
}
@media (max-width: 480px) {
  .grid-cards { grid-template-columns: minmax(0,1fr); }
  .auth-box { padding: 24px 20px; }
  .topbar h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
