/* ==========================================================================
   星际电玩学园 · StarArcade
   视觉风格：活力潮玩电玩风（专为四年级 9–10 岁打造：护眼明亮底色 + 3D 触感大按键 + 炫酷徽章）
   主终端：手机竖屏 9:16 单手大拇指操作，电脑端居中精致掌机外框
   ========================================================================== */

:root {
  /* 明亮护眼主底色 */
  --bg-app: #F3F6FF;
  --bg-card: #FFFFFF;
  --bg-soft: #E8EEFF;
  --ink-main: #131B36;
  --ink-sub: #536084;
  --ink-muted: #8895B8;
  --border-card: #DCE4FA;

  /* 学科与电玩活力主题色 */
  --math: #2563EB;
  --math-light: #DBEAFE;
  --math-dark: #1D4ED8;
  --math-glow: rgba(37, 99, 235, 0.28);

  --chinese: #F43F5E;
  --chinese-light: #FFE4E6;
  --chinese-dark: #BE123C;
  --chinese-glow: rgba(244, 63, 94, 0.28);

  --english: #10B981;
  --english-light: #D1FAE5;
  --english-dark: #047857;
  --english-glow: rgba(16, 185, 129, 0.28);

  --boss: #7C3AED;
  --boss-light: #EDE9FE;
  --boss-dark: #5B21B6;

  --gold: #F59E0B;
  --gold-bright: #FACC15;
  --gold-dark: #B45309;
  --gold-light: #FEF3C7;

  --danger: #EF4444;
  --danger-dark: #B91C1C;
  --success: #16A34A;
  --success-dark: #15803D;

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

input, textarea {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--ink-main);
  background: #0B1225;
}

/* 桌面端掌机展台，移动端铺满全屏 */
.device-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(37, 99, 235, 0.35), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.32), transparent 45%),
    linear-gradient(145deg, #0D1429 0%, #151E3D 100%);
}

.arcade-shell {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 430px;
  max-height: 880px;
  background-color: var(--bg-app);
  background-image:
    radial-gradient(rgba(37, 99, 235, 0.08) 1.5px, transparent 1.5px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 6px #232F55,
    0 0 0 9px rgba(96, 165, 250, 0.25);
  border-radius: 34px;
}

@media (max-width: 480px) {
  .device-stage {
    background: var(--bg-app);
  }
  .arcade-shell {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   顶部 HUD 状态栏
   ========================================================================== */
.top-hud {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--border-card);
  z-index: 20;
}

.hud-left {
  min-width: 0;
  flex: 1;
}

.avatar-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.avatar-emoji {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #EFF6FF, #DBEAFE);
  border: 2.5px solid #93C5FD;
  box-shadow: 0 3px 0 #60A5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.hud-player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hud-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.hud-grade-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--math-light);
  color: var(--math-dark);
  border: 1px solid #93C5FD;
  white-space: nowrap;
}

.hud-rank-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
}

.hud-rank-badge {
  color: var(--boss);
  font-weight: 800;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gem-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 9px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #FEF9C3 0%, #FDE68A 100%);
  border: 2px solid #F59E0B;
  box-shadow: 0 3px 0 #D97706;
  font-size: 13px;
  font-weight: 900;
  color: #92400E;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.gem-pill:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #D97706;
}

.icon-btn-sm {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 2px solid var(--border-card);
  background: #FFFFFF;
  box-shadow: 0 3px 0 #CBD5E1;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn-sm:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #CBD5E1;
}

.mom-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 34px;
  padding: 0 9px;
  border-radius: 11px;
  border: 2px solid #F59E0B;
  background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%);
  box-shadow: 0 3px 0 #D97706;
  font-family: inherit;
  font-size: 12px;
  font-weight: 900;
  color: #92400E;
  cursor: pointer;
  white-space: nowrap;
}

.mom-pill-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #D97706;
}

/* ==========================================================================
   主视图容器与底部导航
   ========================================================================== */
.viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 20px;
  -webkit-overflow-scrolling: touch;
}

.viewport.in-game {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bottom-nav {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  background: #FFFFFF;
  border-top: 2px solid var(--border-card);
  z-index: 20;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 4px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: transparent;
  color: var(--ink-sub);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.14s ease;
}

.nav-item .nav-ico {
  font-size: 20px;
  line-height: 1.1;
}

.nav-item .nav-label {
  font-size: 11px;
  font-weight: 800;
}

.nav-item.active {
  background: #EEF2FF;
  border-color: #93C5FD;
  color: var(--math-dark);
  box-shadow: 0 3px 0 #BFDBFE;
  transform: translateY(-2px);
}

.nav-dot {
  position: absolute;
  top: 5px;
  right: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chinese);
  border: 2px solid #FFFFFF;
}

.nav-badge {
  position: absolute;
  top: 3px;
  right: 10px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--chinese);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
}

/* ==========================================================================
   通用 3D 潮玩按钮与卡片组件
   ========================================================================== */
.btn-3d {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.12s ease;
}

.btn-3d:active:not(:disabled) {
  transform: translateY(4px);
}

.btn-3d:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #3B82F6 0%, #2563EB 100%);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--math-dark);
}
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--math-dark); }

.btn-chinese {
  background: linear-gradient(180deg, #FB7185 0%, #F43F5E 100%);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--chinese-dark);
}
.btn-chinese:active:not(:disabled) { box-shadow: 0 1px 0 var(--chinese-dark); }

.btn-english {
  background: linear-gradient(180deg, #34D399 0%, #10B981 100%);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--english-dark);
}
.btn-english:active:not(:disabled) { box-shadow: 0 1px 0 var(--english-dark); }

.btn-boss {
  background: linear-gradient(180deg, #9333EA 0%, #7C3AED 100%);
  color: #FFFFFF;
  box-shadow: 0 5px 0 var(--boss-dark);
}
.btn-boss:active:not(:disabled) { box-shadow: 0 1px 0 var(--boss-dark); }

.btn-gold {
  background: linear-gradient(180deg, #FDE047 0%, #F59E0B 100%);
  color: #451A03;
  box-shadow: 0 5px 0 var(--gold-dark);
}
.btn-gold:active:not(:disabled) { box-shadow: 0 1px 0 var(--gold-dark); }

.btn-ghost {
  background: #FFFFFF;
  color: var(--ink-main);
  border: 2px solid var(--border-card);
  box-shadow: 0 4px 0 #CBD5E1;
}
.btn-ghost:active:not(:disabled) { box-shadow: 0 1px 0 #CBD5E1; }

.btn-block {
  width: 100%;
}

.card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: 0 5px 0 #E0E7FF;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 2px 10px;
}

.section-title {
  font-size: 16px;
  font-weight: 900;
  color: var(--ink-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-sub);
}

/* ==========================================================================
   大厅视图：赛季晋级横幅 + 机台卡片 + 每日跨科挑战
   ========================================================================== */
.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  color: #FFFFFF;
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 55%, #EC4899 100%);
  box-shadow: 0 6px 0 #4338CA, 0 14px 28px rgba(79, 70, 229, 0.25);
  overflow: hidden;
}

.hero-banner::after {
  content: "";
  position: absolute;
  right: -24px;
  top: -24px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hero-season-tag {
  font-size: 11px;
  font-weight: 900;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
}

.hero-grade-btn {
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: rgba(15, 23, 42, 0.28);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.hero-main {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-rank-big {
  font-size: 20px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-progress-wrap {
  margin-top: 10px;
}

.hero-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  opacity: 0.95;
  margin-bottom: 5px;
}

.progress-track {
  width: 100%;
  height: 12px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.3);
  overflow: hidden;
  padding: 2px;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FDE047, #FB923C);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-track.light {
  background: #E2E8F0;
}

.progress-track.light .progress-fill {
  background: linear-gradient(90deg, #3B82F6, #8B5CF6);
}

.boss-callout {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.28);
  border: 1.5px solid rgba(253, 224, 71, 0.65);
}

.boss-callout.ready {
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.28), rgba(249, 115, 22, 0.35));
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0); }
}

.boss-callout-text {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.boss-callout-btn {
  flex-shrink: 0;
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 12px;
}

/* 三大机台卡片 */
.cabinet-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cabinet-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: 22px;
  background: #FFFFFF;
  border: 2.5px solid var(--border-card);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.cabinet-card.math {
  border-color: #93C5FD;
  box-shadow: 0 6px 0 #BFDBFE;
}
.cabinet-card.chinese {
  border-color: #FDA4AF;
  box-shadow: 0 6px 0 #FECDD3;
}
.cabinet-card.english {
  border-color: #6EE7B7;
  box-shadow: 0 6px 0 #A7F3D0;
}

.cabinet-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #CBD5E1;
}

.cabinet-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  flex-shrink: 0;
  color: #FFFFFF;
}

.cabinet-card.math .cabinet-icon {
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  box-shadow: 0 4px 0 #1E40AF;
}
.cabinet-card.chinese .cabinet-icon {
  background: linear-gradient(135deg, #FB7185, #E11D48);
  box-shadow: 0 4px 0 #9F1239;
}
.cabinet-card.english .cabinet-icon {
  background: linear-gradient(135deg, #34D399, #059669);
  box-shadow: 0 4px 0 #065F46;
}

.cabinet-body {
  flex: 1;
  min-width: 0;
}

.cabinet-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.cabinet-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-main);
  white-space: nowrap;
}

.cabinet-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.cabinet-card.math .cabinet-tag { background: var(--math-light); color: var(--math-dark); }
.cabinet-card.chinese .cabinet-tag { background: var(--chinese-light); color: var(--chinese-dark); }
.cabinet-card.english .cabinet-tag { background: var(--english-light); color: var(--english-dark); }

.cabinet-desc {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-sub);
  line-height: 1.35;
}

.cabinet-meta {
  margin-top: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-muted);
}

.cabinet-arrow {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink-sub);
  flex-shrink: 0;
}

/* 每日跨科任务条 */
.quest-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quest-chip {
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  border-radius: 16px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: 0 4px 0 #E2E8F0;
}

.quest-chip.done {
  background: #F0FDF4;
  border-color: #86EFAC;
  box-shadow: 0 4px 0 #BBF7D0;
}

.quest-chip-ico { font-size: 20px; }
.quest-chip-title { font-size: 12px; font-weight: 900; margin-top: 3px; }
.quest-chip-stat { font-size: 11px; font-weight: 800; color: var(--ink-sub); margin-top: 2px; }
.quest-chip.done .quest-chip-stat { color: var(--success); }

/* ==========================================================================
   教材单元地图界面
   ========================================================================== */
.subpage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.back-btn {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  border: 2px solid var(--border-card);
  background: #FFFFFF;
  box-shadow: 0 3px 0 #CBD5E1;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #CBD5E1; }

.subpage-title {
  font-size: 18px;
  font-weight: 900;
}
.subpage-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
}

.unit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unit-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 20px;
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  box-shadow: 0 5px 0 #E2E8F0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: transform 0.08s ease;
}

.unit-card:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #E2E8F0;
}

.unit-num {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: #FFFFFF;
  flex-shrink: 0;
}

.unit-num.math { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.unit-num.chinese { background: linear-gradient(135deg, #FB7185, #E11D48); }
.unit-num.english { background: linear-gradient(135deg, #34D399, #059669); }

.unit-info {
  flex: 1;
  min-width: 0;
}

.unit-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-main);
}

.unit-focus {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unit-stars {
  font-size: 14px;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.unit-best {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-muted);
  text-align: right;
  margin-top: 2px;
}

/* ==========================================================================
   游戏局内通用框架（手机竖屏 100% 沉浸单手操控）
   ========================================================================== */
.game-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.game-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 12px 10px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 2px solid var(--border-card);
  z-index: 10;
}

.game-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 900;
  background: #F1F5F9;
  color: var(--ink-main);
}

.game-stat-pill.timer {
  background: #FEF3C7;
  color: #B45309;
  border: 1.5px solid #FCD34D;
}

.game-stat-pill.timer.urgent {
  background: #FEE2E2;
  color: #DC2626;
  border-color: #FCA5A5;
  animation: shakeTiny 0.4s infinite;
}

.game-stat-pill.combo {
  background: linear-gradient(90deg, #F59E0B, #EF4444);
  color: #FFFFFF;
}

.game-unit-strip {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-sub);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--border-card);
}

/* 数学《陨石防线》战场 */
.math-arena {
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, #0F172A 0%, #1E293B 55%, #1E3A8A 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.starfield-bg {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 15% 20%, rgba(255,255,255,0.8), transparent),
    radial-gradient(2px 2px at 78% 12%, rgba(147,197,253,0.8), transparent),
    radial-gradient(1.5px 1.5px at 45% 42%, rgba(255,255,255,0.7), transparent),
    radial-gradient(2px 2px at 86% 58%, rgba(253,224,71,0.7), transparent),
    radial-gradient(1.5px 1.5px at 22% 72%, rgba(255,255,255,0.6), transparent);
  pointer-events: none;
}

.meteor-entity {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: min(90%, 360px);
  padding: 16px 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, #FFFFFF, #EFF6FF);
  border: 3px solid #60A5FA;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.45), 0 0 0 6px rgba(59, 130, 246, 0.18);
  text-align: center;
  z-index: 4;
  transition: transform 0.12s ease;
}

.meteor-entity.danger-zone {
  border-color: #F87171;
  box-shadow: 0 10px 26px rgba(239, 68, 68, 0.55), 0 0 0 6px rgba(239, 68, 68, 0.25);
}

.meteor-entity.exploded {
  transform: translateX(-50%) scale(1.22);
  opacity: 0;
  transition: all 0.22s ease;
}

.meteor-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  color: var(--math-dark);
  background: var(--math-light);
  padding: 2px 10px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.meteor-question {
  font-size: 19px;
  font-weight: 900;
  color: var(--ink-main);
  line-height: 1.4;
  word-break: break-word;
}

.laser-beam {
  position: absolute;
  left: 50%;
  bottom: 58px;
  width: 10px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #38BDF8, #FDE047);
  border-radius: 99px;
  box-shadow: 0 0 18px #38BDF8, 0 0 32px #FDE047;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
}

.laser-beam.firing {
  opacity: 1;
  animation: laserFlash 0.24s ease-out;
}

@keyframes laserFlash {
  0% { opacity: 1; width: 16px; }
  100% { opacity: 0; width: 4px; }
}

.turret-base {
  position: relative;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border-top: 2px dashed rgba(147, 197, 253, 0.35);
  background: linear-gradient(180deg, rgba(30, 58, 138, 0.2), rgba(15, 23, 42, 0.85));
}

.turret-ship {
  font-size: 36px;
  filter: drop-shadow(0 4px 10px rgba(56, 189, 248, 0.6));
  transition: transform 0.12s ease;
}

.turret-ship.recoil {
  transform: translateY(6px) scale(1.1);
}

.fever-bar-wrap {
  position: absolute;
  top: 10px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
}

.fever-label {
  font-size: 11px;
  font-weight: 900;
  color: #FDE047;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
}

/* 底部单手 2x2 答案炮台面板 */
.answer-dock {
  flex-shrink: 0;
  padding: 12px 12px max(16px, env(safe-area-inset-bottom));
  background: #FFFFFF;
  border-top: 2.5px solid var(--border-card);
  z-index: 10;
}

.answer-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ans-btn {
  min-height: 62px;
  padding: 10px 10px;
  border-radius: 18px;
  border: 2.5px solid #CBD5E1;
  background: #F8FAFC;
  box-shadow: 0 5px 0 #CBD5E1;
  font-family: inherit;
  font-size: 16px;
  font-weight: 900;
  color: var(--ink-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  word-break: break-word;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.ans-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #CBD5E1;
}

.ans-btn.math-opt {
  background: #EFF6FF;
  border-color: #93C5FD;
  box-shadow: 0 5px 0 #60A5FA;
  color: #1E3A8A;
}

.ans-btn.chinese-opt {
  background: #FFF1F2;
  border-color: #FDA4AF;
  box-shadow: 0 5px 0 #FB7185;
  color: #881337;
}

.ans-btn.english-opt {
  background: #ECFDF5;
  border-color: #6EE7B7;
  box-shadow: 0 5px 0 #34D399;
  color: #064E3B;
}

.ans-btn.boss-opt {
  background: #F5F3FF;
  border-color: #C4B5FD;
  box-shadow: 0 5px 0 #8B5CF6;
  color: #4C1D95;
}

.ans-btn.hit-correct {
  background: #22C55E !important;
  border-color: #15803D !important;
  box-shadow: 0 2px 0 #15803D !important;
  color: #FFFFFF !important;
  transform: scale(1.03);
}

.ans-btn.hit-wrong {
  background: #EF4444 !important;
  border-color: #991B1B !important;
  box-shadow: 0 2px 0 #991B1B !important;
  color: #FFFFFF !important;
}

/* 语文《字词飞花令》舞台 */
.chinese-arena {
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, #FFF1F2 0%, #FFE4E6 55%, #FFEDD5 100%);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.blossom-scroll {
  width: 100%;
  background: #FFFFFF;
  border: 3px solid #FDA4AF;
  border-radius: 24px;
  padding: 20px 18px;
  box-shadow: 0 8px 0 #FECDD3, 0 16px 32px rgba(244, 63, 94, 0.14);
  text-align: center;
  position: relative;
  z-index: 2;
}

.blossom-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--chinese-light);
  color: var(--chinese-dark);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 12px;
}

.blossom-prompt {
  font-size: 21px;
  font-weight: 900;
  color: var(--ink-main);
  line-height: 1.55;
}

.blossom-sub {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-sub);
}

.petal-deco {
  position: absolute;
  font-size: 22px;
  opacity: 0.45;
  animation: floatPetal 5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes floatPetal {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(18deg); }
}

/* 英语《音浪拼词消消乐》舞台 */
.english-arena {
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, #ECFDF5 0%, #D1FAE5 55%, #CCFBF1 100%);
  padding: 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  overflow: hidden;
}

.sound-card {
  width: 100%;
  background: #FFFFFF;
  border: 3px solid #6EE7B7;
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 8px 0 #A7F3D0, 0 14px 28px rgba(16, 185, 129, 0.14);
  text-align: center;
}

.sound-wave-bars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  margin-bottom: 8px;
}

.wave-bar {
  width: 6px;
  border-radius: 99px;
  background: linear-gradient(180deg, #34D399, #059669);
  animation: wavePulse 0.9s ease-in-out infinite;
}

.wave-bar:nth-child(2) { animation-delay: 0.12s; }
.wave-bar:nth-child(3) { animation-delay: 0.24s; }
.wave-bar:nth-child(4) { animation-delay: 0.36s; }
.wave-bar:nth-child(5) { animation-delay: 0.48s; }

@keyframes wavePulse {
  0%, 100% { height: 8px; }
  50% { height: 26px; }
}

.speak-big-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 99px;
  border: 2px solid #34D399;
  background: #ECFDF5;
  color: #065F46;
  font-family: inherit;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 4px 0 #6EE7B7;
  cursor: pointer;
  margin-bottom: 10px;
}
.speak-big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #6EE7B7; }

.en-word-big {
  font-size: 28px;
  font-weight: 900;
  color: var(--ink-main);
  letter-spacing: 0.6px;
}

.en-phonetic {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-sub);
  margin-top: 3px;
}

.en-meaning-hint {
  font-size: 20px;
  font-weight: 900;
  color: #047857;
  margin-top: 4px;
}

.spell-slots {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
}

.spell-slot {
  min-width: 48px;
  height: 42px;
  padding: 0 12px;
  border-radius: 13px;
  border: 2.5px dashed #34D399;
  background: #F0FDF4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  color: #065F46;
}

.spell-slot.filled {
  border-style: solid;
  background: #10B981;
  border-color: #047857;
  color: #FFFFFF;
  cursor: pointer;
}

.spell-slot.filled:active {
  transform: scale(0.94);
}

.spell-slot.wrong-flash {
  border-style: solid;
  background: #EF4444;
  border-color: #991B1B;
  color: #FFFFFF;
}

.spell-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.spell-tile {
  min-width: 68px;
  height: 54px;
  padding: 0 14px;
  border-radius: 16px;
  border: 2.5px solid #6EE7B7;
  background: #ECFDF5;
  box-shadow: 0 5px 0 #34D399;
  font-family: inherit;
  font-size: 18px;
  font-weight: 900;
  color: #064E3B;
  cursor: pointer;
}
.spell-tile:active { transform: translateY(4px); box-shadow: 0 1px 0 #34D399; }
.spell-tile.used { opacity: 0.25; pointer-events: none; }

/* Boss 终极战舞台 */
.boss-arena {
  flex: 1;
  background: linear-gradient(180deg, #1E1B4B 0%, #312E81 52%, #4C1D95 100%);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
}

.boss-stage-header {
  text-align: center;
}

.boss-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
}

.boss-hp-track {
  width: 100%;
  height: 16px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.25);
  padding: 2px;
  overflow: hidden;
}

.boss-hp-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #EF4444, #F97316, #FACC15);
  transition: width 0.28s ease;
}

.boss-avatar-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 6px 0;
}

.boss-sprite {
  font-size: 64px;
  filter: drop-shadow(0 8px 18px rgba(244, 63, 94, 0.5));
  transition: transform 0.14s ease;
}

.boss-sprite.hit {
  transform: scale(0.84) rotate(-10deg);
  filter: drop-shadow(0 0 24px #FACC15);
}

.boss-Taunt {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  color: #E9D5FF;
  background: rgba(15, 23, 42, 0.45);
  padding: 4px 12px;
  border-radius: 99px;
}

.boss-question-card {
  background: #FFFFFF;
  color: var(--ink-main);
  border-radius: 20px;
  padding: 14px 15px;
  border: 3px solid #C4B5FD;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  text-align: center;
}

.boss-subj-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 7px;
  color: #FFFFFF;
}
.boss-subj-pill.math { background: var(--math); }
.boss-subj-pill.chinese { background: var(--chinese); }
.boss-subj-pill.english { background: var(--english); }

.boss-q-text {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.4;
}

/* ==========================================================================
   强纠错「护盾修复」弹窗 & 通用弹窗
   ========================================================================== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  animation: fadeIn 0.16s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  max-height: 88%;
  overflow-y: auto;
  background: #FFFFFF;
  border-radius: 26px;
  border: 3px solid var(--border-card);
  padding: 18px 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  animation: popUp 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.shield-alert {
  border-color: #FCA5A5;
  box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.28), 0 18px 40px rgba(0, 0, 0, 0.4);
}

@keyframes popUp {
  from { transform: scale(0.9) translateY(16px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.shield-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #FECACA;
}

.shield-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #FEE2E2;
  color: #DC2626;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shield-title {
  font-size: 16px;
  font-weight: 900;
  color: #B91C1C;
}

.shield-sub {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-sub);
}

.shield-explain-box {
  margin: 12px 0;
  padding: 12px 13px;
  border-radius: 16px;
  background: #FFFBEB;
  border: 2px solid #FDE68A;
}

.shield-explain-q {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink-main);
  margin-bottom: 6px;
}

.shield-explain-ans {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  background: #DCFCE7;
  color: #166534;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
}

.shield-explain-tip {
  font-size: 13px;
  font-weight: 700;
  color: #78350F;
  line-height: 1.5;
}

.shield-retry-label {
  font-size: 13px;
  font-weight: 900;
  color: var(--math-dark);
  margin: 10px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   段位通行证 & 虚拟 AI 排行榜
   ========================================================================== */
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: #E2E8F0;
  margin-bottom: 12px;
}

.seg-btn {
  padding: 9px 8px;
  border-radius: 12px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  color: var(--ink-sub);
  cursor: pointer;
}

.seg-btn.active {
  background: #FFFFFF;
  color: var(--math-dark);
  box-shadow: 0 3px 0 #CBD5E1;
}

.pass-tier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pass-tier-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  box-shadow: 0 4px 0 #E2E8F0;
}

.pass-tier-row.unlocked {
  border-color: #FCD34D;
  background: #FFFDF2;
}

.pass-tier-row.claimed {
  opacity: 0.78;
}

.pass-lv {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #EEF2FF;
  color: var(--math-dark);
  font-size: 13px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pass-tier-row.unlocked .pass-lv {
  background: linear-gradient(135deg, #FACC15, #F59E0B);
  color: #451A03;
}

.pass-reward-info {
  flex: 1;
  min-width: 0;
}

.pass-reward-name {
  font-size: 14px;
  font-weight: 900;
}

.pass-reward-req {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
  margin-top: 2px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 16px;
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  margin-bottom: 8px;
}

.lb-row.me {
  border-color: #3B82F6;
  background: linear-gradient(90deg, #EFF6FF, #EEF2FF);
  box-shadow: 0 4px 0 #93C5FD;
}

.lb-pos {
  width: 28px;
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  color: var(--ink-sub);
}

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.lb-info {
  flex: 1;
  min-width: 0;
}

.lb-name {
  font-size: 14px;
  font-weight: 900;
}

.lb-rank {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
}

.lb-score {
  font-size: 14px;
  font-weight: 900;
  color: var(--math-dark);
}

/* ==========================================================================
   错题特训 & 星光心愿兑换券
   ========================================================================== */
.mistake-item {
  background: #FFFFFF;
  border: 2px solid #FECDD3;
  border-radius: 18px;
  padding: 12px 13px;
  margin-bottom: 10px;
  box-shadow: 0 4px 0 #FFE4E6;
}

.mistake-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 6px;
}

.mistake-q {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink-main);
  margin-bottom: 4px;
}

.mistake-ans {
  font-size: 12px;
  font-weight: 800;
  color: var(--success);
}

.mistake-tip {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-sub);
  margin-top: 3px;
  line-height: 1.45;
}

.wish-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.wish-card {
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  border-radius: 20px;
  padding: 13px 11px;
  box-shadow: 0 5px 0 #E2E8F0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.wish-ico {
  font-size: 32px;
  text-align: center;
}

.wish-title {
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  line-height: 1.3;
}

.wish-cost {
  text-align: center;
  font-size: 13px;
  font-weight: 900;
  color: #B45309;
  background: #FEF3C7;
  padding: 3px 8px;
  border-radius: 99px;
}

/* 仪式感满满的星光兑换券凭证 */
.voucher-ticket {
  position: relative;
  border-radius: 22px;
  padding: 18px 16px;
  background: linear-gradient(135deg, #FEF9C3 0%, #FDE68A 50%, #FDBA74 100%);
  border: 3px dashed #B45309;
  color: #451A03;
  text-align: center;
  margin: 10px 0 14px;
}

.voucher-stamp {
  display: inline-block;
  padding: 4px 12px;
  border: 2.5px solid #DC2626;
  color: #DC2626;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 900;
  transform: rotate(-6deg);
  margin-top: 8px;
}

.voucher-code {
  margin-top: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.8;
}

.voucher-history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #FFFBEB;
  border: 2px solid #FDE68A;
  margin-bottom: 8px;
}

/* 表单输入框 */
.field-input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 2px solid var(--border-card);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-main);
  outline: none;
}

.field-input:focus {
  border-color: var(--math);
}

/* ==========================================================================
   特效层与 Toast（飘字高对比气泡、不遮挡弹窗大标题）
   ========================================================================== */
.fx-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
}

.float-pop {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translate(-50%, -50%);
  padding: 6px 16px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.92);
  border: 2.5px solid #FACC15;
  font-size: 18px;
  font-weight: 900;
  color: #FDE047;
  white-space: nowrap;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.38);
  animation: floatUpPop 0.78s ease-out forwards;
}

@keyframes floatUpPop {
  0% { opacity: 0; transform: translate(-50%, 6px) scale(0.75); }
  22% { opacity: 1; transform: translate(-50%, -10px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(0.98); }
}

.confetti-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  animation: confettiDrop 1.15s ease-out forwards;
}

@keyframes confettiDrop {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(360deg); opacity: 0; }
}

.toast-stack {
  position: absolute;
  top: 66px;
  left: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  z-index: 90;
}

.toast-item {
  background: rgba(15, 23, 42, 0.9);
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.16s ease;
}

@keyframes shakeTiny {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

.screen-shake {
  animation: shakeBig 0.28s ease;
}

@keyframes shakeBig {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* 结算卡片 */
.result-stars {
  font-size: 38px;
  letter-spacing: 6px;
  text-align: center;
  margin: 6px 0;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.result-stat {
  background: #F8FAFC;
  border: 2px solid var(--border-card);
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
}

.result-stat-v {
  font-size: 19px;
  font-weight: 900;
  color: var(--math-dark);
}

.result-stat-k {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-sub);
  margin-top: 2px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.grade-option {
  padding: 11px 10px;
  border-radius: 16px;
  border: 2px solid var(--border-card);
  background: #F8FAFC;
  text-align: left;
  cursor: pointer;
}

.grade-option.active {
  border-color: var(--math);
  background: #EFF6FF;
  box-shadow: 0 3px 0 #93C5FD;
}

.grade-option.coming {
  opacity: 0.72;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.avatar-opt {
  height: 46px;
  border-radius: 14px;
  border: 2px solid var(--border-card);
  background: #F8FAFC;
  font-size: 24px;
  cursor: pointer;
}

.avatar-opt.active {
  border-color: var(--math);
  background: #DBEAFE;
  box-shadow: 0 3px 0 #60A5FA;
}

/* ==========================================================================
   双入口门户（孩子入口 / 妈妈家长入口）& PIN 数字密码键盘 & 妈妈管理中心
   ========================================================================== */
.portal-screen {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.portal-hero {
  text-align: center;
  padding-top: 8px;
}

.portal-logo-badge {
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  border-radius: 26px;
  background: linear-gradient(135deg, #3B82F6 0%, #7C3AED 55%, #EC4899 100%);
  box-shadow: 0 8px 0 #4338CA, 0 14px 28px rgba(79, 70, 229, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.portal-title {
  font-size: 24px;
  font-weight: 900;
  color: var(--ink-main);
  letter-spacing: 0.4px;
}

.portal-sub {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-sub);
}

.portal-status-strip {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  box-shadow: 0 3px 0 #E0E7FF;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-main);
}

.portal-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.portal-entry-card {
  position: relative;
  width: 100%;
  border-radius: 26px;
  padding: 20px 18px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.portal-entry-card:active {
  transform: translateY(4px);
}

.portal-entry-card.kid {
  border: 3px solid #60A5FA;
  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 58%, #4F46E5 100%);
  color: #FFFFFF;
  box-shadow: 0 7px 0 #1E40AF, 0 14px 28px rgba(37, 99, 235, 0.25);
}

.portal-entry-card.kid:active {
  box-shadow: 0 2px 0 #1E40AF;
}

.portal-entry-card.parent {
  border: 3px solid #FCD34D;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEF3C7 100%);
  color: #451A03;
  box-shadow: 0 7px 0 #D97706, 0 10px 24px rgba(245, 158, 11, 0.16);
}

.portal-entry-card.parent:active {
  box-shadow: 0 2px 0 #D97706;
}

.portal-entry-ico {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.portal-entry-card.kid .portal-entry-ico {
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.portal-entry-card.parent .portal-entry-ico {
  background: #FFFFFF;
  border: 2px solid #F59E0B;
}

.portal-entry-body {
  flex: 1;
  min-width: 0;
}

.portal-entry-title {
  font-size: 19px;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 6px;
}

.portal-entry-desc {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0.92;
}

.portal-entry-pill {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 99px;
}

.portal-entry-card.kid .portal-entry-pill {
  background: rgba(255, 255, 255, 0.24);
  color: #FFFFFF;
}

.portal-entry-card.parent .portal-entry-pill {
  background: #F59E0B;
  color: #FFFFFF;
}

/* 4 位妈妈密码数字键盘 */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 16px;
}

.pin-dot {
  width: 44px;
  height: 48px;
  border-radius: 14px;
  border: 2.5px solid var(--border-card);
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  color: var(--math-dark);
}

.pin-dot.filled {
  border-color: var(--gold);
  background: #FFFBEB;
  color: #B45309;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-key {
  height: 50px;
  border-radius: 14px;
  border: 2px solid var(--border-card);
  background: #FFFFFF;
  box-shadow: 0 4px 0 #CBD5E1;
  font-family: inherit;
  font-size: 19px;
  font-weight: 900;
  color: var(--ink-main);
  cursor: pointer;
}

.pin-key:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #CBD5E1;
}

.pin-key.util {
  font-size: 13px;
  background: #F1F5F9;
  color: var(--ink-sub);
}

/* 妈妈专属管理中心顶栏与卡片 */
.parent-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border-bottom: 2.5px solid #F59E0B;
}

.parent-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border-radius: 16px;
  background: #E2E8F0;
  margin-bottom: 12px;
}

.parent-wish-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: #FFFFFF;
  border: 2px solid var(--border-card);
  box-shadow: 0 4px 0 #E2E8F0;
  margin-bottom: 9px;
}

.mom-note-banner {
  background: linear-gradient(135deg, #FFF1F2, #FFFBEB);
  border: 2px solid #FDA4AF;
  border-radius: 18px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 800;
  color: #9F1239;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-gem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.wish-icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.wish-icon-opt {
  height: 40px;
  border-radius: 12px;
  border: 2px solid var(--border-card);
  background: #F8FAFC;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.08s ease;
}

.wish-icon-opt:active {
  transform: scale(0.92);
}

.wish-icon-opt.active {
  border-color: var(--gold);
  background: #FEF3C7;
  box-shadow: 0 3px 0 #F59E0B;
}

