:root {
  --cat-size: 240px;
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background: linear-gradient(#22004c, #3f007f);
  color: #e9d7ff;
}

.container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(48, 25, 71, 0.95);
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
  padding: 24px;
  width: 100%;
  max-width: 500px;
  overflow: hidden;
  color: #e9d7ff;
}

.history-page .container {
  max-width: 640px;
  overflow: visible;
}

h2 {
  margin: 0;
  color: #f0e8ff;
  text-align: center;
}

p {
  margin-top: 8px;
  margin-bottom: 16px;
  color: #d1b6f2;
  text-align: center;
}

.status {
  font-style: italic;
}

.button {
  margin-top: 12px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: #7e56da;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.3s;
}

.history-page .button {
  margin-top: 24px;
}

.button:hover {
  background: #916ce0;
}

.button:disabled,
.button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.button.secondary {
  background: #5440a3;
}

.button.secondary:hover {
  background: #6654b8;
}

.button.small {
  padding: 8px 16px;
  font-size: 14px;
}

.button-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.button-row .button {
  margin-top: 0;
}

@media (min-width: 480px) {
  .button-row {
    flex-direction: row;
    justify-content: center;
  }

  .button-row .button {
    flex: 1;
  }
}

.cat-wrapper {
  position: relative;
  width: var(--cat-size);
  height: var(--cat-size);
  margin-bottom: 24px;
}

.cat-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.picker-page #numbers {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
}

.board {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}

.number-ball {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #ffffff;
  background: #7e56da;
}

.picker-page .number-ball {
  width: 52px;
  height: 52px;
  font-size: 20px;
  animation: bounce 0.6s ease-out;
}

.history-item .number-ball {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.mega-ball {
  background: #bb65c8;
}

@media (max-width: 480px) {
  .history-item .number-ball {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(-12px);
  }

  60% {
    transform: translateY(-6px);
  }
}

#sparkle-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  background: #bb86fc;
  opacity: 0;
  transform: rotate(45deg) scale(0);
  border-radius: 2px;
  animation: sparkle 1.5s ease-out forwards;
}

@keyframes sparkle {
  0% {
    opacity: 1;
    transform: rotate(45deg) scale(0);
  }

  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: rotate(45deg) scale(0);
  }
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.history-item {
  background: rgba(63, 27, 97, 0.75);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-top: 4px;
}

.history-meta .button {
  margin-top: 0;
}

.history-played-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(126, 86, 218, 0.35);
  color: #f5e3ff;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.history-played-state.is-true {
  background: rgba(64, 168, 122, 0.35);
  color: #c7ffdc;
}

.history-played-state.is-false {
  background: rgba(217, 109, 140, 0.35);
  color: #ffe3f1;
}

.history-played-toggle[aria-busy="true"] {
  cursor: progress;
}

.history-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
}

.history-board-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.history-board {
  width: 140px;
  height: 140px;
  display: block;
}

.history-item h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #f5e3ff;
}

.history-item .numbers {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
}

@media (min-width: 560px) {
  .history-item {
    flex-direction: row;
    align-items: center;
  }

  .history-board-wrapper {
    flex: 0 0 auto;
    margin-left: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .history-board {
    width: 120px;
    height: 120px;
  }
}
