/* site.css —— 页面布局（大厅/页头/页脚/气泡），组件样式在 pixel-base.css */
body { min-height: 100vh; display: flex; flex-direction: column; }

/* ── 页头 ── */
.site-header { padding: 28px 0 12px; position: relative; }
.back-lobby { position: absolute; left: 24px; top: 8px; font-size: .7rem; padding: 4px 12px; text-decoration: none; }
.site-header .brand { display: flex; align-items: center; gap: 16px; justify-content: center; }
.site-header .brand img { width: 64px; height: 64px; }
.header-meta { display: flex; justify-content: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }

/* ── 效果开关 ── */
.fx-toggle { position: fixed; top: 12px; right: 12px; z-index: 9997; font-size: .6rem; padding: 4px 10px; }
body.fx-off .px-mascot { animation-play-state: paused; }

/* ── 大厅 ── */
.lobby { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 24px 0 48px; }
.lobby-stage, .mode-grid { position: relative; z-index: 1; }  /* 盖过漂浮符号层，保文字可读 */
.lobby-stage { display: flex; align-items: flex-end; gap: 20px; }
.lobby-mascot { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.speech-bubble {
  position: relative;
  background: var(--px-paper); color: var(--px-navy);
  border: 3px solid var(--px-border);
  padding: 10px 16px;
  font-size: .85rem;
  max-width: 340px;
  box-shadow: 4px 4px 0 var(--px-ink);
}
.speech-bubble::before {
  content: '';
  position: absolute; left: -14px; bottom: 12px;
  border: 7px solid transparent;
  border-right-color: var(--px-border);
}
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; width: 100%; max-width: 1020px; }
@media (max-width: 760px) { .mode-grid { grid-template-columns: 1fr 1fr; } }

/* ── 长文字题面（奥数/趣味问答） ── */
.ol-q { font-size: 1.1rem; color: var(--px-cream); text-shadow: 3px 3px 0 var(--px-ink); max-width: 640px; margin: 10px auto; line-height: 1.8; min-height: 2em; }

/* ── 视图区 ── */
.view { flex: 1; padding: 8px 0 48px; display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: center; gap: 14px; margin: 12px 0 20px; }
.view-head img { width: 48px; height: 48px; }

/* ── 页脚 ── */
.site-footer {
  border-top: 4px solid var(--px-border);
  background: var(--px-panel);
  padding: 16px 0;
  font-size: .65rem;
  color: var(--px-text-dim);
}
.site-footer .px-wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer a { color: var(--px-link); text-decoration: none; }
.site-footer a:hover { color: var(--px-accent); }

/* ── 步骤条（P3 向导） ── */
.wizard-steps { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.wizard-steps .px-badge.is-current { background: var(--px-yellow); }

/* ── 单元网格 ── */
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.unit-btn {
  font-family: var(--px-font); font-size: .85rem;
  padding: 12px 14px; text-align: left;
  color: var(--px-text); background: var(--px-panel-hi);
  border: 3px solid var(--px-border); cursor: pointer;
  box-shadow: 4px 4px 0 var(--px-ink);
}
.unit-btn:hover { background: var(--px-navy-2); transform: translateY(-2px); }
.unit-btn.is-active { background: var(--px-green); color: var(--px-ink); }
.unit-btn .unit-tag { display: block; font-size: .6rem; color: var(--px-text-dim); margin-top: 4px; }
.unit-btn.is-active .unit-tag { color: var(--px-navy); }

/* ── 试卷预览纸 ── */
.paper-sheet {
  position: relative;
  background: #ffffff; color: var(--px-ink);   /* 纯白纸面：省彩墨，所见即所印 */
  border: 4px solid var(--px-border);
  box-shadow: 8px 8px 0 var(--px-ink);
  padding: 32px 36px;
  max-width: 820px; margin: 0 auto;
  font-size: .8rem;
}
.paper-sheet h2 { font-size: 1rem; text-align: center; margin: 0 0 6px; }
.paper-sheet .paper-meta { text-align: center; font-size: .65rem; color: var(--px-tan); margin-bottom: 18px; }
.paper-q { margin: 0 0 10px; display: flex; gap: 8px; align-items: baseline; break-inside: avoid; }
.paper-q .q-no { min-width: 2.2em; color: var(--px-tan); }
.paper-q .q-diagram svg { max-width: 260px; height: auto; display: block; margin-top: 6px; }

/* 答案纸双栏（打印端在 print-a4.css 中另有关照） */
.ans-list { columns: 2; column-gap: 26px; }
.ans-item { break-inside: avoid; margin-bottom: 6px; }
@media (max-width: 600px) { .ans-list { columns: 1; } }

/* ── 作答留白：默认显示，"留白"开关关闭时隐藏（打印时始终恢复） ── */
.paper-sheet.compact .solve-workspace,
.paper-sheet.compact .steps-workspace { display: none; }

/* ── 题面填空位：像素虚线方框（替代一串下划线字符） ── */
.q-blank {
  display: inline-block;
  min-width: 3.6em; height: 1.35em;
  border: 2px dashed var(--px-tan);
  background: rgba(255, 255, 255, .35);
  vertical-align: -3px;
  margin: 0 3px;
}

/* ── 像素印章（屏幕装饰，打印不输出） ── */
.paper-stamp {
  position: absolute; top: 14px; right: 16px;
  padding: 4px 10px;
  font-size: .55rem; letter-spacing: 2px;
  color: var(--px-red-soft);
  border: 3px double var(--px-red-soft);
  transform: rotate(6deg);
  opacity: .75;
  animation: stamp-in .4s steps(4, end) .3s backwards;
}
@keyframes stamp-in { from { transform: rotate(6deg) scale(2.2); opacity: 0; } }

/* ── 试卷底部吉祥物评语条 ── */
.paper-footer-strip {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 22px; padding: 10px 14px;
  font-size: .7rem; color: var(--px-tan);
  border: 3px dashed var(--px-sand-2);
}
.paper-footer-strip img { width: 32px; height: 32px; }
.footer-stars { font-size: 1rem; color: var(--px-orange); letter-spacing: 6px; }

/* ── 大厅漂浮像素数学符号层 ── */
.float-syms { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.float-syms span {
  position: absolute; bottom: -40px;
  font-size: 1.6rem; font-weight: 700;
  color: var(--px-sky);
  opacity: .55;
  text-shadow: 3px 3px 0 var(--px-ink);
  animation: float-up linear infinite;
}
@keyframes float-up {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  8%   { opacity: .9; }
  92%  { opacity: .9; }
  100% { transform: translateY(-105vh) rotate(20deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .float-syms { display: none; } }

/* ── 口算闯关 ── */
.challenge-hud { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.challenge-hud .hud-item { display: flex; align-items: center; gap: 8px; }
.challenge-hud .hud-value { font-size: 1.4rem; color: var(--px-accent); text-shadow: 2px 2px 0 var(--px-ink); }
.challenge-stage {
  position: relative;
  background: var(--px-panel);
  border: 4px solid var(--px-border);
  box-shadow: 8px 8px 0 var(--px-ink);
  padding: 40px 24px;
  text-align: center;
}
.challenge-q { font-size: var(--px-fs-hero); color: var(--px-cream); text-shadow: 4px 4px 0 var(--px-ink); min-height: 1.4em; }
.challenge-answer-row { display: flex; justify-content: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.challenge-feedback { min-height: 1.6em; margin-top: 14px; font-size: 1rem; }
.challenge-feedback.ok { color: var(--px-lime); }
.challenge-feedback.no { color: var(--px-rose); }
.combo-flash { color: var(--px-orange); font-size: 1.2rem; text-shadow: 2px 2px 0 var(--px-ink); }
.hud-value.time-low { color: var(--px-red-soft); animation: px-pop .5s steps(2, end) infinite; }
.ch-input::placeholder { color: var(--px-sand-2); }
.ch-key { min-width: 64px; }
.ch-mascot { width: 64px; height: 64px; background-size: 256px 64px; margin: 0 auto 10px; }
.ch-pad { display: grid; grid-template-columns: repeat(4, 84px); gap: 8px; justify-content: center; }
.ch-pad .ch-key { height: 48px; }
.range-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.ch-result .result-stars { animation: px-pop .4s steps(3, end) .2s backwards; }
.ch-answer-row .ch-key { margin-top: 6px; }

/* ── 趣味角棋盘 ── */
.fun-grid-canvas { display: flex; justify-content: center; margin: 18px 0; }
.sudoku-board { border-collapse: collapse; background: #ffffff; border: 4px solid var(--px-border); }
.sudoku-board td { width: 44px; height: 44px; border: 2px solid var(--px-sand-2); text-align: center; font-size: 1rem; color: var(--px-ink); }
.sudoku-board td.bold-right { border-right: 4px solid var(--px-border); }
.sudoku-board td.bold-bottom { border-bottom: 4px solid var(--px-border); }
.sudoku-board td.fixed { color: var(--px-tan); }
.sudoku-board td input { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font-family: var(--px-font); font-size: 1rem; color: var(--px-blue); outline: none; }
.maze-canvas svg { image-rendering: pixelated; }
.magic-board { border-collapse: collapse; background: #ffffff; border: 4px solid var(--px-border); }
.magic-board td { width: 52px; height: 52px; border: 2px solid var(--px-sand-2); text-align: center; font-size: 1rem; color: var(--px-ink); }
.magic-board td input { width: 100%; height: 100%; border: 0; background: transparent; text-align: center; font-family: var(--px-font); font-size: 1rem; color: var(--px-blue); outline: none; }
.magic-board .fixed-mg { color: var(--px-tan); }
.sudoku-board td.conflict { background: var(--px-rose); }
.sudoku-board td.ans-cell { color: var(--px-teal); }

/* ── AI 弹窗 ── */
.ai-dialog {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 40px));
  max-height: 82vh; overflow-y: auto;
  z-index: 9990;
  background: var(--px-panel);
}
.ai-body { font-size: .8rem; line-height: 1.8; min-height: 60px; }
.ai-body b { color: var(--px-yellow); }
