:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-soft: #0b1220;
  --panel: #0f172a;
  --panel-soft: #111c31;
  --line: rgba(148, 163, 184, 0.2);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22d3ee;
  --danger: #fb7185;
  --ok: #34d399;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at top, #0f172a 0%, #020617 52%);
  color: var(--text);
}

#app {
  min-height: 100vh;
}

.loading-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  padding: 24px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  margin: 0;
  font-size: 34px;
}

.login-card p {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.login-card label {
  display: block;
  margin-top: 12px;
}

.login-card label span {
  display: block;
  font-size: 13px;
  color: #cbd5e1;
  margin-bottom: 6px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1324;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(34, 211, 238, 0.6);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: #06b6d4;
  color: #06293a;
}

.btn-primary:hover {
  background: #22d3ee;
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #e2e8f0;
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.22);
}

.msg {
  min-height: 18px;
  margin-top: 10px;
  font-size: 13px;
}

.msg.err {
  color: var(--danger);
}

.msg.ok {
  color: var(--ok);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  background: transparent;
}

.sidebar {
  width: 250px;
  flex: 0 0 250px;
  border-right: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.88);
  padding: 20px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: #f8fafc;
}

.brand-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.35);
  color: #a5f3fc;
}

.sidebar-foot {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.7);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.top-title {
  color: #f8fafc;
  font-size: 16px;
  font-weight: 600;
}

.top-sub {
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.content {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.82));
  border-radius: 14px;
  padding: 14px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 20px;
}

.panel p {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.cards.compact {
  margin-bottom: 12px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.05);
  padding: 10px;
}

.stat .k {
  color: var(--muted);
  font-size: 12px;
}

.stat .v {
  margin-top: 4px;
  color: #f8fafc;
  font-size: 20px;
  font-weight: 700;
}

.form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-row > input,
.form-row > select {
  width: auto;
  min-width: 180px;
  flex: 1 1 180px;
}

.inline-label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.inline-label input,
.inline-label select {
  min-width: 180px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding: 8px 10px;
  text-align: left;
  font-size: 13px;
}

th {
  background: rgba(148, 163, 184, 0.08);
  color: #cbd5e1;
  position: sticky;
  top: 0;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.link-user {
  border: 0;
  padding: 0;
  background: transparent;
  color: #67e8f9;
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
  font-weight: 600;
}

.link-user:hover {
  color: #a5f3fc;
}

.good {
  color: #6ee7b7;
}

.bad {
  color: #fda4af;
}

.empty {
  color: var(--muted);
}

.pager {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: min(1180px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #020617;
  padding: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.modal-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.modal-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1.3fr 1fr;
}

.panel-inner {
  background: rgba(15, 23, 42, 0.75);
}

.modal-section-title {
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wager-board {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1741 / 652;
}

.wager-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wager-reels {
  position: absolute;
  left: 8.4%;
  top: 10%;
  width: 83.2%;
  height: 80%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 3% 1%;
}

.symbol {
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.25);
}

.symbol.hit {
  box-shadow: 0 0 14px rgba(248, 113, 113, 0.9);
  border-color: rgba(248, 113, 113, 0.9);
}

.symbol img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.json-box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  padding: 8px;
  margin-bottom: 10px;
}

.json-box pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  color: #cbd5e1;
}

@media (max-width: 980px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

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

@media (max-width: 760px) {
  .login-wrap,
  .loading-wrap {
    padding: 14px;
  }

  .login-card {
    border-radius: 12px;
    padding: 16px;
  }

  .login-card h1 {
    font-size: 28px;
  }

  .sidebar {
    padding: 12px;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    text-align: center;
  }

  .topbar {
    padding: 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .top-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .top-actions > * {
    flex: 1 1 120px;
    text-align: center;
  }

  .content {
    padding: 12px;
    gap: 10px;
  }

  .panel {
    border-radius: 12px;
    padding: 12px;
  }

  .panel h2 {
    font-size: 18px;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row {
    flex-direction: column;
  }

  .form-row > input,
  .form-row > select,
  .inline-label input,
  .inline-label select {
    min-width: 0;
    width: 100%;
  }

  .pager {
    flex-wrap: wrap;
  }

  table {
    min-width: 680px;
  }

  .modal-card {
    border-radius: 12px;
    padding: 10px;
  }

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

  .json-box pre {
    max-height: 180px;
  }
}

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

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

  .top-actions > * {
    flex-basis: 100%;
  }

  table {
    min-width: 600px;
  }
}
