
:root {
  color-scheme: dark;
  --bg: #09090d;
  --panel: #12121a;
  --panel2: #191923;
  --border: #292936;
  --text: #f4f2fa;
  --muted: #92909f;
  --purple: #8b5cf6;
  --purple2: #6d42d7;
  --green: #35d39a;
  --red: #ff647c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; color: inherit; }
.hidden { display: none !important; }
.muted, small { color: var(--muted); }
h1 { font-size: clamp(27px,4vw,38px); margin: 0 0 8px; letter-spacing: -1px; }
h2 { margin: 0 0 12px; }
p { color: var(--muted); }
.logo { font-size: 29px; font-weight: 900; letter-spacing: 3px; }
.logo span, .hero h1 span { color: var(--purple); }
.auth-screen {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(ellipse at 50% 20%,#251744 0,transparent 55%),var(--bg);
}
.auth-box {
  width: min(420px,100%); padding: 35px; border: 1px solid var(--border);
  border-radius: 22px; background: #11111a; text-align: center;
}
.auth-box .logo { font-size: 43px; }
.auth-tabs { display: flex; gap: 8px; margin: 25px 0 18px; }
.auth-tabs button { flex: 1; background: var(--panel2); border: 1px solid var(--border); padding: 11px; border-radius: 10px; }
.auth-tabs button.active { background: #30204d; border-color: var(--purple); }
input, select {
  width: 100%; min-width: 0; color: var(--text); background: #0c0c13;
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px;
  outline: none; margin: 6px 0;
}
input:focus, select:focus { border-color: var(--purple); }
button.primary {
  border: 0; border-radius: 10px; padding: 12px 17px;
  background: var(--purple); color: white; font-weight: 700;
}
button.primary:hover { background: var(--purple2); }
button:disabled { opacity: .45; cursor: not-allowed; }
.full { width: 100%; margin-top: 12px; }
.error { color: var(--red); min-height: 20px; }
.app { min-height: 100vh; }
.sidebar {
  width: 250px; position: fixed; inset: 0 auto 0 0; z-index: 5;
  background: #0e0e15; border-right: 1px solid var(--border);
  padding: 22px 14px; display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar .logo { padding: 0 13px 25px; }
.side-label { color: #696777; font-size: 10px; letter-spacing: 2px; padding: 0 13px 10px; }
.sidebar nav { display: grid; gap: 4px; }
.nav {
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent;
  padding: 11px 13px; border-radius: 9px; color: #aaa8b7;
}
.nav:hover { background: var(--panel2); color: white; }
.nav.active { color: white; background: #251b3a; border-color: #49316d; }
.sidebar-bottom { margin-top: auto; padding: 18px 8px 0; color: var(--muted); }
.main { margin-left: 250px; min-height: 100vh; }
.topbar {
  height: 76px; position: sticky; top: 0; z-index: 4; background: #09090deF;
  backdrop-filter: blur(15px); border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; padding: 0 34px;
}
.topbar strong { display: block; font-size: 17px; }
.topbar .muted { font-size: 9px; letter-spacing: 2px; }
.top-right { display: flex; gap: 15px; align-items: center; }
.xp { color: #d8c2ff; background: #241936; border: 1px solid #49316d; padding: 8px 13px; border-radius: 20px; }
.avatar { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; background: var(--purple); font-weight: 800; }
.content { max-width: 1450px; margin: auto; padding: 34px; }
.page { display: none; animation: appear .2s ease; }
.page.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero {
  padding: 48px; border: 1px solid #392957; border-radius: 22px;
  background: radial-gradient(ellipse at 80% 20%,#38205f,transparent 55%),linear-gradient(120deg,#171322,#11111a);
}
.hero h1 { font-size: clamp(36px,5vw,60px); line-height: 1.08; margin: 18px 0; }
.hero p { max-width: 560px; }
.eyebrow { color: #b89aff; letter-spacing: 3px; font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 20px 0; }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 15px;
  padding: 21px; min-width: 0;
}
.card h2 { font-size: 19px; }
.card small { letter-spacing: 1px; font-size: 10px; }
.card h2:not(:first-child) { margin-top: 8px; }
.stats-grid .card h2 { font-size: 30px; margin: 8px 0 0; }
.section-heading { margin: 30px 0 14px; }
.quick-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; }
.quick {
  display: grid; gap: 8px; text-align: left; padding: 20px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border); font-size: 25px;
}
.quick b { font-size: 15px; }
.quick small { font-size: 12px; }
.chat-layout { display: grid; grid-template-columns: 260px 1fr; min-height: 520px; padding: 0; overflow: hidden; }
.chat-users { border-right: 1px solid var(--border); padding: 18px; }
.chat-window { display: flex; flex-direction: column; min-width: 0; }
#chatHeader { padding: 18px; border-bottom: 1px solid var(--border); font-weight: 700; }
.message-list { flex: 1; padding: 18px; overflow-y: auto; min-height: 350px; }
.message-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.message-form input { margin: 0; }
.message { max-width: 75%; margin: 9px 0; padding: 11px 14px; border-radius: 13px; background: var(--panel2); overflow-wrap: anywhere; }
.message.mine { margin-left: auto; background: #38245c; }
.message .time { display: block; color: #aaa; font-size: 10px; margin-top: 4px; }
.list-box { min-height: 65px; }
.user-row, .data-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.user-row:last-child, .data-row:last-child { border: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1; }
.game-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; margin: 20px 0; }
.game-grid canvas { display: block; width: min(100%,300px); height: auto; background: #08080d; border: 1px solid var(--border); border-radius: 10px; }
.rubik { display: grid; grid-template-columns: repeat(3,42px); gap: 4px; margin: 18px auto; width: max-content; }
.rubik span { width: 42px; height: 42px; border-radius: 5px; background: var(--purple); }
.feed-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 20px; }
.feed-grid iframe { width: 100%; aspect-ratio: 16/9; border: 0; }
.table-list { margin-top: 15px; }
.status-line { padding: 12px 0; color: var(--muted); }
.status-dot { display: inline-block; width: 8px; height: 8px; background: #e0a13b; border-radius: 50%; margin-right: 8px; }
iframe { width: 100%; min-height: 300px; border: 1px solid var(--border); border-radius: 12px; }
a { color: #b99aff; }
.toast {
  position: fixed; bottom: 25px; right: 25px; z-index: 20; padding: 13px 18px;
  background: #29213a; border: 1px solid #65479a; border-radius: 11px;
  opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; }
@media(max-width:900px) {
  .sidebar { width: 205px; }
  .main { margin-left: 205px; }
  .content { padding: 22px; }
  .stats-grid, .quick-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:650px) {
  .sidebar { position: relative; width: 100%; height: auto; padding: 12px; }
  .sidebar .logo { padding: 0 8px 10px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav { white-space: nowrap; width: auto; }
  .side-label, .sidebar-bottom { display: none; }
  .main { margin-left: 0; }
  .topbar { height: 65px; padding: 0 15px; }
  .content { padding: 16px; }
  .hero { padding: 25px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .quick-grid, .game-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-users { border-right: 0; border-bottom: 1px solid var(--border); }
  .feed-grid { grid-template-columns: 1fr; }
}
