:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111318;
  color: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #111318;
}

.app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.panel,
.controls {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.top-actions {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px;
}

.top-actions button {
  padding: 0 10px;
  font-size: 13px;
}

.label {
  margin: 0 0 6px;
  color: #aab1c5;
  font-size: 13px;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #f4c84a;
  color: #17140a;
  font-weight: 800;
}

button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.roulette {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 330px;
}

.history-button,
.top-day-button {
  position: absolute;
  top: 6px;
  z-index: 5;
  min-height: 34px;
  padding: 0 10px;
  background: #2a303d;
  color: #f5f7fb;
  font-size: 12px;
}

.history-button {
  right: 0;
}

.top-day-button {
  left: 0;
}

.pointer {
  position: absolute;
  top: 10px;
  z-index: 4;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 30px solid #f5f7fb;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.3));
}

.pointer::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -38px;
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: #f5f7fb;
}

.wheel {
  position: relative;
  display: grid;
  place-items: center;
  width: min(78vw, 320px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #555b66;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  transition: none;
}

.wheel.is-waiting {
  animation: idle-spin 8s linear infinite;
  background: conic-gradient(#555b66, #383d47, #555b66);
}

.wheel.is-spinning {
  transition: none;
}

.center {
  z-index: 3;
  display: grid;
  place-items: center;
  width: 32%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #111318;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #f5f7fb;
  padding: 6px;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
}

.players-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.player-avatar {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.88);
  background: var(--color);
  color: #fff;
  font-weight: 900;
  overflow: hidden;
  transform:
    rotate(var(--angle))
    translate(var(--radius))
    rotate(calc(-1 * var(--angle)))
    translate(-50%, -50%);
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.controls {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

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

.quick-bet,
.edit-bets {
  min-height: 46px;
  padding: 0 8px;
}

.field {
  display: grid;
  gap: 8px;
  color: #cbd1df;
  font-size: 13px;
}

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

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 12px;
  background: #191d27;
  color: #f5f7fb;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
}

.pin {
  min-height: 46px;
  padding: 0 10px;
  font-size: 14px;
  letter-spacing: 0;
}

.panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 16px;
}

.stat {
  display: grid;
  gap: 4px;
}

.stat span {
  color: #aab1c5;
  font-size: 13px;
}

.stat b {
  font-size: 18px;
}

.panel p {
  grid-column: 1 / -1;
  margin: 0;
  color: #cbd1df;
}

.players-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.list-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--color);
  border-radius: 50%;
  background: #191d27;
  color: #fff;
  font-weight: 900;
  overflow: hidden;
}

.list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.player-meta b,
.player-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta span {
  color: #aab1c5;
  font-size: 13px;
}

.player-chance {
  font-weight: 900;
  color: #f4c84a;
}

.empty-list {
  color: #aab1c5;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
}

.modal[hidden] {
  display: none;
}

.modal-content {
  display: grid;
  grid-template-rows: auto;
  gap: 14px;
  width: min(100%, 360px);
  max-height: min(86vh, 680px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  background: #191d27;
  overflow: hidden;
}

.modal-content h2 {
  margin: 0;
  font-size: 19px;
}

.modal-note {
  margin: -6px 0 0;
  color: #aab1c5;
  font-size: 13px;
}

.slot-list,
.modal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.slot {
  min-height: 42px;
  background: #2a303d;
  color: #f5f7fb;
}

.slot.selected {
  outline: 3px solid #f4c84a;
  outline-offset: 2px;
}

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

.history-list,
.top-day-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  max-height: min(52vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #f4c84a #2a303d;
}

.history-list::-webkit-scrollbar,
.top-day-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-track,
.top-day-list::-webkit-scrollbar-track {
  background: #2a303d;
  border-radius: 999px;
}

.history-list::-webkit-scrollbar-thumb,
.top-day-list::-webkit-scrollbar-thumb {
  background: #f4c84a;
  border-radius: 999px;
}

.history-row,
.top-day-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.top-day-row {
  grid-template-columns: 38px minmax(0, 1fr);
}

.top-day-row.has-prize {
  grid-template-columns: 38px minmax(0, 1fr) 64px;
}

.history-meta,
.top-day-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.history-meta b,
.history-meta span,
.top-day-meta b,
.top-day-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-meta span,
.top-day-meta span {
  color: #aab1c5;
  font-size: 13px;
}

.history-chance {
  color: #f4c84a;
  font-weight: 900;
}

.top-day-prize {
  width: 58px;
  height: 58px;
  justify-self: end;
  object-fit: contain;
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
}

.secondary {
  background: #2a303d;
  color: #f5f7fb;
}

.winner-toast {
  position: fixed;
  left: 50%;
  top: 18px;
  z-index: 20;
  width: min(calc(100% - 36px), 360px);
  transform: translateX(-50%);
}

.winner-toast[hidden] {
  display: none;
}

.winner-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
  border: 1px solid rgba(244, 200, 74, 0.45);
  border-radius: 8px;
  padding: 12px 14px;
  background: #191d27;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.winner-card span {
  color: #aab1c5;
  font-size: 13px;
}

.winner-card b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.winner-card strong {
  grid-row: 1 / 3;
  grid-column: 2;
  color: #f4c84a;
  font-size: 22px;
}

@keyframes idle-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}
