* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e3f2fd, #bbdefb);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 20px;
  color: #333;
}

h1 {
  color: #0277bd;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
  margin: 15px 0 20px;
  font-size: 26px;
  text-align: center;
}

.config {
  margin: 15px 0 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.config label {
  font-weight: bold;
  color: #0277bd;
  white-space: nowrap;
}

#numCount {
  padding: 8px 12px;
  font-size: 16px;
  width: 80px;
  border: 1px solid #90a4ae;
  border-radius: 6px;
  text-align: center;
}

#apply {
  padding: 8px 16px;
  background: #0288d1;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

#apply:hover {
  background: #0277bd;
}

.wheel-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 40px auto;
}

.pointer {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 36px solid #d32f2f;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

canvas {
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  display: block;
  z-index: 10;
  position: relative;
}

.controls {
  margin-top: 25px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

button {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: white;
  transition: all 0.2s ease;
  min-width: 100px;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

button#spin { background: #2e7d32; }
button#confirm { background: #d32f2f; }
button#reset { background: #5e35b1; }

button:disabled {
  background: #bdbdbd;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.7;
}

#result {
  margin-top: 25px;
  font-size: 22px;
  font-weight: bold;
  min-height: 30px;
  text-align: center;
  padding: 12px 20px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  width: 90%;
  max-width: 400px;
}

/* Popup Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  text-align: center;
  position: relative;
}

.modal-content img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.close {
  position: absolute;
  top: 10px;
  right: 20px;
  color: #aaa;
  font-size: 30px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

#imageCaption {
  margin-top: 15px;
  font-size: 18px;
  color: #333;
}

@media (max-width: 480px) {
  .wheel-container { width: 260px; height: 260px; }
  canvas { width: 260px; height: 260px; }
  h1 { font-size: 22px; }
  .config { flex-direction: column; gap: 8px; }
}