/* 数感小挑战 · 共用游戏引擎样式（gamekit.css）
   四个凑十法游戏（凑十 / 凑二十 / 凑十进位 / 破十）共用。
   依赖 games.css 里的 body / .wrap / .topbar / .hero / .board / .ask / .fb /
   .row / .btn / .pc / .opt 等基础样式，这里只补引擎自己的部分：
   出题进度、姓名登记、成绩单、排行榜、以及「十宫格」直观视图。

   配色沿用站内紫系主色；十宫格按示意图来：
   已放 = 砖红实心圆角块，空位 = 浅蓝虚线框，外框浅灰圆角。 */

/* ---------------- 通用 ---------------- */
.hidden { display: none !important; }

/* 题面算式里的 + 号 / 选项行 / 手牌整行垂直居中
   （games.css 的 .hand 是 flex-end，会让「+」沉到牌底边） */
.eq { font-size: 26px; font-weight: 900; color: #a78bfa; align-self: center; }
.hand { align-items: center; }
.cands { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 4px; }
/* 答完把问号格填成答案：虚线框变实线，对=绿、错=红 */
.pc.slot.filled { border-style: solid; animation: cellPop .4s ease-out; }
.pc.slot.filled.ok { background: #ecfdf5; border-color: #16a34a; color: #15803d; }
.pc.slot.filled.no { background: #fef2f2; border-color: #dc2626; color: #b91c1c; }
/* 分步作答时，刚点的那一步给个小提示 */
.stepmark { font-size: 13px; font-weight: 800; color: #7c6f9e; margin-top: 12px; min-height: 20px; }
.stepmark b { color: #4c1d95; }
.stepmark .y { color: #16a34a; }
.stepmark .n { color: #dc2626; }
/* 分步作答里已判定的按钮：别被 .opt:disabled 的 opacity 冲淡 */
.opt.right:disabled, .opt.wrong:disabled { opacity: 1; }

/* 数字选项：孩子手指点，可点区域不低于 56px（iPad 上也够大） */
.cands .opt { min-height: 64px; min-width: 78px; padding: 18px 24px; }
body.hasviz .cands .opt { min-height: 56px; padding: 14px 20px; font-size: 18px; }

/* 答题/看成绩时把 hero 压成一条细横幅，给题目腾高度（iPad 768 高一屏放得下） */
body.playing .hero { padding: 9px 18px; border-radius: 16px; box-shadow: 0 6px 16px rgba(91,33,182,.20); }
body.playing .hero .emoji { display: none; }
body.playing .hero h1 { font-size: 17px; margin: 0; letter-spacing: 0; }
body.playing .hero p { display: none; }

/* ---------------- 出题进度 ---------------- */
.prog { display: flex; gap: 7px; justify-content: center; align-items: center; margin: 0 0 12px; }
.prog i { width: 11px; height: 11px; border-radius: 50%; background: #e4defb; display: block; transition: .2s; }
.prog i.cur { background: #7c3aed; transform: scale(1.35); box-shadow: 0 0 0 4px #ede9fe; }
.prog i.ok { background: #16a34a; }
.prog i.no { background: #dc2626; }
.prog i.hint { background: #f59e0b; }
.prog span { font-size: 13px; font-weight: 900; color: #6d28d9; margin-left: 6px; }

/* ---------------- 开场：登记姓名 ---------------- */
.namerow { display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 6px 0 4px; }
.ninput { font-family: inherit; font-size: 18px; font-weight: 800; color: #4c1d95;
  border: 2.5px solid #ddd6fe; background: #faf9ff; border-radius: 14px;
  padding: 11px 16px; width: 200px; text-align: center; outline: none; }
.ninput:focus { border-color: #7c3aed; background: #fff; box-shadow: 0 0 0 4px #ede9fe; }
.ninput::placeholder { color: #c4b5fd; font-weight: 700; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.chip { border: 2px solid #ddd6fe; background: #fff; color: #6d28d9; font-family: inherit;
  font-weight: 800; font-size: 14px; padding: 7px 15px; border-radius: 999px; cursor: pointer; }
.chip.on { background: #7c3aed; color: #fff; border-color: transparent; }

.startbtn { display: block; margin: 18px auto 0; border: 0; font-family: inherit; cursor: pointer;
  background: linear-gradient(135deg,#a78bfa,#7c3aed); color: #fff; font-weight: 900; font-size: 20px;
  padding: 17px 46px; border-radius: 999px; box-shadow: 0 12px 26px rgba(124,58,237,.32); }
.startbtn:active { transform: scale(.97); }

.mine { margin-top: 16px; font-size: 13.5px; font-weight: 700; color: #7c6f9e; line-height: 1.9; }
.mine b { color: #4c1d95; font-size: 15px; }

/* ---------------- 提示按钮（每题一个） ---------------- */
.vizbar { display: flex; justify-content: center; margin: 0 0 10px; }
.vizbtn { border: 2px solid #fcd34d; background: #fffbeb; color: #b45309; font-family: inherit;
  font-weight: 900; font-size: 14px; padding: 9px 18px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; }
.vizbtn.on { background: linear-gradient(135deg,#fbbf24,#f59e0b); color: #fff; border-color: transparent;
  box-shadow: 0 8px 18px rgba(245,158,11,.30); }
.vizbtn.used { border-color: #fdba74; background: #fff7ed; color: #c2410c; }
.vizbtn.on.used { background: linear-gradient(135deg,#fb923c,#ea580c); color: #fff; border-color: transparent;
  box-shadow: 0 8px 18px rgba(234,88,12,.30); }
.vizbtn .dot { font-size: 12px; font-weight: 800; opacity: .9;
  background: rgba(255,255,255,.26); border-radius: 999px; padding: 2px 8px; }

/* ---------------- 题面：把整道算式亮出来（9 + 8 = ?） ---------------- */
.qeq { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 2px 0 4px;
  font-variant-numeric: tabular-nums; }
.qeq b { font-size: 46px; font-weight: 900; color: #4c1d95; line-height: 1; }
.qeq i { font-size: 34px; font-weight: 900; color: #a78bfa; font-style: normal; line-height: 1; }
.qeq .qs { display: inline-flex; align-items: center; justify-content: center;
  min-width: 84px; height: 68px; border: 3px dashed #c4b5fd; border-radius: 18px;
  background: #f8f7ff; color: #c4b5fd; font-size: 38px; font-weight: 900; }
.qeq .qs.filled { border-style: solid; animation: cellPop .4s ease-out; }
.qeq .qs.ok { border-color: #16a34a; background: #ecfdf5; color: #15803d; }
.qeq .qs.no { border-color: #dc2626; background: #fef2f2; color: #b91c1c; }

/* ---------------- 动手任务卡（动手玩用） ---------------- */
.task { margin: 0 0 12px; background: #fffbeb; border: 2px solid #fde68a; border-radius: 18px;
  padding: 11px 14px 12px; text-align: left; }
.theads { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tico { font-size: 19px; line-height: 1; }
.ttitle { font-size: 13.5px; font-weight: 900; color: #b45309; flex: 1; min-width: 110px; }
.modes { display: flex; gap: 5px; }
.mode { border: 2px solid #fcd34d; background: #fff; color: #b45309; font-family: inherit;
  font-weight: 800; font-size: 12px; padding: 4px 9px; border-radius: 999px; cursor: pointer; }
.mode.on { background: #f59e0b; border-color: transparent; color: #fff; }
.tsay { border: 0; background: #fff; cursor: pointer; font-size: 16px; line-height: 1;
  padding: 5px 7px; border-radius: 999px; box-shadow: 0 2px 6px rgba(20,60,120,.12); }
.tsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tsteps li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px;
  font-weight: 800; color: #4c1d95; line-height: 1.55; }
.tsteps .tn { flex: none; width: 19px; height: 19px; border-radius: 50%; background: #f59e0b;
  color: #fff; font-size: 11.5px; font-weight: 900; display: flex; align-items: center;
  justify-content: center; margin-top: 2px; }
.tsteps b { color: #cf4b3e; font-size: 15.5px; }

/* ---------------- 十宫格直观视图 ---------------- */
.viz { margin: 0 0 14px; animation: vizIn .26s ease-out; }
@keyframes vizIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* 分步提示（hflow）：编号 ① ② ③ + 一张小图 + 一句话 */
.hflow { display: flex; flex-direction: column; gap: 9px; text-align: left; }
.hstep { display: flex; align-items: center; gap: 11px; background: #faf9ff;
  border: 2px solid #ede9fe; border-radius: 16px; padding: 9px 13px; }
.hstep.ans { background: #f0fdf4; border-color: #bbf7d0; }
.hn { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #7c3aed; color: #fff;
  font-size: 14px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.hstep.ans .hn { background: #16a34a; }
.hb { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hb p { margin: 0; font-size: 14.5px; font-weight: 800; color: #4c1d95; line-height: 1.5; }
.hb p b { color: #cf4b3e; font-size: 17px; }
.hstep.ans .hb p b { color: #16a34a; }
.hv { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; }
.hvop { font-size: 15px; font-weight: 900; color: #b45309; }
.hvgrp { display: inline-flex; align-items: center; gap: 7px; }
.heq { font-size: 21px; font-weight: 900; color: #4c1d95; letter-spacing: .5px; }
.heq b { color: #16a34a; }

/* 提示里的小图：尺寸沿用下面「十宫格直观视图」的紧凑档（.hv 只负责排版） */

.tfwrap { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; }
.tfbox { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tf { border: 2.5px solid #e5e7eb; border-radius: 16px; padding: 10px; background: #fff;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.tf .c { width: 40px; height: 40px; border-radius: 11px; display: block;
  border: 2.5px dashed #93c5fd; background: #fff; position: relative; }
/* 已放进去的块：砖红实心（对齐示意图） */
.tf .c.on { border: 2.5px solid #cf4b3e; background: #cf4b3e; }
/* 凑二十第 1 步：逐块分色（7 个红块 + 4 个黄块）。
   必须写在 .c.add 前面 —— 同特异性下后面的赢，add 得留给「刚补进去的绿块」。 */
.tf .c.ta { border-color: var(--tint-red-fill, #cf4b3e); background: var(--tint-red-fill, #cf4b3e); }
.tf .c.tb { border-color: var(--tint-yellow-fill-line, #c98a04);
  background: var(--tint-yellow-fill, #eab308); }
/* 新填进去的块（揭示答案时）：亮点 + 弹一下 */
.tf .c.add { border-color: #16a34a; background: #16a34a; animation: cellPop .32s ease-out; }
/* 凑二十：提示里两个十宫格一红一黄（GK.frame 传 tone）。
   :not(.add) 是必须的 —— 不加的话这里特异性更高，会把「刚补进去的绿块」也染成红/黄。 */
.tf.tone-a .c.on:not(.add) {
  border-color: var(--tint-red-fill, #cf4b3e); background: var(--tint-red-fill, #cf4b3e); }
.tf.tone-b .c.on:not(.add) {
  border-color: var(--tint-yellow-fill-line, #c98a04);
  background: var(--tint-yellow-fill, #eab308); }
/* 黄格子里的「就差这一格」虚线也换成深黄，别跟橙虚线糊在一起 */
.tf.tone-b .c.gap { border-color: #b45309; }
@keyframes cellPop { 0% { transform: scale(.5); opacity: .3; } 70% { transform: scale(1.12); } 100% { transform: scale(1); } }
/* 「就差这一格」的高亮缺口（进位用） */
.tf .c.gap { border-color: #f59e0b; border-width: 3px; background: #fffbeb;
  animation: gapPulse 1.1s ease-in-out infinite; }
@keyframes gapPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.45); } 55% { box-shadow: 0 0 0 7px rgba(245,158,11,0); } }
/* 被拿走的块：红底 + 白叉（破十用）。
   叉号不用 ✕ 字符 —— 有些字体里 U+2715 是空字形，线上会看不见；
   用两条 3px 白条转 ±45° 画，任何设备都稳。 */
.tf .c.cross { background: #fca5a5; border-color: #f87171; }
.tf .c.cross::before, .tf .c.cross::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 58%; height: 3px; border-radius: 2px; background: #fff;
}
.tf .c.cross::before { transform: translate(-50%, -50%) rotate(45deg); }
.tf .c.cross::after { transform: translate(-50%, -50%) rotate(-45deg); }

/* 同一算式里重复出现的相同加数：交替红 / 黄（GK.tint 用）。
   色值统一取自 games.css 的 :root 变量，改配色只改那一处。
   加浅底衬是为了小字号也一眼分得清 —— 只靠字色，深琥珀和深红在 15px 下几乎同色。 */
.nk { display: inline-block; padding: 0 3px; border-radius: 5px; line-height: 1.2; }
.nk.nk0 { color: var(--tint-red, #c81e42); background: var(--tint-red-bg, #ffe4e9); }
.nk.nk1 { color: var(--tint-yellow, #8a5a00); background: var(--tint-yellow-bg, #ffe9a0); }

.tflabel { font-size: 12.5px; font-weight: 800; color: #6b7280; }
.tfplus { font-size: 22px; font-weight: 900; color: #a78bfa; padding: 0 2px; }

/* 散块（进位里「拆小数」、破十里「剩下的几」） */
.dots { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.dots .d { width: 30px; height: 30px; border-radius: 9px; border: 2.5px solid #cf4b3e;
  background: #cf4b3e; display: block; position: relative; }
.dots .d.taken { border-color: #f59e0b; border-style: dashed; background: #fffbeb; }
/* 「借」用汉字而不是 ↖ 箭头：箭头缺字形时线上什么都不显示，家长还以为是 bug */
.dots .d.taken::after { content: '借'; position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center; font-size: 13px; font-weight: 900; color: #b45309; }

.vizcap { text-align: center; font-size: 13px; font-weight: 800; color: #7c6f9e;
  margin-top: 10px; line-height: 1.75; }
.vizcap b { color: #cf4b3e; font-size: 15px; }

/* 打开「看图」后页面会高出一截 ⇒ 整体收紧一档，保证 iPad 768 高
   从题目到「下一题」按钮一屏放得下，不用滚动。 */
body.hasviz .viz { margin-bottom: 10px; }
body.hasviz .vizcap { margin-top: 7px; line-height: 1.6; }
body.hasviz .tf { padding: 8px; gap: 6px; }
body.hasviz .tf .c { width: 33px; height: 33px; border-radius: 9px; }
body.hasviz .dots .d { width: 26px; height: 26px; border-radius: 7px; }
body.hasviz .ask { font-size: 17px; }
body.hasviz .ask small { font-size: 12px; margin-top: 2px; }
body.hasviz .hand { margin: 8px 0 2px; min-height: 0; gap: 9px; }
body.hasviz .pc.big { width: 78px; height: 108px; font-size: 38px; }
body.hasviz .pc.pick { width: 64px; height: 90px; font-size: 30px; }
body.hasviz .cands { gap: 10px; }
body.hasviz .opt { font-size: 18px; padding: 12px 18px; min-width: 66px; }
body.hasviz .fb { margin-top: 8px; font-size: 15px; }
body.hasviz .nextrow { margin-top: 10px; }
body.hasviz .nextbtn { padding: 12px 32px; font-size: 17px; }
.vizcap .ok { color: #16a34a; }
.vizcap .warn { color: #b45309; }

/* 提示展开时整体再收紧一档（孩子不该为了点「下一题」去滚屏） */
body.hasviz .hflow { gap: 7px; }
body.hasviz .hstep { padding: 7px 11px; }
body.hasviz .hb p { font-size: 13.5px; }
body.hasviz .qeq b { font-size: 40px; }
body.hasviz .qeq i { font-size: 30px; }
body.hasviz .qeq .qs { height: 58px; min-width: 74px; font-size: 32px; }
body.hasviz .vizbar { margin-bottom: 6px; }
body.hasviz .prog { margin-bottom: 8px; }
body.hasviz .viz { margin-bottom: 6px; }
body.hasviz .hand { margin: 4px 0 0; }
body.hasviz .cands { margin-top: 2px; gap: 9px; }
body.hasviz .hero { padding: 7px 16px; }
body.hasviz .ask small { display: none; }   /* 提示已经把题讲透了，省一行高度 */
body.hasviz .nextrow { margin-top: 8px; }
body.hasviz .nextbtn { padding: 11px 30px; font-size: 17px; }
body.hasviz .task { display: none; }   /* 提示已把算理画出来了，动手步骤先让位（收起提示就回来） */
body.hasviz .theads { margin-bottom: 5px; }

/* ---------------- 下一题 ---------------- */
.nextrow { margin-top: 18px; display: flex; gap: 10px; justify-content: center;
  align-items: center; flex-wrap: wrap; }
.nextbtn { border: 0; font-family: inherit; cursor: pointer; font-weight: 900; font-size: 19px;
  color: #fff; background: linear-gradient(135deg,#34d399,#059669); padding: 15px 40px;
  border-radius: 999px; box-shadow: 0 10px 24px rgba(5,150,105,.30); }
.nextbtn:active { transform: scale(.96); }
/* 「上一题」：常驻在进度行尾的小按钮，白底紫字，别跟绿色的「下一题」抢眼 */
.prog .prevbtn { border: 1.5px solid #ddd6fe; background: #fff; color: #6d28d9;
  font-family: inherit; cursor: pointer; font-weight: 800; font-size: 12.5px;
  padding: 4px 11px; border-radius: 999px; margin-left: 6px; line-height: 1.5; }
.prog .prevbtn:active { transform: scale(.96); }
.prog .prevbtn.hidden, .prevbtn[hidden] { display: none; }

/* ---------------- 成绩单 ---------------- */
.bigscore { font-size: 52px; font-weight: 900; line-height: 1.05; color: #7c3aed;
  letter-spacing: -1px; margin: 4px 0 2px; }
.bigscore small { font-size: 20px; color: #a78bfa; font-weight: 900; }
.grade { font-size: 16px; font-weight: 900; color: #4c1d95; margin-bottom: 14px; }
.sumgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin: 0 0 6px; }
.sumgrid div { background: #faf9ff; border: 2px solid #ede9fe; border-radius: 14px; padding: 11px 6px; }
.sumgrid b { display: block; font-size: 21px; color: #4c1d95; font-weight: 900; }
.sumgrid span { font-size: 12px; color: #8b7fb0; font-weight: 700; }
.sumgrid .g b { color: #16a34a; }
.sumgrid .h b { color: #b45309; }
.sumgrid .r b { color: #dc2626; }

table.qt { width: 100%; border-collapse: collapse; margin: 16px 0 4px; font-size: 14px; }
table.qt th { font-size: 12px; font-weight: 800; color: #8b7fb0; padding: 6px 4px;
  border-bottom: 2px solid #ede9fe; text-align: center; }
table.qt td { padding: 9px 4px; text-align: center; font-weight: 800; color: #475569;
  border-bottom: 1px solid #f3f0ff; }
table.qt td.q { font-weight: 900; color: #4c1d95; }
table.qt td.t { color: #6d28d9; }
table.qt td.y { color: #16a34a; }
table.qt td.n { color: #dc2626; }
table.qt td.h { color: #b45309; font-size: 15px; }
table.qt tr.slow td.t { color: #c2410c; }
table.qt td.a { color: #6d28d9; font-variant-numeric: tabular-nums; }

/* ---------------- 排行榜 ---------------- */
.lbhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-bottom: 12px; }
.lbhead h2 { margin: 0; font-size: 19px; color: #4c1d95; }
.lbsrc { font-size: 11.5px; font-weight: 800; color: #8b7fb0; background: #faf9ff;
  border: 1.5px solid #ede9fe; border-radius: 999px; padding: 4px 10px; }

ol.lb { list-style: none; margin: 0; padding: 0; }
ol.lb li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 14px;
  background: #faf9ff; border: 2px solid #f1ecff; margin-bottom: 8px; }
ol.lb li.me { background: #f0fdf4; border-color: #bbf7d0; }
ol.lb .rk { width: 30px; text-align: center; font-size: 16px; font-weight: 900; color: #a78bfa; flex: none; }
ol.lb li:nth-child(1) .rk { font-size: 22px; }
ol.lb .who { flex: 1; min-width: 0; text-align: left; }
ol.lb .who b { display: block; font-size: 15.5px; color: #4c1d95; font-weight: 900;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.lb .who span { font-size: 11.5px; color: #8b7fb0; font-weight: 700; }
ol.lb .val { flex: none; text-align: right; }
ol.lb .val b { display: block; font-size: 20px; font-weight: 900; color: #7c3aed; line-height: 1.2; }
ol.lb .val span { font-size: 12.5px; color: #6d28d9; font-weight: 800; white-space: nowrap; }
.lbempty { text-align: center; font-size: 14px; color: #8b7fb0; font-weight: 700; padding: 22px 0; }

/* ---------------- 兄弟游戏互链 ---------------- */
.siblings { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.sib { font-size: 13px; font-weight: 800; color: #6d28d9; background: #fff;
  border: 2px solid #ede9fe; border-radius: 999px; padding: 8px 14px; }
.sib.cur { background: #ede9fe; border-color: #ddd6fe; color: #4c1d95; }

@media (max-width: 560px) {
  .sumgrid { grid-template-columns: repeat(2, 1fr); }
  .bigscore { font-size: 42px; }
  .ninput { width: 150px; font-size: 16px; }
  table.qt { font-size: 13px; }
  .tf .c { width: 30px; height: 30px; border-radius: 9px; }
  .dots .d { width: 24px; height: 24px; border-radius: 7px; }
  .tf { gap: 5px; padding: 8px; }
  .tfwrap { gap: 8px; }
  .qeq b { font-size: 36px; }
  .qeq i { font-size: 26px; }
  .qeq .qs { height: 54px; min-width: 64px; font-size: 30px; }
  .hb p { font-size: 13px; }
  .vizbtn { font-size: 13px; padding: 8px 14px; }
  /* 窄屏：图和小块允许折行，别撑出横向滚动条 */
  .hv { gap: 5px; }
  .hstep { gap: 8px; padding: 8px 9px; }
  .hstep .hn { width: 22px; height: 22px; font-size: 12.5px; }
  .dots { gap: 4px; }
  body.hasviz .dots .d { width: 21px; height: 21px; border-radius: 6px; }
  body.hasviz .tf { gap: 4px; padding: 6px; }
  body.hasviz .tf .c { width: 27px; height: 27px; border-radius: 7px; }
}
