/* ============================================================
   apps/point24.html 样式（P0-4-T17 <style> 块外联）
   - 页面 style="..." 与 on* 仍在本页（P0-4-T18 整改）
   ============================================================ */

  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  /* body 用 min-height（而非 height:100%）：让 body 高度随内容增长，保证 sticky 顶栏全程有效 */
  html { height: 100%; }
  body { min-height: 100%; }

  :root {
    --bg-deep:     #0f172a;
    --bg-page:     #0f172a;
    --bg-card:     rgba(30, 41, 59, 0.72);
    --bg-card-solid: #1e293b;
    --bg-inner:    rgba(15, 23, 42, 0.55);
    --bg-key:      #1e293b;
    --bg-key-edge: #0b1220;
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --text-hint:      #475569;
    --text-on-accent: #ffffff;
    --border:      rgba(148, 163, 184, 0.18);
    --border-soft: rgba(148, 163, 184, 0.10);
    --accent:        #3b82f6;
    --accent-hover:  #2563eb;
    --accent-soft:   #60a5fa;
    --accent-fade:   rgba(59, 130, 246, 0.14);
    --blue-glow:     rgba(59, 130, 246, 0.45);
    --success:     #34d399;
    --warning:     #fbbf24;
    --danger:      #f87171;
    --gold:        #f59e0b;
    --gold-2:      #fbbf24;
    --gold-dark:   #d97706;
    --gold-bg:     rgba(245, 158, 11, 0.12);
    --gold-border: rgba(251, 191, 36, 0.55);
    --gold-glow:   rgba(245, 158, 11, 0.35);
    --shadow:      0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-neon: 0 0 0 1px rgba(59, 130, 246, 0.35), 0 0 28px rgba(59, 130, 246, 0.22);
  }

  body {
    background:
      radial-gradient(ellipse 75% 55% at 50% -5%, rgba(59, 130, 246, 0.22) 0%, transparent 60%),
      radial-gradient(ellipse 45% 40% at 100% 100%, rgba(245, 158, 11, 0.10) 0%, transparent 60%),
      radial-gradient(ellipse 40% 35% at 0% 80%, rgba(37, 99, 235, 0.10) 0%, transparent 60%),
      var(--bg-deep);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
  }
  a { color: inherit; text-decoration: none; }

  /* ============== 漂浮数学符号粒子 ============== */
  .p24-particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
  .p24-particles span {
    position: fixed;
    bottom: -8vh;
    font-weight: 700;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    opacity: 0;
    animation-name: p24-float;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    user-select: none;
  }
  @keyframes p24-float {
    0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
    12%  { opacity: 0.55; }
    88%  { opacity: 0.55; }
    100% { transform: translateY(-118vh) rotate(360deg); opacity: 0; }
  }

  /* ============== 通用容器 ============== */
  main {
    flex: 1;
    position: relative;
    z-index: 1;
    padding: 28px 40px 80px;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
  }

  /* ============== Hero + 3D 立方体 ============== */
  .p24-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 56px;
    margin-bottom: 34px;
    /* 防止 body 的 overflow-x:hidden 截断立方体背面 face，并保证子级 3D stacking 不受外层 transform/opacity 干扰 */
    overflow: visible;
    isolation: isolate;
    position: relative;
    z-index: 1;
  }
  .p24-hero-text { text-align: left; }
  .p24-hero .eyebrow {
    display: inline-block;
    font-size: 11px;
    letter-spacing: 0.42em;
    color: var(--accent-soft);
    text-transform: uppercase;
    margin-bottom: 14px;
    text-shadow: 0 0 14px rgba(96, 165, 250, 0.7);
  }
  .p24-hero h1 {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.1;
    background: linear-gradient(92deg, #93c5fd 0%, #bfdbfe 40%, #fbbf24 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 26px rgba(96, 165, 250, 0.35));
  }
  .p24-hero .sub {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.8;
  }
  .cube-scene {
    --s: 176px;
    /* 给立方体足够的"旋转空间"——6 个 face 通过 translateZ(88px) 散开，
       加上 perspective(900px) 的倾斜，最大外接圆直径约 s*1.55 = 272px。
       把容器尺寸直接定为旋转所需空间，避免父容器 overflow 裁切。 */
    width: calc(var(--s) * 1.6);
    height: calc(var(--s) * 1.6);
    flex-shrink: 0;
    perspective: 900px;
    /* 关键防御性属性：保证立方体不被任何祖先容器裁切 */
    overflow: visible;
    position: relative;
    z-index: 2;
    /* 隔离独立 stacking context，让 3D z 轴排序在浏览器层面正确生效 */
    isolation: isolate;
    /* 允许子级超出视觉边界而不被隐藏 */
    contain: layout style;
  }
  .cube {
    position: absolute;
    /* 居中放在 scene 内，让立方体中心对齐 scene 中心 */
    top: 50%;
    left: 50%;
    width: var(--s);
    height: var(--s);
    /* 把立方体的中心从左上角移到几何中心（补偿 top/left:50%） */
    margin-left: calc(var(--s) / -2);
    margin-top: calc(var(--s) / -2);
    transform-style: preserve-3d;
    animation: p24-cube-spin 16s linear infinite;
    /* 让所有 face 的 paint order 跟随浏览器自身的 3D 排序，不要人为覆盖 */
    transform-origin: 50% 50%;
  }
  .cube .face {
    position: absolute;
    width: var(--s);
    height: var(--s);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 62px;
    font-weight: 800;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, sans-serif;
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.55);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.20), rgba(15, 23, 42, 0.55));
    box-shadow: inset 0 0 34px rgba(59, 130, 246, 0.28), 0 0 26px rgba(59, 130, 246, 0.18);
    text-shadow: 0 0 18px rgba(96, 165, 250, 0.8);
    backface-visibility: visible;
    /* 显式声明参与 3D 渲染，避免某些浏览器把子元素拍平 */
    transform-style: preserve-3d;
    will-change: transform;
  }
  .cube .face.gold-face {
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.55);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.20), rgba(15, 23, 42, 0.55));
    box-shadow: inset 0 0 34px rgba(245, 158, 11, 0.26), 0 0 26px rgba(245, 158, 11, 0.18);
    text-shadow: 0 0 18px rgba(251, 191, 36, 0.8);
  }
  .cube .f-front  { transform: translateZ(calc(var(--s) / 2)); }
  .cube .f-back   { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
  .cube .f-right  { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
  .cube .f-left   { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
  .cube .f-top    { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
  .cube .f-bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
  @keyframes p24-cube-spin {
    0%   { transform: rotateX(-22deg) rotateY(0deg); }
    100% { transform: rotateX(-22deg) rotateY(360deg); }
  }

  /* ============== 玻璃卡片 ============== */
  .p24-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px 32px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
  .p24-card-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 18px;
  }

  /* ============== 设置页：左右两大卡片 ============== */
  .p24-set-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
  }

  /* 两栏布局：左列堆叠难度+模式卡片，右列放置说明+操作 */
  .p24-set-layout {
    display: flex;
    gap: 18px;
    margin-bottom: 18px;
  }
  .p24-set-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }
  .p24-set-col:first-child {
    flex: 1 1 55%;
    min-width: 0;
  }
  .p24-set-col--right {
    flex: 1 1 45%;
    min-width: 0;
  }
  .p24-rules-card {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .p24-rules-card .p24-rules {
    margin-top: 0;
    flex: 1;
  }
  .p24-rules-card .p24-actions {
    margin-top: auto;
  }

  .p24-set-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 0.25s, box-shadow 0.25s;
  }
  .p24-set-card:hover { border-color: rgba(96, 165, 250, 0.35); }
  .set-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
  }
  .set-card-head .set-ico {
    width: 42px; height: 42px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.06));
    border: 1px solid rgba(96, 165, 250, 0.35);
    box-shadow: 0 0 16px rgba(59, 130, 246, 0.18);
  }
  .set-card-head.gold .set-ico {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(245, 158, 11, 0.06));
    border-color: var(--gold-border);
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.18);
  }
  .set-card-head h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
  .set-card-head p { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

  .p24-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .p24-choice.p24-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--bg-inner);
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  }
  .p24-choice .c-ico { font-size: 22px; line-height: 1; }
  .p24-choice .c-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
  .p24-choice .c-desc { font-size: 11px; color: var(--text-muted); line-height: 1.65; text-align: center; }
  .p24-choice.p24-pill:hover { transform: translateY(-2px); border-color: rgba(96, 165, 250, 0.5); }
  .p24-choice.p24-pill.active {
    border-color: var(--accent);
    background: var(--accent-fade);
    box-shadow: var(--shadow-neon);
  }
  .p24-choice.p24-pill.active .c-name { color: #bfdbfe; }
  .p24-choice.p24-pill.gold:hover { border-color: var(--gold-border); }
  .p24-choice.p24-pill.gold.active {
    border-color: var(--gold);
    background: var(--gold-bg);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45), 0 0 26px rgba(245, 158, 11, 0.22);
  }
  .p24-choice.p24-pill.gold.active .c-name { color: #fde68a; }

  /* 紧凑 pill（限时子选项） */
  .p24-pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
  .p24-pill {
    padding: 7px 17px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-inner);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
  }
  .p24-pill:hover { border-color: var(--accent-soft); color: var(--accent-soft); }
  .p24-pill.active {
    background: rgba(59, 130, 246, 0.20);
    color: #bfdbfe;
    border-color: var(--accent);
    box-shadow: 0 0 14px rgba(59, 130, 246, 0.3);
  }
  .p24-pill.gold.active {
    background: rgba(245, 158, 11, 0.20);
    color: #fde68a;
    border-color: var(--gold);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.3);
  }

  /* 限时子选项 */
  .p24-subopts {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed var(--border);
    display: none;
  }
  .p24-subopts.show { display: block; animation: p24-fadein 0.25s ease; }
  .p24-subopts .row {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
  }
  .p24-subopts .row:last-child { margin-bottom: 0; }
  .p24-subopts .row > label { flex-shrink: 0; min-width: 64px; color: var(--text-muted); }

  /* 游戏说明面板（P2：永久展开，移除折叠交互） */
  .p24-rules {
    margin-top: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-inner);
  }
  .p24-rules .p24-rules-title {
    margin: 0;
    padding: 13px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.4;
    /* 永久展示，无 cursor:pointer / hover 高亮 / +－图标 */
  }
  .p24-rules .body {
    padding: 16px 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.85;
    border-top: 1px solid var(--border-soft);
  }
  .p24-rules .body b { color: var(--text-primary); }
  .p24-rules .body code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--accent-soft);
    background: rgba(59, 130, 246, 0.12);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 12px;
  }
  .p24-rules .body .gold-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    background: var(--gold-bg);
    color: var(--gold-2);
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-weight: 600;
    margin-right: 4px;
    font-size: 11px;
  }

  /* 主操作按钮 */
  .p24-actions {
    margin-top: 22px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
  }
  .p24-btn {
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.12em;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: inherit;
  }
  .p24-btn.primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.4), 0 6px 20px rgba(59, 130, 246, 0.35);
  }
  .p24-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.6), 0 10px 28px rgba(59, 130, 246, 0.5); }
  .p24-btn.primary.gold {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.4), 0 6px 20px rgba(245, 158, 11, 0.35);
  }
  .p24-btn.primary.gold:hover { box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.6), 0 10px 28px rgba(245, 158, 11, 0.5); }
  .p24-btn.ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
  }
  .p24-btn.ghost:hover { border-color: var(--accent); color: var(--accent-soft); background: rgba(59, 130, 246, 0.08); }
  .p24-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

  .p24-best {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.08em;
  }
  .p24-best b {
    color: var(--gold-2);
    font-weight: 700;
    font-size: 15px;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
  }

  /* ============== 对局页 ============== */
  .p24-play-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
  }
  .p24-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.12em;
  }
  .p24-meta .badge {
    padding: 4px 13px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 11.5px;
  }
  .p24-meta .badge.easy {
    background: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.4);
  }
  .p24-meta .badge.hard {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9) 0%, rgba(217, 119, 6, 0.9) 100%);
    color: #1a1206;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.45);
  }
  .p24-meta .badge.mode {
    background: var(--bg-inner);
    color: var(--text-secondary);
    border: 1px solid var(--border);
  }
  .p24-meta #roundInfo b { color: var(--text-primary); font-size: 13px; }
  .p24-progress {
    flex: 1;
    max-width: 220px;
    height: 6px;
    background: rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    overflow: hidden;
  }
  .p24-progress .bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.7);
    width: 100%;
    transition: width 0.2s linear, background 0.2s;
  }
  .p24-progress .bar.warn { background: linear-gradient(90deg, #d97706, #fbbf24); box-shadow: 0 0 10px rgba(251, 191, 36, 0.7); }
  .p24-progress .bar.danger { background: linear-gradient(90deg, #dc2626, #f87171); box-shadow: 0 0 10px rgba(248, 113, 113, 0.8); animation: p24-pulse 0.8s infinite; }
  @keyframes p24-pulse { 50% { opacity: 0.45; } }
  .p24-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    min-width: 48px;
    text-align: right;
  }
  .p24-timer.warn { color: var(--warning); text-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
  .p24-timer.stopped {
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.18em;
    font-size: 12px;
    opacity: 0.65;
  }
  .p24-progress .bar.stopped {
    background: rgba(148, 163, 184, 0.25);
    box-shadow: none;
    opacity: 0.55;
  }
  .p24-timer.danger { color: var(--danger); animation: p24-pulse 0.8s infinite; text-shadow: 0 0 12px rgba(248, 113, 113, 0.6); }

  .p24-progress-bar {
    margin: 10px 0 20px;
    height: 6px;
    background: rgba(148, 163, 184, 0.14);
    border-radius: 999px;
    overflow: hidden;
  }
  .p24-progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.7);
    transition: width 0.3s;
  }

  /* ============== 扑克牌风格数字 ============== */
  .p24-numbers {
    display: flex;
    justify-content: center;
    gap: 22px;
    margin: 26px 0 18px;
    flex-wrap: wrap;
    min-height: 118px;
  }
  .p24-num {
    position: relative;
    width: 88px;
    height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: #dbeafe;
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    border: 1.5px solid rgba(96, 165, 250, 0.55);
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
    user-select: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(148, 163, 184, 0.12), 0 0 16px rgba(59, 130, 246, 0.18);
    text-shadow: 0 0 14px rgba(96, 165, 250, 0.55);
    animation: p24-deal 0.5s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
  }
  .p24-num:nth-child(1) { transform: rotate(-7deg) translateY(5px); animation-delay: 0.04s; }
  .p24-num:nth-child(2) { transform: rotate(-2.5deg); animation-delay: 0.12s; }
  .p24-num:nth-child(3) { transform: rotate(2.5deg); animation-delay: 0.20s; }
  .p24-num:nth-child(4) { transform: rotate(7deg) translateY(5px); animation-delay: 0.28s; }
  @keyframes p24-deal {
    from { opacity: 0; transform: translateY(26px) scale(0.82); }
    to   { opacity: 1; }
  }
  .p24-num::before,
  .p24-num::after {
    content: attr(data-num);
    position: absolute;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-soft);
    opacity: 0.85;
    line-height: 1;
  }
  .p24-num::before { top: 7px; left: 9px; }
  .p24-num::after { bottom: 7px; right: 9px; transform: rotate(180deg); }
  .p24-num:hover {
    border-color: var(--accent-soft);
    transform: translateY(-8px) rotate(0deg) scale(1.07);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(148, 163, 184, 0.18), 0 0 26px rgba(59, 130, 246, 0.5);
    z-index: 2;
  }
  .p24-num.used {
    opacity: 0.32;
    filter: grayscale(0.7);
    cursor: not-allowed;
  }
  .p24-num.used:hover {
    transform: rotate(0deg) scale(1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), 0 0 10px rgba(59, 130, 246, 0.1);
  }
  .p24-num.used:nth-child(1):hover { transform: rotate(-7deg) translateY(5px); }
  .p24-num.used:nth-child(2):hover { transform: rotate(-2.5deg); }
  .p24-num.used:nth-child(3):hover { transform: rotate(2.5deg); }
  .p24-num.used:nth-child(4):hover { transform: rotate(7deg) translateY(5px); }
  .p24-num.highlight {
    border-color: var(--accent-soft);
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.3) 0%, rgba(15, 23, 42, 0.9) 100%);
  }
  /* 高阶难度：金色扑克牌 */
  .p24-numbers.hard .p24-num {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.6);
    text-shadow: 0 0 14px rgba(251, 191, 36, 0.6);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(251, 191, 36, 0.15), 0 0 18px rgba(245, 158, 11, 0.25);
  }
  .p24-numbers.hard .p24-num::before,
  .p24-numbers.hard .p24-num::after { color: var(--gold-2); }
  .p24-numbers.hard .p24-num:hover {
    border-color: var(--gold-2);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.55), 0 0 30px rgba(245, 158, 11, 0.55);
  }

  /* ============== 算式输入 + 实时预览 ============== */
  .p24-expr-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
  }
  .p24-expr-wrap { position: relative; flex: 1; }
  .p24-expr {
    width: 100%;
    height: 64px;
    padding: 0 110px 0 20px;
    font-size: 28px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    background: var(--bg-inner);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    text-align: center;
    letter-spacing: 0.05em;
  }
  .p24-expr::placeholder { font-size: 14px; color: var(--text-hint); letter-spacing: 0; }
  .p24-expr:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), 0 0 22px rgba(59, 130, 246, 0.2);
  }
  .p24-expr.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.15), 0 0 20px rgba(248, 113, 113, 0.2); }
  .p24-expr.success {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15), 0 0 22px rgba(52, 211, 153, 0.28);
  }
  .p24-expr-preview {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 17px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    pointer-events: none;
    min-width: 64px;
    text-align: right;
  }
  .p24-expr-preview.hit {
    color: var(--success);
    text-shadow: 0 0 14px rgba(52, 211, 153, 0.7);
    animation: p24-bounce 0.4s ease;
  }
  .p24-expr-preview.dim { color: var(--text-hint); }
  .p24-expr-error {
    flex: 0 0 auto;
    font-size: 12px;
    color: var(--danger);
    min-width: 96px;
    text-align: right;
    line-height: 1.4;
  }

  /* ============== 3D 凹陷键盘 ============== */
  .p24-keypad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 16px;
  }
  .p24-key {
    height: 64px;
    font-size: 22px;
    font-weight: 600;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    color: var(--text-primary);
    background: linear-gradient(180deg, #263449 0%, var(--bg-key) 100%);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.15s, color 0.15s;
    user-select: none;
    box-shadow: 0 3px 0 var(--bg-key-edge), 0 6px 14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(148, 163, 184, 0.12);
  }
  .p24-key:hover { border-color: rgba(96, 165, 250, 0.55); color: #bfdbfe; }
  .p24-key:active,
  .p24-key.pressed {
    transform: translateY(3px);
    box-shadow: 0 0 0 var(--bg-key-edge), 0 2px 6px rgba(0, 0, 0, 0.4), inset 0 2px 6px rgba(0, 0, 0, 0.45);
  }
  .p24-key[data-k="+"], .p24-key[data-k="-"], .p24-key[data-k="*"], .p24-key[data-k="/"] {
    color: var(--gold-2);
    text-shadow: 0 0 10px rgba(251, 191, 36, 0.45);
  }
  .p24-key[data-k="("], .p24-key[data-k=")"] { color: #a5b4fc; }
  .p24-key.danger { color: #fca5a5; }
  .p24-key.danger:hover { border-color: rgba(248, 113, 113, 0.6); color: var(--danger); }
  .p24-key.ok {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
    border-color: rgba(96, 165, 250, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: 0 3px 0 #112b66, 0 6px 16px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }
  .p24-key.ok:hover { color: #fff; border-color: var(--accent-soft); }
  .p24-key.ok:active { box-shadow: 0 0 0 #112b66, 0 2px 6px rgba(59, 130, 246, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.35); }

  /* 操作按钮行 */
  .p24-play-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .p24-play-actions .p24-btn { padding: 9px 20px; font-size: 13px; letter-spacing: 0.08em; }

  /* 状态提示区 */
  .p24-status {
    margin-top: 14px;
    min-height: 38px;
    padding: 10px 16px;
    border-radius: 11px;
    font-size: 13px;
    text-align: center;
    line-height: 1.6;
    background: transparent;
    transition: all 0.2s;
  }
  .p24-status.info { background: rgba(96, 165, 250, 0.10); color: #bfdbfe; }
  .p24-status.success {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: var(--success);
    animation: p24-bounce 0.5s ease;
    text-shadow: 0 0 12px rgba(52, 211, 153, 0.5);
  }
  .p24-status.error {
    background: rgba(248, 113, 113, 0.10);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
  }
  @keyframes p24-bounce {
    0% { transform: scale(0.95); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
  }

  /* 提示解法展示 */
  .p24-hint-box {
    margin-top: 14px;
    padding: 16px 20px;
    background: var(--bg-inner);
    border: 1px solid var(--border);
    border-radius: 14px;
  }
  .p24-hint-box .head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 10px;
  }
  .p24-hint-box .head .ico { font-size: 14px; }
  .p24-hint-solution {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    padding: 14px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    margin-bottom: 8px;
    letter-spacing: 0.04em;
  }
  .p24-hint-solution .res {
    display: inline-block;
    margin-left: 12px;
    padding: 2px 12px;
    border-radius: 7px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
  }
  .p24-hint-step {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.7;
    padding: 3px 0;
  }
  .p24-hint-step .num { color: var(--accent-soft); font-weight: 700; margin-right: 4px; }
  .p24-fail-reason {
    margin: 0 0 12px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--danger);
    background: rgba(248, 113, 113, 0.10);
    border: 1px solid rgba(248, 113, 113, 0.30);
    text-align: center;
  }
  .p24-leader-card { width: 560px; }
  .p24-leader-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    margin-bottom: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
  }
  .p24-leader-tab {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s;
  }
  .p24-leader-tab:hover { color: var(--accent-soft); }
  .p24-leader-tab.active {
    background: var(--accent-fade);
    color: #bfdbfe;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.30), inset 0 0 0 1px rgba(96, 165, 250, 0.55);
  }
  .p24-leader-loading {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
    letter-spacing: 0.12em;
  }
  .p24-leader-section { margin-bottom: 16px; }
  .p24-leader-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.45);
  }
  .p24-leader-row {
    display: grid;
    grid-template-columns: 44px 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13px;
  }
  .p24-leader-row:last-child { border-bottom: 0; }
  .p24-leader-row .rank {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
  }
  .p24-leader-row.top1 .rank { color: #fcd34d; text-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
  .p24-leader-row.top2 .rank { color: #e2e8f0; text-shadow: 0 0 10px rgba(226, 232, 240, 0.45); }
  .p24-leader-row.top3 .rank { color: #fb923c; text-shadow: 0 0 10px rgba(251, 146, 60, 0.5); }
  .p24-leader-row .user {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .p24-leader-row .score {
    color: var(--accent-soft);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .p24-leader-row.top1 .score { color: #fde68a; text-shadow: 0 0 10px rgba(251, 191, 36, 0.5); }
  .p24-leader-row .meta {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }
  .p24-leader-empty {
    padding: 28px 18px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
  }
  .p24-leader-personal {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px dashed var(--border);
  }
  .p24-leader-personal .head {
    font-size: 11.5px;
    color: var(--text-muted);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 8px;
  }
  .p24-leader-personal .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .p24-leader-personal .stat {
    padding: 10px 8px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    text-align: center;
  }
  .p24-leader-personal .stat .label {
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.10em;
    margin-bottom: 4px;
  }
  .p24-leader-personal .stat .value {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
  }
  .p24-leader-personal .stat.gold .value { color: #fde68a; }
  .p24-leader-personal .stat.blue .value { color: var(--accent-soft); }
  .p24-leader-personal .empty {
    padding: 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12.5px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px dashed var(--border);
  }
  .p24-hint-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
  }
  .p24-hint-nav button {
    background: transparent;
    border: 0;
    color: var(--accent-soft);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    font-family: inherit;
  }
  .p24-hint-nav button:disabled { color: var(--text-hint); cursor: not-allowed; }

  /* ============== 结算弹窗 ============== */
  .p24-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
  .p24-modal.show { display: flex; animation: p24-fadein 0.22s ease; }
  @keyframes p24-fadein { from { opacity: 0; } to { opacity: 1; } }
  .p24-modal-card {
    background: linear-gradient(165deg, #1e293b 0%, #141d31 100%);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 22px;
    width: 480px;
    max-width: 92vw;
    max-height: 88vh;
    overflow: auto;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(59, 130, 246, 0.15);
    padding: 30px 32px;
    animation: p24-pop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  }
  @keyframes p24-pop {
    from { transform: scale(0.9) translateY(14px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
  }
  .p24-modal-card h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
  }
  .p24-modal-card .sub {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: 0.18em;
  }
  .p24-result-badge {
    display: block;
    width: fit-content;
    margin: 0 auto 18px;
    padding: 6px 20px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
  }
  .p24-result-badge.perfect {
    background: rgba(245, 158, 11, 0.15);
    color: var(--gold-2);
    border: 1px solid rgba(251, 191, 36, 0.6);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  }
  .p24-result-badge.good {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(96, 165, 250, 0.55);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.3);
  }
  .p24-result-badge.try {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid var(--border);
  }
  .p24-summary {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 18px;
  }
  .p24-summary-cell {
    padding: 13px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }
  .p24-summary-cell .label {
    font-size: 10.5px;
    color: var(--text-muted);
    letter-spacing: 0.12em;
  }
  .p24-summary-cell .value {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
  }
  .p24-summary-cell .value.accent { color: var(--accent-soft); text-shadow: 0 0 12px rgba(96, 165, 250, 0.45); }
  .p24-summary-cell .value.gold { color: var(--gold-2); text-shadow: 0 0 12px rgba(251, 191, 36, 0.45); }
  .p24-summary-cell .value.success { color: var(--success); text-shadow: 0 0 12px rgba(52, 211, 153, 0.45); }
  .p24-summary-cell .value.danger { color: var(--danger); }
  .p24-score-big {
    padding: 20px;
    background: linear-gradient(135deg, #2563eb, #3b82f6 55%, #60a5fa);
    color: #fff;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.35), 0 12px 30px rgba(59, 130, 246, 0.4);
  }
  .p24-score-big.gold {
    background: linear-gradient(135deg, #b45309, #f59e0b 55%, #fbbf24);
    box-shadow: 0 0 0 1px rgba(253, 230, 138, 0.35), 0 12px 30px rgba(245, 158, 11, 0.45);
  }
  .p24-score-big .label {
    font-size: 11px;
    letter-spacing: 0.22em;
    opacity: 0.9;
  }
  .p24-score-big .value {
    font-size: 52px;
    font-weight: 800;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
    text-shadow: 0 0 26px rgba(255, 255, 255, 0.4);
  }
  .p24-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
  }
  .p24-modal-actions .p24-btn { padding: 10px 22px; font-size: 13px; }

  /* toast */
  .p24-toast {
    position: fixed;
    bottom: 34px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 41, 59, 0.95);
    color: #bfdbfe;
    border: 1px solid rgba(96, 165, 250, 0.5);
    padding: 12px 24px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.14em;
    border-radius: 999px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 22px rgba(59, 130, 246, 0.3);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 1100;
    pointer-events: none;
  }
  .p24-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
  .p24-toast.error { border-color: rgba(248, 113, 113, 0.6); color: #fecaca; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 22px rgba(248, 113, 113, 0.3); }
  .p24-toast.success { border-color: rgba(52, 211, 153, 0.6); color: #a7f3d0; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 22px rgba(52, 211, 153, 0.3); }

  /* 音效开关 */
  .p24-sound {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(30, 41, 59, 0.85);
    color: var(--text-secondary);
    font-size: 19px;
    cursor: pointer;
    z-index: 900;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: all 0.18s ease;
    line-height: 1;
  }
  .p24-sound:hover {
    color: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5), 0 0 18px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
  }
  .p24-sound.off { color: var(--text-hint); }

  /* 返回应用市场按钮 */
  .p24-back-btn {
    position: fixed;
    top: 18px;
    left: 20px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    transition: all 0.18s ease;
  }
  .p24-back-btn:hover {
    color: var(--accent-soft);
    border-color: var(--accent);
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 14px rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
  }

  /* 响应式 */
  @media (max-width: 820px) {
    .p24-hero { gap: 28px; }
    .cube-scene { --s: 128px; }
    .cube .face { font-size: 44px; }
    .p24-hero h1 { font-size: 36px; }
    .p24-set-layout { flex-direction: column; }
    .p24-set-col:first-child,
    .p24-set-col--right { flex: 1 1 100%; }
  }
  @media (max-width: 720px) {
    main { padding: 20px 16px 70px; }
    .p24-hero { flex-direction: column-reverse; gap: 18px; margin-bottom: 24px; }
    .p24-hero-text { text-align: center; }
    .p24-hero h1 { font-size: 30px; }
    .cube-scene { --s: 110px; }
    .p24-set-grid { grid-template-columns: 1fr; }
    .p24-card { padding: 20px 18px; }
    .p24-keypad { gap: 6px; }
    .p24-key { height: 52px; font-size: 18px; border-radius: 11px; }
    .p24-numbers { gap: 12px; }
    .p24-num { width: 68px; height: 90px; font-size: 30px; border-radius: 10px; }
    .p24-expr { height: 56px; font-size: 21px; padding-left: 14px; padding-right: 84px; }
    .p24-expr::placeholder { font-size: 12px; }
    .p24-expr-error { min-width: 0; flex-basis: 100%; text-align: center; }
    .p24-summary { grid-template-columns: 1fr 1fr; }
    .p24-play-top { flex-wrap: wrap; }
    .p24-back-btn { top: 12px; left: 12px; padding: 6px 12px; font-size: 12px; }
  }

  /* 隐藏视图 */
  [hidden] { display: none !important; }
