:root {
  --bg: #111114;
  --bg-elevated: #18181d;
  --glass: rgba(32, 32, 38, 0.55);
  --glass-hover: rgba(42, 42, 50, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-strong: rgba(255, 255, 255, 0.14);
  --text: #ececf1;
  --text-muted: #9494a3;
  --accent: #7c9cff;
  --accent-soft: rgba(124, 156, 255, 0.16);
  --ok: #5ee1a2;
  --ok-soft: rgba(94, 225, 162, 0.14);
  --warn: #f5c26b;
  --warn-soft: rgba(245, 194, 107, 0.14);
  --danger: #ff7b8a;
  --danger-soft: rgba(255, 123, 138, 0.14);
  --radius: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

.bg-glow--a {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -120px;
  background: rgba(124, 156, 255, 0.12);
}

.bg-glow--b {
  width: 480px;
  height: 480px;
  right: -140px;
  bottom: -160px;
  background: rgba(94, 225, 162, 0.08);
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 24px 48px;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar {
  padding: 12px;
  position: sticky;
  top: 20px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: 0.18s ease;
}

.sidebar__item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.sidebar__item--active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(124, 156, 255, 0.28);
}

.sidebar__icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgba(124, 156, 255, 0.12);
  flex-shrink: 0;
}

.main {
  min-width: 0;
}

.panel-hint {
  color: var(--text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.lua-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lua-card {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lua-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.lua-card__title {
  font-size: 1rem;
  font-weight: 700;
}

.lua-card__meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.lua-card__author {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.lua-card__author strong {
  color: var(--text);
}

.lua-preview {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: hidden;
}

.lua-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
}

.modal__card {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.modal__head h3 {
  font-size: 1rem;
}

.modal__source {
  margin: 0;
  padding: 18px 20px;
  overflow: auto;
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px;
  margin-bottom: 22px;
}

.header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 156, 255, 0.25);
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.header__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s ease;
}

.btn--ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.btn--ghost:hover {
  background: var(--glass-hover);
  border-color: var(--glass-border-strong);
}

.btn--primary {
  color: #0f1220;
  background: linear-gradient(135deg, #9eb6ff, #7c9cff);
  border-color: transparent;
}

.btn--primary:hover {
  filter: brightness(1.06);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn--ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(94, 225, 162, 0.25);
}

.btn--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(245, 194, 107, 0.25);
}

.btn--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(255, 123, 138, 0.25);
}

.github-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.github-bar--ok {
  color: var(--ok);
}

.github-bar--warn {
  color: var(--warn);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px 20px;
}

.stat-card__label {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.stat-card__value {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-card__value--ok {
  color: var(--ok);
}

.stat-card__value--warn {
  color: var(--warn);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: 0.18s ease;
}

.search:focus {
  border-color: rgba(124, 156, 255, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.18s ease;
}

.chip:hover,
.chip--active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: rgba(124, 156, 255, 0.35);
}

.table-wrap {
  overflow: hidden;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 16px 18px;
  text-align: left;
  vertical-align: middle;
}

.users-table thead {
  background: rgba(0, 0, 0, 0.18);
}

.users-table th {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.users-table tbody tr {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge--ok {
  color: var(--ok);
  background: var(--ok-soft);
}

.badge--warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge--danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.users-table tbody tr.row--mismatch {
  background: rgba(255, 123, 138, 0.06);
}

.users-table tbody tr.row--mismatch:hover {
  background: rgba(255, 123, 138, 0.1);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 156, 255, 0.2);
  flex-shrink: 0;
}

.user-name {
  font-weight: 600;
}

.user-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

.mono {
  font-family: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

.hwid {
  max-width: 280px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 320px;
}

.btn--reset {
  border-color: rgba(124, 156, 255, 0.45);
  color: #9eb8ff;
  background: rgba(124, 156, 255, 0.12);
}

.btn--reset:hover {
  background: rgba(124, 156, 255, 0.22);
}

.btn--reset-alert {
  border-color: rgba(255, 123, 138, 0.55);
  color: #ffb4be;
  background: rgba(255, 123, 138, 0.16);
  animation: reset-pulse 1.6s ease-in-out infinite;
}

@keyframes reset-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 123, 138, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(255, 123, 138, 0.12);
  }
}

.steam-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.84rem;
}

.steam-link:hover {
  text-decoration: underline;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 42px 18px !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h2 {
  font-size: 1.2rem;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(24, 24, 30, 0.92);
  border: 1px solid var(--glass-border-strong);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.loader-upload {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.loader-upload__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.loader-upload__head h2 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.loader-upload__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .sidebar__nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar__item span:last-child {
    white-space: nowrap;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .users-table {
    min-width: 920px;
  }
}
