* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(170deg, #05080f 0%, #0a140d 35%, #0d1a10 60%, #05080f 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 60% 40% at 50% 85%, rgba(245, 158, 11, 0.04) 0%, transparent 70%),
              radial-gradient(ellipse 40% 30% at 30% 90%, rgba(251, 191, 36, 0.03) 0%, transparent 60%),
              radial-gradient(ellipse 50% 50% at 70% 80%, rgba(239, 68, 68, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1px 1px at 20% 10%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 40% 5%, rgba(255,255,255,0.1) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 60% 15%, rgba(255,255,255,0.12) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 8%, rgba(255,255,255,0.08) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 25%, rgba(255,255,255,0.1) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 50% 20%, rgba(255,255,255,0.06) 0%, transparent 100%),
    radial-gradient(1px 1px at 75% 30%, rgba(255,255,255,0.09) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 18%, rgba(255,255,255,0.07) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 35%, rgba(255,255,255,0.05) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 65% 28%, rgba(255,255,255,0.08) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.main-container {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  position: relative;
  z-index: 1;
}

.content-container {
  width: 100%;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  transition: all 0.4s ease;
  margin-top: 1rem;
}

.content-container.blur {
  filter: blur(6px);
  pointer-events: none;
}

.logo-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  position: relative;
}

.logo-container::after {
  content: "";
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.3), transparent);
  margin-top: 0.5rem;
}

.logo-image {
  max-width: 80%;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(245, 158, 11, 0.12));
}

.game-title {
  font-family: "Creepster", cursive;
  font-size: 1.6rem;
  color: #fbbf24;
  text-align: center;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(251, 191, 36, 0.15), 0 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.game-subtitle {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-top: -0.25rem;
}

.input-container {
  width: 90%;
}

.username-input {
  width: 100%;
  height: 3rem;
  padding: 0 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  font-family: "Inter", sans-serif;
  font-size: 0.9rem;
  color: #fef3c7;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.username-input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.username-input:focus {
  outline: none;
  border-color: rgba(245, 158, 11, 0.25);
  box-shadow: 0 4px 30px rgba(245, 158, 11, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  background: rgba(0, 0, 0, 0.4);
}

.primary-button {
  width: 60%;
  height: 3rem;
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
  color: #1a1a1a;
  border: none;
  border-radius: 0.75rem;
  font-family: "Inter", sans-serif;
  font-weight: 800;
  letter-spacing: 1.5px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 25px rgba(245, 158, 11, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
}

.primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 50%, rgba(0, 0, 0, 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.primary-button::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 35px rgba(245, 158, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.primary-button:hover::before {
  opacity: 1;
}

.primary-button:hover::after {
  opacity: 1;
}

.primary-button:active {
  transform: translateY(0) scale(0.98);
}

.error-message {
  color: #fca5a5;
  font-size: 0.8rem;
  font-weight: 500;
  margin-top: 0.25rem;
  display: none;
  background: rgba(239, 68, 68, 0.08);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.selection-text {
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
  font-size: 0.8rem;
  margin-top: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.items-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 0.25rem;
  position: relative;
}

.section-title {
  font-family: "Kalam", cursive;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
  color: #fbbf24;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.section-title::before,
.section-title::after {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.3));
}

.section-title::after {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.3), transparent);
}

.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  gap: 1.25rem;
  justify-items: center;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 25rem;
  justify-content: center;
}

.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.item-image {
  position: relative;
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.25);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.item-image:hover {
  transform: translateY(-2px);
  border-color: rgba(251, 191, 36, 0.12);
  box-shadow: 0 8px 30px rgba(251, 191, 36, 0.04);
  background: rgba(0, 0, 0, 0.35);
}

.item-image.selected {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.06);
  box-shadow: 0 0 25px rgba(34, 197, 94, 0.08), 0 8px 30px rgba(34, 197, 94, 0.03);
}

.item-image.selected:hover {
  border-color: rgba(34, 197, 94, 0.5);
}

.item-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  transition: transform 0.3s ease;
  opacity: 0.85;
}

.item-image:hover .item-img {
  transform: scale(1.08);
  opacity: 1;
}

.item-image.selected .item-img {
  opacity: 1;
}

.item-checkmark {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  border-radius: 50%;
  padding: 0.2rem;
  display: none;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.item-image.selected .item-checkmark {
  display: block;
}

.checkmark {
  width: 0.8rem;
  height: 0.8rem;
  color: white;
}

.item-title {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  letter-spacing: 0.5px;
}

.item-image.selected ~ .item-title {
  color: rgba(74, 222, 128, 0.7);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(16px);
  display: none;
  padding: 1rem;
}

.modal-content {
  background: linear-gradient(160deg, rgba(10, 14, 23, 0.98), rgba(15, 22, 18, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 2.5rem 2rem;
  width: 22rem;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: modalFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
  overflow: hidden;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.2), transparent);
}

.star-container {
  width: 5rem;
  height: 5rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.star-svg {
  width: 100%;
  height: 100%;
  animation: spin-slow 6s linear infinite;
  filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.2));
}

.star-svg path {
  stroke: #fbbf24;
  stroke-width: 2;
}

.selected-items-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.selected-item {
  width: 5rem;
  height: 5rem;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(251, 191, 36, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.selected-item-img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  opacity: 0.9;
}

.modal-text {
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  margin-bottom: 1.5rem;
  font-family: "Inter", sans-serif;
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.6;
}

.modal-title {
  color: #fbbf24;
  font-size: 1.3rem;
  font-family: "Creepster", cursive;
  font-weight: 400;
  margin-bottom: 0.75rem;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.1);
}

.loading-dots {
  display: flex;
  justify-content: center;
  margin-top: 0;
}

.dots {
  color: rgba(251, 191, 36, 0.5);
  font-size: 2rem;
  font-weight: 300;
  letter-spacing: 4px;
}

button {
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.item-image {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.item-image::selection {
  background: transparent;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .main-container {
    padding: 1.5rem 0.75rem;
  }

  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 20rem;
  }

  .item-image {
    width: 5.5rem;
    height: 5.5rem;
  }

  .modal-content {
    padding: 2rem 1.5rem;
    width: 100%;
  }

  .game-title {
    font-size: 1.3rem;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 22rem;
  }
}

@media (min-width: 769px) {
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 25rem;
  }
}
