:root {
  color-scheme: dark;
  --bg: #020617;
  --bg-2: #06112b;
  --panel: #0f172a;
  --panel-2: #101c3f;
  --line: rgba(148, 163, 184, 0.24);
  --line-soft: rgba(148, 163, 184, 0.14);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --title: #f8fafc;
  --accent: #22d3ee;
  --accent-2: #0ea5e9;
  --ok: #34d399;
  --bad: #fb7185;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, #103a70 0%, transparent 55%),
    radial-gradient(900px 600px at 0% 100%, #0a2147 0%, transparent 45%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 65%);
}

button,
input {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #071227;
  color: var(--text);
  padding: 10px 12px;
}

input:focus {
  outline: 0;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.15);
}

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

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

#app {
  min-height: 100vh;
}

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

.sidebar {
  width: 252px;
  border-right: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(4px);
  padding: 16px 12px;
}

.brand {
  font-size: 21px;
  font-weight: 700;
  color: var(--title);
}

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

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

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

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

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

.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.75);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.top-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--title);
}

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

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

.top-user {
  font-size: 12px;
  color: #bae6fd;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(14, 165, 233, 0.14);
}

.btn-primary {
  background: linear-gradient(180deg, #22d3ee, #0ea5e9);
  color: #08213a;
}

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

.btn-danger {
  border: 1px solid rgba(251, 113, 133, 0.35);
  background: rgba(251, 113, 133, 0.16);
  color: #ffe4ea;
}

.content {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.login-wrap {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.86));
  padding: 18px;
}

.login-title {
  font-size: 30px;
  font-weight: 800;
  color: var(--title);
}

.login-sub {
  margin-top: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 10px;
}

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

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

.panel-head h2 {
  margin: 0;
  color: var(--title);
  font-size: 19px;
}

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

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

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

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

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

.stat .v.small {
  font-size: 14px;
  font-weight: 600;
}

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

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

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

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

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

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 10px;
  text-align: left;
  font-size: 13px;
}

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

tr:last-child td {
  border-bottom: 0;
}

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

.link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: #67e8f9;
  text-decoration: underline;
  font-weight: 600;
}

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

.empty {
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

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

.bad {
  color: var(--bad);
}

.status {
  min-height: 20px;
  font-size: 13px;
}

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

.status.err {
  color: var(--bad);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.72);
  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: 12px;
}

.modal-card.narrow {
  width: min(680px, 100%);
}

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

.modal-title {
  font-size: 18px;
  color: var(--title);
  font-weight: 700;
}

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

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

.panel-inner {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.75);
  padding: 10px;
}

.modal-section-title {
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  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: 4.8%;
  top: 10.2%;
  width: 90.4%;
  height: 79%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 2.8% 0.6%;
}

.symbol-cell {
  position: relative;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

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

.symbol-cell .fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  padding: 2px;
  text-align: center;
}

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

.mult-badge {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 1px 4px;
  font-size: 10px;
  border-radius: 999px;
  color: #fff;
  background: rgba(225, 29, 72, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.36);
}

.kpi-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 8px;
}

.kpi-box {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.kpi-box .k {
  font-size: 11px;
  color: var(--muted);
}

.kpi-box .v {
  margin-top: 4px;
  font-size: 16px;
  color: #fff;
  font-weight: 700;
}

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

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

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

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

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

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

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

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

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

  .login-title {
    font-size: 26px;
  }

  .sidebar {
    padding: 12px;
  }

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

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

  .topbar {
    padding: 12px;
  }

  .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-head {
    flex-direction: column;
  }

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

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions > * {
    flex: 1 1 120px;
  }

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

  table {
    min-width: 700px;
  }

  .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,
  .kpi-row {
    grid-template-columns: 1fr;
  }

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

  table {
    min-width: 620px;
  }
}
