* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1f2933 0, #020617 55%, #000 100%);
  color: #e5e7eb;
}

.game-wrapper {
  position: relative;
  text-align: center;
}

h1 {
  margin-bottom: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.6rem;
}

canvas {
  background: #020617;
  border-radius: 12px;
  box-shadow:
    0 0 0 2px rgba(148, 163, 184, 0.2),
    0 30px 60px rgba(15, 23, 42, 0.9);
  display: block;
  margin: 0 auto;
}

.info {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: #9ca3af;
}

button {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.45);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(34, 197, 94, 0.5);
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}

.settings-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding-inline: 0.75rem;
  font-size: 0.7rem;
}

.main-menu-btn {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  padding-inline: 0.75rem;
  font-size: 0.7rem;
}

.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.winner-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(56, 189, 248, 0.2), rgba(15, 23, 42, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.settings-modal {
  width: 520px;
  max-width: 90vw;
  background: #020617;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem 1rem;
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.25),
    0 25px 65px rgba(15, 23, 42, 0.9);
}

.settings-modal h2 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.settings-section h3 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.settings-row label,
.settings-row span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
}

.settings-row input[type="number"],
.settings-row select {
  background: #020617;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  min-width: 5rem;
}

.settings-row .settings-input-wide {
  min-width: 7rem;
}

.settings-row input[type="number"]:focus,
.settings-row select:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.gradient-options {
  display: flex;
  gap: 0.4rem;
}

.gradient-swatch {
  width: 28px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.gradient-swatch[data-gradient="bluePurple"] {
  background-image: linear-gradient(135deg, #38bdf8, #6366f1);
}

.gradient-swatch[data-gradient="pinkOrange"] {
  background-image: linear-gradient(135deg, #ec4899, #f97316);
}

.gradient-swatch[data-gradient="greenTeal"] {
  background-image: linear-gradient(135deg, #22c55e, #14b8a6);
}

.gradient-swatch[data-gradient="yellowRed"] {
  background-image: linear-gradient(135deg, #eab308, #ef4444);
}

.gradient-swatch.selected {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.6);
}

.settings-footer {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.winner-modal {
  min-width: 260px;
  padding: 1.25rem 1.75rem 1rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.96);
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.5),
    0 25px 70px rgba(15, 23, 42, 1);
  text-align: center;
}

.winner-modal h2 {
  font-size: 1.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.winner-modal button {
  padding-inline: 1.3rem;
}

.error-text {
  color: #f97316;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.hidden {
  display: none !important;
}

.main-menu-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    circle at top,
    rgba(15, 23, 42, 0.8),
    rgba(0, 0, 0, 0.7)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.main-menu-modal {
  min-width: 260px;
  padding: 1.75rem 2rem 1.5rem;
  border-radius: 1.25rem;
  background: rgba(15, 23, 42, 0.98);
  box-shadow:
    0 0 0 1px rgba(148, 163, 184, 0.55),
    0 30px 80px rgba(15, 23, 42, 1);
  text-align: center;
}

.main-menu-title {
  font-size: 2rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.main-menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main-menu-buttons button {
  padding-inline: 1.6rem;
}

.main-menu-row {
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.main-menu-row select {
  background: #020617;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #e5e7eb;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  min-width: 5rem;
}
button {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(34, 197, 94, 0.45);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(34, 197, 94, 0.5);
  filter: brightness(1.08);
}

button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}
