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

html, body {
  height: 100%;
  background: #12121a;
  color: #eee;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow: hidden;
}

.step {
  display: none;
  position: relative;
  height: 100dvh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  /* safe center：内容装得下就居中，装不下时退化为顶端对齐，
     否则 flex 居中会把溢出的顶部裁掉，配合 body 的 overflow:hidden 就再也滚不到了 */
  justify-content: safe center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  gap: 20px;
  padding: 24px;
  text-align: center;
}
.step > * { flex-shrink: 0; }
.step.active { display: flex; }

.hidden { display: none !important; }

.subtitle { color: #ccc; max-width: 320px; line-height: 1.6; }
.hint { font-size: 1.2rem; }
.status { color: #aaa; }
.error { color: #ff6b6b; max-width: 320px; }

.btn {
  font-size: 1.1rem;
  padding: 14px 40px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-weight: bold;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: #ffd400; color: #000; }
.btn-secondary { background: rgba(40, 40, 50, 0.85); color: #eee; }

.btn-big {
  font-size: 1.25rem;
  line-height: 1.5;
  padding: 16px 36px;
}

.btn-row { display: flex; gap: 16px; }

.video {
  width: 100%;
  max-width: 480px;
  max-height: 60dvh;
  border-radius: 12px;
  background: #000;
}

/* ===== 入场页（飞翔牛全屏背景） ===== */
.intro-bg {
  background:
    linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.45)),
    #5a7a4a url("assets/intro-bull-sm.webp") center 35% / cover no-repeat;
}

.intro-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 24px;
}

.title {
  font-size: 3rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 0, 0, 0.45);
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.title-sub {
  display: block;
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  margin-top: 6px;
}

.intro-bg .subtitle {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75);
}

/* ===== 首页预载进度条 ===== */
#load-wrap {
  width: 80%;
  max-width: 280px;
  height: 10px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  overflow: hidden;
}
#load-bar {
  height: 100%;
  width: 0%;
  background: #ffd400;
  border-radius: 5px;
  transition: width 150ms linear;
}
.load-text {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

/* ===== 录音倒计时 ===== */
.countdown {
  font-size: clamp(4rem, 16vw, 5.5rem);
  font-weight: 900;
  line-height: 1;
  color: #ffd400;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  animation: cd-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes cd-pop {
  0% { opacity: 0; transform: scale(1.6); }
  60% { opacity: 1; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}

/* 真正开录的那一刻才切到这个状态 —— 指令出现 = 录音机已在跑 */
.hint.shout {
  /* clamp 保证窄屏也能一行放下，不会断成「喊「妈 / 妈」！」 */
  font-size: clamp(2.2rem, 9vw, 3.2rem);
  white-space: nowrap;
  font-weight: 900;
  color: #ffd400;
  letter-spacing: 0.06em;
  text-shadow: 0 0 28px rgba(255, 212, 0, 0.5), 0 3px 14px rgba(0, 0, 0, 0.8);
  animation: shout-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
@keyframes shout-in {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}

/* ===== 音量条 ===== */
#volume-bar-wrap {
  width: 80%;
  max-width: 320px;
  height: 14px;
  background: #2a2a35;
  border-radius: 7px;
  overflow: hidden;
}
#volume-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd400, #ff6b6b);
  transition: width 60ms linear;
}

/* ===== 结束页背景（默认未中奖图，中奖时 JS 加 .win 类切换） ===== */
.end-bg {
  background:
    linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.65)),
    #6a8f4a url("assets/bg-lose-sm.webp") center / cover no-repeat;
}
.end-bg.win {
  background:
    linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.65)),
    #6a8f4a url("assets/bg-win-sm.webp") center / cover no-repeat;
}

/* 首页水墨背景仅约 90KB，全端共用一张，无需区分 */

#end-lose, #end-win {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* 页脚是 absolute 的，给结束页预留出它的高度，别让内容顶到它下面 */
#step-end { padding-bottom: 56px; }

/* ===== 页脚域名 ===== */
.site-footer {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffd400;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* 领取页内容太长，页脚改走文档流，跟着内容滚动而不是浮在上面压字 */
.site-footer-inline {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  color: #ffd400;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

/* ===== 未中奖 ===== */
.lose-title {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85);
}

.download-link {
  color: #ffd400;
  text-decoration: underline;
  font-size: 1rem;
}

/* ===== 中奖：克制的大字设计 ===== */
.win-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #f5eeda;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 24px rgba(255, 214, 90, 0.45),
    0 2px 18px rgba(0, 0, 0, 0.8);
  animation: win-in 0.9s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.win-sub {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.55em;
  color: rgba(255, 214, 90, 0.75);
  text-indent: 0.55em; /* 抵消末字 letter-spacing 造成的视觉偏移 */
  animation: win-in 0.9s 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.win-amount {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
  animation: win-in 0.9s 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.win-amount span {
  font-size: 2rem;
  font-weight: 900;
  color: #ffd400;
  padding: 0 2px;
}

.win-range {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.72);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  animation: win-in 0.9s 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes win-in {
  0% { opacity: 0; transform: translateY(18px) scale(0.96); filter: blur(6px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* ===== 领取结果 ===== */
#claim-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 92vw;
  background: rgba(0, 0, 0, 0.68);
  border-radius: 12px;
  padding: 22px;
}

#key-box {
  background: #000;
  color: #7ee787;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.75rem;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-all;
  max-width: 100%;
  max-height: 26dvh;
  overflow: auto;
}

/* ===== 使用方法（可上下滑动的说明框） ===== */
#usage-box {
  width: 100%;
  max-width: 340px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 12px 16px;
}

.usage-title {
  font-weight: 800;
  font-size: 1rem;
  color: #ffd400;
  text-align: center;
  margin-bottom: 8px;
}

.usage-scroll {
  max-height: 26dvh;
  overflow-y: auto;
  text-align: left;
  font-size: 0.82rem;
  line-height: 1.7;
  color: #ddd;
  padding-right: 6px;
}

.usage-scroll .usage-h {
  color: #fff;
  font-weight: 700;
  margin-top: 10px;
}

.usage-scroll p { margin: 4px 0; }

.usage-scroll code {
  background: #000;
  color: #7ee787;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  word-break: break-all;
}

.again-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.stack-tip {
  max-width: 320px;
  border: 1px solid rgba(255, 212, 0, 0.5);
  background: rgba(255, 212, 0, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
}
.stack-tip-main {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffd400;
  line-height: 1.5;
}
.stack-tip-warn {
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
}

@media (min-width: 768px) {
  .title { font-size: 3.6rem; }
  .title-sub { font-size: 1.9rem; }
  .video { max-width: 560px; }
}

/* 桌面端（宽度 ≥769px）换用全尺寸大图 */
@media (min-width: 769px) {
  .intro-bg {
    background-image:
      linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.15) 40%, rgba(0, 0, 0, 0.45)),
      url("assets/intro-bull.webp");
  }
  .end-bg {
    background-image:
      linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.65)),
      url("assets/bg-lose.webp");
  }
  .end-bg.win {
    background-image:
      linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.65)),
      url("assets/bg-win.webp");
  }
}
