:root {
  --bg: #F0F6FF;
  --card: #FFFFFF;
  --ink: #2A3A52;
  --muted: #7A8AA5;
  --blue: #2E7BD4;
  --blue-dark: #1F5FA8;
  --blue-soft: #DCEBFB;
  --green: #3E7C63;
  --green-soft: #E6F3EC;
  --gold: #E8B44A;
  --gold-soft: #FFF3D9;
  --red: #E4572E;
  --red-soft: #FFE9E0;
  --line: #E2ECF7;
  --shadow: 0 8px 24px rgba(46, 123, 212, .10);
  --radius: 20px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 10%, rgba(46, 123, 212, .06) 0, rgba(46, 123, 212, .06) 1px, transparent 1.6px),
    radial-gradient(circle at 78% 42%, rgba(62, 124, 99, .05) 0, rgba(62, 124, 99, .05) 1px, transparent 1.6px);
  background-size: 26px 26px, 32px 32px;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

/* ---------- 启动屏 ---------- */
.splash {
  position: fixed; inset: 0; z-index: 999;
  background: linear-gradient(160deg, #E8F1FB 0%, #D6E6F7 55%, #C7DCF2 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .45s ease, visibility .45s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-inner { text-align: center; }
.splash-logo { font-size: 76px; animation: bob 1.6s ease-in-out infinite; }
.splash-title { font-size: 27px; letter-spacing: 2px; margin: 14px 0 8px; color: #1F5FA8; }
.splash-sub { font-size: 14px; color: #5A7AA5; letter-spacing: 3px; }
.splash-load {
  width: 120px; height: 4px; margin: 26px auto 0; border-radius: 4px;
  background: rgba(46, 123, 212, .18); overflow: hidden; position: relative;
}
.splash-load::after {
  content: ""; position: absolute; left: -40%; top: 0; width: 40%; height: 100%;
  border-radius: 4px; background: var(--blue); animation: loadbar 1.2s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes loadbar { 0% { left: -40%; } 100% { left: 100%; } }

/* ---------- 顶栏 ---------- */
.app-header {
  position: sticky; top: 0; z-index: 60;
  height: 56px; display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  background: rgba(240, 246, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 236, 247, .8);
  max-width: 560px; margin: 0 auto;
}
.back-btn, .voice-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--ink);
  background: #fff; box-shadow: 0 2px 8px rgba(46, 123, 212, .12);
  visibility: hidden;
}
.voice-btn { visibility: visible; }
.app-title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; letter-spacing: .5px; }

.app-main { max-width: 560px; margin: 0 auto; padding: 12px 16px 96px; }

.page { display: none; animation: fadeUp .28s ease; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 14px 0 18px; }
.hero-emoji { font-size: 38px; }
.hero h2 { font-size: 21px; margin: 8px 0 6px; letter-spacing: 1px; }
.hero-date { font-size: 13px; color: var(--muted); letter-spacing: 1px; }

/* 年级切换 */
.grade-switch {
  display: flex; gap: 10px; margin-bottom: 14px;
  background: #fff; border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow);
}
.grade-btn {
  flex: 1; padding: 14px 10px; border-radius: 14px;
  background: #F3F7FC; text-align: center; transition: all .2s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.grade-btn .grade-num { font-size: 17px; font-weight: 700; color: var(--muted); }
.grade-btn small { font-size: 11px; color: var(--muted); line-height: 1.4; }
.grade-btn.active {
  background: linear-gradient(135deg, var(--blue) 0%, #5BA0E8 100%);
  box-shadow: 0 6px 16px rgba(46, 123, 212, .3);
}
.grade-btn.active .grade-num, .grade-btn.active small { color: #fff; }

.daily-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  padding: 20px 18px 18px;
  background: linear-gradient(135deg, #2E7BD4 0%, #4A95E0 55%, #6AAEEC 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(46, 123, 212, .26);
  margin-bottom: 14px;
}
.daily-card::after {
  content: ""; position: absolute; right: -30px; top: -34px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255, 255, 255, .14);
}
.daily-badge {
  display: inline-block; font-size: 11px; letter-spacing: 2px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(255, 255, 255, .22);
}
.daily-title { font-size: 20px; font-weight: 700; margin: 12px 0 6px; position: relative; }
.daily-desc { font-size: 13px; opacity: .9; }
.daily-play {
  margin-top: 16px; padding: 9px 22px; border-radius: 22px;
  background: #fff; color: var(--blue-dark); font-weight: 700; font-size: 14px;
  box-shadow: 0 4px 12px rgba(20, 60, 110, .18);
}

.cont-card {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-bottom: 12px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: left;
}
.cont-card.soft { background: linear-gradient(135deg, #FFF9F0, #FFF3E0); }
.cont-icon { font-size: 26px; }
.cont-text { flex: 1; }
.cont-text b { font-size: 15px; display: block; margin-bottom: 2px; }
.cont-text small { font-size: 12px; color: var(--muted); }
.cont-arrow { font-size: 22px; color: var(--muted); }

.section-title {
  font-size: 15px; font-weight: 700; margin: 18px 4px 10px;
  display: flex; align-items: center; gap: 6px;
}
.section-title span { font-size: 12px; font-weight: 400; color: var(--muted); }

.module-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.module-card {
  background: #fff; border-radius: var(--radius); padding: 16px 12px;
  box-shadow: var(--shadow); text-align: left;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform .15s;
}
.module-card:active { transform: scale(0.97); }
.module-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 4px;
}
.module-name { font-size: 16px; font-weight: 700; }
.module-tip { font-size: 12px; color: var(--muted); line-height: 1.4; }

.install-card {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; margin-top: 12px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: left;
}
.install-card-icon { font-size: 26px; }
.install-card-text { flex: 1; }
.install-card-text b { font-size: 15px; display: block; margin-bottom: 2px; }
.install-card-text small { font-size: 12px; color: var(--muted); }
.install-card-arrow { font-size: 22px; color: var(--muted); }

.page-subtitle { font-size: 15px; color: var(--muted); margin: 4px 2px 14px; }

/* ---------- 学习页 ---------- */
.learn-head {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.learn-icon {
  width: 54px; height: 54px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; background: var(--blue-soft);
}
.learn-head h2 { font-size: 20px; margin-bottom: 2px; }
.learn-desc { font-size: 13px; color: var(--muted); }

.tip-box {
  background: linear-gradient(135deg, #FFF7E6, #FFEFD2);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 12px;
  font-size: 14px; line-height: 1.6; color: #8A6A2A;
  border-left: 4px solid var(--gold);
}
.tip-box::before { content: "💡 "; }

.example-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.example-card {
  background: #fff; border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.example-q { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.example-a { font-size: 16px; color: var(--green); font-weight: 600; }
.example-note { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* 乘法口诀表 */
.multiply-table {
  background: #fff; border-radius: 14px; padding: 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 8px;
}
.multiply-row {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.multiply-cell {
  padding: 6px 8px; border-radius: 8px;
  background: var(--blue-soft); font-size: 13px; font-weight: 600;
  color: var(--blue-dark);
}

/* 练习题 */
.practice-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.practice-item {
  background: #fff; border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.practice-q { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.practice-input-row { display: flex; gap: 10px; align-items: center; }
.practice-input {
  flex: 1; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--line); font-size: 16px; font-family: inherit;
  outline: none; transition: border-color .2s;
}
.practice-input:focus { border-color: var(--blue); }
.practice-check {
  padding: 10px 18px; border-radius: 10px;
  background: var(--blue); color: #fff; font-weight: 600; font-size: 14px;
}
.practice-feedback { margin-top: 10px; font-size: 14px; font-weight: 600; }
.practice-feedback.right { color: var(--green); }
.practice-feedback.wrong { color: var(--red); }

.practice-btn {
  width: 100%; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, #5BA0E8 100%);
  color: #fff; font-size: 16px; font-weight: 700;
  box-shadow: 0 6px 16px rgba(46, 123, 212, .3);
  margin-top: 8px;
}
.practice-btn.small { width: auto; padding: 8px 16px; font-size: 14px; display: inline-block; }

/* ---------- 闯关 ---------- */
.game-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.game-card {
  background: #fff; border-radius: var(--radius); padding: 18px 14px;
  box-shadow: var(--shadow); text-align: center;
  transition: transform .15s;
}
.game-card:active { transform: scale(0.97); }
.game-icon { font-size: 36px; margin-bottom: 8px; }
.game-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.game-desc { font-size: 12px; color: var(--muted); line-height: 1.4; }
.game-best { font-size: 11px; color: var(--gold); margin-top: 8px; font-weight: 600; }

.game-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.game-meta { font-size: 14px; font-weight: 600; color: var(--blue-dark); }
.q-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.q-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); flex: 1;
}
.q-dot.ok { background: var(--green); }
.q-dot.bad { background: var(--red); }
.q-dot.now { background: var(--blue); transform: scale(1.3); }

.q-card {
  background: #fff; border-radius: var(--radius); padding: 20px 18px;
  box-shadow: var(--shadow);
}
.q-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.q-text { font-size: 22px; font-weight: 700; margin-bottom: 18px; line-height: 1.4; }
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  padding: 14px 16px; border-radius: 12px;
  background: #F3F7FC; font-size: 16px; font-weight: 600;
  text-align: left; transition: all .15s;
}
.option-btn:active { transform: scale(0.98); }
.option-btn.right { background: var(--green-soft); color: var(--green); }
.option-btn.wrong { background: var(--red-soft); color: var(--red); }
.q-feedback { margin-top: 14px; padding: 12px; border-radius: 10px; font-size: 14px; }
.q-feedback.ok { background: var(--green-soft); color: var(--green); }
.q-feedback.bad { background: var(--red-soft); color: var(--red); }

/* 闯关结果 */
.result-box {
  background: #fff; border-radius: var(--radius); padding: 30px 20px;
  box-shadow: var(--shadow); text-align: center;
}
.result-emoji { font-size: 64px; margin-bottom: 12px; }
.result-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.result-score { font-size: 18px; color: var(--muted); margin-bottom: 20px; }
.result-btns { display: flex; gap: 10px; }
.result-btns .practice-btn { margin-top: 0; }

/* ---------- 错题本 ---------- */
.seg-tabs {
  display: flex; background: #fff; border-radius: 14px; padding: 5px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.seg-tab {
  flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: var(--muted); transition: all .2s;
}
.seg-tab.active { background: var(--blue); color: #fff; }
.seg-tab span {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: rgba(46, 123, 212, .15); font-size: 12px; margin-left: 4px;
}
.seg-tab.active span { background: rgba(255,255,255,.25); color: #fff; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip-row.small { margin-bottom: 10px; }
.chip {
  padding: 7px 14px; border-radius: 18px;
  background: #fff; font-size: 13px; font-weight: 600;
  color: var(--muted); box-shadow: var(--shadow);
}
.chip.active { background: var(--blue); color: #fff; }

.wrong-list { display: flex; flex-direction: column; gap: 12px; }
.empty-box {
  text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.wrong-card {
  background: #fff; border-radius: 14px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.wrong-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.wrong-module {
  font-size: 12px; padding: 3px 10px; border-radius: 10px;
  background: var(--blue-soft); color: var(--blue-dark); font-weight: 600;
}
.wrong-time { font-size: 12px; color: var(--muted); }
.wrong-q { font-size: 16px; font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.wrong-answers { font-size: 14px; margin-bottom: 8px; }
.wrong-my { color: var(--red); margin-bottom: 2px; }
.wrong-right { color: var(--green); }
.wrong-tip { font-size: 13px; color: var(--muted); background: #F7FAFF; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.wrong-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-action {
  padding: 7px 14px; border-radius: 10px;
  background: #F3F7FC; font-size: 13px; font-weight: 600; color: var(--ink);
}
.mini-action.ok { background: var(--green-soft); color: var(--green); }
.mini-action.ghost { background: #fff; border: 1px solid var(--line); color: var(--muted); }
.mini-action.danger { background: var(--red-soft); color: var(--red); }

.redo-box { margin-top: 10px; padding: 12px; background: #F7FAFF; border-radius: 10px; }
.redo-title { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.redo-options { display: flex; gap: 8px; flex-wrap: wrap; }

/* 拍照错题 */
.photo-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.photo-add {
  flex: 1; padding: 12px; border-radius: 12px;
  background: var(--blue); color: #fff; font-weight: 600; font-size: 14px;
}
.photo-add.ghost { background: #fff; color: var(--blue); border: 1.5px solid var(--blue-soft); }
.photo-hint { font-size: 12px; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-item {
  position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-note {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.7));
  color: #fff; font-size: 11px; padding: 16px 8px 6px;
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.photo-done {
  position: absolute; top: 6px; right: 6px;
  background: var(--green); color: #fff; font-size: 10px;
  padding: 2px 8px; border-radius: 10px;
}
.empty-tip { text-align: center; color: var(--muted); padding: 30px 0; }

/* ---------- 学习记录 ---------- */
.record-streak {
  background: linear-gradient(135deg, var(--blue) 0%, #5BA0E8 100%);
  color: #fff; border-radius: var(--radius); padding: 20px;
  text-align: center; margin-bottom: 12px; box-shadow: 0 8px 20px rgba(46,123,212,.25);
}
.record-streak b { font-size: 32px; display: block; }
.record-streak span { font-size: 13px; opacity: .9; }
.record-overview {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px;
}
.ov-card {
  background: #fff; border-radius: 14px; padding: 14px 10px;
  text-align: center; box-shadow: var(--shadow);
}
.ov-card b { font-size: 22px; color: var(--blue); display: block; }
.ov-card span { font-size: 12px; color: var(--muted); }
.record-section { margin-bottom: 16px; }
.week-chart {
  background: #fff; border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow); display: flex; gap: 8px; align-items: flex-end;
  height: 140px;
}
.week-bar {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.week-bar-fill {
  width: 100%; background: linear-gradient(180deg, var(--blue), #5BA0E8);
  border-radius: 6px 6px 0 0; min-height: 4px; transition: height .3s;
}
.week-bar-label { font-size: 11px; color: var(--muted); }
.week-bar-val { font-size: 11px; font-weight: 700; color: var(--blue-dark); }
.module-stat, .best-stat {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  box-shadow: var(--shadow); margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.module-stat b, .best-stat b { font-size: 14px; }
.module-stat span, .best-stat span { font-size: 13px; color: var(--blue); font-weight: 600; }
.record-clear {
  width: 100%; padding: 12px; border-radius: 12px;
  background: var(--red-soft); color: var(--red); font-weight: 600;
  margin-top: 8px;
}
.record-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px; color: var(--muted); font-size: 11px;
}
.nav-item .nav-icon { font-size: 22px; }
.nav-item.active { color: var(--blue); }
.nav-item.active .nav-icon { filter: drop-shadow(0 2px 4px rgba(46,123,212,.3)); }

/* ---------- 模态框 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  visibility: hidden; opacity: 0; transition: all .25s;
}
.modal.show { visibility: visible; opacity: 1; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-box {
  position: relative; width: calc(100% - 40px); max-width: 400px;
  background: #fff; border-radius: var(--radius); padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
  max-height: 85vh; overflow-y: auto;
}
.photo-modal-box { max-width: 460px; padding: 16px; }
.modal-x {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: #F3F7FC; font-size: 16px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.modal-box h3 { font-size: 18px; margin-bottom: 16px; }
.setting-block { margin-bottom: 16px; }
.block-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.rate-chips { display: flex; gap: 8px; }
.rate-chip {
  flex: 1; padding: 10px; border-radius: 10px;
  background: #F3F7FC; font-size: 13px; font-weight: 600; color: var(--muted);
}
.rate-chip.active { background: var(--blue); color: #fff; }
.setting-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.setting-row label { font-size: 14px; font-weight: 600; }
.setting-hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 12px 0; }
.voice-test {
  width: 100%; padding: 12px; border-radius: 12px;
  background: var(--blue-soft); color: var(--blue-dark); font-weight: 600; margin-bottom: 10px;
}
.modal-close {
  width: 100%; padding: 12px; border-radius: 12px;
  background: var(--blue); color: #fff; font-weight: 600;
}
.modal-close.ghost { background: #F3F7FC; color: var(--muted); }

.photo-full { width: 100%; border-radius: 12px; margin-bottom: 12px; }
.photo-form { display: flex; flex-direction: column; gap: 10px; }
.photo-note-input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--line); font-size: 14px; font-family: inherit;
  outline: none; resize: vertical; min-height: 70px;
}
.photo-note-input:focus { border-color: var(--blue); }
.photo-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.install-how { font-size: 14px; line-height: 1.8; color: var(--ink); margin-bottom: 16px; }
.install-how p { margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(42, 58, 82, .92); color: #fff;
  padding: 10px 20px; border-radius: 22px; font-size: 14px;
  z-index: 300; opacity: 0; transition: all .25s; pointer-events: none;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 游戏广场卡片 ---------- */
.game-card.hall { background: linear-gradient(135deg, #FFF9F0, #FFF3E0); }
.game-card.hall .game-icon { font-size: 40px; }

/* ---------- 火柴棍等式游戏（7段数码管真实火柴视觉） ---------- */
.match-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.match-level-info { font-size: 14px; font-weight: 600; color: var(--blue-dark); }
.match-attempts { font-size: 13px; color: var(--muted); }

.match-stage {
  background: linear-gradient(160deg, #D6EAF8, #C5DFF5);
  border-radius: var(--radius); padding: 30px 16px;
  box-shadow: var(--shadow); margin-bottom: 12px;
  min-height: 200px; display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 8px;
}

/* 每个数字/运算符的容器 */
.match-digit {
  position: relative;
  width: 100px; height: 160px;
  flex-shrink: 0;
}

/* 火柴棍：米色杆 + 红色火柴头 */
.stick {
  position: absolute;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.stick.on {
  /* 米色火柴杆 */
  background: linear-gradient(90deg, #F5E6C8, #E8D5A8, #F5E6C8);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.stick.on.h::before {
  /* 横向火柴头（红色，在左端） */
  content: ""; position: absolute; left: 0; top: 0;
  width: 10px; height: 100%;
  background: linear-gradient(180deg, #E74C3C, #C0392B);
  border-radius: 4px 0 0 4px;
}
.stick.on.v::before {
  /* 竖向火柴头（红色，在顶端） */
  content: ""; position: absolute; left: 0; top: 0;
  width: 100%; height: 10px;
  background: linear-gradient(90deg, #E74C3C, #C0392B);
  border-radius: 4px 4px 0 0;
}
.stick.off {
  /* 空位：淡淡的虚线提示 */
  background: rgba(255,255,255,0.25);
  border: 2px dashed rgba(255,255,255,0.4);
}
.stick.off:hover {
  background: rgba(255,255,255,0.45);
  border-color: rgba(255,255,255,0.7);
}
.stick.selected {
  outline: 3px solid #F39C12;
  outline-offset: 2px;
  transform: scale(1.08);
}

.match-tip {
  background: var(--gold-soft); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: #8A6A2A; margin-bottom: 12px;
  border-left: 4px solid var(--gold);
}
.match-tip::before { content: "💡 提示："; font-weight: 600; }

.match-btns { display: flex; gap: 10px; }
.match-btns .practice-btn { flex: 1; margin-top: 0; }
.match-btns .ghost { background: #F3F7FC; color: var(--ink); box-shadow: none; }

.match-feedback {
  margin-top: 12px; padding: 12px; border-radius: 10px; font-size: 14px;
  display: none;
}
.match-feedback.ok { background: var(--green-soft); color: var(--green); display: block; }
.match-feedback.bad { background: var(--red-soft); color: var(--red); display: block; }

/* ---------- 速算竞速 ---------- */
.race-top {
  display: flex; justify-content: space-between; margin-bottom: 12px;
}
.race-stat {
  background: #fff; border-radius: 12px; padding: 10px 14px;
  box-shadow: var(--shadow); text-align: center; flex: 1; margin: 0 4px;
}
.race-stat b { font-size: 20px; color: var(--blue); display: block; }
.race-stat span { font-size: 12px; color: var(--muted); }

.race-q {
  background: #fff; border-radius: var(--radius); padding: 30px 20px;
  box-shadow: var(--shadow); text-align: center; margin-bottom: 12px;
}
.race-q-text { font-size: 36px; font-weight: 700; margin-bottom: 16px; font-family: 'Courier New', monospace; }
.race-input-row { display: flex; gap: 10px; }
.race-input {
  flex: 1; padding: 14px; border-radius: 12px;
  border: 2px solid var(--line); font-size: 22px; text-align: center;
  outline: none; font-family: inherit;
}
.race-input:focus { border-color: var(--blue); }
.race-btn {
  padding: 14px 24px; border-radius: 12px;
  background: var(--blue); color: #fff; font-weight: 700; font-size: 16px;
}

/* ---------- 翻翻乐 ---------- */
.memory-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.memory-card {
  aspect-ratio: 3/4; perspective: 600px; cursor: pointer;
}
.memory-card-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; transition: transform .4s;
}
.memory-card.flipped .memory-card-inner { transform: rotateY(180deg); }
.memory-face {
  position: absolute; inset: 0; border-radius: 12px;
  backface-visibility: hidden; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.memory-front {
  background: linear-gradient(135deg, var(--blue), #5BA0E8); color: #fff;
}
.memory-back {
  background: #fff; color: var(--ink);
  transform: rotateY(180deg); box-shadow: var(--shadow);
}
.memory-card.matched .memory-back { background: var(--green-soft); color: var(--green); }

/* ---------- 数字泡泡 ---------- */
.bubble-board {
  position: relative; width: 100%; height: 380px;
  background: linear-gradient(180deg, #E8F4FD, #D6EAF8);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 12px;
}
.bubble {
  position: absolute; width: 60px; height: 60px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.8), rgba(46,123,212,.4));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--blue-dark);
  cursor: pointer; animation: bubbleFloat 3s ease-in-out infinite;
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.bubble.good { background: radial-gradient(circle at 30% 30%, #fff, rgba(62,124,99,.5)); color: var(--green); }
.bubble.bad { background: radial-gradient(circle at 30% 30%, #fff, rgba(228,87,46,.5)); color: var(--red); }
.bubble-target {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: #fff; padding: 6px 16px; border-radius: 20px;
  font-size: 14px; font-weight: 600; color: var(--blue);
  box-shadow: var(--shadow); z-index: 5;
}

/* ---------- 找规律 ---------- */
.pattern-q {
  background: #fff; border-radius: var(--radius); padding: 24px 20px;
  box-shadow: var(--shadow); margin-bottom: 12px; text-align: center;
}
.pattern-seq {
  font-size: 28px; font-weight: 700; font-family: 'Courier New', monospace;
  letter-spacing: 4px; margin-bottom: 16px;
}
.pattern-blank {
  display: inline-block; min-width: 50px; border-bottom: 3px solid var(--blue);
  color: var(--blue);
}

/* ---------- 打靶 ---------- */
.target-board {
  position: relative; width: 100%; height: 300px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
}
.target-ring {
  position: absolute; border-radius: 50%; border: 4px solid var(--red);
  display: flex; align-items: center; justify-content: center;
}
.target-ring.r1 { width: 240px; height: 240px; }
.target-ring.r2 { width: 170px; height: 170px; border-color: var(--blue); }
.target-ring.r3 { width: 100px; height: 100px; border-color: var(--gold); }
.target-ring.bullseye {
  width: 40px; height: 40px; background: var(--red); border: none;
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}
.target-q {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 18px; font-weight: 700; color: var(--ink);
}

/* ---------- 游戏通用结果 ---------- */
.game-result {
  background: #fff; border-radius: var(--radius); padding: 30px 20px;
  box-shadow: var(--shadow); text-align: center;
}
.game-result-emoji { font-size: 56px; margin-bottom: 12px; }
.game-result-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.game-result-score { font-size: 18px; color: var(--muted); margin-bottom: 20px; }
