/* ============================================================
   安全知识答题抽奖 · SaaS 级设计系统
   字体：Rajdhani（数字/展示） + Noto Sans SC（正文）
   配色：深海军蓝底 + 青绿主色 + 琥珀点缀
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&family=Noto+Sans+SC:wght@400;500;700;900&display=swap');

:root {
  --bg-deep: #0A1628;
  --bg-mid: #0F2440;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(148, 197, 222, 0.16);
  --ink: #EAF2F8;
  --ink-dim: #9FB3C8;
  --teal: #2DD4BF;
  --teal-deep: #14B8A6;
  --cyan: #38BDF8;
  --gold: #F5B547;
  --coral: #FF6B5E;
  --ok: #34D399;
  --display: 'Rajdhani', 'Noto Sans SC', sans-serif;
  --body: 'Noto Sans SC', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--bg-deep);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- 分层环境背景：底色 + 网格 + 双色光晕 ---- */
.env {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 620px at 88% -12%, rgba(45, 212, 191, 0.14), transparent 62%),
    radial-gradient(760px 560px at -12% 32%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(680px 500px at 55% 108%, rgba(20, 120, 160, 0.10), transparent 60%),
    linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 55%, #0B1D33 100%);
}
.env::before { /* 细网格 */
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(120, 180, 210, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 210, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 0%, transparent 78%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; }
.orb.a { width: 340px; height: 340px; left: -90px; top: 12%; background: rgba(45,212,191,.16); animation: drift 16s ease-in-out infinite alternate; }
.orb.b { width: 280px; height: 280px; right: -70px; top: 48%; background: rgba(56,189,248,.14); animation: drift 20s ease-in-out infinite alternate-reverse; }
@keyframes drift { from { transform: translateY(0) translateX(0); } to { transform: translateY(-46px) translateX(24px); } }

/* ---- 主容器：手机全宽，桌面居中 ---- */
.container {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding: 0 clamp(14px, 4vw, 22px) calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 820px) {
  .container { min-height: calc(100vh - 56px); margin: 28px auto; justify-content: flex-start; }
}

/* ---- 页头（品牌条）---- */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 2px 4px;
}
.brand img { width: 38px; height: 38px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.brand .name { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand .sub { font-size: 11px; color: var(--ink-dim); letter-spacing: .14em; text-transform: uppercase; font-family: var(--display); }

/* ---- 标题区 ---- */
.page-title {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 900; letter-spacing: .01em;
  margin-top: clamp(10px, 3vw, 18px);
}
.page-title .accent { color: var(--teal); }
.page-sub { color: var(--ink-dim); font-size: clamp(13px, 3.4vw, 15px); margin-top: 6px; line-height: 1.6; }

/* ---- 卡片 ---- */
.card {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 4.5vw, 26px);
  margin-top: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 40px rgba(2, 10, 24, 0.45);
  animation: rise .55s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
.card:nth-of-type(2) { animation-delay: .08s; }
.card:nth-of-type(3) { animation-delay: .16s; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px 20px;
  border: none; border-radius: 13px;
  font-family: var(--body); font-size: 16px; font-weight: 700; letter-spacing: .04em;
  color: #04251F; cursor: pointer;
  background: linear-gradient(135deg, var(--teal) 0%, var(--cyan) 100%);
  box-shadow: 0 10px 26px rgba(45, 212, 191, 0.28), inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(45, 212, 191, 0.4), inset 0 1px 0 rgba(255,255,255,.5); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: transparent; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--teal); color: var(--teal); transform: translateY(-2px); }
.btn.gold { background: linear-gradient(135deg, var(--gold), #F59E0B); color: #3A2A05; box-shadow: 0 10px 26px rgba(245,181,71,.3), inset 0 1px 0 rgba(255,255,255,.55); }

/* ---- 表单 ---- */
.form-label { display: block; font-size: 13px; color: var(--ink-dim); margin-bottom: 8px; font-weight: 500; letter-spacing: .05em; }
.form-input {
  width: 100%; padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid var(--line); border-radius: 12px;
  color: var(--ink); font-size: 16px; font-family: var(--body); outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.form-input::placeholder { color: rgba(159,179,200,.5); }
.form-input:focus { border-color: var(--teal); background: rgba(45,212,191,.06); box-shadow: 0 0 0 4px rgba(45,212,191,.12); }
.form-group { margin-bottom: 18px; }

/* ---- 小组网格：手机 2 列 → 桌面 3 列 ---- */
.group-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 620px) { .group-grid { grid-template-columns: repeat(3, 1fr); } }
.group-item {
  padding: 15px 8px; text-align: center;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 14px; font-weight: 600; color: var(--ink-dim); cursor: pointer;
  transition: all .2s var(--ease);
}
.group-item:hover { border-color: rgba(45,212,191,.5); color: var(--ink); transform: translateY(-2px); }
.group-item.active {
  border-color: var(--teal); color: var(--teal);
  background: rgba(45,212,191,.1); box-shadow: 0 6px 18px rgba(45,212,191,.18);
}

/* ---- 答题：进度 + 计时 ---- */
.quiz-top {
  display: flex; align-items: center; gap: 12px; margin-top: 18px;
  padding: 0 2px;
}
.q-progress-bar { flex: 1; height: 7px; background: rgba(255,255,255,.08); border-radius: 99px; overflow: hidden; }
.q-progress-fill {
  height: 100%; width: 3%; border-radius: 99px;
  background: linear-gradient(90deg, var(--teal-deep), var(--teal), var(--cyan));
  background-size: 200% 100%; animation: shimmer 2.4s linear infinite;
  transition: width .35s var(--ease);
}
@keyframes shimmer { to { background-position: -200% 0; } }
.q-index { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--teal); letter-spacing: .05em; white-space: nowrap; }
.q-timer {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(17px, 4.2vw, 20px); letter-spacing: .08em;
  color: var(--ink); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.q-timer .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.q-timer.warn { color: var(--coral); }
.q-timer.warn .dot { background: var(--coral); box-shadow: 0 0 10px var(--coral); animation-duration: .7s; }

/* ---- 题目 ---- */
.q-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.q-tag {
  display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 99px;
  font-size: 12px; font-weight: 700; letter-spacing: .06em;
}
.q-tag.single { background: rgba(56,189,248,.14); color: var(--cyan); border: 1px solid rgba(56,189,248,.3); }
.q-tag.multi  { background: rgba(245,181,71,.12); color: var(--gold); border: 1px solid rgba(245,181,71,.3); }
.q-tag.judge  { background: rgba(52,211,153,.12); color: var(--ok); border: 1px solid rgba(52,211,153,.3); }
.q-score { font-family: var(--display); font-weight: 700; color: var(--ink-dim); font-size: 14px; letter-spacing: .06em; }
.q-content {
  font-size: clamp(16px, 4.2vw, 18px); line-height: 1.65; font-weight: 600;
  margin-bottom: 18px; color: var(--ink);
}
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt-item {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  background: rgba(255,255,255,.045);
  border: 1.5px solid var(--line); border-radius: 13px;
  font-size: 15px; color: var(--ink); cursor: pointer;
  transition: all .18s var(--ease);
  animation: rise .4s var(--ease) both;
}
.opt-item:hover { border-color: rgba(45,212,191,.55); background: rgba(255,255,255,.07); transform: translateX(4px); }
.opt-item .opt-letter {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 15px;
  background: rgba(255,255,255,.08); color: var(--ink-dim);
  transition: all .18s var(--ease);
}
.opt-item.active { border-color: var(--teal); background: rgba(45,212,191,.12); }
.opt-item.active .opt-letter { background: var(--teal); color: #04251F; box-shadow: 0 4px 12px rgba(45,212,191,.4); }
.opt-item .opt-text { flex: 1; line-height: 1.5; }
.q-nav { display: flex; gap: 10px; margin-top: 22px; }
.q-nav .btn { flex: 1; padding: 13px; font-size: 15px; }

/* ---- 结果页 ---- */
.result-ring { position: relative; width: 190px; height: 190px; margin: 6px auto 4px; }
.result-ring svg { transform: rotate(-90deg); }
.result-ring .track { stroke: rgba(255,255,255,.07); }
.result-ring .bar {
  stroke: url(#scoreGrad); stroke-linecap: round;
  stroke-dasharray: 0 1000;
  animation: drawScore 1.3s var(--ease) forwards;
}
@keyframes drawScore { to { stroke-dasharray: var(--dash) 1000; } }
.result-num {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.result-num .n { font-family: var(--display); font-weight: 700; font-size: 52px; line-height: 1; color: var(--teal); }
.result-num .u { font-size: 12px; color: var(--ink-dim); letter-spacing: .2em; margin-top: 4px; }
.result-stats { display: flex; gap: 10px; margin: 18px 0 4px; }
.result-stats .chip {
  flex: 1; text-align: center; padding: 12px 8px; border-radius: 12px;
  background: rgba(255,255,255,.05); border: 1px solid var(--line);
}
.result-stats .chip b { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--cyan); }
.result-stats .chip span { font-size: 12px; color: var(--ink-dim); }

/* ---- 转盘 ---- */
.wheel-wrap { display: flex; flex-direction: column; align-items: center; padding: 10px 0 4px; }
.wheel-box {
  position: relative;
  width: clamp(260px, 74vw, 340px); height: clamp(260px, 74vw, 340px);
}
.wheel-glow {
  position: absolute; inset: -14px; border-radius: 50%;
  background: radial-gradient(circle, rgba(245,181,71,.22), transparent 68%);
  animation: pulse 2.6s infinite; pointer-events: none;
}
#wheelCanvas { width: 100%; height: 100%; display: block; }
.wheel-pointer {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: clamp(64px, 18vw, 80px); height: clamp(64px, 18vw, 80px);
  border-radius: 50%; z-index: 10; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: clamp(15px, 4vw, 18px); letter-spacing: .1em;
  color: #3A2A05;
  background: linear-gradient(135deg, var(--gold), #F59E0B);
  border: 4px solid #FFF6E4;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), 0 0 22px rgba(245,181,71,.45);
  transition: transform .2s var(--ease);
}
.wheel-pointer:hover { transform: translate(-50%, -50%) scale(1.07); }
.wheel-pointer:active { transform: translate(-50%, -50%) scale(.96); }
.wheel-hint { margin-top: 16px; color: var(--ink-dim); font-size: 13px; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4, 12, 26, 0.72); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.modal-mask.show { display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 340px;
  background: linear-gradient(180deg, #12294A, #0E2140);
  border: 1px solid var(--line); border-radius: 20px;
  padding: 30px 24px 24px; text-align: center;
  animation: pop .4s var(--ease);
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
@keyframes pop { from { transform: scale(.85) translateY(16px); opacity: 0; } }
.modal .art { width: 130px; height: 130px; object-fit: contain; margin: 0 auto 14px; display: block; }
.modal .emoji { font-size: 58px; line-height: 1; margin-bottom: 14px; }
.modal h3 { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.modal p { color: var(--ink-dim); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.modal p b { color: var(--gold); }

/* ---- toast ---- */
.toast {
  position: fixed; top: 18%; left: 50%; transform: translate(-50%, -12px);
  background: rgba(10, 26, 48, 0.92); border: 1px solid rgba(45,212,191,.35);
  color: var(--ink); padding: 12px 24px; border-radius: 99px;
  font-size: 14px; z-index: 2000; opacity: 0;
  transition: opacity .3s, transform .3s; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- 工具类 ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.muted { color: var(--ink-dim); font-size: 13px; }
.mt { margin-top: 16px; }

/* ---- 首页特性行 ---- */
.feat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.feat { text-align: center; padding: 14px 6px; border-radius: 13px; background: rgba(255,255,255,.05); border: 1px solid var(--line); }
.feat .ic { font-size: 22px; }
.feat .t { font-size: 12px; color: var(--ink-dim); margin-top: 6px; }
.feat b { display: block; font-family: var(--display); font-size: 16px; color: var(--teal); }

/* ---- 页脚 ---- */
.foot { margin-top: auto; padding: 26px 0 8px; text-align: center; color: rgba(159,179,200,.5); font-size: 11px; letter-spacing: .12em; }
