:root {
  color-scheme: dark;
  --bg: #0d1017;
  --panel: #161b24;
  --panel-strong: #1f2632;
  --text: #f3f7fb;
  --muted: #9da8b8;
  --line: #2c3442;
  --gold: #f6c85f;
  --green: #61d394;
  --red: #ef6f6c;
  --blue: #72a7ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(114, 167, 255, 0.18), transparent 34rem),
    linear-gradient(135deg, #0d1017 0%, #151923 52%, #111820 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
}

.admin-shell {
  grid-template-columns: minmax(300px, 380px) 1fr;
}

.play-panel,
.board-panel,
.recent-panel {
  background: rgba(22, 27, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
}

.recent-panel {
  grid-column: 1 / -1;
}

.brand-row,
.board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.3rem, 5vw, 4.8rem);
}

h2 {
  font-size: 1.5rem;
}

.admin-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--panel-strong);
}

.spin-form {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}

.prank-banner {
  margin-top: 18px;
  border: 1px solid rgba(246, 200, 95, 0.45);
  border-radius: 8px;
  background: rgba(246, 200, 95, 0.11);
  color: var(--gold);
  padding: 12px;
  font-weight: 800;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f131b;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(114, 167, 255, 0.18);
}

.digit-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(48px, 1fr));
  gap: 10px;
}

.digit-input {
  height: 62px;
  padding: 0;
  text-align: center;
  font-size: 2rem;
  font-weight: 950;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 13px 16px;
  background: var(--gold);
  color: #211807;
  font-weight: 900;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.result-box {
  min-height: 150px;
  margin-top: 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 18px;
  background: #111721;
}

.draw-number {
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  line-height: 1;
  font-weight: 950;
  color: var(--green);
  letter-spacing: 0;
}

.muted,
.message {
  color: var(--muted);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #111721;
  color: var(--muted);
  white-space: nowrap;
}

.stats b {
  color: var(--text);
}

.leaderboard {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 10px;
}

.leaderboard li,
.recent-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #111721;
}

.rank {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--gold);
  font-weight: 900;
}

.player-name {
  font-weight: 850;
  overflow-wrap: anywhere;
}

.player-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.coin {
  color: var(--green);
  font-weight: 950;
  white-space: nowrap;
}

.recent-list {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.active-user-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.active-user {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #111721;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(97, 211, 148, 0.12);
}

.active-user.is-spinning {
  border-color: rgba(246, 200, 95, 0.55);
}

.active-user.is-spinning .status-dot {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(246, 200, 95, 0.16);
}

.admin-history-head {
  margin-top: 26px;
}

.settings-panel {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111721;
}

.switch-row {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.recent-number {
  font-size: 1.45rem;
  font-weight: 950;
  color: var(--blue);
}

.hidden {
  display: none;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  background: #111721;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  color: var(--text);
}

.admin-stats {
  justify-content: flex-start;
  margin-top: 16px;
}

@media (max-width: 840px) {
  .app-shell,
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .brand-row,
  .board-head {
    align-items: stretch;
    flex-direction: column;
  }

  .stats {
    justify-content: flex-start;
  }
}
