/* ============================================================
   beatAI · 共享设计底座 (theme.css)  v2 — 质感升级版
   人类 vs AI 爆款小游戏厅 — 暗色霓虹 / 移动优先 / 可截图分享
   所有游戏 <link> 此文件，使用以下 class，保证风格统一。
   v2 升级：氛围背景层 / 高级按钮与卡片质感 / 更顺的转场
            —— 全部在既有 class 上增强，不改尺寸契约。
   ============================================================ */

:root {
  /* 背景 */
  --bg:        #07070c;
  --bg-soft:   #0e0e17;
  --bg-card:   #15151f;
  --bg-elev:   #1d1d2b;
  --line:      #2a2a3a;
  --line-2:    #3a3a50;

  /* 品牌色 */
  --purple:    #7B6CFF;   /* 主色 */
  --purple-l:  #9A8DFF;
  --purple-d:  #534AB7;
  --gold:      #EF9F27;   /* 高光 / 分数 */
  --gold-l:    #FFC15E;
  --teal:      #1FB585;   /* 人类一方 */
  --teal-l:    #36E0A8;
  --pink:      #FF5D8F;   /* 强调 / AI 一方 */
  --pink-l:    #FF85AC;
  --blue:      #3DA9FC;

  /* 文字 */
  --text:      #F4F4F9;
  --text-2:    #BCBCCC;
  --text-3:    #74748C;

  /* 语义 */
  --ok:        #1FB585;
  --bad:       #FF4D5E;

  /* 尺寸 */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-pill: 999px;
  --maxw: 460px;
  --pad: 20px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* iOS 长按不弹选择/放大菜单（长按类游戏必需） */
  touch-action: manipulation;    /* 去掉双击缩放的 300ms 延迟；canvas 游戏各自再设 touch-action:none */
}

/* ---------- 氛围背景：流动光晕 + 极细网格 + 暗角（不挡点击） ---------- */
body::before {
  content: ''; position: fixed; inset: -25%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 30% at 22% 12%, rgba(123,108,255,0.28), transparent 60%),
    radial-gradient(42% 32% at 82% 8%,  rgba(255,93,143,0.18), transparent 62%),
    radial-gradient(50% 40% at 60% 108%, rgba(31,181,133,0.14), transparent 60%);
  animation: ambient 22s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    repeating-linear-gradient(0deg,  rgba(255,255,255,0.016) 0 1px, transparent 1px 46px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.016) 0 1px, transparent 1px 46px),
    radial-gradient(125% 90% at 50% 0%, transparent 58%, rgba(0,0,0,0.55) 100%);
}
@keyframes ambient {
  from { transform: translate3d(-3%, -2%, 0) scale(1.02); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

/* ---------- 布局外壳（置于背景层之上） ---------- */
.app {
  position: relative; z-index: 1;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;               /* 手机一律铺满（含高分屏宽 CSS 像素机型）*/
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 14px) var(--pad)
           max(env(safe-area-inset-bottom), 18px);
  display: flex;
  flex-direction: column;
}
/* 仅真正的桌面（鼠标设备）才收窄居中；任何触摸设备（含宽 CSS 像素手机，如 1260÷1.5=840）始终铺满 */
@media (min-width: 820px) and (pointer: fine) { .app { max-width: var(--maxw); } }
.screen { flex: 1; display: flex; flex-direction: column; }
.center { justify-content: center; align-items: center; text-align: center; gap: 18px; }
.spacer { flex: 1; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; margin-bottom: 6px;
}
.back {
  appearance: none; border: 0; background: transparent;
  color: var(--text-2); font-size: 15px; font-family: var(--font);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 4px;
}
.back:active { color: var(--text); transform: translateX(-1px); }
.brand { font-size: 13px; letter-spacing: 2px; color: var(--text-3); font-weight: 700; }
.brand b { color: var(--purple-l); text-shadow: 0 0 14px rgba(123,108,255,0.6); }

/* ---------- 文字 ---------- */
.title    { font-size: 31px; line-height: 1.14; font-weight: 800; margin: 0; letter-spacing: -0.6px; }
.subtitle { font-size: 17px; font-weight: 700; margin: 0; }
.hook     { font-size: 15px; color: var(--text-2); margin: 0; line-height: 1.6; }
.dim      { color: var(--text-3); }
.mono     { font-family: var(--mono); }
.huge     {
  font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -1px;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 32px rgba(123,108,255,0.35);
}
.accent      { color: var(--purple-l); }
.accent-gold { color: var(--gold); }
.accent-teal { color: var(--teal-l); }
.accent-pink { color: var(--pink-l); }

/* ---------- 卡片 ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(33,33,48,0.92), rgba(14,14,23,0.92));
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  width: 100%;
  box-shadow: 0 6px 22px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.card-lg { padding: 22px; border-radius: var(--r-lg); }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; cursor: pointer; font-family: var(--font);
  font-size: 17px; font-weight: 700; color: #fff;
  border: 0; border-radius: var(--r-pill);
  padding: 16px 22px; width: 100%;
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--purple-l), var(--purple) 62%, var(--purple-d));
  box-shadow: 0 10px 26px rgba(123,108,255,0.34), inset 0 1px 0 rgba(255,255,255,0.28);
  transition: transform .08s ease, filter .15s ease, box-shadow .15s, opacity .15s;
}
.btn::after {           /* 顶部柔光 */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), transparent);
  pointer-events: none;
}
.btn:active { transform: translateY(1px) scale(0.99); filter: brightness(1.07); box-shadow: 0 4px 14px rgba(123,108,255,0.30), inset 0 1px 0 rgba(255,255,255,0.28); }
.btn[disabled] { opacity: .4; box-shadow: none; pointer-events: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-l), var(--gold) 60%, #cf7f12); color: #20160a; box-shadow: 0 10px 26px rgba(239,159,39,0.32), inset 0 1px 0 rgba(255,255,255,0.4); }
.btn-teal { background: linear-gradient(180deg, var(--teal-l), var(--teal) 60%, #138a64); box-shadow: 0 10px 26px rgba(31,181,133,0.30), inset 0 1px 0 rgba(255,255,255,0.3); }
.btn-ghost {
  background: rgba(255,255,255,0.03); color: var(--text-2);
  border: 1px solid var(--line-2); box-shadow: none;
}
.btn-ghost::after { display: none; }
.btn-ghost:active { background: rgba(255,255,255,0.06); }
.btn-row { display: flex; gap: 12px; width: 100%; }
.btn-row .btn { flex: 1; }

/* ---------- 徽章 / 药丸 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg-card));
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}
.pill-gold { color: var(--gold-l); border-color: rgba(239,159,39,0.45); box-shadow: 0 0 18px rgba(239,159,39,0.12), inset 0 1px 0 rgba(255,255,255,0.06); }

/* ---------- 你 vs AI 对决条 ---------- */
.vs {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; width: 100%;
}
.vs .side { text-align: center; }
.vs .who { font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.vs .you .who { color: var(--teal-l); }
.vs .ai  .who { color: var(--pink-l); }
.vs .num { font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; }
.vs .you .num { text-shadow: 0 0 22px rgba(31,181,133,0.35); }
.vs .ai  .num { text-shadow: 0 0 22px rgba(255,93,143,0.35); }
.vs .mid {
  font-size: 13px; color: var(--text-3); font-weight: 800; letter-spacing: 1px;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev); border: 1px solid var(--line);
  box-shadow: 0 0 16px rgba(123,108,255,0.18);
}

/* ---------- 选项网格 ---------- */
.choices { display: grid; gap: 12px; width: 100%; }
.choices-2 { grid-template-columns: 1fr 1fr; }
.choice {
  appearance: none; cursor: pointer; font-family: var(--font);
  text-align: left; color: var(--text); font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, var(--bg-card), var(--bg-soft));
  border: 1.5px solid var(--line);
  border-radius: var(--r-md); padding: 16px;
  transition: transform .12s ease, border-color .12s, background .12s, box-shadow .15s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
.choice:active { transform: scale(0.99); }
.choice.selected { border-color: var(--purple); background: var(--bg-elev); box-shadow: 0 0 0 1px var(--purple), 0 8px 22px rgba(123,108,255,0.18); }
.choice.correct  { border-color: var(--ok);  background: rgba(31,181,133,0.14); box-shadow: 0 0 0 1px rgba(31,181,133,0.5), 0 8px 22px rgba(31,181,133,0.18); }
.choice.wrong    { border-color: var(--bad); background: rgba(255,77,94,0.12); box-shadow: 0 0 0 1px rgba(255,77,94,0.45), 0 8px 22px rgba(255,77,94,0.16); }

/* ---------- 进度条 ---------- */
.bar { width: 100%; height: 8px; border-radius: var(--r-pill); background: var(--bg-elev); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.4); }
.bar > i { display: block; height: 100%; border-radius: inherit; transition: width .3s ease;
  background: linear-gradient(90deg, var(--purple-d), var(--purple-l));
  box-shadow: 0 0 12px rgba(123,108,255,0.5);
}

/* ---------- 结果区 ---------- */
.result { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.result .verdict { font-size: 22px; font-weight: 800; }
.result .label { font-size: 14px; color: var(--text-3); letter-spacing: 1px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev); color: var(--text); border: 1px solid var(--line-2);
  padding: 12px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight: 600;
  opacity: 0; transition: all .25s ease; z-index: 999; pointer-events: none;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 动效 ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pop    { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake  { 10%,90%{transform:translateX(-2px)} 30%,70%{transform:translateX(4px)} 50%{transform:translateX(-6px)} }
@keyframes grow   { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes float  { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-7px) } }
.fade-in { animation: fadeIn .42s cubic-bezier(.2,.8,.3,1) both; }
.pop     { animation: pop .35s cubic-bezier(.2,1.3,.4,1) both; }
.shake   { animation: shake .4s ease; }
.grow    { animation: grow .4s cubic-bezier(.2,1.3,.4,1) both; }
.float   { animation: float 3s ease-in-out infinite; }

.hidden { display: none !important; }
::selection { background: var(--purple); color: #fff; }
