/* ==========================================================================
   小词树 · 做练习（互动数学游戏）
   样式移植自 the-bunker-code/matematicas-con-dados（MIT），已中文化。
   全部规则作用域到 body.papp，避免与站点 public/style.css 冲突。
   `.card` → `.pr-card`、`.answers` → `.pr-answers`（与站点同名类冲突）。
   ========================================================================== */

body.papp {
--theme-main: #ffa23a;
  --theme-dark: #af630e; 
  --theme-light: #fff0d6;
  --sky-top: #ffe7b8;
  --sky-bottom: #fff8ea;
  --hills: #b9e48f;

  
  --ink: #2b2d42;
  
  --on-theme: #1a1b29;
  
  --muted: #5c5f6e;
  --line: #ece7dc;
  --white: #ffffff;
  --edge: #d9d2c2; 
  --edge-soft: #e6dcc6;
  --gold: #ffc21a;
  --gold-dark: #e0a400;
  --correct-bg: #e4f8dc;
  --correct-shadow: #9fd88a;
  --orange: #ffa23a;
  --orange-dark: #e07f12;
  
  --blue: #2f6fd8;
  --blue-dark: #1f55b0;
  --focus: #1e3a8a; 
  --wood-light: #f3c98d;
  --wood-dark: #e9b673;
  --wood-edge: #c98b45;
  --wood-shadow: #a96f30;

  
  --radius-small: 14px;
  --radius: 20px;
  --radius-large: 28px;
  --cap-size: 52px;
  --cap-size-small: 36px;
  --die-size: 74px;

  
  --press-depth: 6px;
  --press-travel: 3px;
  --card-shadow: 0 6px 0 rgb(0 0 0 / 5%), 0 10px 24px rgb(0 0 0 / 6%);
  --touch-min: 44px;

  --font-kid: ui-rounded, system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --font-adult: system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}
body.papp *,
body.papp *::before,
body.papp *::after {
box-sizing: border-box;
}
body.papp,
body.papp {
margin: 0;
}
body.papp {
min-height: 100dvh;
  font-family: var(--font-kid);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 70%) fixed;
  
  
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body.papp button {
font: inherit;
  color: inherit;
  cursor: pointer;
}
body.papp [hidden] {
display: none !important;
}
body.papp .visually-hidden {
position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
body.papp [tabindex='-1']:focus {
outline: none;
}
body.papp .boot-message {
position: fixed;
  inset: 40px 0 auto;
  z-index: 2;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
  color: var(--muted);
  text-align: center;
}
body.papp .boot-message code {
color: var(--ink);
  font-weight: 600;
}
body.papp .hills {
position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  height: 28vh;
  z-index: 0;
  pointer-events: none;
}
body.papp .hills path {
fill: var(--hills);
  transition: fill 0.4s;
}
body.papp .hills__back {
opacity: 0.55;
}
body.papp .app {
position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px 32px;
}
body.papp .screen {
display: flex;
  flex-direction: column;
  gap: 12px;
}
body.papp .icon {
display: block;
  flex-shrink: 0;
}
body.papp .button {
display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 18px;
  background: var(--white);
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 5px 0 var(--edge);
}
body.papp .button:active {
transform: translateY(3px);
  box-shadow: 0 2px 0 var(--edge);
}
body.papp .button--primary {
background: var(--blue);
  color: var(--white);
  box-shadow: 0 5px 0 var(--blue-dark);
}
body.papp .button--primary:active {
box-shadow: 0 2px 0 var(--blue-dark);
}
body.papp .button--ghost {
box-shadow: none;
  background: transparent;
}
body.papp .button--ghost:active {
box-shadow: none;
}
body.papp .icon-button {
display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  border: 0;
  border-radius: 16px;
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 5px 0 var(--orange-dark);
}
body.papp .icon-button:active {
transform: translateY(3px);
  box-shadow: 0 2px 0 var(--orange-dark);
}
/* 游戏内返回练习选择页：比设置按钮低调，避免误以为是网站首页 */
body.papp .icon-button--back {
  background: var(--white);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  box-shadow: 0 5px 0 var(--edge-soft);
}
body.papp .icon-button--back:active { box-shadow: 0 2px 0 var(--edge-soft); }
body.papp .pr-card {
padding: 18px 14px;
  border-radius: var(--radius-large);
  background: var(--white);
  box-shadow: var(--card-shadow);
}
body.papp :focus-visible {
outline: 4px solid var(--focus);
  outline-offset: 3px;
}
body.papp .home-header {
display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body.papp .logo {
margin: 0;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  color: #d46540; 
  text-shadow: 0 3px 0 var(--white);
}
body.papp .logo span {
color: var(--blue);
}
body.papp .hero {
display: flex;
  align-items: center;
  gap: 12px;
}
body.papp .hero__mascot {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  animation: float 3s ease-in-out infinite;
}
/* 小猫页：与首页 .intro 一样用 block 容器，避免 flex 影响 #wt-pet 的居中与气泡锚点 */
body.papp .hero--pet { display: block; }
body.papp .speech-bubble {
position: relative;
  margin: 0;
  padding: 12px 18px;
  border-radius: 24px;
  background: var(--white);
  font-size: 22px;
  font-weight: 600;
  box-shadow: 0 5px 16px rgb(0 0 0 / 8%);
}
body.papp .speech-bubble::before {
content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  margin-top: -10px;
  border: 10px solid transparent;
  border-left: 0;
  border-right-color: var(--white);
}
body.papp .level-picker {
display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
body.papp .level-button {
display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 0;
  border-radius: 18px;
  background: var(--white);
  color: var(--muted);
  box-shadow: 0 4px 0 var(--edge-soft);
}
body.papp .level-button__name {
font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
body.papp .level-button__dice {
font-size: 12px;
}
body.papp .level-button.is-selected {
background: #ffb020;
  color: var(--on-theme); 
  box-shadow: 0 4px 0 var(--orange-dark);
}
body.papp .level-button.is-selected .level-button__name {
color: var(--on-theme);
}
body.papp .operation-tiles {
display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
body.papp .operation-tile {
position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  min-height: 132px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius-large);
  background: var(--tile-main);
  
  color: var(--on-theme);
  text-align: left;
  box-shadow: 0 7px 0 var(--tile-dark);
}
body.papp .operation-tile:active {
transform: translateY(4px);
  box-shadow: 0 3px 0 var(--tile-dark);
}
body.papp .operation-tile:first-child {
grid-column: span 2;
  min-height: 120px;
}
body.papp .operation-tile::before {
content: '';
  position: absolute;
  top: -14px;
  left: -14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgb(255 255 255 / 22%);
  box-shadow:
    40px 0 0 rgb(255 255 255 / 22%),
    80px 0 0 rgb(255 255 255 / 22%);
}
body.papp .operation-tile__icon {
position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--white);
  color: var(--tile-main);
  box-shadow: 0 4px 0 rgb(0 0 0 / 12%);
}
body.papp .operation-tile__name {
font-size: 24px;
  font-weight: 700;
  text-shadow: 0 2px 0 rgb(255 255 255 / 35%);
}
body.papp .operation-tile__dice {
font-size: 14px;
}
body.papp .top-bar {
display: flex;
  align-items: center;
  gap: 10px;
}
body.papp .avatar {
width: 58px;
  height: 58px;
  flex-shrink: 0;
  padding: 3px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 4px 0 rgb(0 0 0 / 8%);
}
body.papp .avatar.is-bouncing {
animation: hop 0.6s ease;
}
body.papp .progress {
position: relative;
  flex: 1;
  height: 26px;
  overflow: hidden;
  border: 4px solid var(--white);
  border-radius: 999px;
  background: rgb(255 255 255 / 70%);
}
body.papp .progress__fill {
position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe066, var(--gold));
  transition: width 0.5s ease;
}
body.papp .progress__text {
position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #6c530c;
}
body.papp .operation-chip {
align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 16px 5px 6px;
  border-radius: 999px;
  background: var(--theme-main);
  color: var(--on-theme); 
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 4px 0 var(--theme-dark);
}
body.papp .operation-chip__icon {
display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--white);
  color: var(--theme-main);
}
body.papp .prompt {
align-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 8px 20px 8px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  font-size: 20px;
  font-weight: 600;
  text-align: left;
  box-shadow: 0 5px 16px rgb(0 0 0 / 8%);
}
body.papp .prompt__icon {
display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--theme-light);
  color: var(--theme-dark);
}
body.papp .game-layout,
body.papp .game-layout__main,
body.papp .game-layout__side {
display: flex;
  flex-direction: column;
  gap: 12px;
}
body.papp .dice-row {
display: flex;
  flex-wrap: nowrap; 
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 80px;
}
body.papp .dice-row__symbol {
color: var(--theme-dark);
}
body.papp .dice-row__total {
min-width: 56px;
  font-size: 50px;
  font-weight: 700;
  text-align: center;
  color: var(--theme-dark);
}
body.papp .die {
display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: var(--die-size);
  height: var(--die-size);
  padding: calc(var(--die-size) * 0.1);
  border: calc(var(--die-size) * 0.068) solid var(--edge);
  border-radius: calc(var(--die-size) * 0.27);
  background: var(--white);
  box-shadow: 0 5px 0 #e6e0d3;
}
body.papp .die__pip {
width: calc(var(--die-size) * 0.165);
  height: calc(var(--die-size) * 0.165);
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--edge);
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 18%);
}
body.papp .result-box {
display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: 4px dashed var(--theme-main);
  border-radius: 20px;
  background: var(--theme-light);
  font-size: 38px;
  font-weight: 700;
  color: var(--theme-dark);
}
body.papp .wood-table {
padding: 14px;
  border: 7px solid var(--wood-edge);
  border-radius: 30px;
  
  background: repeating-linear-gradient(90deg, var(--wood-light) 0 58px, var(--wood-dark) 58px 61px);
  box-shadow:
    inset 0 4px 0 rgb(255 255 255 / 35%),
    0 6px 0 var(--wood-shadow);
}
body.papp .table {
display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 130px;
}
body.papp .table__symbol {
color: var(--theme-dark);
}
body.papp .cap-group {
display: grid;
  grid-template-columns: repeat(var(--columns), auto);
  gap: 8px;
  padding: 10px;
  border: 3px dashed var(--edge);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 62%);
}
body.papp .cap {
display: grid;
  place-items: center;
  width: var(--cap-size);
  height: var(--cap-size);
  padding: 0;
  border: 3px dashed rgb(255 255 255 / 45%);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--cap-shine), var(--cap-base));
  color: var(--cap-text);
  font-size: 21px;
  font-weight: 700;
  box-shadow:
    0 4px 0 rgb(0 0 0 / 25%),
    inset 0 2px 4px rgb(255 255 255 / 45%);
  transition:
    transform 0.15s ease,
    opacity 0.2s ease;
}
body.papp .cap:active {
transform: scale(0.9);
}
body.papp .cap--small {
width: var(--cap-size-small);
  height: var(--cap-size-small);
  font-size: 15px;
  border-width: 2px;
}
body.papp .cap--counted {
outline: 4px solid var(--gold);
  outline-offset: 2px;
}
body.papp .cap--highlighted {
transform: scale(1.22);
}
body.papp .cap--removed {
opacity: 0.22;
  transform: scale(0.78);
}
body.papp .storage-box {
display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 18px;
  background: var(--white);
  color: #b07a3a;
  font-size: 22px;
  font-weight: 600;
  box-shadow: 0 4px 0 rgb(0 0 0 / 12%);
}
body.papp .storage-box span {
color: var(--ink);
}
body.papp .plates {
display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
body.papp .plate {
display: flex;
  flex: 1 1 30%;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 5px;
  min-width: 96px;
  max-width: 170px;
  min-height: 104px;
  padding: 14px;
  border: 4px solid #dfe3ea;
  border-radius: 999px;
  background: var(--white);
  box-shadow:
    inset 0 0 0 7px #f3f5f8,
    0 4px 0 rgb(0 0 0 / 12%);
  cursor: pointer;
}
body.papp .plate--full {
flex: 0 1 auto;
  max-width: none;
  gap: 8px;
  border-color: var(--edge);
  background: #fffdf7;
  box-shadow: 0 4px 0 rgb(0 0 0 / 12%);
  cursor: default;
}
body.papp .plate--full .cap-group {
gap: 5px;
  padding: 6px;
}
body.papp .real-caps {
display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  padding: 14px;
  border-radius: 22px;
  background: rgb(255 255 255 / 80%);
  text-align: center;
}
body.papp .real-caps__icon {
color: #e0a050;
}
body.papp .real-caps p {
margin: 0;
  font-size: 19px;
  font-weight: 500;
}
body.papp .pr-answers {
display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px;
  border-radius: 30px;
  background: var(--theme-light);
  box-shadow: 0 6px 0 rgb(0 0 0 / 6%);
}
body.papp .answer {
display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 118px;
  padding: 10px 4px 12px;
  border: 0;
  border-radius: 24px;
  background: var(--white);
  color: var(--answer-color);
  box-shadow:
    0 7px 0 var(--edge),
    inset 0 -4px 0 #f3eee4;
}
body.papp .answer:active {
transform: translateY(4px);
  box-shadow: 0 3px 0 var(--edge);
}
body.papp .answer[aria-disabled='true'] {
opacity: 0.55;
  cursor: default;
}
body.papp .answer__number {
font-size: 54px;
  font-weight: 700;
  line-height: 1;
}
body.papp .answer__dots {
display: grid;
  grid-template-columns: repeat(5, 10px);
  gap: 4px;
  min-height: 10px;
}
body.papp .answer__dots i {
display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
}
body.papp .answer.is-correct {
background: var(--correct-bg);
  box-shadow: 0 7px 0 var(--correct-shadow);
}
body.papp .answer.is-pulsing {
animation: pulse 1.1s ease-in-out infinite;
  box-shadow:
    0 7px 0 var(--gold),
    0 0 0 4px var(--gold);
}
body.papp .answer.is-shaking {
animation: shake 0.35s;
}
body.papp .adult-guide {
padding: 10px 14px;
  border-radius: 18px;
  background: rgb(255 255 255 / 85%);
  color: #3d4052;
  font-size: 15px;
}
body.papp .adult-guide summary {
display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
body.papp .adult-guide summary::-webkit-details-marker {
display: none;
}
body.papp .adult-guide__chevron {
margin-left: auto;
  transition: transform 0.2s;
}
body.papp .adult-guide[open] .adult-guide__chevron {
transform: rotate(180deg);
}
body.papp .adult-guide ul {
margin: 8px 0 0;
  padding-left: 20px;
}
body.papp .adult-guide li {
margin: 4px 0;
}
body.papp .screen--end {
align-items: center;
  justify-content: center;
  min-height: 90dvh;
  text-align: center;
}
body.papp .end__mascot {
width: 150px;
  height: 150px;
  animation: float 3s ease-in-out infinite;
}
body.papp .end__stars {
display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  color: var(--gold);
}
body.papp .end__stars .icon {
fill: var(--gold);
}
body.papp .end__title {
margin: 0;
  font-size: 34px;
  color: var(--theme-dark);
}
body.papp .end__text {
display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 18px;
  color: var(--muted);
}
body.papp .end__buttons {
display: flex;
  gap: 12px;
  margin-top: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
body.papp .end__buttons.is-visible {
opacity: 1;
  pointer-events: auto;
}
body.papp .settings {
  /* 用 100vw + calc：部分移动浏览器不支持 min(…, 100% - 24px)，会退回很窄的 UA 默认宽度。 */
  width: min(560px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  /* 必须给明确高度：移动 WebView（微信）里 dialog + flex 自动高度会把内容区压成 0。 */
  height: min(810px, 90vh);
  height: min(810px, 90dvh);
  max-height: none;
  position: fixed;
  /* 不用 inset 简写：部分旧 WebView 不支持，显式四边更稳。 */
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  box-sizing: border-box;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 26px;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Arial,
    sans-serif;
  color: var(--ink);
  user-select: text;
}
body.papp .settings[open] {
display: flex;
  flex-direction: column;
}
body.papp .settings::backdrop {
background: rgb(15 23 42 / 55%);
}
body.papp .settings__header {
  flex: none;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
body.papp .settings__header h2 {
margin: 0;
  font-size: 19px;
}
body.papp .settings__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 20px;
}
body.papp .settings__footer {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
@media (max-width: 480px) {
  body.papp .settings {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    /* 移动端直接铺满：header + 可滚动 body + footer，任何 WebView 都有明确高度。 */
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    max-height: none;
    border-radius: 20px;
  }
  body.papp .settings__header { padding: 14px 16px; }
  body.papp .settings__body { padding: 6px 16px; }
  body.papp .settings__footer { padding: 10px 12px; gap: 6px; }
}
body.papp .settings__footer .button--primary {
flex: 1;
  font-size: 16px;
}
body.papp .settings__footer .button {
font-size: 16px;
  padding: 10px 12px;
}
body.papp .settings-section {
margin: 12px 0;
  padding: 0;
  border: 0;
}
body.papp .settings-section legend {
padding: 0;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
body.papp .settings-note {
margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
body.papp .settings-warning {
margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff4e5;
  color: #7a3e00;
  font-size: 14px;
  font-weight: 600;
}
body.papp .settings-row {
display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
}
body.papp .pill-group {
display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
body.papp .pill {
position: relative;
}
body.papp .pill input {
position: absolute;
  opacity: 0;
  pointer-events: none;
}
body.papp .pill span {
display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px; 
  padding: 7px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}
body.papp .pill input:checked + span {
border-color: #4f46e5;
  background: #eef2ff;
  color: #3730a3;
}
body.papp .pill input:focus-visible + span {
outline: 3px solid var(--focus);
  outline-offset: 2px;
}
body.papp .pill.is-disabled span {
opacity: 0.35;
  cursor: not-allowed;
}
body.papp .switch {
display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  font-weight: 600;
}
body.papp .switch input {
width: 20px;
  height: 20px;
  accent-color: #4f46e5;
}
body.papp select {
padding: 6px 8px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  font: inherit;
}
body.papp .dice-colors,
body.papp .inventory {
display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
}
body.papp .inventory__item {
display: flex;
  align-items: center;
  gap: 6px;
}
body.papp .inventory__swatch {
width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--cap-shine), var(--cap-base));
  box-shadow: 0 2px 0 rgb(0 0 0 / 20%);
}
body.papp .inventory__name {
flex: 1;
  font-weight: 600;
  font-size: 14px;
}
body.papp .inventory output {
width: 24px;
  font-weight: 700;
  text-align: center;
}
body.papp .stepper {
display: grid;
  place-items: center;
  width: 44px; 
  height: 44px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}
body.papp .link-button {
margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  min-height: 44px;
  color: #4f46e5;
  font-weight: 600;
  text-decoration: underline;
}
@media (max-width: 520px) {
body.papp .table[data-operation='add'] {
flex-direction: column;
    gap: 6px;
}
body.papp .dice-row[data-dice='3'] {
--die-size: 60px;
    gap: 4px;
}
body.papp .dice-row[data-dice='4'] {
--die-size: 42px;
    gap: 2px;
}
body.papp .dice-row[data-dice='3'] .icon,
body.papp .dice-row[data-dice='4'] .icon {
width: 22px;
    height: 22px;
}
body.papp .dice-row[data-dice='3'] .result-box,
body.papp .dice-row[data-dice='4'] .result-box {
width: 50px;
    height: 50px;
    font-size: 26px;
    border-width: 3px;
    border-radius: 14px;
}
body.papp .dice-colors,
body.papp .inventory {
grid-template-columns: 1fr;
}
}
@media (max-width: 380px) {
body.papp .answer__number {
font-size: 46px;
}
body.papp .prompt {
font-size: 18px;
}
}
@media (min-width: 640px) {
body.papp .operation-tiles {
grid-template-columns: repeat(3, 1fr);
}
body.papp .operation-tile:first-child {
grid-column: auto;
    min-height: 132px;
}
body.papp .hero__mascot {
width: 130px;
    height: 130px;
}
}
@media (min-width: 1000px) {
body.papp .app {
max-width: 1200px;
}
body.papp .operation-tiles {
grid-template-columns: repeat(5, 1fr);
}
body.papp .operation-tile {
min-height: 170px;
}
body.papp .operation-tile:first-child {
min-height: 170px;
}
body.papp .game-layout {
display: grid;
    grid-template-columns: 3fr 2fr;
    align-items: start;
    gap: 20px;
}
}
@keyframes float {
0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@keyframes hop {
0%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-12px) rotate(-6deg);
  }
  60% {
    transform: translateY(0) rotate(4deg);
  }
}
@keyframes pulse {
0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}
@keyframes shake {
0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
@media (prefers-reduced-motion: reduce) {
body.papp *,
body.papp *::before,
body.papp *::after {
animation: none !important;
    transition: none !important;
}
}

/* 小词树补充：与打印作业纸互链、页脚署名、无 JS 提示 */
body.papp .practice-math-link {
  display: block;
  width: max-content;
  margin: 18px auto 0;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--white);
  border: 2px solid var(--edge-soft);
  box-shadow: 0 var(--press-depth) 0 var(--edge-soft);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
body.papp .practice-math-link:active {
  transform: translateY(var(--press-travel));
  box-shadow: 0 2px 0 var(--edge-soft);
}
body.papp .practice-foot {
  position: relative;
  z-index: 2;
  padding: 22px 14px 30px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
body.papp .practice-foot a { color: var(--blue); }
body.papp .practice-noscript {
  margin: 24px auto;
  max-width: 520px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  text-align: center;
}

/* ===== 口算闯关：/practice 首页入口 ===== */
body.papp .quiz-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 2px solid #f3d9a8;
  background: linear-gradient(135deg, #fff8e8, #ffe9c7);
  box-shadow: 0 5px 0 #f0d5a0;
  color: var(--ink);
  text-decoration: none;
}
body.papp .quiz-entry:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #f0d5a0;
}
body.papp .quiz-entry__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffb020;
  color: #fff;
  font-size: 22px;
}
body.papp .quiz-entry__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.papp .quiz-entry__main b { font-size: 17px; }
body.papp .quiz-entry__main small { color: var(--muted); font-size: 12px; }
body.papp .quiz-entry__go { color: #b37a16; font-weight: 700; font-size: 14px; }

/* 打印作业纸入口：与口算闯关同款卡片，换一套蓝色强调 */
body.papp .quiz-entry--print {
  margin-top: 10px;
  border-color: #c9dcf7;
  background: linear-gradient(135deg, #f0f6ff, #dbe9ff);
  box-shadow: 0 5px 0 #c9dcf7;
}
body.papp .quiz-entry--print:active { box-shadow: 0 2px 0 #c9dcf7; }
body.papp .quiz-entry--print .quiz-entry__icon { background: var(--blue); }
body.papp .quiz-entry--print .quiz-entry__go { color: var(--blue-dark); }

/* ===== 口算闯关：关卡地图 ===== */
body.papp .quiz-lead {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
body.papp .quiz-levels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  body.papp .quiz-levels { grid-template-columns: 1fr 1fr; }
}
body.papp .quiz-level {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--edge-soft);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: 0 var(--press-depth) 0 var(--edge-soft);
  text-align: left;
  color: var(--ink);
}
body.papp .quiz-level:active {
  transform: translateY(var(--press-travel));
  box-shadow: 0 2px 0 var(--edge-soft);
}
body.papp .quiz-level.is-locked {
  opacity: 0.55;
  filter: grayscale(0.5);
  box-shadow: none;
}
body.papp .quiz-level__no {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--level-color, var(--blue));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}
body.papp .quiz-level__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.papp .quiz-level__main b { font-size: 17px; }
body.papp .quiz-level__main small { color: var(--muted); font-size: 12px; }
body.papp .quiz-level__stars {
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 1px;
  white-space: nowrap;
}
body.papp .quiz-level__lock { font-size: 18px; }
@media (max-width: 360px) {
  body.papp .quiz-level { padding: 12px; gap: 8px; }
  body.papp .quiz-level__no { width: 36px; height: 36px; font-size: 13px; }
  body.papp .quiz-level__main b { font-size: 15px; }
  body.papp .quiz-level__stars { font-size: 16px; }
  body.papp .quiz-level__lock { font-size: 16px; }
}

/* ===== 口算闯关：答题 ===== */
body.papp .quiz-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
body.papp .quiz-top .progress { flex: 1; }
body.papp .quiz-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 18px 22px;
  border-radius: var(--radius-large);
  background: var(--white);
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.15s ease;
}
body.papp .quiz-card.is-correct {
  box-shadow: 0 0 0 5px var(--correct-shadow), var(--card-shadow);
}
body.papp .quiz-card.is-wrong { animation: shake 0.32s; }
body.papp .quiz-card.is-revealed {
  box-shadow: 0 0 0 5px #f6c7c7, var(--card-shadow);
}
body.papp .quiz-equation {
  margin: 0;
  font-size: clamp(40px, 13vw, 72px);
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
body.papp .quiz-answer {
  min-width: 3ch;
  min-height: 1.2em;
  padding: 2px 18px 6px;
  border-bottom: 6px solid var(--theme-main, var(--blue));
  font-size: clamp(36px, 12vw, 64px);
  font-weight: 700;
  color: var(--blue);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
body.papp .quiz-answer.is-empty { color: var(--muted); opacity: 0.4; }
body.papp .quiz-feedback {
  min-height: 24px;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}
body.papp .quiz-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
}
body.papp .quiz-key {
  min-height: 58px;
  border: 0;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 4px 0 var(--edge-soft);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
}
body.papp .quiz-key:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--edge-soft);
}
body.papp .quiz-key--util { background: #eef2ff; color: var(--blue); }
body.papp .quiz-key--ok {
  background: #2f6f4f;
  color: #fff;
  box-shadow: 0 4px 0 #1f4d36;
}
body.papp .quiz-key--ok:active { box-shadow: 0 2px 0 #1f4d36; }

/* ===== 口算闯关：结算 ===== */
body.papp .quiz-star {
  font-size: 46px;
  color: var(--gold);
  line-height: 1;
}
body.papp #quiz-screen-end .end__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ===== 做练习统一入口：/practice hub ===== */
body.papp .hub-main { max-width: 760px; }
body.papp .hub-head { padding: 14px 0 6px; text-align: center; }
body.papp .hub-head .logo { font-size: 34px; }
body.papp .hub-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}
body.papp .hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
body.papp .hub-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 156px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--hub-main), var(--hub-dark));
  box-shadow: 0 7px 0 var(--hub-dark);
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 0 rgb(0 0 0 / 12%);
}
body.papp .hub-card::after {
  content: '';
  position: absolute;
  right: -24px;
  top: -24px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgb(255 255 255 / 16%);
}
body.papp .hub-card:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 var(--hub-dark);
}
body.papp .hub-card__icon { position: relative; z-index: 1; font-size: 34px; line-height: 1; }
body.papp .hub-card__name { position: relative; z-index: 1; font-size: 21px; font-weight: 700; }
body.papp .hub-card__desc { position: relative; z-index: 1; font-size: 12px; line-height: 1.5; opacity: 0.92; }
body.papp .hub-card__go { position: relative; z-index: 1; margin-top: auto; font-size: 13px; font-weight: 700; }
body.papp .hub-card--caps { --hub-main: #e8871e; --hub-dark: #b96200; }
body.papp .hub-card--quiz { --hub-main: #3f9a2e; --hub-dark: #2a6b1f; }
body.papp .hub-card--logic { --hub-main: #8a5cf0; --hub-dark: #6636c9; }
body.papp .hub-card--print { --hub-main: #3b7de0; --hub-dark: #2859b0; }
body.papp .hub-foot {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
@media (max-width: 360px) {
  body.papp .hub-grid { grid-template-columns: 1fr; }
  body.papp .hub-card { min-height: 132px; }
}

/* ===== 逻辑练习：旧入口样式（保留兼容） ===== */
body.papp .quiz-entry--logic {
  margin-top: 10px;
  border-color: #cbe8d5;
  background: linear-gradient(135deg, #f1fbf4, #dcf3e4);
  box-shadow: 0 5px 0 #cbe8d5;
}
body.papp .quiz-entry--logic:active { box-shadow: 0 2px 0 #cbe8d5; }
body.papp .quiz-entry--logic .quiz-entry__icon { background: #2f9e6b; }
body.papp .quiz-entry--logic .quiz-entry__go { color: #1f7a4d; }

/* ===== 逻辑练习：划数字凑和 ===== */
body.papp .sumplete-main { max-width: 560px; }
body.papp .sum-head { padding: 10px 0 0; text-align: center; }
body.papp .sum-head .logo { font-size: 30px; }
body.papp .sum-lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
body.papp .sum-sizes {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 12px;
}
body.papp .sum-size {
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border: 2px solid var(--edge-soft);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
}
body.papp .sum-size[aria-pressed='true'] {
  border-color: #2f9e6b;
  background: #2f9e6b;
  color: #fff;
}
body.papp .sum-board {
  display: grid;
  gap: 5px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  --sum-target: 44px;
}
body.papp .sum-board[data-size='4'] { grid-template-columns: repeat(4, minmax(0, 1fr)) var(--sum-target); }
body.papp .sum-board[data-size='5'] { grid-template-columns: repeat(5, minmax(0, 1fr)) var(--sum-target); }
body.papp .sum-board[data-size='6'] { grid-template-columns: repeat(6, minmax(0, 1fr)) var(--sum-target); }
body.papp .sum-cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 0;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 3px 0 var(--edge-soft);
  color: var(--ink);
  font-size: clamp(19px, 5.8vw, 30px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
body.papp .sum-cell:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge-soft); }
body.papp .sum-cell.is-crossed {
  background: #f1ece2;
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.55;
  box-shadow: none;
}
body.papp .sum-target {
  display: grid;
  place-items: center;
  min-height: 28px;
  border-radius: 12px;
  background: #fff7e6;
  color: #a06a2c;
  font-size: clamp(13px, 3.8vw, 18px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
body.papp .sum-target.is-met {
  background: #e4f8dc;
  color: #2f6f4f;
  box-shadow: inset 0 0 0 2px #9fd88a;
}
body.papp .sum-corner {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
body.papp .sum-hint {
  min-height: 44px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
body.papp .sum-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
body.papp .sum-actions .button { min-height: 48px; font-size: 16px; }
body.papp .sum-stats {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
body.papp .sum-end-icon { font-size: 56px; line-height: 1; text-align: center; }
body.papp #sum-end-text { white-space: pre-line; }
@media (max-width: 360px) {
  body.papp .sum-board { --sum-target: 36px; gap: 3px; }
  body.papp .sum-cell { font-size: clamp(17px, 5.4vw, 24px); border-radius: 10px; }
  body.papp .sum-size { min-width: 58px; padding: 0 10px; }
}
