/* 抽奖终端客户端 - 公共样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e83c3c;
  --primary-dark: #c92f2f;
  --primary-light: #ffe9e9;
  --gold: #f5a623;
  --text: #333;
  --text-light: #888;
  --bg: #f5f5f7;
  --card: #fff;
  --success: #07c160;
  --error: #ee0a24;
}

html,
body {
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 24px;
}

/* 顶部导航 */
.navbar {
  width: 100%;
  max-width: 720px;
  display: flex;
  gap: 12px;
  margin-bottom: 32px;
}

.nav-btn {
  flex: 1;
  padding: 14px 0;
  border: none;
  border-radius: 12px;
  background: var(--card);
  color: var(--text-light);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
}

.nav-btn:hover {
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.nav-btn.active {
  background: var(--primary);
  color: #fff;
}

/* 卡片 */
.card {
  width: 100%;
  max-width: 720px;
  background: var(--card);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
}

.card-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 8px;
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-light);
  text-align: center;
  margin-bottom: 32px;
}

/* 输入框 */
.input {
  width: 100%;
  height: 64px;
  border: 2px solid #e5e5ea;
  border-radius: 14px;
  font-size: 22px;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
  transition: border-color 0.2s;
  padding: 0 16px;
}

.input:focus {
  border-color: var(--primary);
}

.input::placeholder {
  color: #c7c7cc;
  letter-spacing: 0;
  font-size: 17px;
}

/* 按钮 */
.btn {
  width: 100%;
  height: 64px;
  border: none;
  border-radius: 14px;
  font-size: 21px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 20px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b6b, var(--primary));
  color: #fff;
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 60, 60, 0.35);
}

.btn-primary:not(:disabled):active {
  transform: translateY(0);
}

.btn-gold {
  background: linear-gradient(135deg, #ffd86f, var(--gold));
  color: #7a4a00;
}

.btn-gold:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 166, 35, 0.4);
}

/* 抽奖次数展示 */
.quota-panel {
  margin-top: 28px;
  border-radius: 16px;
  background: var(--primary-light);
  padding: 28px;
  text-align: center;
}

.quota-total {
  font-size: 72px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.quota-total small {
  font-size: 18px;
  color: var(--text-light);
  font-weight: 500;
  margin-left: 6px;
}

.quota-detail {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 18px;
}

.quota-item {
  text-align: center;
}

.quota-item .num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
}

.quota-item .label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

/* 券码信息面板 */
.coupon-panel {
  margin-top: 28px;
  border-radius: 16px;
  padding: 24px 28px;
  background: #f0faf4;
  border: 1px solid #d4f0dd;
}

.coupon-panel.error {
  background: #fff2f2;
  border-color: #ffd6d6;
}

.coupon-code {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  text-align: center;
  word-break: break-all;
}

.coupon-rows {
  margin-top: 16px;
}

.coupon-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}

.coupon-row:last-child {
  border-bottom: none;
}

.coupon-row .k {
  color: var(--text-light);
}

.coupon-row .v {
  font-weight: 600;
}

/* 奖品展示 */
.prize-panel {
  margin-top: 28px;
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  background: linear-gradient(160deg, #fff8e6, #fff);
  border: 2px solid var(--gold);
}

.prize-label {
  font-size: 16px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 6px;
  margin-bottom: 16px;
}

.prize-name {
  font-size: 40px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  word-break: break-all;
}

.prize-group {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-light);
}

.prize-img {
  max-width: 100%;
  max-height: 260px;
  border-radius: 12px;
  margin-top: 20px;
}

/* 提示信息 */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.78);
  z-index: 999;
  transition: transform 0.3s;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: var(--error);
}

.toast.success {
  background: var(--success);
}

/* 手动输入券码区（扫码枪不可用时显示） */
.manual-input {
  margin-top: 20px;
}

.manual-input .input {
  height: 56px;
  font-size: 20px;
}

.manual-input .btn {
  height: 56px;
  margin-top: 12px;
}

/* 扫码状态指示 */
.scan-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-light);
}

.scan-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c7c7cc;
}

.scan-dot.on {
  background: var(--success);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* 加载中 */
.loading {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 抽奖动画 */
@keyframes popIn {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.prize-panel.animate {
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
