:root {
  color-scheme: dark;
  --bg: #050607;
  --panel: #101214;
  --panel-2: #15181b;
  --border: #272d32;
  --text: #f4f7f8;
  --muted: #8d979f;
  --green: #2df27c;
  --red: #ff4d5e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-shell,
.entered-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 420px);
  padding: 28px;
  background: linear-gradient(180deg, rgba(21, 24, 27, 0.98), rgba(12, 14, 16, 0.98));
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.brand {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 12px 0 8px;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: 0;
}

p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: #c8d0d5;
  font-size: 14px;
  font-weight: 650;
}

input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  background: #080a0b;
  color: var(--text);
  font: inherit;
}

input:focus {
  border-color: rgba(45, 242, 124, 0.7);
  box-shadow: 0 0 0 3px rgba(45, 242, 124, 0.12);
}

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

.code-cell {
  height: 54px;
  padding: 0;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
}

button {
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #021006;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.08);
}

.muted-link {
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 14px;
}

.muted-link:hover {
  color: var(--text);
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 77, 94, 0.38);
  border-radius: 6px;
  background: rgba(255, 77, 94, 0.1);
  color: #ffb5bd;
  font-size: 14px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.qr-wrap img {
  width: 224px;
  height: 224px;
  display: block;
}

.secret-note {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.secret-note strong {
  color: var(--green);
}

.entered-screen h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 84px);
  color: var(--text);
  text-shadow: 0 0 36px rgba(45, 242, 124, 0.18);
}

.admin-shell {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
  padding: 32px 0;
}

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

.admin-header h1 {
  margin-bottom: 0;
}

.admin-section {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(21, 24, 27, 0.94), rgba(10, 12, 14, 0.94));
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.section-title span {
  color: var(--green);
  font-weight: 850;
}

.section-title form,
.actions form {
  margin: 0;
}

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

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 14px;
}

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

code {
  color: var(--green);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.danger-button {
  width: auto;
  height: 34px;
  padding: 0 12px;
  background: rgba(255, 77, 94, 0.14);
  color: #ffb5bd;
  border: 1px solid rgba(255, 77, 94, 0.42);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.dashboard-shell {
  position: relative;
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 28px 0 40px;
}

.dashboard-shell::before {
  content: "";
  position: fixed;
  left: 50%;
  top: -320px;
  width: min(1700px, 150vw);
  height: 780px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at top, rgba(45, 242, 124, 0.085), rgba(45, 242, 124, 0.044) 38%, rgba(45, 242, 124, 0.02) 62%, transparent 86%);
  filter: blur(42px);
  pointer-events: none;
  z-index: 0;
}

.dashboard-shell > * {
  position: relative;
  z-index: 1;
}

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

.dashboard-top h1 {
  margin: 8px 0 0;
  font-size: 22px;
}

.strategy-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.strategy-button {
  width: auto;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: #090c0e;
  color: var(--muted);
  font-size: 13px;
}

.strategy-button.is-active {
  border-color: rgba(244, 247, 248, 0.58);
  color: var(--text);
}

.strategy-button.is-on {
  box-shadow: inset 0 -2px 0 rgba(45, 242, 124, 0.8);
}

.strategy-filters {
  max-width: 680px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.dashboard-actions form {
  margin: 0;
}

.ghost-button {
  width: auto;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.auto-state-button {
  width: auto;
  min-width: 116px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.auto-state-button.is-on {
  border-color: rgba(45, 242, 124, 0.68);
  background: rgba(45, 242, 124, 0.9);
  color: #021006;
}

.balance-hero {
  position: relative;
  overflow: visible;
  text-align: center;
  padding: 8px 0 30px;
}

.balance-hero::before {
  display: none;
}

.balance-label {
  position: relative;
  color: #d7dde1;
  font-size: 20px;
  font-weight: 800;
}

.balance-value {
  position: relative;
  margin-top: 8px;
  font-size: clamp(46px, 8vw, 78px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 0 30px rgba(45, 242, 124, 0.08);
}

.balance-sub,
.sync-note,
.settings-actions span,
.section-title > span,
td small {
  color: var(--muted);
  font-size: 13px;
}

.balance-sub {
  position: relative;
  margin-top: 8px;
}

.sync-note {
  position: relative;
  min-height: 20px;
  margin-top: 6px;
}

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

.stat-panel,
.settings-panel,
.bets-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #090c0e;
}

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

.stat-panel h2 {
  margin: 0 0 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 19px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-row span {
  color: #aab3ba;
}

.stat-row strong {
  font-size: 18px;
}

.positive {
  color: var(--green) !important;
}

.negative {
  color: var(--red) !important;
}

.muted-value {
  color: var(--muted) !important;
}

.settings-panel,
.bets-panel {
  margin-top: 18px;
  padding: 18px;
}

.settings-panel.is-hidden {
  display: none;
}

.bet-counters {
  margin: 12px 0 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  white-space: pre-wrap;
}

.settings-form {
  display: grid;
  gap: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.settings-field:last-child {
  grid-column: span 2;
}

.settings-field {
  display: grid;
  gap: 8px;
}

.settings-field label {
  color: var(--muted);
  font-size: 14px;
}

.settings-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.settings-input-row input {
  min-width: 0;
}

.settings-copy-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.settings-actions button {
  width: auto;
  min-width: 132px;
  padding: 0 18px;
}

.bets-table-wrap {
  border: 0;
  border-radius: 0;
  margin-top: 0;
}

.bets-table {
  min-width: 720px;
}

.bets-table th:nth-child(3),
.bets-table th:nth-child(4),
.bets-table td:nth-child(3),
.bets-table td:nth-child(4) {
  text-align: right;
  white-space: nowrap;
}

.bet-row {
  cursor: pointer;
}

.bet-row:hover,
.bet-row:focus {
  background: #111518;
  outline: none;
}

.bet-players {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.bet-player.is-opponent,
.bet-vs {
  color: var(--muted);
}

.sport-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 10px;
  border-radius: 50%;
  vertical-align: -3px;
  background: radial-gradient(circle at 35% 35%, #efffb0 0 18%, #a7d62b 19% 52%, #6f8d20 53%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

td small {
  display: block;
  margin-top: 4px;
}

@media (max-width: 440px) {
  .auth-panel {
    padding: 22px;
  }

  .code-grid {
    gap: 6px;
  }

  .code-cell {
    height: 48px;
    font-size: 20px;
  }

  .admin-header,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .stats-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-field:last-child {
    grid-column: auto;
  }

  .dashboard-top,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .dashboard-top form,
  .dashboard-top button,
  .settings-actions button {
    width: 100%;
  }
}
