* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #fff5e6 0%, #ffe0b2 40%, #ffcc80 100%);
  color: #5c2608;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent; /* 手机端点击不出现灰块 */
}

/* 转盘统一尺寸变量，指针与按钮都随它缩放 */
:root {
  --wheel-size: min(88vw, 360px);
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #d84315, #ff6f00);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(216, 67, 21, 0.3);
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: #bf360c;
  line-height: 1.2;
}

.brand-sub {
  font-size: 9px;
  color: #e65100;
  line-height: 1.2;
}

.slogan {
  font-size: 12px;
  color: #e65100;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid rgba(230, 81, 0, 0.2);
}

.main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-wrap {
  text-align: center;
  margin-bottom: 8px;
}

.main-title {
  font-size: clamp(30px, 9vw, 42px);
  font-weight: 900;
  color: #d32f2f;
  text-shadow: 2px 2px 0 #ffecb3, 0 0 16px rgba(211, 47, 47, 0.3);
  letter-spacing: 4px;
}

.sub-title {
  width: min(62%, 240px);
  margin: 6px auto;
  padding: 4px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #ff8f00, #ff6f00, #ff8f00);
  border-radius: 20px;
  box-shadow: 0 3px 8px rgba(230, 81, 0, 0.35);
  position: relative;
}

.sub-title::before,
.sub-title::after {
  content: '◆';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: #ffecb3;
}

.sub-title::before {
  left: 8px;
}

.sub-title::after {
  right: 8px;
}

.tagline {
  font-size: 13px;
  color: #e65100;
  margin-top: 4px;
}

.wheel-box {
  position: relative;
  width: var(--wheel-size);
  height: var(--wheel-size);
  margin: 20px auto;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(230, 81, 0, 0.25),
    inset 0 0 0 8px rgba(255, 236, 179, 0.6);
}

/* 指针：SVG 图钉样式，尖端对准转盘扇区上沿 */
.pointer {
  position: absolute;
  top: calc(var(--wheel-size) * -0.075);
  left: 50%;
  transform: translateX(-50%);
  width: calc(var(--wheel-size) * 0.125);
  height: calc(var(--wheel-size) * 0.162);
  z-index: 10;
  pointer-events: none;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.pointer svg {
  display: block;
  width: 100%;
  height: 100%;
}

.draw-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--wheel-size) * 0.28);
  height: calc(var(--wheel-size) * 0.28);
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 35%, #ffccbc 0%, #ff7043 40%, #d84315 100%);
  color: #fff;
  font-size: calc(var(--wheel-size) * 0.07);
  font-weight: 800;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(216, 67, 21, 0.45),
    inset 0 -4px 10px rgba(0, 0, 0, 0.15);
  z-index: 20;
  transition: transform 0.1s;
}

.draw-btn:disabled {
  background: radial-gradient(circle at 35% 35%, #e0e0e0 0%, #bdbdbd 100%);
  color: #757575;
  cursor: not-allowed;
  box-shadow: none;
}

.draw-btn:not(:disabled):active {
  transform: translate(-50%, -50%) scale(0.95);
}


.code-panel {
  width: 100%;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(230, 81, 0, 0.12);
  backdrop-filter: blur(4px);
}

.code-input-wrap {
  display: flex;
  gap: 8px;
}

#codeInput {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 2px solid #ffcc80;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  text-transform: uppercase;
  background: #fff;
  color: #5c2608;
}

#codeInput:focus {
  border-color: #ff7043;
}

.verify-btn {
  height: 44px;
  padding: 0 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #ff6f00, #ff8f00);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.code-msg {
  min-height: 22px;
  margin-top: 8px;
  font-size: 13px;
  text-align: center;
}

.code-msg.success {
  color: #2e7d32;
}

.code-msg.error {
  color: #c62828;
}

.chance-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #fff3e0, #ffe0b2);
  border: 1px solid #ffcc80;
  border-radius: 24px;
  font-size: 13px;
  color: #bf360c;
}

.chance-bar .rate {
  color: #d32f2f;
  font-weight: 800;
}

.chance-left {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: #e65100;
}

.chance-left strong {
  display: inline-block;
  min-width: 24px;
  padding: 2px 8px;
  background: #d32f2f;
  color: #fff;
  border-radius: 6px;
  font-size: 16px;
}

.rules {
  width: 100%;
  margin-top: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
}

.rules h3 {
  font-size: 15px;
  color: #bf360c;
  margin-bottom: 10px;
  text-align: center;
}

.rules ul {
  list-style: none;
}

.rules li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(230, 81, 0, 0.15);
  font-size: 13px;
}

.rules li:last-child {
  border-bottom: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  padding: 20px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(180deg, #fff8e1 0%, #ffffff 100%);
  border-radius: 20px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  animation: popIn 0.3s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-icon {
  font-size: 56px;
  margin-bottom: 8px;
}

.modal-content h2 {
  font-size: 22px;
  color: #d32f2f;
  margin-bottom: 12px;
}

.modal-prize {
  font-size: 18px;
  font-weight: 700;
  color: #e65100;
  padding: 12px;
  background: #fff3e0;
  border-radius: 12px;
  margin-bottom: 12px;
}

.modal-tip {
  font-size: 12px;
  color: #8d6e63;
  margin-bottom: 18px;
}

.modal-close {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(90deg, #ff6f00, #ff8f00);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

/* 极小屏：隐藏次要信息，给转盘和标题留空间 */
@media (max-width: 360px) {
  .slogan {
    display: none;
  }

  .brand-sub {
    display: none;
  }

  .rules li {
    font-size: 12px;
  }
}

/* 横屏或矮屏：压缩转盘尺寸，保证一屏可见 */
@media (max-height: 700px) {
  :root {
    --wheel-size: min(72vw, 300px);
  }

  .wheel-box {
    margin: 10px auto;
  }
}
