* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

header {
  text-align: center;
  padding: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 0.5rem 1rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.wheel-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wheel-wrapper {
  position: relative;
  width: min(92vw, 480px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 10px 40px rgba(0,0,0,0.4), 0 0 0 8px rgba(255,255,255,0.15);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

/* Pointer at the right (3 o'clock position) */
.pointer {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-right: 28px solid #ff3b30;
  filter: drop-shadow(-2px 2px 3px rgba(0,0,0,0.4));
  z-index: 3;
}

.spin-btn {
  position: absolute;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  border: 4px solid #fff;
  background: radial-gradient(circle at 30% 30%, #ff6b6b, #c0392b);
  color: #fff;
  font-weight: bold;
  font-size: clamp(0.85rem, 3vw, 1.1rem);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  z-index: 2;
  transition: transform 0.1s ease;
  letter-spacing: 1px;
}

.spin-btn:active {
  transform: scale(0.95);
}

.hint {
  margin-top: 0.75rem;
  opacity: 0.75;
  font-size: 0.9rem;
}

.names-section {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.names-section label {
  font-size: 0.95rem;
  opacity: 0.9;
}

#names {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,0.95);
  color: #222;
  font-family: inherit;
  font-size: 1rem;
  resize: vertical;
  min-height: 160px;
  outline: none;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.15);
}

#names:focus {
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.15), 0 0 0 3px rgba(255,255,255,0.3);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: linear-gradient(160deg, #fff 0%, #f4f4f8 100%);
  color: #222;
  padding: 2rem 1.75rem;
  border-radius: 16px;
  text-align: center;
  width: min(85vw, 380px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: pop 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.modal-content h2 {
  font-size: 3rem;
  margin: 0 0 0.5rem;
}

.modal-content p {
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
  font-weight: 600;
}

.close-btn {
  background: linear-gradient(135deg, #2a5298, #1e3c72);
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.close-btn:active {
  transform: scale(0.97);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Wide screens: side-by-side */
@media (min-width: 850px) {
  main {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 3rem;
    padding-top: 1rem;
  }

  .wheel-wrapper {
    width: min(50vw, 520px);
  }

  .names-section {
    margin-top: 1rem;
    max-width: 360px;
  }

  #names {
    min-height: 320px;
  }

  header h1 {
    font-size: 2rem;
  }
}
