/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: url(bg.jpg) no-repeat center center;
  background-size: cover;
  min-height: 100vh;
  padding: 300px 15px 15px;
  color: #333;
}

/* 隐藏类 */
.hidden {
  display: none !important;
}

/* 模态框 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  background: #FEF8FA;
  border-radius: 16px;
  padding: 30px 25px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  color: #EE5898;
  margin-bottom: 8px;
  font-size: 22px;
}

.subtitle {
  color: #888;
  font-size: 14px;
  margin-bottom: 20px;
}

#orderInput {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.3s;
  text-align: center;
  letter-spacing: 2px;
}

#orderInput:focus {
  border-color: #EE5898;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #EE5898 0%, #EE5898 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: auto;
  position: relative;
  z-index: 1002;
}

.btn-primary:active {
  transform: scale(0.98);
}

.error {
  color: #e74c3c;
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

/* 主界面头部 */
.header {
  text-align: center;
  color: #fff;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 22px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  user-select: none;
}

.order-info {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 20px;
  padding: 10px 18px;
  margin-top: 12px;
  font-size: 14px;
  display: inline-block;
  color: #444;
  user-select: none;
}

.order-info strong {
  color: #EE8497;
}

#chancesLeft {
  color: #EE8497;
}

.chances {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.4);
}

.chances strong {
  font-size: 18px;
  color: #ffd700;
}

/* 九宫格 */
.lottery-container {
  background: rgba(255, 249, 251, 0.95);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 320px;
  margin: 0 auto;
}

.cell {
  aspect-ratio: 1;
  background: transparent;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: all 0.3s;
  overflow: hidden;
}

.cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  border: none;
}

.center-cell {
  background: linear-gradient(135deg, #e84393 0%, #fd79a8 100%);
  color: #fff;
  cursor: pointer;
  border: none;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(232, 67, 147, 0.4);
}

.center-cell:active {
  transform: scale(0.95);
}

.center-cell.disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

.center-cell.rolling {
  background: linear-gradient(135deg, #ccc 0%, #999 100%);
  cursor: not-allowed;
  animation: none;
  transform: scale(0.95);
}

.center-cell.rolling span {
  animation: blink 0.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.cell.active {
  background: linear-gradient(135deg, #e84393 0%, #fd79a8 100%) !important;
  transform: scale(1.1) !important;
  box-shadow: 0 0 30px rgba(232, 67, 147, 0.8), 0 0 60px rgba(232, 67, 147, 0.4) !important;
  border: 3px solid #e84393 !important;
  z-index: 10;
  position: relative;
}

@keyframes pulse {
  0%, 100% { transform: scale(1.1); }
  50% { transform: scale(1.15); }
}

.cell.active {
  animation: pulse 0.3s ease-in-out infinite;
}

/* 中奖记录 ========================================= */
.records-section {
  background: rgba(255, 249, 251, 0.97);
  border-radius: 20px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.records-section h2 {
  font-size: 16px;
  color: #EE5898;
  margin-bottom: 16px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.records-section h2 svg {
  color: #ffd700;
  flex-shrink: 0;
}

.records-count {
  background: linear-gradient(135deg, #e84393, #fd79a8);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  line-height: 1.4;
  min-width: 20px;
  text-align: center;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 空状态 */
.no-records {
  text-align: center;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.no-records svg {
  color: #ddd;
  margin-bottom: 4px;
}

.no-records p {
  font-size: 15px;
  color: #bbb;
  font-weight: 500;
}

.no-records span {
  font-size: 12px;
  color: #ccc;
}

/* 单条记录卡片 */
.record-item {
  background: #fff;
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(232, 67, 147, 0.08);
  border: 1.5px solid rgba(232, 67, 147, 0.1);
  transition: box-shadow 0.2s, transform 0.2s;
  animation: recordSlideIn 0.4s ease-out;
}

@keyframes recordSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.record-item:hover {
  box-shadow: 0 4px 20px rgba(232, 67, 147, 0.15);
}

/* 卡片头部：奖品信息 */
.record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 10px;
}

.record-prize {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.prize-level-tag {
  background: linear-gradient(135deg, #e84393 0%, #fd79a8 100%);
  color: #fff;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(232, 67, 147, 0.3);
}

.prize-item-tag {
  color: #667eea;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.record-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.record-time {
  color: #bbb;
  font-size: 11px;
  white-space: nowrap;
}

/* 地址状态标签 */
.address-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.address-status.done {
  background: rgba(46, 213, 115, 0.12);
  color: #2ed573;
}

.address-status.pending {
  background: rgba(255, 185, 59, 0.15);
  color: #f9a825;
}

.address-status.done svg,
.address-status.pending svg {
  width: 10px;
  height: 10px;
}

/* 卡片内容：收货信息 */
.record-body {
  border-top: 1px dashed rgba(0, 0, 0, 0.06);
  padding: 12px 16px;
}

.record-address-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.record-address-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.record-address-row .label {
  color: #aaa;
  font-size: 12px;
  flex-shrink: 0;
  min-width: 36px;
  padding-top: 1px;
}

.record-address-row .value {
  color: #444;
  flex: 1;
  word-break: break-all;
  line-height: 1.4;
}

.record-address-row .value.phone {
  color: #667eea;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* 未填写提示 */
.record-no-address {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ccc;
  font-size: 12px;
  padding: 2px 0;
}

.record-no-address svg {
  color: #e0e0e0;
  flex-shrink: 0;
}

/* 卡片底部：操作按钮 */
.record-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 16px 12px;
  gap: 8px;
}

.record-edit-btn {
  padding: 7px 16px;
  background: linear-gradient(135deg, #EE5898, #e84393);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 2px 8px rgba(232, 67, 147, 0.3);
}

.record-edit-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

.record-edit-btn.pending {
  background: linear-gradient(135deg, #ffd700, #ffb300);
  box-shadow: 0 2px 8px rgba(255, 185, 0, 0.3);
}

/* 滚动条样式 */
.records-list::-webkit-scrollbar {
  width: 3px;
}

.records-list::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #e84393, #fd79a8);
  border-radius: 2px;
}

/* 中奖提示弹窗 */
.win-content {
  position: relative;
  overflow: hidden;
}

.win-confetti {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 40px;
  background: linear-gradient(135deg, #ffd700, #ff6b6b, #ee5898, #667eea, #ffd700);
  border-radius: 0 0 50% 50%;
  opacity: 0.2;
  animation: confettiPulse 2s ease-in-out infinite;
  z-index: 0;
}

@keyframes confettiPulse {
  0%, 100% { opacity: 0.15; transform: translateX(-50%) scaleX(1); }
  50% { opacity: 0.3; transform: translateX(-50%) scaleX(1.2); }
}

.win-content h2 {
  color: #e84393;
  font-size: 26px;
  margin-bottom: 15px;
  position: relative;
  z-index: 1;
}

.win-prize {
  margin: 15px 0 20px;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.win-prize .prize-level {
  font-size: 28px;
  font-weight: 700;
  color: #e84393;
  margin-bottom: 10px;
}

.win-prize .prize-detail {
  font-size: 18px;
  font-weight: 600;
  color: #667eea;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 10px;
  border: 2px solid rgba(102, 126, 234, 0.3);
}

/* 弹窗内表单 */
.address-form {
  margin-top: 10px;
  position: relative;
  z-index: 1;
}

.win-prize {
  margin: 15px 0 20px;
  line-height: 1.4;
}

.win-prize .prize-level {
  font-size: 28px;
  font-weight: 700;
  color: #e84393;
  margin-bottom: 10px;
}

.win-prize .prize-detail {
  font-size: 18px;
  font-weight: 600;
  color: #667eea;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-radius: 10px;
  border: 2px solid rgba(102, 126, 234, 0.3);
}

/* 弹窗内表单 */
.address-form {
  margin-top: 10px;
}

.form-group {
  margin-bottom: 10px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
  background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: #EE5898;
}

.form-group textarea {
  min-height: 60px;
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #bbb;
}

/* 动画 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.3s ease-in-out;
}

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 10px;
}

.btn-danger {
  width: 100%;
  padding: 12px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

/* 管理员面板 */
.admin-panel {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.admin-panel h3 {
  text-align: center;
  color: #e74c3c;
  margin-bottom: 15px;
}
