/* ==========================================================================
   幸运九宫格 · 主样式
   主题体系：body[data-theme] 切换 CSS 变量
   ========================================================================== */

:root {
  --gold: #f6d27a;
  --gold-2: #ffb64d;
  --gold-deep: #c8963e;
  --ink: #fff8ea;
  --ink-dim: rgba(255, 248, 234, .62);
  --glass: rgba(255, 255, 255, .06);
  --glass-brd: rgba(255, 255, 255, .14);
  --radius: 22px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

body[data-theme="violet"] {
  --bg-0: #090616; --bg-1: #1c1040; --bg-2: #34176b;
  --glow: #a78bfa; --cell-glow: rgba(167, 139, 250, .55);
  --accent: #f6d27a; --accent-2: #ff9d4d;
}
body[data-theme="crimson"] {
  --bg-0: #1c0508; --bg-1: #4a0d10; --bg-2: #7a1a14;
  --glow: #ff8f6b; --cell-glow: rgba(255, 122, 89, .5);
  --accent: #ffd77a; --accent-2: #ff7a45;
}
body[data-theme="ocean"] {
  --bg-0: #030d1c; --bg-1: #0a2a4a; --bg-2: #0e4470;
  --glow: #67d8f7; --cell-glow: rgba(103, 216, 247, .5);
  --accent: #8fe3ff; --accent-2: #3ec9f5;
}
body[data-theme="emerald"] {
  --bg-0: #02120a; --bg-1: #0b3b24; --bg-2: #10613a;
  --glow: #6ee7b7; --cell-glow: rgba(110, 231, 183, .5);
  --accent: #b9f4d8; --accent-2: #4ade80;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg-0);
  overflow-x: hidden;
  user-select: none;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
.hidden { display: none !important; }
.pre { white-space: pre-line; }

/* ===== 背景层 ===== */
.bg-layer {
  position: fixed; inset: 0; z-index: -3;
  background:
    radial-gradient(120% 90% at 50% -10%, var(--bg-2) 0%, var(--bg-1) 42%, var(--bg-0) 100%);
  background-size: cover; background-position: center;
  transition: background-image .5s;
}
.bg-layer.has-img { filter: saturate(1.05); }
.bg-overlay {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(80% 55% at 50% 0%, transparent 0%, rgba(0, 0, 0, .18) 70%, rgba(0, 0, 0, .55) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, .08) 0%, transparent 28%, rgba(2, 0, 10, .5) 100%);
}
.bg-layer.has-img + .bg-overlay {
  background:
    radial-gradient(90% 65% at 50% 10%, rgba(2, 2, 12, .25) 0%, rgba(2, 2, 12, .55) 70%, rgba(2, 2, 12, .8) 100%);
  backdrop-filter: blur(1px);
}

.fx-particles { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
.fx-confetti { position: fixed; inset: 0; z-index: 340; pointer-events: none; }

/* ===== 主舞台 ===== */
.stage {
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
  gap: 18px;
}

/* --- 顶部标题区 --- */
.hero { text-align: center; margin-top: 2vh; animation: heroIn .9s cubic-bezier(.2, .9, .25, 1.2) both; }
@keyframes heroIn { from { opacity: 0; transform: translateY(-26px) scale(.94); } }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 3px; color: var(--accent);
  padding: 6px 16px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  backdrop-filter: blur(6px);
}
.badge i { font-style: normal; opacity: .7; animation: twinkle 2.2s ease-in-out infinite; }
.badge i:last-child { animation-delay: 1.1s; }
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

.title {
  margin-top: 14px;
  font-size: clamp(38px, 9vw, 56px);
  font-weight: 800; letter-spacing: 6px; line-height: 1.15;
  background: linear-gradient(100deg, #fff6dd 0%, var(--accent) 28%, #fff9e8 50%, var(--accent-2) 72%, #ffe9b5 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 22px color-mix(in srgb, var(--accent-2) 45%, transparent));
  animation: sheen 4.5s linear infinite;
}
@keyframes sheen { to { background-position: -220% 0; } }

.subtitle { margin-top: 8px; font-size: 14px; letter-spacing: 4px; color: var(--ink-dim); }

/* --- 九宫格面板 --- */
.board-wrap { position: relative; width: min(92vw, 430px); animation: boardIn 1s .12s cubic-bezier(.2, .9, .25, 1.15) both; }
@keyframes boardIn { from { opacity: 0; transform: translateY(30px) scale(.92); } }

.rays {
  position: absolute; inset: -18%; z-index: -1; pointer-events: none;
  background: conic-gradient(from 0deg,
    transparent 0deg, color-mix(in srgb, var(--accent) 22%, transparent) 18deg, transparent 40deg,
    transparent 90deg, color-mix(in srgb, var(--glow) 20%, transparent) 108deg, transparent 130deg,
    transparent 180deg, color-mix(in srgb, var(--accent) 22%, transparent) 198deg, transparent 220deg,
    transparent 270deg, color-mix(in srgb, var(--glow) 20%, transparent) 288deg, transparent 310deg);
  -webkit-mask: radial-gradient(closest-side, #000 30%, transparent 72%);
          mask: radial-gradient(closest-side, #000 30%, transparent 72%);
  animation: raysSpin 24s linear infinite;
}
@keyframes raysSpin { to { transform: rotate(1turn); } }
body.no-rays .rays { display: none; }

.board {
  position: relative;
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .02) 45%, rgba(255, 255, 255, .06)) padding-box,
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 65%, transparent), rgba(255, 255, 255, .12) 40%, color-mix(in srgb, var(--accent-2) 55%, transparent)) border-box;
  border: 1px solid transparent;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .12),
    0 0 80px -20px color-mix(in srgb, var(--glow) 55%, transparent);
  backdrop-filter: blur(14px);
}

.corner {
  position: absolute; width: 22px; height: 22px; pointer-events: none;
  border: 2px solid var(--accent); opacity: .85;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent));
}
.corner.tl { top: -5px; left: -5px; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.corner.tr { top: -5px; right: -5px; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.corner.bl { bottom: -5px; left: -5px; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.corner.br { bottom: -5px; right: -5px; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }

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

/* --- 奖品格子 --- */
.cell {
  position: relative;
  aspect-ratio: 1;
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .03));
  border: 1px solid var(--glass-brd);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 6px 18px rgba(0, 0, 0, .25);
  overflow: hidden;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.cell::after { /* 顶部高光 */
  content: ""; position: absolute; inset: 0 0 55% 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), transparent);
}
.cell-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 8px;
}
.p-icon { font-size: clamp(30px, 8vw, 40px); line-height: 1; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4)); transition: transform .25s; }
.p-img { width: clamp(34px, 9vw, 46px); height: clamp(34px, 9vw, 46px); object-fit: contain; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .4)); transition: transform .25s; }
.p-name {
  font-size: clamp(11px, 3vw, 13px); font-weight: 600; letter-spacing: .5px;
  color: var(--ink); opacity: .92; text-align: center; line-height: 1.2;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.p-tag {
  position: absolute; top: 7px; right: -26px; transform: rotate(38deg);
  font-size: 10px; padding: 2px 26px; letter-spacing: 1px;
  background: linear-gradient(90deg, #6b7280, #4b5563); color: #e5e7eb;
}
.cell.soldout .cell-inner > .p-icon,
.cell.soldout .cell-inner > .p-img,
.cell.soldout .cell-inner > .p-name { opacity: .35; filter: grayscale(.9); }

@media (hover: hover) {
  .cell:not(.center):hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
  .cell:not(.center):hover .p-icon, .cell:not(.center):hover .p-img { transform: scale(1.12) translateY(-1px); }
}

/* 跑马灯高亮 */
.cell.active {
  border-color: var(--accent);
  background: linear-gradient(165deg, color-mix(in srgb, var(--accent) 30%, transparent), color-mix(in srgb, var(--accent-2) 14%, transparent));
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 26px var(--cell-glow),
    0 0 60px -8px var(--cell-glow),
    inset 0 0 22px color-mix(in srgb, var(--accent) 28%, transparent);
  transform: scale(1.05);
  z-index: 2;
  transition: none;
}
.cell.active .p-icon, .cell.active .p-img { transform: scale(1.2); }
.cell.trail {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 25%, transparent);
  transition: all .5s ease-out;
}
.cell.winner { animation: winnerBlink .32s steps(2, jump-none) 6; }
@keyframes winnerBlink {
  0% { box-shadow: 0 0 0 1px var(--accent), 0 0 30px var(--cell-glow), 0 0 80px -4px var(--cell-glow); }
  100% { box-shadow: none; }
}

/* --- 中央抽奖按钮 --- */
.cell.center {
  background: none; border: none; box-shadow: none; overflow: visible;
}
.cell.center::after { display: none; }
.draw-btn {
  position: absolute; inset: 2px;
  border-radius: 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background:
    linear-gradient(170deg, #ffe9ad 0%, var(--gold) 30%, var(--accent-2) 78%, var(--gold-deep) 100%);
  color: #4a2a05;
  box-shadow:
    0 10px 26px -6px color-mix(in srgb, var(--accent-2) 65%, transparent),
    inset 0 2px 2px rgba(255, 255, 255, .75),
    inset 0 -10px 18px rgba(160, 82, 12, .35);
  transition: transform .18s, filter .18s;
}
.draw-btn::before { /* 呼吸光环 */
  content: ""; position: absolute; inset: -7px; border-radius: 24px; z-index: -1;
  border: 2px solid color-mix(in srgb, var(--accent) 75%, transparent);
  animation: ringPulse 1.8s ease-out infinite;
}
@keyframes ringPulse {
  0% { opacity: .9; transform: scale(.92); }
  70%, 100% { opacity: 0; transform: scale(1.14); }
}
.draw-btn::after { /* 扫光 */
  content: ""; position: absolute; inset: 0; border-radius: 18px; overflow: hidden;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .55) 46%, rgba(255, 255, 255, .2) 52%, transparent 62%);
  background-size: 260% 100%;
  animation: btnSheen 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes btnSheen { 0% { background-position: 130% 0; } 55%, 100% { background-position: -130% 0; } }
.draw-btn:active { transform: scale(.94); }
.d-main { font-size: clamp(17px, 4.6vw, 21px); font-weight: 800; letter-spacing: 3px; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.d-sub { font-size: 11px; font-weight: 600; opacity: .78; letter-spacing: .5px; }
.draw-btn.disabled { filter: grayscale(.75) brightness(.75); }
.draw-btn.disabled::before, .draw-btn.disabled::after { display: none; }
.draw-btn.spinning { pointer-events: none; filter: brightness(1.06); }
.draw-btn.spinning::before { display: none; }

/* --- 中奖播报 --- */
.marquee {
  width: min(92vw, 430px);
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-brd);
  backdrop-filter: blur(10px);
  animation: heroIn .9s .25s cubic-bezier(.2, .9, .25, 1.2) both;
}
.m-icon { font-size: 15px; }
.m-viewport { flex: 1; height: 20px; overflow: hidden; position: relative; }
.m-viewport ul { list-style: none; position: absolute; width: 100%; transition: transform .6s cubic-bezier(.4, 0, .2, 1); }
.m-viewport li {
  height: 20px; line-height: 20px; font-size: 12.5px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-viewport li b { color: var(--accent); font-weight: 600; }

/* --- 底部操作 --- */
.actions { display: flex; gap: 12px; animation: heroIn .9s .35s cubic-bezier(.2, .9, .25, 1.2) both; }
.chip {
  padding: 9px 18px; border-radius: 999px; font-size: 13px; letter-spacing: 1px;
  color: var(--ink); background: var(--glass); border: 1px solid var(--glass-brd);
  backdrop-filter: blur(10px);
  transition: all .2s;
}
.chip:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent); transform: translateY(-2px); }
.chip:active { transform: scale(.95); }

.foot { margin-top: auto; padding-top: 10px; font-size: 11px; letter-spacing: 1px; color: rgba(255, 255, 255, .28); }

/* --- 管理入口浮钮 --- */
.admin-fab {
  position: fixed; right: 16px; bottom: 16px; z-index: 50;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  font-size: 17px; color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(8px);
  transition: all .25s;
}
.admin-fab:hover { color: var(--accent); transform: rotate(90deg); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

/* ==========================================================================
   弹窗
   ========================================================================== */
.modal { position: fixed; inset: 0; z-index: 320; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(4, 2, 14, .72); backdrop-filter: blur(6px); animation: fadeIn .3s both; }
@keyframes fadeIn { from { opacity: 0; } }

.sheet {
  position: relative; width: min(92vw, 420px); max-height: 80dvh;
  display: flex; flex-direction: column;
  border-radius: 20px; padding: 24px 22px 20px;
  background: linear-gradient(170deg, #241b3f, #140e28);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: var(--shadow);
  animation: popIn .42s cubic-bezier(.2, 1.1, .3, 1.15) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(28px) scale(.92); } }
.sheet.slim { width: min(88vw, 340px); }
.s-title { font-size: 17px; letter-spacing: 2px; margin-bottom: 14px; text-align: center; }
.s-body { flex: 1; overflow-y: auto; font-size: 13.5px; line-height: 1.9; color: var(--ink-dim); }
.s-body::-webkit-scrollbar { width: 4px; }
.s-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 2px; }
.s-btn {
  margin-top: 18px; padding: 12px; border-radius: 999px; width: 100%;
  font-size: 15px; font-weight: 700; letter-spacing: 4px; color: #4a2a05;
  background: linear-gradient(170deg, #ffe9ad, var(--gold) 40%, var(--accent-2));
  box-shadow: 0 8px 22px -6px color-mix(in srgb, var(--accent-2) 60%, transparent), inset 0 1px 1px rgba(255, 255, 255, .7);
  transition: transform .15s, filter .15s;
}
.s-btn:hover { filter: brightness(1.06); }
.s-btn:active { transform: scale(.96); }
.s-btn.ghost { background: rgba(255, 255, 255, .08); color: var(--ink); box-shadow: none; border: 1px solid var(--glass-brd); }
.s-btn.danger { background: linear-gradient(170deg, #ff9d8a, #ef4444 60%, #b91c1c); color: #fff; }
.s-row { display: flex; gap: 12px; }
.s-row .s-btn { flex: 1; }

.ipt {
  width: 100%; padding: 11px 14px; border-radius: 12px; font-size: 14px;
  color: var(--ink); background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .15); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ipt:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.ipt::placeholder { color: rgba(255, 255, 255, .3); }
.hint { font-size: 11.5px; color: rgba(255, 255, 255, .4); margin-top: 8px; line-height: 1.7; }

/* --- 中奖结果卡 --- */
.result-card {
  position: relative; width: min(88vw, 360px);
  border-radius: 26px; overflow: hidden; text-align: center;
  background:
    linear-gradient(175deg, #2d2050, #17102e 60%, #1d1235) padding-box,
    linear-gradient(160deg, var(--accent), rgba(255, 255, 255, .1) 45%, var(--accent-2)) border-box;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow), 0 0 90px -18px var(--cell-glow);
  animation: resultIn .55s cubic-bezier(.18, 1.2, .3, 1.12) both;
}
@keyframes resultIn { from { opacity: 0; transform: translateY(46px) scale(.8); } }
.result-card.lose { filter: saturate(.85); }
.result-rays {
  position: absolute; left: 50%; top: 110px; width: 460px; height: 460px;
  margin: -230px 0 0 -230px; /* 用 margin 居中，避免 translate 被旋转动画覆盖 */
  background: conic-gradient(from 0deg,
    color-mix(in srgb, var(--accent) 26%, transparent) 0 14deg, transparent 14deg 30deg,
    color-mix(in srgb, var(--accent) 26%, transparent) 30deg 44deg, transparent 44deg 60deg,
    color-mix(in srgb, var(--accent) 26%, transparent) 60deg 74deg, transparent 74deg 90deg);
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 22%, transparent) 0 13deg, transparent 13deg 30deg);
  -webkit-mask: radial-gradient(closest-side, #000 0%, transparent 70%);
          mask: radial-gradient(closest-side, #000 0%, transparent 70%);
  animation: raysSpin 14s linear infinite;
  pointer-events: none;
}
.result-card.lose .result-rays { opacity: .3; }
.result-body { position: relative; padding: 34px 26px 26px; }
.r-icon {
  font-size: 76px; line-height: 1.1;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .5));
  animation: iconDrop .7s .1s cubic-bezier(.2, 1.4, .35, 1.1) both;
}
.r-icon img { width: 86px; height: 86px; object-fit: contain; }
@keyframes iconDrop { from { opacity: 0; transform: translateY(-40px) scale(.4) rotate(-14deg); } }
.r-title {
  margin-top: 12px; font-size: 24px; font-weight: 800; letter-spacing: 5px;
  background: linear-gradient(100deg, #fff6dd, var(--accent) 40%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.r-name { margin-top: 8px; font-size: 16px; font-weight: 600; letter-spacing: 1px; }
.r-tip { margin-top: 6px; font-size: 12px; color: var(--ink-dim); }
.r-btn {
  margin-top: 22px; width: 100%; padding: 13px; border-radius: 999px;
  font-size: 15px; font-weight: 700; letter-spacing: 4px; color: #4a2a05;
  background: linear-gradient(170deg, #ffe9ad, var(--gold) 40%, var(--accent-2));
  box-shadow: 0 10px 26px -6px color-mix(in srgb, var(--accent-2) 65%, transparent), inset 0 1px 1px rgba(255, 255, 255, .7);
  transition: transform .15s, filter .15s;
}
.r-btn:hover { filter: brightness(1.06); }
.r-btn:active { transform: scale(.96); }

/* --- 我的奖品列表 --- */
.rec-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px dashed rgba(255, 255, 255, .1);
}
.rec-item .ri-icon { font-size: 24px; width: 32px; text-align: center; }
.rec-item .ri-icon img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; }
.rec-item .ri-info { flex: 1; min-width: 0; }
.rec-item .ri-name { font-size: 13.5px; color: var(--ink); font-weight: 600; }
.rec-item .ri-time { font-size: 11px; color: rgba(255, 255, 255, .35); margin-top: 2px; }
.rec-item .ri-badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; letter-spacing: 1px; }
.rec-item .ri-badge.win { color: #3b2303; background: linear-gradient(135deg, #ffe9ad, var(--gold-2)); font-weight: 700; }
.rec-item .ri-badge.lose { color: rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .08); }
.rec-empty { text-align: center; padding: 34px 0 20px; color: rgba(255, 255, 255, .35); font-size: 13px; letter-spacing: 1px; }
.rec-empty i { display: block; font-style: normal; font-size: 40px; margin-bottom: 10px; opacity: .6; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed; left: 50%; top: 8dvh; z-index: 400;
  transform: translate(-50%, -24px); opacity: 0; pointer-events: none;
  padding: 11px 22px; border-radius: 999px;
  font-size: 13.5px; letter-spacing: 1px; color: var(--ink); white-space: nowrap;
  background: rgba(20, 14, 40, .92); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 0 24px -6px var(--cell-glow);
  backdrop-filter: blur(8px);
  transition: all .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ==========================================================================
   管理后台登录页
   ========================================================================== */
.admin-body {
  background: radial-gradient(120% 90% at 50% -10%, var(--bg-2) 0%, var(--bg-1) 42%, var(--bg-0) 100%);
  background-attachment: fixed;
}
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: min(90vw, 360px); text-align: center;
  border-radius: 22px; padding: 34px 30px 26px;
  background: linear-gradient(170deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  animation: popIn .45s cubic-bezier(.2, 1.1, .3, 1.15) both;
}
.login-logo { font-size: 46px; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, .4)); }
.login-title {
  margin: 14px 0 6px; font-size: 18px; letter-spacing: 2px;
  background: linear-gradient(100deg, #fff6dd, var(--accent) 45%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.login-sub { font-size: 12.5px; color: var(--ink-dim); margin-bottom: 20px; letter-spacing: 1px; }
.login-card .ipt { text-align: center; letter-spacing: 2px; }
.login-card .s-btn { margin-top: 14px; }
.login-back { display: inline-block; margin-top: 18px; font-size: 12px; color: rgba(255, 255, 255, .4); text-decoration: none; letter-spacing: 1px; }
.login-back:hover { color: var(--accent); }

/* ==========================================================================
   管理后台
   ========================================================================== */
.admin {
  position: fixed; inset: 0; z-index: 250;
  display: flex;
  background: #0d0a1c;
  color: #e7e3f4;
  animation: fadeIn .3s both;
  user-select: text;
}
.a-side {
  width: 210px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 14px;
  background: rgba(255, 255, 255, .03);
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.a-logo { font-size: 15px; font-weight: 700; letter-spacing: 1px; padding: 4px 10px 18px; color: var(--accent); }
.a-logo span { margin-right: 4px; }
.a-tab {
  text-align: left; padding: 12px 14px; border-radius: 12px;
  font-size: 14px; letter-spacing: 1px; color: rgba(255, 255, 255, .6);
  transition: all .2s;
}
.a-tab:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.a-tab.active {
  background: linear-gradient(100deg, color-mix(in srgb, var(--accent) 22%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent));
  color: var(--accent); font-weight: 700;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.a-side-gap { flex: 1; }
.a-exit {
  display: block; text-align: center; text-decoration: none;
  padding: 12px; border-radius: 12px; font-size: 13px; letter-spacing: 1px;
  color: rgba(255, 255, 255, .55); border: 1px solid rgba(255, 255, 255, .12);
  transition: all .2s;
}
.a-exit:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.a-exit + .a-exit { margin-top: 8px; }
.a-mini {
  padding: 5px 12px; border-radius: 999px; font-size: 11.5px; letter-spacing: 1px;
  color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14); cursor: pointer;
  transition: all .2s; vertical-align: 2px;
}
.a-mini:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.a-main { flex: 1; overflow-y: auto; padding: 26px 30px 60px; }
.a-main::-webkit-scrollbar { width: 6px; }
.a-main::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }
.a-pane { display: none; max-width: 860px; }
.a-pane.active { display: block; animation: paneIn .35s ease both; }
@keyframes paneIn { from { opacity: 0; transform: translateY(10px); } }

.a-h2 { font-size: 20px; letter-spacing: 1px; margin-bottom: 18px; }
.a-h2 small { font-size: 12px; font-weight: 400; color: rgba(255, 255, 255, .4); margin-left: 10px; letter-spacing: .5px; }
.a-h3 { font-size: 14.5px; letter-spacing: 1px; margin-bottom: 14px; color: var(--accent); }
.a-h3 small { font-size: 11px; color: rgba(255, 255, 255, .4); font-weight: 400; margin-left: 8px; }

.a-card {
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 16px; padding: 20px; margin-bottom: 18px;
}
.a-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 14px; }
.fld { display: flex; flex-direction: column; gap: 7px; }
.fld > span { font-size: 12.5px; color: rgba(255, 255, 255, .55); letter-spacing: 1px; }
.fld > span em { font-style: normal; color: rgba(255, 255, 255, .3); }
.ipt.area { resize: vertical; line-height: 1.8; min-height: 100px; }
.a-row { display: flex; gap: 12px; align-items: center; }
.a-row.end { justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.a-row .ipt { max-width: 260px; }

.a-btn {
  display: inline-block; text-decoration: none;
  padding: 10px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: 1px; color: #3b2303;
  background: linear-gradient(170deg, #ffe9ad, var(--gold) 45%, var(--accent-2));
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent-2) 55%, transparent);
  transition: transform .15s, filter .15s;
  white-space: nowrap;
}
.a-btn:hover { filter: brightness(1.07); }
.a-btn:active { transform: scale(.95); }
.a-btn.ghost { background: rgba(255, 255, 255, .07); color: #e7e3f4; box-shadow: none; border: 1px solid rgba(255, 255, 255, .15); }
.a-btn.danger { background: linear-gradient(170deg, #ff9d8a, #ef4444 55%, #b91c1c); color: #fff; }

/* 开关 */
.a-switches { display: flex; flex-direction: column; gap: 14px; }
.sw { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 13.5px; }
.sw input { display: none; }
.sw i {
  width: 42px; height: 24px; border-radius: 999px; position: relative; flex-shrink: 0;
  background: rgba(255, 255, 255, .12); transition: background .25s;
}
.sw i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .25s cubic-bezier(.3, 1.4, .5, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.sw input:checked + i { background: linear-gradient(135deg, var(--gold), var(--accent-2)); }
.sw input:checked + i::after { transform: translateX(18px); }

/* 奖品编辑表 */
.p-scroll { overflow-x: auto; padding-bottom: 4px; }
.p-scroll::-webkit-scrollbar { height: 6px; }
.p-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }
.p-head, .p-row {
  display: grid;
  grid-template-columns: 40px 72px minmax(150px, 1fr) 70px 86px 72px 64px;
  gap: 10px; align-items: center;
  min-width: 590px;
}
.p-head { font-size: 11.5px; color: rgba(255, 255, 255, .4); letter-spacing: 1px; padding: 0 6px 10px; white-space: nowrap; }
.p-head em { font-style: normal; opacity: .7; }
.p-row { padding: 9px 6px; border-radius: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.p-row:hover { background: rgba(255, 255, 255, .03); }
.p-no { font-size: 12px; color: rgba(255, 255, 255, .4); text-align: center; }
.p-ico-btn {
  width: 46px; height: 46px; border-radius: 12px; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .07); border: 1px dashed rgba(255, 255, 255, .22);
  transition: border-color .2s; position: relative;
}
.p-ico-btn:hover { border-color: var(--accent); }
.p-ico-btn img { width: 34px; height: 34px; object-fit: contain; }
.p-ico-btn .p-ico-x {
  position: absolute; top: -7px; right: -7px; width: 17px; height: 17px; border-radius: 50%;
  font-size: 11px; line-height: 15px; background: #ef4444; color: #fff; display: none;
}
.p-ico-btn.has-img .p-ico-x { display: block; }
.p-row .ipt { padding: 9px 11px; font-size: 13px; border-radius: 10px; }
.p-pct { font-size: 13px; font-weight: 700; color: var(--accent); text-align: center; }
.p-thx { display: flex; justify-content: center; }

/* 背景编辑 */
.bg-editor { display: flex; gap: 20px; align-items: flex-start; }
.bg-preview {
  width: 150px; height: 240px; border-radius: 14px; flex-shrink: 0;
  background: radial-gradient(120% 90% at 50% -10%, var(--bg-2), var(--bg-1) 42%, var(--bg-0));
  background-size: cover; background-position: center;
  border: 1px solid rgba(255, 255, 255, .15);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: rgba(255, 255, 255, .45); letter-spacing: 1px;
}
.bg-preview.has-img span { display: none; }
.bg-ops { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

/* 主题选择 */
.themes { display: flex; gap: 14px; flex-wrap: wrap; }
.theme-sw {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12px; color: rgba(255, 255, 255, .6); letter-spacing: 1px;
  padding: 10px; border-radius: 14px; border: 1.5px solid transparent;
  transition: all .2s;
}
.theme-sw i { width: 72px; height: 44px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .18); }
.theme-sw:hover { color: #fff; }
.theme-sw.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* 统计 */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  padding: 18px; border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .03));
  border: 1px solid rgba(255, 255, 255, .1);
}
.stat-card .sc-num { font-size: 26px; font-weight: 800; color: var(--accent); }
.stat-card .sc-label { font-size: 12px; color: rgba(255, 255, 255, .5); margin-top: 6px; letter-spacing: 1px; }

.stat-bars { display: flex; flex-direction: column; gap: 12px; }
.sb-row { display: grid; grid-template-columns: 120px 1fr 64px; gap: 12px; align-items: center; font-size: 12.5px; }
.sb-name { color: rgba(255, 255, 255, .75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-track { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.sb-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--accent-2)); transition: width .6s cubic-bezier(.2, .9, .3, 1); }
.sb-num { color: rgba(255, 255, 255, .5); text-align: right; }

.rec-wrap { max-height: 340px; overflow: auto; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); }
.rec-table td, .rec-table th { white-space: nowrap; }
.rec-wrap::-webkit-scrollbar { width: 5px; }
.rec-wrap::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rec-table th, .rec-table td { padding: 9px 14px; text-align: left; }
.rec-table thead th {
  position: sticky; top: 0; background: #1a1430; color: rgba(255, 255, 255, .5);
  font-weight: 600; letter-spacing: 1px; font-size: 11.5px;
}
.rec-table tbody tr { border-top: 1px solid rgba(255, 255, 255, .05); }
.rec-table tbody tr:hover { background: rgba(255, 255, 255, .03); }
.rec-table .win { color: var(--accent); font-weight: 600; }
.rec-table .lose { color: rgba(255, 255, 255, .4); }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 760px) {
  .admin { flex-direction: column; }
  .a-side {
    width: 100%; flex-direction: row; align-items: center; gap: 4px;
    padding: 10px 12px; overflow-x: auto;
    border-right: none; border-bottom: 1px solid rgba(255, 255, 255, .08);
  }
  .a-logo { display: none; }
  .a-tab { padding: 9px 12px; font-size: 13px; white-space: nowrap; }
  .a-side-gap { display: none; }
  .a-exit { margin-left: auto; padding: 9px 12px; white-space: nowrap; flex-shrink: 0; }
  .a-main { padding: 18px 14px 50px; }
  .a-grid2 { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .bg-editor { flex-direction: column; }
}

/* 矮视口（横屏手机 / 小窗口）：压缩留白，让九宫格随高度缩放 */
@media (max-height: 720px) {
  .stage { gap: 12px; }
  .hero { margin-top: 0; }
  .title { font-size: clamp(26px, 7vh, 44px); letter-spacing: 4px; margin-top: 10px; }
  .subtitle { margin-top: 4px; font-size: 12.5px; letter-spacing: 3px; }
  .badge { font-size: 11px; padding: 5px 14px; }
  .board-wrap { width: min(92vw, 62vh, 430px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}
