* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  overflow-x: hidden;
}
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.header { text-align: center; margin-bottom: 16px; }
.header h1 { font-size: 28px; font-weight: 700; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.header p { font-size: 15px; opacity: 0.9; margin-top: 4px; }

.wheel-wrap {
  position: relative;
  width: min(320px, 85vw);
  height: min(320px, 85vw);
  margin: 10px 0 20px;
}
#wheelCanvas { width: 100%; height: 100%; transition: transform 0.1s linear; }
.wheel-pointer {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  cursor: pointer;
  z-index: 10;
}
.pointer-triangle {
  position: absolute;
  top: -16px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 18px solid #ff4d4f;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.pointer-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff5e62, #ff9966);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,78,78,0.4), inset 0 -3px 0 rgba(0,0,0,0.1);
  transition: transform 0.1s;
  user-select: none;
}
.pointer-btn:active { transform: scale(0.92); }

.controls { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 10px; }
.code-input-wrap { display: flex; justify-content: center; }
#codeInput {
  width: 100%; max-width: 280px;
  padding: 12px 16px;
  border: none; border-radius: 8px;
  font-size: 16px; text-align: center;
  background: rgba(255,255,255,0.95);
  color: #333;
  outline: none;
}
.btn-group {
  display: flex; gap: 10px; justify-content: center;
  width: 100%; max-width: 280px;
  margin: 0 auto;
}
.draw-btn {
  flex: 1;
  padding: 14px;
  border: none; border-radius: 8px;
  font-size: 16px; font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #f6d365, #fda085);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.draw-btn:active { transform: scale(0.97); }
.draw-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.query-btn {
  flex: 1;
  padding: 14px;
  border: 2px solid rgba(255,255,255,0.8); border-radius: 8px;
  font-size: 16px; font-weight: 700;
  color: #fff;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.query-btn:active { background: rgba(255,255,255,0.2); }

.stats {
  margin-top: 14px;
  display: flex; gap: 24px;
  font-size: 13px; opacity: 0.85;
}

.recent-winners {
  margin-top: 20px;
  width: 100%; max-width: 400px;
  background: rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px 16px;
}
.recent-winners h3 {
  font-size: 14px; text-align: center;
  margin-bottom: 8px; opacity: 0.9;
}
.marquee {
  height: 28px;
  overflow: hidden;
  position: relative;
}
.marquee-content {
  position: absolute;
  white-space: nowrap;
  animation: marquee 25s linear infinite;
}
@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}
.marquee-item {
  display: inline-block;
  margin-right: 40px;
  font-size: 13px;
}

.desc {
  margin-top: 20px;
  width: 100%; max-width: 400px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px; line-height: 1.8;
  white-space: pre-wrap;
}

/* 弹窗 */
.modal-overlay {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  width: 100%; max-width: 340px;
  text-align: center;
  color: #333;
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.modal-icon { font-size: 56px; margin-bottom: 8px; }
.win { animation: bounce 1.5s infinite; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.modal h2 { font-size: 22px; margin-bottom: 8px; }
.win-prize { font-size: 18px; color: #ff4d4f; font-weight: 700; margin-bottom: 16px; }
.form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.form input, .form textarea {
  padding: 10px 12px;
  border: 1px solid #ddd; border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.form input:focus, .form textarea:focus { border-color: #667eea; }
.form .primary {
  padding: 12px;
  border: none; border-radius: 8px;
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.upload-wrap { display: flex; flex-direction: column; gap: 6px; }
.upload-label { font-size: 12px; color: #666; }
.upload-area {
  display: flex; justify-content: center; align-items: center;
  width: 100%; padding: 16px;
  border: 1px dashed #ddd; border-radius: 8px;
  cursor: pointer; background: #fafafa;
  text-align: center;
}
.upload-area:hover { border-color: #667eea; background: #f7f8ff; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; color: #999; }

.msg { font-size: 13px; margin: 6px 0; min-height: 18px; }
.msg.err { color: #ff4d4f; }
.close-btn {
  margin-top: 10px;
  padding: 10px 24px;
  border: 1px solid #ddd; border-radius: 8px;
  background: #f5f5f5;
  font-size: 14px; cursor: pointer;
}

/* 暂停提示 */
.paused-notice {
  background: rgba(0,0,0,0.4);
  padding: 8px 16px; border-radius: 20px;
  font-size: 13px; margin-bottom: 10px;
}

/* 响应式 */
@media (max-width: 400px) {
  .header h1 { font-size: 22px; }
  .wheel-wrap { width: min(280px, 90vw); height: min(280px, 90vw); }
}
