* { 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;
}

/* 登录/注册页面 */
.auth-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.auth-card h2 {
  text-align: center;
  font-size: 22px; color: #333;
  margin-bottom: 18px;
}
.auth-tabs {
  display: flex;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 14px; font-weight: 600;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: #fff;
  color: #667eea;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.auth-form {
  display: none;
  flex-direction: column;
  gap: 10px;
}
.auth-form.active {
  display: flex;
}
.auth-form input, .auth-form select, .auth-form textarea {
  padding: 10px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.auth-form input:focus, .auth-form select:focus, .auth-form textarea:focus {
  border-color: #667eea;
}
.auth-form textarea { resize: vertical; }
.auth-form .reg-row {
  display: flex; align-items: center; gap: 8px;
}
.auth-form .reg-row label {
  font-size: 14px; color: #666; min-width: 50px;
}
.auth-form .reg-row select { flex: 1; }
.auth-err {
  font-size: 13px; color: #ff4d4f;
  min-height: 18px; margin: 0;
}
.auth-submit {
  margin-top: 8px;
  padding: 12px;
  border: none; border-radius: 8px;
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-submit:hover { opacity: 0.92; }
.auth-submit:active { transform: scale(0.98); }

/* 用户信息栏 */
.user-bar {
  width: 100%; max-width: 400px;
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: 24px;
  padding: 6px 14px 6px 6px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
}
.user-info {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-size: 13px;
}
.user-info .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f6d365, #fda085);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  color: #fff;
}
.user-info .user-name { font-weight: 600; }
.user-info .user-detail { opacity: 0.75; font-size: 12px; }
.logout-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 16px;
  background: transparent;
  color: #fff; font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.logout-btn:hover { background: rgba(255,255,255,0.2); }

/* 主布局 */
.main-layout {
  display: flex;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  padding: 20px;
  align-items: flex-start;
}
.side-panel {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  color: #333;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  position: sticky;
  top: 20px;
}
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 用户卡片 */
.panel-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 14px;
}
.panel-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(145deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 700;
}
.panel-user-detail { flex: 1; min-width: 0; }
.panel-username {
  font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.panel-meta {
  font-size: 12px; color: #999;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 余额 */
.panel-balance {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #fff7e6, #ffe7ba);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.balance-label { font-size: 13px; color: #8c6d1f; }
.balance-value { font-size: 18px; font-weight: 700; color: #d46b08; }

/* 用户详情 */
.panel-user-info {
  font-size: 12px; color: #666;
  line-height: 1.8;
  padding: 0 4px 14px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 14px;
  max-height: 160px;
  overflow-y: auto;
}
.panel-user-info .info-row {
  display: flex;
  gap: 6px;
}
.panel-user-info .info-label { color: #999; flex-shrink: 0; }
.panel-user-info .info-value {
  word-break: break-all;
}

/* 功能按钮 */
.panel-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.panel-btn {
  padding: 12px 8px;
  border: none;
  border-radius: 10px;
  font-size: 13px; font-weight: 600;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.panel-btn:nth-child(1) { background: linear-gradient(145deg, #667eea, #764ba2); }
.panel-btn:nth-child(2) { background: linear-gradient(145deg, #f6d365, #fda085); }
.panel-btn:nth-child(3) { background: linear-gradient(145deg, #52c41a, #389e0d); }
.panel-btn:nth-child(4) { background: linear-gradient(145deg, #1890ff, #096dd9); }
.panel-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.panel-btn:active { transform: scale(0.97); }

/* 退出按钮 */
.panel-logout {
  width: 100%;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}
.panel-logout:hover { background: #f5f5f5; color: #ff4d4f; }

/* 弹窗扩展 */
.modal-wide { max-width: 480px !important; }
.exchange-desc { font-size: 14px; color: #666; margin: 8px 0; }
.exchange-desc strong { color: #ff4d4f; }

/* 抽奖码查询列表 */
.code-query-list {
  max-height: 300px;
  overflow-y: auto;
  margin: 10px 0;
  text-align: left;
}
.code-query-item {
  padding: 10px 12px;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fafafa;
  font-size: 13px;
  line-height: 1.8;
}
.code-query-item .code { font-weight: 700; color: #667eea; letter-spacing: 2px; }
.code-query-item .status-done { color: #52c41a; }
.code-query-item .status-pending { color: #999; }
.code-query-item .prize-name { color: #ff4d4f; font-weight: 600; }
.code-query-empty { text-align: center; color: #999; padding: 30px 0; }

/* 响应式 */
@media (max-width: 768px) {
  .main-layout {
    flex-direction: column;
    padding: 10px;
  }
  .side-panel {
    width: 100%;
    position: static;
  }
  .panel-buttons {
    grid-template-columns: 1fr 1fr;
  }
}

.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); }
}
