* { box-sizing: border-box; margin: 0; padding: 0; }

/* 作者样式表里的 display 会盖掉 UA 的 [hidden]{display:none}，统一兜住 */
[hidden] { display: none !important; }

:root {
  /* 后台未配置背景图时的兜底底色 */
  --page-bg: linear-gradient(180deg, #ff6a3d 0%, #ff3b30 40%, #e02020 100%);
  --side-width: 360px;
}

body {
  font-family: system-ui, -apple-system, "PingFang SC", sans-serif;
  background: var(--page-bg);
  min-height: 100vh;
  color: #333;
  padding-bottom: 40px;
}

/* 背景图铺满整屏，滚动时固定，两侧留白由它承接 */
body.has-bg {
  background-image: var(--page-bg-image);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  background-attachment: fixed;
  background-color: var(--page-bg-color, #e02020);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: center;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: rgba(224, 32, 32, 0.95);
}

/* 中间一列固定宽度，两侧等分剩余空间——只配单侧时中间也不会偏。
   align-items 用默认的 stretch，三列被拉到同一高度，两侧才能跟中栏底部齐平 */
.layout {
  display: grid;
  grid-template-columns: 1fr minmax(0, 480px) 1fr;
  gap: 16px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 0;
}

/* 两侧撑满整列高度，装修图等分剩余空间：图片张数无论多少，
   上边和中栏顶部齐、下边和中栏底部齐。原来的 sticky 会让两侧
   滚动时脱离中栏，底部必然对不齐，所以去掉 */
.side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  height: 100%;
  min-height: 0;
  padding: 0 10px;
}
.side:empty { display: none; }

.side > * {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: var(--side-width);
}
/* 整图卡按分到的高度等比缩放；flex-basis 归零，让高度完全由列高决定 */
.side .side-photo { flex-basis: 0; }
.side .side-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
  filter: drop-shadow(0 6px 20px rgba(0, 0, 0, 0.22));
}
.side a { display: flex; flex-direction: column; transition: transform 0.2s; text-decoration: none; }
.side a > * { flex: 1 1 auto; min-height: 0; }
.side a:hover { transform: translateY(-3px); }

/* ---------- 装修卡片 ---------- */

.side-card {
  --cap-from: #ff8c42;
  --cap-to: #e8503a;
  --bg-from: #fff6e2;
  --bg-to: #ffe0b0;
  --card-border: #ffb870;
  --ink: #8a3b18;
  --ink-soft: #7a4a20;
  --ink-faint: #a8815a;

  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  border: 2px solid var(--card-border);
  background: linear-gradient(180deg, var(--bg-from), var(--bg-to));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  font-family: "PingFang SC", system-ui, sans-serif;
  text-align: center;
}
.side-card--amber {
  --cap-from: #f2a03d; --cap-to: #d9741c;
  --bg-from: #fffaf0; --bg-to: #ffe9cf; --card-border: #f5c383;
}
.side-card--red {
  --cap-from: #ff6b4a; --cap-to: #d92d20;
  --bg-from: #fff2e8; --bg-to: #ffd9c2; --card-border: #ffab8c;
}
.side-card--green {
  --cap-from: #3fb27f; --cap-to: #1e8a5c;
  --bg-from: #fff8ee; --bg-to: #ffe6cc; --card-border: #ffc999;
}

.sc-cap {
  flex: none;
  padding: 15px 12px;
  background: linear-gradient(180deg, var(--cap-from), var(--cap-to));
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}
/* 内容区吃掉卡片被拉高后多出来的空间，元素均匀铺开而不是挤在顶部 */
.sc-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 10px;
  padding: 16px 20px 20px;
  overflow: hidden;
}

.sc-icon { font-size: 64px; line-height: 1.1; }
.sc-title { font-size: 22px; font-weight: 700; color: #b8321c; }
.sc-subtitle { font-size: 14px; color: #8a5a30; }

.sc-pills { display: flex; flex-direction: column; gap: 10px; }
.sc-pill {
  padding: 12px 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.75);
  color: #b8321c;
  font-size: 15px;
}

.sc-steps { list-style: none; display: flex; flex-direction: column; gap: 16px; text-align: left; }
.sc-steps li { display: flex; align-items: flex-start; gap: 11px; }
.sc-step-no {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #e8503a;
  color: #fff;
  font-size: 14px; font-weight: 700; font-style: normal;
  display: flex; align-items: center; justify-content: center;
}
.sc-step-title { display: block; font-size: 15px; font-weight: 600; color: var(--ink); }
.sc-step-desc { display: block; font-size: 13px; color: var(--ink-soft); margin-top: 3px; }
.sc-footer { font-size: 12px; color: var(--ink-faint); }

.sc-rank { list-style: none; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.sc-rank li { display: flex; align-items: center; gap: 10px; }
.sc-rank-icon { flex: none; font-size: 22px; font-style: normal; width: 28px; text-align: center; }
.sc-rank-main { flex: 1; min-width: 0; }
.sc-rank-name {
  display: block; font-size: 15px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sc-bar {
  display: block; height: 9px; margin-top: 6px;
  border-radius: 5px; background: rgba(255, 255, 255, 0.7); overflow: hidden;
}
.sc-bar i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #ffb347, #ff6b4a); }
.sc-cta {
  padding: 13px 10px;
  border-radius: 26px;
  background: #e8503a;
  color: #fff;
  font-size: 16px; font-weight: 700;
}

.sc-qr {
  display: block; width: 150px; height: 150px; margin: 0 auto;
  object-fit: contain; border-radius: 10px; background: #fff;
}
.sc-caption { font-size: 12px; color: var(--ink-faint); }
.sc-line { font-size: 14px; color: var(--ink-soft); }
.sc-badge {
  padding: 8px 10px;
  border-radius: 17px;
  background: #e8f6ec;
  color: #1f9d55;
  font-size: 13px;
}

/* 窄屏放不下两侧，隐藏装修位，回到纯移动端单列 */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); max-width: 480px; }
  .side { display: none; }
}

.page { max-width: 480px; margin: 0 auto; padding: 0 12px; width: 100%; }

.panel {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
}

.panel-title { font-size: 15px; text-align: center; color: #e02020; margin-bottom: 12px; }

.prize-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.prize-card {
  background: #fff7ec;
  border: 1px solid #ffd9a8;
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.prize-card img { width: 100%; height: 62px; object-fit: contain; }
.prize-card .placeholder {
  height: 62px; display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.prize-card span { display: block; margin-top: 4px; font-size: 11px; line-height: 1.3; color: #8a2b12; }

.wheel-panel { display: flex; justify-content: center; }
.wheel-wrap { position: relative; width: 100%; max-width: 320px; aspect-ratio: 1; }

.wheel {
  width: 100%; height: 100%; display: block;
  border-radius: 50%;
  border: 6px solid #e8503a;
  background: #fff3d6;
  transition: transform 4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 13px solid transparent;
  border-right: 13px solid transparent;
  border-top: 26px solid #e8503a;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
  z-index: 2;
}

.spin-btn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 84px; height: 84px; border-radius: 50%;
  border: 4px solid #fff;
  background: linear-gradient(180deg, #ffb84d, #ff7a1a);
  color: #fff; font-size: 16px; font-weight: 700; line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.spin-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field span { width: 56px; font-size: 14px; color: #666; flex-shrink: 0; }
.field input {
  flex: 1; padding: 10px 12px; font-size: 15px;
  border: 1px solid #e0e0e0; border-radius: 8px; outline: none;
}
.field input:focus { border-color: #ff7a1a; }
#code { text-transform: uppercase; letter-spacing: 1px; }

.error { color: #e02020; font-size: 13px; text-align: center; margin-top: 4px; }

.floating {
  position: fixed; right: 0; top: 45%; z-index: 20;
  display: flex; flex-direction: column; gap: 6px;
}
.floating button {
  width: 46px; padding: 10px 0;
  border: none; border-radius: 8px 0 0 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #e02020; font-size: 12px; font-weight: 600; cursor: pointer;
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.18);
}

.modal {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.55); padding: 24px;
}
.modal[hidden] { display: none; }

.modal-card {
  position: relative;
  width: 100%; max-width: 320px;
  background: #fffaf2; border-radius: 16px;
  padding: 24px 20px; text-align: center;
  max-height: 80vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 8px; right: 12px;
  border: none; background: none; font-size: 24px; color: #999; cursor: pointer;
}
.modal-title { font-size: 17px; color: #e02020; margin-bottom: 16px; }

.result-image {
  width: 140px; height: 140px; object-fit: contain;
  background: #fff; border-radius: 12px; padding: 8px; margin-bottom: 12px;
}
.result-name { font-size: 16px; font-weight: 700; color: #333; margin-bottom: 10px; }
.redeem-line { font-size: 14px; color: #666; }
.redeem-code {
  font-size: 18px; font-weight: 700; color: #e02020;
  letter-spacing: 1px; cursor: pointer; text-decoration: underline dotted;
}
.copy-hint { font-size: 12px; color: #21a366; height: 16px; margin-top: 4px; }
.result-time { font-size: 12px; color: #999; margin: 8px 0 16px; }

.primary-btn {
  width: 100%; padding: 12px;
  border: none; border-radius: 24px;
  background: linear-gradient(90deg, #ff7a1a, #e02020);
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}

.info-body { text-align: left; font-size: 14px; line-height: 1.8; color: #555; }
.info-body ol { padding-left: 20px; }
.record-item {
  border-bottom: 1px dashed #e0d5c0; padding: 8px 0; font-size: 13px;
}
.record-item b { color: #e02020; }
