* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  min-height: 100vh;
  color: #333;
}

.app {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 32px;
}

.header {
  text-align: center;
  color: #fff;
  margin-bottom: 32px;
}

.header h1 {
  font-size: 2.2rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.subtitle {
  margin-top: 8px;
  opacity: 0.9;
  font-size: 1rem;
}

.main {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 720px;
}

.wheel-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: fit-content;
  margin: 0 auto;
}

.wheel-container {
  position: relative;
  width: 630px;
  height: 630px;
}

.wheel-pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 54px;
  color: #ff4757;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  line-height: 1;
}

#wheelCanvas {
  border-radius: 50%;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3),
              0 0 0 9px #fff,
              0 0 0 15px rgba(255, 255, 255, 0.3);
}

.spin-btn {
  padding: 14px 48px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(238, 90, 36, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(0);
}

.spin-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-display {
  min-height: 48px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}

.result-display.show {
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.stats-panel {
  position: absolute;
  top: 0;
  left: calc(50% + 315px + 56px);
  width: 260px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.stat-card:last-of-type {
  border-bottom: none;
  margin-bottom: 16px;
}

.stat-label {
  color: #666;
  font-size: 0.95rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #667eea;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  padding: 10px 16px;
  font-size: 0.95rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #667eea;
  color: #fff;
  transition: background 0.2s;
}

.action-btn:hover {
  background: #5a6fd6;
}

.action-btn.danger {
  background: #ff6b6b;
}

.action-btn.danger:hover {
  background: #ee5a5a;
}

.legend-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.legend-title {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 10px;
  font-weight: 600;
}

.prize-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.legend-name {
  flex: 1;
  color: #444;
}

.legend-count {
  color: #999;
  font-size: 0.8rem;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 0 4px;
}

.close-btn:hover {
  color: #333;
}

.history-list {
  overflow-y: auto;
  padding: 16px 24px 24px;
  flex: 1;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: #f8f9ff;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.history-item .index {
  color: #999;
  font-size: 0.85rem;
  min-width: 36px;
}

.history-item .prize {
  flex: 1;
  font-weight: 500;
  margin: 0 12px;
}

.history-item .time {
  color: #999;
  font-size: 0.8rem;
  white-space: nowrap;
}

.empty-tip {
  text-align: center;
  color: #999;
  padding: 32px;
}

.confirm-content {
  padding: 24px;
  text-align: center;
}

.confirm-content h2 {
  margin-bottom: 12px;
}

.confirm-content p {
  color: #666;
  margin-bottom: 24px;
  line-height: 1.6;
}

.confirm-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btns .action-btn {
  min-width: 100px;
}

@media (max-width: 1300px) {
  .main {
    min-height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
  }

  .stats-panel {
    position: static;
    left: auto;
    width: 100%;
    max-width: 420px;
  }
}

@media (max-width: 700px) {
  .wheel-container {
    width: 480px;
    height: 480px;
  }

  #wheelCanvas {
    width: 480px;
    height: 480px;
  }

  .header h1 {
    font-size: 1.6rem;
  }
}
