/* ===== 基础：苹果扁平化 / 移动优先 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f5f5f7; --card: #ffffff; --text: #1d1d1f; --sub: #86868b;
  --blue: #0071e3; --green: #34c759; --red: #ff3b30; --line: #f2f2f7;
  --radius: 18px;
}
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
img { max-width: 100%; }

/* 导航 */
.nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.8);
       backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
       border-bottom: 1px solid var(--line); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 12px 16px;
              display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); }
.nav-links { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.nav-links a { color: var(--text); }
.btn-mini { background: var(--blue); color: #fff !important; padding: 7px 14px;
            border-radius: 999px; font-size: 13px; font-weight: 500; }
.btn-mini.warn { background: #ff9500; }

.container { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }

/* Hero */
.hero { text-align: center; padding: 48px 16px 32px; }
.hero h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.hero p { color: var(--sub); margin: 12px 0 24px; font-size: 16px; }
.btn-primary { display: inline-block; background: var(--blue); color: #fff; border: none;
               padding: 13px 26px; border-radius: 999px; font-size: 16px; font-weight: 600;
               cursor: pointer; text-align: center; }
.btn-primary:hover { background: #0077ed; }
.btn-primary:disabled { opacity: .5; }

.section-title { font-size: 20px; margin: 24px 4px 16px; }

/* 活动卡片 */
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media(min-width:600px){ .grid { grid-template-columns: repeat(2,1fr); } }
@media(min-width:900px){ .grid { grid-template-columns: repeat(3,1fr); } }
.card-lot { background: var(--card); border-radius: var(--radius); padding: 22px;
            box-shadow: 0 2px 12px rgba(0,0,0,.05); color: var(--text);
            transition: transform .15s, box-shadow .15s; display:block; }
.card-lot:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.card-lot-emoji { font-size: 36px; }
.card-lot h3 { margin: 10px 0 6px; font-size: 17px; }
.card-lot .meta { color: var(--sub); font-size: 13px; }
.tag { display: inline-block; margin-top: 10px; background: var(--line); color: var(--sub);
       padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.tag.win { background: #e8f9ed; color: var(--green); }

.empty { text-align: center; color: var(--sub); padding: 40px 0; }

/* 认证页 */
.auth { max-width: 420px; margin: 30px auto; background: var(--card);
        padding: 30px; border-radius: var(--radius); box-shadow: 0 4px 20px rgba(0,0,0,.06); }
.auth.wide { max-width: 680px; }
.auth h1 { font-size: 24px; }
.auth .sub { color: var(--sub); margin: 6px 0 18px; font-size: 14px; }
.auth label { display:block; font-size: 13px; color: var(--sub); margin: 14px 0 6px; }
.auth input, .auth select { width: 100%; padding: 12px 14px; border: 1px solid #d2d2d7;
    border-radius: 12px; font-size: 16px; outline: none; background: #fff; }
.auth input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
.auth .btn-primary { width: 100%; margin-top: 22px; }
.auth .switch { text-align:center; margin-top:16px; font-size:14px; color:var(--sub); }
.err { background:#ffeceb; color:var(--red); padding:12px; border-radius:10px; font-size:14px; margin-top:14px; }
.two-col { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice-row { display:flex; flex-wrap: wrap; gap: 8px; }
.choice-row.wrap .choice { flex: 1 1 40%; }
.choice { background: var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px;
          cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.choice input { accent-color: var(--blue); }

/* 控制台 */
.dash-head { display:flex; justify-content:space-between; align-items:center; margin: 20px 0; }
.dash-head h1 { font-size: 22px; }
.dash-row { background: var(--card); border-radius: var(--radius); padding: 18px;
            margin-bottom: 12px; display:flex; justify-content:space-between; align-items:center;
            box-shadow:0 2px 10px rgba(0,0,0,.04); flex-wrap: wrap; gap: 12px; }
.dash-row.off { opacity: .7; }
.dash-row-main h3 { font-size: 16px; }
.dash-row-main .meta { color: var(--sub); font-size: 13px; margin-top: 4px; }
.dash-row-main .share-link { font-size: 12px; margin-top: 6px; }
.dash-actions { display:flex; gap:8px; flex-wrap: wrap; }
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--green); margin-left:6px; }
.dash-row.off .status-dot { background:#c7c7cc; }

/* 表格 */
.table { width:100%; border-collapse: collapse; background: var(--card);
         border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { background: #fafafa; color: var(--sub); font-weight: 500; }
.mono { font-family: ui-monospace, monospace; font-size: 13px; }
.link-del { color: var(--red); background:none; border:none; cursor:pointer; font-size:13px; }

.footer { text-align:center; color:var(--sub); font-size:13px; padding:30px 0; }

/* ========== 抽奖页 ========== */
body.type-wheel, body.type-grid, body.type-claw {
  background: linear-gradient(160deg,#1a1a2e,#16213e 50%,#0f3460);
  min-height: 100vh;
}
body.type-wheel .draw-head h1, body.type-grid .draw-head h1, body.type-claw .draw-head h1 { color:#fff; text-shadow:0 2px 10px rgba(0,0,0,.3); }
body.type-wheel .draw-head .sub, body.type-grid .draw-head .sub, body.type-claw .draw-head .sub { color:rgba(255,255,255,.7); }
.draw-wrap { max-width: 520px; margin: 0 auto; padding: 24px 16px; text-align: center; }
.draw-head h1 { font-size: 24px; font-weight: 700; }
.draw-head .sub { color: var(--sub); font-size: 14px; margin-top: 6px; }
.stage { margin: 24px 0; min-height: 280px; display:flex; align-items:center; justify-content:center; }

/* 转盘 */
.wheel-wrap { position: relative; width: min(88vw, 340px); height: min(88vw, 340px);
              filter: drop-shadow(0 12px 30px rgba(0,0,0,.4)); }
.wheel { width:100%; height:100%; border-radius:50%; position:relative;
         border: 6px solid #fff;
         box-shadow: 0 0 0 4px #ffd700, 0 10px 40px rgba(0,0,0,.4), inset 0 0 30px rgba(0,0,0,.15);
         transition: transform 4.5s cubic-bezier(.12,.75,.2,1); }
.wheel-seg { position:absolute; left:50%; top:50%; width:0; height:0; transform-origin: 0 0; }
.wheel-label { position:absolute; left: min(24vw, 88px); top: 0; transform: translateY(-50%);
               display:flex; flex-direction:column; align-items:center; gap:2px;
               width: 64px; text-align:center; }
.wheel-label .wl-icon { font-size: clamp(16px, 5.5vw, 24px); line-height:1;
                        filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.wheel-label .wl-name { font-size: clamp(8px, 2.4vw, 10px); color:#fff; font-weight:600;
                        width:60px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
                        text-shadow:0 1px 3px rgba(0,0,0,.7); }
.wheel-pointer { position:absolute; top:-16px; left:50%; transform:translateX(-50%);
                 font-size:34px; color:#ffd700; z-index:5;
                 filter:drop-shadow(0 3px 6px rgba(0,0,0,.5));
                 animation: bouncePointer 1s ease-in-out infinite; }
@keyframes bouncePointer { 0%,100%{transform:translateX(-50%) translateY(0);} 50%{transform:translateX(-50%) translateY(6px);} }
.wheel-center { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%);
                width:22%; height:22%; border-radius:50%; background:radial-gradient(circle at 30% 30%,#fff,#ffe082);
                color:#c62828; display:flex; align-items:center; justify-content:center;
                font-weight:800; font-size:clamp(14px,4vw,20px);
                box-shadow:0 4px 16px rgba(0,0,0,.3), inset 0 -3px 8px rgba(0,0,0,.1);
                cursor:pointer; z-index:4; border:3px solid #fff; }

/* 九宫格 */
.grid9 { display:grid; grid-template-columns: repeat(3, minmax(88px, 28vw)); gap:10px; }
.grid-cell { aspect-ratio:1; background:rgba(255,255,255,.95); border-radius:18px;
             display:flex; flex-direction:column; align-items:center; justify-content:center;
             box-shadow:0 4px 14px rgba(0,0,0,.2); transition: all .18s; padding:6px; position:relative; }
.grid-cell.active { background:linear-gradient(135deg,#ffd700,#ff9800); transform:scale(1.08);
                    box-shadow:0 0 24px rgba(255,215,0,.8); }
.grid-cell.active .grid-icon, .grid-cell.active .grid-name { color:#fff; }
.grid-icon { font-size: clamp(26px, 9vw, 38px); line-height:1; }
.grid-name { font-size: clamp(9px, 2.8vw, 11px); color:var(--sub); margin-top:4px;
             max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.grid-btn { background:linear-gradient(135deg,#ff3b30,#ff9500); color:#fff; font-weight:800;
            font-size:clamp(16px,5vw,22px); cursor:pointer; box-shadow:0 6px 18px rgba(255,59,48,.5);
            animation: pulseBtn 1.6s ease-in-out infinite; }
@keyframes pulseBtn { 0%,100%{box-shadow:0 6px 18px rgba(255,59,48,.5);} 50%{box-shadow:0 6px 28px rgba(255,59,48,.9);} }

/* 抓娃娃 */
.claw-machine { position:relative; width:100%; max-width:420px; padding-top:10px; }
.claw-arm { position:absolute; top:0; left:0; width:60px; height:120px; z-index:3;
            transition: left 1.2s ease-in-out; }
.claw { font-size:42px; text-align:center; filter:drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.claw-rope { width:3px; height:60px; background:#ccc; margin:0 auto; }
.claw-row { display:flex; gap:10px; margin-top:130px; justify-content:center; flex-wrap:wrap; }
.claw-prize { width:23%; min-width:72px; aspect-ratio:0.85; background:rgba(255,255,255,.95);
              border-radius:16px; display:flex; flex-direction:column; align-items:center; justify-content:center;
              box-shadow:0 4px 14px rgba(0,0,0,.2); padding:8px; }
.claw-icon { font-size: clamp(26px, 9vw, 36px); line-height:1; }
.claw-name { font-size: clamp(9px, 2.8vw, 11px); color:var(--sub); margin-top:4px;
             max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* 抽奖按钮 */
.btn-draw { background:linear-gradient(135deg,#ff3b30,#ff9500); color:#fff; border:none;
            padding:16px 60px; border-radius:999px; font-size:18px; font-weight:800;
            box-shadow:0 8px 24px rgba(255,59,48,.5); cursor:pointer;
            animation: pulseBtn 1.6s ease-in-out infinite; }
.btn-draw:disabled { animation:none; opacity:.6; }
.chances { margin-top:10px; color:rgba(255,255,255,.8); font-size:14px; }

/* 抽奖公示 */
.transparency { margin: 4px 0 18px; text-align:left; }
.tn-toggle { width:100%; background:rgba(255,255,255,.12); color:#fff; border:none;
  padding:12px 16px; border-radius:14px; font-size:14px; cursor:pointer;
  display:flex; justify-content:space-between; align-items:center; backdrop-filter:blur(8px); }
.tn-body { background:rgba(255,255,255,.95); border-radius:14px; padding:14px; margin-top:8px; }
.tn-summary { font-size:13px; color:#333; line-height:1.8; margin-bottom:10px; }
.tn-summary b { color:#e53935; }
.tn-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-top:1px solid #f0f0f3; font-size:13px; }
.tn-row .tn-ic { font-size:20px; width:26px; text-align:center; flex-shrink:0; }
.tn-row .tn-ic img { width:26px; height:26px; object-fit:contain; }
.tn-row .tn-name { flex:1; color:#222; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tn-row .tn-num { color:#666; font-size:12px; white-space:nowrap; }
.tn-row .tn-num b { color:#e53935; }
.tn-bar { height:5px; background:#eee; border-radius:3px; margin-top:4px; overflow:hidden; }
.tn-bar i { display:block; height:100%; background:linear-gradient(90deg,#ffd700,#ff9800); border-radius:3px; }

/* 弹窗 */
.modal-mask { position:fixed; inset:0; background:rgba(0,0,0,.4); display:none;
              align-items:center; justify-content:center; z-index:100; padding:20px; }
.modal-mask.show { display:flex; }
.modal-box { background:#fff; border-radius:24px; padding:32px; max-width:340px; width:100%;
             text-align:center; animation: pop .3s ease; }
@keyframes pop { from { transform:scale(.8); opacity:0; } to { transform:scale(1); opacity:1; } }
.modal-icon { font-size:56px; }
.modal-box h2 { margin:10px 0 6px; }
.modal-box p { color:var(--sub); font-size:15px; }
.code-box { margin:16px 0; background:var(--line); border-radius:12px; padding:12px; }
.code-box small { color:var(--sub); }
.code { font-family:ui-monospace,monospace; font-size:20px; letter-spacing:2px; font-weight:700; margin-top:4px; }
.modal-box .btn-primary { margin-top:8px; width:100%; }

/* 小屏微调 */
@media(max-width:380px){
  .draw-wrap { padding:16px 10px; }
}

/* 中奖时弹窗图标放大动画 */
.modal-icon.win { animation: bigWin .6s ease; }
@keyframes bigWin { 0%{transform:scale(0) rotate(-20deg);} 60%{transform:scale(1.3) rotate(10deg);} 100%{transform:scale(1);} }

/* ===== v2 新增组件 ===== */
.prize-img { width:36px; height:36px; object-fit:contain; border-radius:8px; }
.grid-icon .prize-img, .claw-icon .prize-img { width:40px; height:40px; }

/* 中奖滚动墙 */
.winner-wall { background: rgba(255,255,255,.7); backdrop-filter: blur(10px);
  border-radius: 12px; padding: 8px 14px; margin-bottom: 16px; font-size: 13px;
  display: flex; align-items: center; gap: 10px; overflow: hidden; }
.wall-label { white-space: nowrap; color: var(--red); font-weight: 600; }
.wall-scroll { overflow: hidden; flex: 1; }
.wall-item { white-space: nowrap; animation: scrollWall 18s linear infinite; }
@keyframes scrollWall { from { transform: translateX(100%);} to { transform: translateX(-100%);} }

/* 底部操作按钮组 */
.draw-actions { display:flex; gap:10px; justify-content:center; margin-top:14px; }
.btn-ghost { background: rgba(255,255,255,.8); color: var(--text); border: none;
  padding: 10px 18px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.btn-ghost:hover { background:#fff; }
.draw-footer { margin-top: 8px; }
.draw-footer .chances { margin-bottom: 12px; }

/* 分享弹窗 */
.qrcode-box { text-align:center; margin: 12px 0; }
.qrcode-box img { width:160px; height:160px; border-radius:12px; border:1px solid var(--line); }
.share-url { width:100%; padding:10px; border:1px solid #d2d2d7; border-radius:10px;
  font-size:12px; margin: 8px 0; }
.modal-box.wide { max-width: 400px; }

/* 我的记录 */
.mine-list { max-height: 320px; overflow-y: auto; margin: 12px 0; text-align: left; }
.mine-row { display:flex; justify-content:space-between; align-items:center;
  padding:10px 4px; border-bottom:1px solid var(--line); font-size:14px; gap:8px; }
.mine-row small { color: var(--sub); font-size: 11px; }

/* 礼花画布 */
#confettiCanvas { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

/* 上传表单 */
.upload-preview { max-width: 80px; max-height: 80px; border-radius: 10px; margin-top: 6px; }

/* 数据看板 */
.stat-grid { display:grid; grid-template-columns: repeat(2,1fr); gap:12px; margin:16px 0; }
.stat-card { background: var(--card); border-radius:14px; padding:18px; text-align:center;
  box-shadow:0 2px 10px rgba(0,0,0,.04); }
.stat-card .num { font-size:28px; font-weight:700; color:var(--blue); }
.stat-card .lbl { color:var(--sub); font-size:13px; margin-top:4px; }
.bar-row { display:flex; align-items:center; gap:10px; margin:8px 0; font-size:13px; }
.bar-row .bar-name { width:90px; text-align:right; }
.bar-row .bar-track { flex:1; background:var(--line); border-radius:999px; height:14px; overflow:hidden; }
.bar-row .bar-fill { height:100%; background:var(--blue); border-radius:999px; }
.bar-row .bar-val { width:60px; color:var(--sub); }

