/* ============================================================
   app-ui.css — APP 化界面（登录页 / 栏目选择 / PC 侧栏 / 童趣视觉）
   在 style.css 之后加载：只做增强与覆盖，不破坏原有模块样式。
   ============================================================ */

:root {
  --rq-blue: #2563c9;
  --rq-purple: #1f4fb0;
  --rq-pink: #e58a2e;
  --rq-orange: #f59e0b;
  --rq-green: #2dd4bf;
  --rq-cyan: #22b8e6;
  --rq-r1: 22px;
  --rq-shadow: 0 12px 30px rgba(20, 40, 80, .12);
  --rq-shadow-lg: 0 20px 46px rgba(20, 40, 80, .18);
}

/* ---------- 背景：柔和童趣渐变 + 光斑 ---------- */
body {
  /* 云 / 太阳 / 大雁只在登录、注册界面生效：这里（应用内部与后台）保持干净的浅蓝天空 */
  background-image:
    radial-gradient(900px 520px at 6% -10%, rgba(37, 99, 201, .12), transparent 60%),
    radial-gradient(760px 520px at 100% 4%, rgba(34, 184, 230, .12), transparent 60%),
    radial-gradient(820px 560px at 50% 112%, rgba(37, 99, 201, .06), transparent 60%),
    linear-gradient(180deg, #eaf5ff 0%, #e0eeff 45%, #d2e6fd 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#app {
  max-width: 1080px;
}

/* ---------- PC 侧栏（默认隐藏） ---------- */
.sidebar {
  display: none;
}

/* ---------- 分区标题 ---------- */
.sec-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: #2b4a75;
  margin: 20px 2px 10px;
  letter-spacing: .3px;
}

.sec-title::before {
  content: "";
  width: 6px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--rq-blue), var(--rq-purple));
}

/* ---------- 顶部用户条：卡片化 + 左侧渐变色条 + 右侧退出 ---------- */
.userbar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 18px;   /* 左边留出给色条的位置 */
  margin: 4px 0 8px;
  background: #fff;
  border: 1px solid rgba(58, 96, 160, .12);
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(58, 96, 160, .12);
}

/* 左侧竖向色条：配色跟着剩余天数走，一眼看出授权状态 */
.userbar::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  background: linear-gradient(180deg, var(--rq-blue), var(--rq-purple));
}
.userbar.ok::before   { background: linear-gradient(180deg, #6ee7fa, #4a8cff); }
.userbar.near::before { background: linear-gradient(180deg, #7ed0ff, #4a86ff); }
.userbar.warn::before { background: linear-gradient(180deg, #ffc16b, #ff7a45); }
.userbar.bad::before  { background: linear-gradient(180deg, #ffa1a1, #ef4b4b); }
.userbar.local::before{ background: linear-gradient(180deg, #7ff0c4, #22b07d); }

/* 头像：白底圆框 + 柔光 */
.ub-avatar {
  position: relative;
  z-index: 1;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(36, 72, 140, .18), inset 0 0 0 1px rgba(58, 96, 160, .12);
  overflow: hidden;
}
/* 头像本体是内联 SVG（渐变圆底 + 白色剪影），不再是 emoji */
.ub-av-svg {
  display: block;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(36, 72, 140, .28);
}

.ub-info {
  flex: 1;
  min-width: 0;
}

/* 第一行：昵称 / 账号 + 状态徽章 */
.ub-line1 {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ub-name {
  font-size: 15px;
  font-weight: 800;
  color: #22406b;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ub-badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 2px 8px;
  border-radius: 999px;
  color: #2563c9;
  background: rgba(74, 140, 255, .12);
  border: 1px solid rgba(74, 140, 255, .2);
}
.userbar.warn .ub-badge {
  color: #c9601a;
  background: rgba(255, 167, 74, .14);
  border-color: rgba(255, 167, 74, .3);
}
.userbar.bad .ub-badge {
  color: #c62f28;
  background: rgba(239, 75, 75, .13);
  border-color: rgba(239, 75, 75, .26);
}
.userbar.local .ub-badge {
  color: #12875f;
  background: rgba(34, 176, 125, .13);
  border-color: rgba(34, 176, 125, .26);
}

/* 第二行：手机 / 到期 / 套餐，一行排不下就省略 */
.ub-line2 {
  margin-top: 4px;
  font-size: 12px;
  color: #7b91ab;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 退出：右侧胶囊小按钮，悬停变实心红 */
.ub-logout {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  color: #d0342c;
  background: linear-gradient(135deg, rgba(255, 123, 107, .13), rgba(239, 75, 75, .1));
  border: 1px solid rgba(208, 52, 44, .22);
  box-shadow: 0 4px 10px rgba(208, 52, 44, .1);
  transition: transform .16s, background .16s, color .16s, box-shadow .16s;
}
.ub-logout:hover {
  color: #fff;
  background: linear-gradient(135deg, #ff7b6b, #ef4b4b);
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(239, 75, 75, .28);
}
.ub-logout:active { transform: scale(.95); }
.ub-exit-ic { width: 14px; height: 14px; }

@media (max-width: 380px) {
  .ub-logout span { display: none; }        /* 超窄屏只留图标 */
  .ub-logout { padding: 8px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .ub-logout { transition: none; }
}

/* ---------- 栏目大卡 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 6px;
}

.cat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--rq-r1);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--rq-shadow);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
}

.cat-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}

.cat-card:active {
  transform: scale(.985);
}

.cc-basic {
  background: linear-gradient(135deg, #4f8fe6, #1f4fb0);
}

.cc-redblue {
  background: linear-gradient(135deg, #ff6b6b, #ff8fb1);
}

.cc-bluered {
  background: linear-gradient(135deg, #38b6ff, #6f7dff);
}

.cc-fine {
  background: linear-gradient(135deg, #f5a623, #ef8a1e);
}

.cc-game {
  background: linear-gradient(135deg, #4ed8a0, #38c6f4);
}

.cc-icon {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .18));
}

.cc-body {
  flex: 1;
  min-width: 0;
}

.cc-name {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
}

.cc-desc {
  font-size: 12px;
  opacity: .92;
  margin-top: 3px;
  line-height: 1.45;
}

.cc-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-left: 6px;
}

.cc-count b {
  font-size: 22px;
  line-height: 1;
}

.cc-count span {
  font-size: 11px;
  opacity: .9;
}

/* ---------- 训练卡片美化 ---------- */
.module-card {
  border-radius: var(--rq-r1) !important;
  box-shadow: var(--rq-shadow);
  border: 1px solid rgba(255, 255, 255, .9);
  transition: transform .18s ease, box-shadow .18s ease;
}

.module-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--rq-shadow-lg);
}

.module-card.mc-more {
  background: linear-gradient(150deg, #ffffff, #eef5ff);
  border: 2px dashed rgba(74, 140, 255, .45);
}

.module-grid {
  gap: 14px;
}

/* ---------- 模块卡片 = 应用商店 APP 图标风格 ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 10px;
  margin-top: 12px;
}
.module-card {
  background: #ffffff !important;
  border: 1px solid rgba(31, 49, 92, .07) !important;
  box-shadow: 0 3px 10px rgba(31, 49, 92, .08) !important;
  border-radius: 16px !important;
  padding: 14px 6px 11px !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: relative;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .18s ease;
}
.module-card:active { transform: scale(.96); }
.module-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(31, 49, 92, .14); }

/* 图标 = 固定大小小图标（无背景色，参考应用商店布局） */
.module-card .mc-icon {
  width: 62px;
  height: 62px;
  max-width: 100%;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  line-height: 1;
  background: none;
  box-shadow: none;
  position: relative;
  overflow: visible;
}
.module-card .mc-icon::after { content: none; }
/* 名称 */
.module-card .mc-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink, #2a3656);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* 旧结构残留元素隐藏（兼容） */
.module-card .mc-badge,
.module-card .mc-desc,
.module-card .mc-go { display: none !important; }

/* “查看全部”图标（同样无背景色） */
.module-card.mc-more .mc-icon {
  color: #4a8cff;
  font-size: 40px;
}
.module-card.mc-more .mc-name { color: #4a8cff; font-weight: 700; }

/* 响应式列数：越宽越多列，贴近应用商店 */
@media (min-width: 560px) { .module-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 760px) { .module-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1040px) { .module-grid { grid-template-columns: repeat(8, 1fr); } }
@media (min-width: 1280px) { .module-grid { grid-template-columns: repeat(10, 1fr); } }
@media (max-width: 380px) {
  .module-card .mc-icon { width: 54px; height: 54px; font-size: 44px; }
  .module-card .mc-name { font-size: 11.5px; }
}

/* ---------- 栏目页 ---------- */
.cat-head {
  padding: 6px 2px 4px;
}

/* 「返回首页」：渐变胶囊按钮 + 小房子图标，比原来的纯蓝字更像按钮 */
.cat-back,
.big-btn.has-home,
.primary-btn.has-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 18px 0 14px;
  border: none;
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .5px;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #5b9bff, #2563c9 52%, #1f4fb0);
  box-shadow:
    0 8px 18px rgba(58, 105, 220, .28),
    inset 0 1px 0 rgba(255, 255, 255, .38);
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}
.cat-back .cb-ic,
.big-btn.has-home .cb-ic,
.primary-btn.has-home .cb-ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .14));
}
.cat-back:active,
.big-btn.has-home:active,
.primary-btn.has-home:active {
  transform: scale(.94);
  box-shadow: 0 4px 10px rgba(58, 105, 220, .24);
}
@media (hover: hover) {
  .cat-back:hover,
  .big-btn.has-home:hover,
  .primary-btn.has-home:hover {
    transform: translateY(-1px);
    filter: saturate(1.08) brightness(1.03);
    box-shadow: 0 11px 22px rgba(58, 105, 220, .32),
                inset 0 1px 0 rgba(255, 255, 255, .38);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cat-back,
  .big-btn.has-home,
  .primary-btn.has-home { transition: none; }
  .cat-back:hover, .cat-back:active,
  .big-btn.has-home:hover, .big-btn.has-home:active,
  .primary-btn.has-home:hover, .primary-btn.has-home:active { transform: none; }
}
/* 训练结束页 / 帮助页的返回按钮：沿用胶囊形，尺寸稍大更好点 */
.big-btn.has-home,
.primary-btn.has-home {
  width: 100%;
  min-height: 50px;
  font-size: 16px;
  padding: 0 22px;
}
.primary-btn.has-home { margin-top: 14px; }

.cat-title {
  font-size: 22px;
  font-weight: 800;
  color: #22406b;
  margin-top: 4px;
}

.cat-desc {
  font-size: 13px;
  color: #5b748f;
  margin-top: 4px;
  line-height: 1.5;
}

.cat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 2px 4px;
  scrollbar-width: none;
}

.cat-chips::-webkit-scrollbar {
  display: none;
}

/* ---------- 登录页 ---------- */
#screen-login {
  padding: 0;
}

/* 登录时：整屏"晨曦天空"背景（背景放在 body 上，内容区限宽居中，
   这样超宽屏不会出现两侧大片空白，也不用担心限宽后背景被截断）。
   明亮亲和风：上天蓝 → 中浅蓝 → 下暖白，两团静态柔光（无动画不"闪闪"） */
body.is-login {
  padding-left: 0;
  background-color: #eef1f7;
  background-image:
    radial-gradient(1100px 720px at 8% -6%, rgba(15, 42, 74, .10), transparent 60%),
    radial-gradient(900px 680px at 100% 8%, rgba(200, 163, 90, .10), transparent 58%),
    linear-gradient(165deg, #eef2f8 0%, #f5f7fb 45%, #eef1f7 100%);
  background-attachment: fixed;
  /* 装饰点阵用独立的固定层画，避免影响登录卡内的排版 */
  position: relative;
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ============================================================
   宇宙装饰层 v2（星空 / 星云 / 极光 / 大星球 / 十字星 / 火箭 / 流星）
   纯 CSS 绘制，不依赖图片；登录页与 index.php 无 JS 兜底页共用同一份结构
   ============================================================ */
.rq-space {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ---------- 克制版（rq-space--calm）：静态淡蓝点阵 ---------- */
/* 登录页只保留一层静态细点，关闭所有闪烁/漂浮/流动动画；
   明亮背景下白点不可见，覆盖为淡蓝/淡橙细点，像晴日里的微尘。 */
.rq-space--calm .sp-stars,
.rq-space--calm .sp-stars2,
.rq-space--calm .sp-stars3 {
  animation: none !important;
  opacity: .7;
  background-image:
    radial-gradient(1.6px 1.6px at 12px 18px, rgba(15, 42, 74, .14), transparent),
    radial-gradient(1.1px 1.1px at 64px 42px, rgba(200, 163, 90, .16), transparent),
    radial-gradient(1.9px 1.9px at 118px 96px, rgba(30, 64, 120, .10), transparent),
    radial-gradient(1px 1px at 36px 132px, rgba(200, 163, 90, .14), transparent);
}

.rq-space--calm .sp-nebula,
.rq-space--calm .sp-aurora,
.rq-space--calm .sp-spark,
.rq-space--calm .sp-planet,
.rq-space--calm .sp-rocket,
.rq-space--calm .sp-comet,
.rq-space--calm .sp-shoot {
  display: none !important;
}

/* ---------- 星云：三片大面积柔光，营造深邃氛围 ---------- */
.rq-space .sp-nebula {
  position: absolute;
  inset: 0;
  filter: blur(46px);
}

.rq-space .sp-nebula i {
  position: absolute;
  border-radius: 50%;
}

.rq-space .sp-nebula .n1 {
  width: 560px;
  height: 400px;
  left: -8%;
  top: 8%;
  background: radial-gradient(closest-side, rgba(147, 51, 234, .38), transparent 72%);
  animation: rqNebula 16s ease-in-out infinite;
}

.rq-space .sp-nebula .n2 {
  width: 500px;
  height: 380px;
  right: -6%;
  top: -10%;
  background: radial-gradient(closest-side, rgba(56, 189, 248, .30), transparent 72%);
  animation: rqNebula 20s ease-in-out infinite reverse;
}

.rq-space .sp-nebula .n3 {
  width: 620px;
  height: 440px;
  left: 28%;
  bottom: -18%;
  background: radial-gradient(closest-side, rgba(244, 114, 182, .30), transparent 72%);
  animation: rqNebula 24s ease-in-out infinite;
}

/* ---------- 极光带：斜向流动的彩色光幕（高端感） ---------- */
.rq-space .sp-aurora {
  position: absolute;
  left: -22%;
  right: -22%;
  top: 16%;
  height: 150px;
  transform: rotate(-13deg);
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(94, 234, 212, .16) 22%,
    rgba(129, 140, 248, .26) 46%,
    rgba(244, 114, 182, .18) 70%,
    transparent 100%);
  filter: blur(30px);
  animation: rqAurora 15s ease-in-out infinite;
}

/* ---------- 星空：三层视差星尘，密而有序 ---------- */
.rq-space .sp-stars {
  position: absolute;
  inset: -25% -12%;
  background-repeat: repeat;
  background-image:
    radial-gradient(1.7px 1.7px at 12px 18px, #ffffff, transparent),
    radial-gradient(1.2px 1.2px at 64px 42px, #d9e6ff, transparent),
    radial-gradient(2.1px 2.1px at 118px 96px, #ffffff, transparent),
    radial-gradient(1.1px 1.1px at 36px 132px, #ffe9a8, transparent),
    radial-gradient(1.5px 1.5px at 156px 24px, #ffd9f2, transparent),
    radial-gradient(1.3px 1.3px at 92px 168px, #ffffff, transparent);
  background-size: 190px 190px;
  animation: rqDrift 80s linear infinite, rqTwinkle 4.6s ease-in-out infinite;
}

.rq-space .sp-stars2 {
  position: absolute;
  inset: -25% -12%;
  background-repeat: repeat;
  background-image:
    radial-gradient(2.8px 2.8px at 40px 40px, rgba(255, 255, 255, .95), transparent),
    radial-gradient(2.2px 2.2px at 160px 130px, rgba(180, 214, 255, .9), transparent),
    radial-gradient(2.5px 2.5px at 96px 200px, rgba(255, 226, 176, .9), transparent),
    radial-gradient(2px 2px at 220px 70px, rgba(255, 255, 255, .85), transparent);
  background-size: 280px 280px;
  animation: rqDrift 120s linear infinite reverse, rqTwinkle 3.4s ease-in-out infinite;
}

/* 最远的一层星尘：极细、极密，撑起底色 */
.rq-space .sp-stars3 {
  position: absolute;
  inset: -25% -12%;
  background-repeat: repeat;
  background-image:
    radial-gradient(1px 1px at 26px 58px, rgba(255, 255, 255, .8), transparent),
    radial-gradient(1px 1px at 88px 12px, rgba(214, 232, 255, .7), transparent),
    radial-gradient(1px 1px at 142px 84px, rgba(255, 255, 255, .65), transparent),
    radial-gradient(1px 1px at 190px 150px, rgba(255, 233, 168, .6), transparent),
    radial-gradient(1px 1px at 54px 196px, rgba(255, 255, 255, .7), transparent),
    radial-gradient(1px 1px at 168px 30px, rgba(255, 217, 242, .55), transparent);
  background-size: 130px 130px;
  opacity: .8;
  animation: rqDrift 160s linear infinite, rqTwinkle 6s ease-in-out infinite;
}

/* ---------- 十字大星星：会"眨眼"的亮星 ---------- */
.rq-space .sp-spark {
  position: absolute;
  font-size: 21px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 12px rgba(255, 255, 255, .95), 0 0 30px rgba(167, 139, 250, .8);
  animation: rqPulse 3.2s ease-in-out infinite;
}

.rq-space .sp-spark.s2 { font-size: 15px; left: 30%; top: 12%; animation-delay: -1.1s; color: #ffe9a8; }
.rq-space .sp-spark.s3 { font-size: 17px; left: 47%; top: 66%; animation-delay: -2.2s; color: #cfe6ff; }
.rq-space .sp-spark.s4 { font-size: 13px; left: 70%; top: 30%; animation-delay: -.6s; }
.rq-space .sp-spark.s1 { left: 20%; top: 26%; }

/* ---------- 大星球们 ---------- */
.rq-space .sp-planet {
  position: absolute;
  border-radius: 50%;
  animation: rqFloat 9s ease-in-out infinite;
}

/* 主星球：大粉紫，最抢眼 */
.rq-space .p1 {
  width: 320px;
  height: 320px;
  left: -104px;
  top: 2%;
  background: radial-gradient(circle at 32% 26%, #ffe3bd 0%, #ff8fc4 40%, #b06bff 72%, #6d3ae0 100%);
  box-shadow: 0 0 110px rgba(255, 143, 196, .42), inset -34px -26px 70px rgba(88, 20, 120, .5);
}

.rq-space .p1::before {
  /* 表面高光 */
  content: '';
  position: absolute;
  left: 18%;
  top: 12%;
  width: 34%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  filter: blur(10px);
  transform: rotate(-18deg);
}

/* 带光环的小行星 */
.rq-space .p2 {
  width: 150px;
  height: 150px;
  right: 5%;
  top: 9%;
  background: radial-gradient(circle at 34% 28%, #ccf5ff 0%, #57bcff 50%, #2f66d8 92%);
  box-shadow: 0 0 70px rgba(87, 188, 255, .45), inset -18px -16px 40px rgba(20, 60, 130, .5);
  animation-duration: 12s;
  animation-delay: -3s;
}

.rq-space .p2::after {
  content: '';
  position: absolute;
  left: -46%;
  right: -46%;
  top: 45%;
  height: 46px;
  border: 7px solid rgba(255, 226, 176, .68);
  border-radius: 50%;
  transform: rotate(-18deg);
}

/* 月亮（带环形坑） */
.rq-space .p3 {
  width: 185px;
  height: 185px;
  right: 7%;
  bottom: 5%;
  background:
    radial-gradient(circle at 66% 32%, rgba(214, 196, 160, .5) 0 11%, transparent 12%),
    radial-gradient(circle at 38% 60%, rgba(214, 196, 160, .42) 0 9%, transparent 10%),
    radial-gradient(circle at 62% 68%, rgba(214, 196, 160, .36) 0 6%, transparent 7%),
    radial-gradient(circle at 30% 26%, #fffbe8 0%, #ffe6a3 55%, #f0bf60 100%);
  box-shadow: 0 0 80px rgba(255, 226, 150, .38);
  animation-duration: 14s;
  animation-delay: -6s;
}

/* 远处的迷你绿星球 */
.rq-space .p4 {
  width: 78px;
  height: 78px;
  left: 11%;
  bottom: 13%;
  background: radial-gradient(circle at 34% 30%, #e0fff2 0%, #4ce0b3 58%, #1f9e86 100%);
  box-shadow: 0 0 40px rgba(76, 224, 179, .45);
  animation-duration: 10s;
  animation-delay: -5s;
}

/* 紫色小伴星（PC 空白区点缀） */
.rq-space .p5 {
  width: 54px;
  height: 54px;
  left: 43%;
  top: 74%;
  background: radial-gradient(circle at 32% 30%, #f3e8ff 0%, #c084fc 55%, #7c3aed 100%);
  box-shadow: 0 0 34px rgba(192, 132, 252, .5);
  animation-duration: 11s;
  animation-delay: -7s;
}

/* ---------- 火箭 & 彗星 ---------- */
.rq-space .sp-rocket {
  position: absolute;
  left: 7%;
  top: 34%;
  font-size: 40px;
  line-height: 1;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .4)) drop-shadow(0 0 22px rgba(167, 139, 250, .5));
  animation: rqRocket 11s ease-in-out infinite;
}

/* 彗星：亮核 + 拖尾，缓慢横扫 */
.rq-space .sp-comet {
  position: absolute;
  left: 26%;
  top: 8%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 14px 3px rgba(255, 255, 255, .9);
  animation: rqComet 18s linear infinite;
}

.rq-space .sp-comet::before {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 130px;
  height: 2.5px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 255, 255, .9), rgba(167, 139, 250, .35), transparent);
  border-radius: 3px;
}

/* 流星：斜着划过一次，间歇循环（两条错开） */
.rq-space .sp-shoot {
  position: absolute;
  right: 24%;
  top: 5%;
  width: 110px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .95));
  transform: rotate(28deg);
  opacity: 0;
  animation: rqShoot 8s ease-in-out infinite;
}

.rq-space .sp-shoot.s2 {
  right: 55%;
  top: 16%;
  width: 76px;
  animation-delay: -4.2s;
  animation-duration: 9.5s;
}

@keyframes rqDrift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: -190px 130px, 130px -190px, -190px -190px, 190px 190px, 150px -160px, -150px 180px; }
}

@keyframes rqTwinkle {
  0%, 100% { opacity: .5; }
  50%      { opacity: 1; }
}

@keyframes rqFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-20px); }
}

@keyframes rqPulse {
  0%, 100% { opacity: .35; transform: scale(.82); }
  50%      { opacity: 1; transform: scale(1.12); }
}

@keyframes rqNebula {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(26px, -18px) scale(1.06); }
}

@keyframes rqAurora {
  0%, 100% { opacity: .55; transform: rotate(-13deg) translateX(0); }
  50%      { opacity: .95; transform: rotate(-13deg) translateX(60px); }
}

@keyframes rqRocket {
  0%   { transform: translate(0, 0) rotate(-12deg); }
  50%  { transform: translate(34px, -40px) rotate(6deg); }
  100% { transform: translate(0, 0) rotate(-12deg); }
}

@keyframes rqComet {
  0%   { transform: translate(0, 0); opacity: 0; }
  6%   { opacity: 1; }
  46%  { opacity: 1; }
  54%, 100% { transform: translate(46vw, 30vh); opacity: 0; }
}

@keyframes rqShoot {
  0%, 74%  { opacity: 0; transform: translate(0, 0) rotate(28deg); }
  80%      { opacity: 1; }
  92%      { opacity: .9; transform: translate(-170px, 92px) rotate(28deg); }
  100%     { opacity: 0; transform: translate(-220px, 120px) rotate(28deg); }
}

/* ---- 左侧品牌展示区（≥900px 才出现）—— 明亮亲和风 ---- */
.login-aside {
  display: none;
  flex: 1.05;
  flex-direction: column;
  justify-content: center;
  padding: 56px 54px;
  color: #eaf0f8;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(680px 460px at 16% 6%, rgba(200, 163, 90, .16), transparent 60%),
    linear-gradient(160deg, #0f2a4a 0%, #11335c 52%, #0a2138 100%);
}

.login-aside::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, rgba(200, 163, 90, .65), transparent);
}

/* 品牌标识行：Logo + 中英文名称 */
.la-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.la-logo {
  position: relative;
  width: 66px;
  height: 66px;
  flex: none;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: linear-gradient(140deg, #1a3f6e, #0f2a4a);
  border: 1.5px solid rgba(200, 163, 90, .55);
  box-shadow: 0 14px 32px rgba(0, 0, 0, .35), inset 0 0 0 4px rgba(255, 255, 255, .04);
  color: #e9d9a8;
}

.la-brand-tx { display: flex; flex-direction: column; }

.la-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffffff;
  line-height: 1.15;
}

.la-title-en {
  margin-top: 5px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  color: rgba(200, 163, 90, .88);
}

/* 主标语 + 副标语 */
.la-slogan {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f0f4fa;
}

.la-desc {
  margin: 10px 0 0;
  font-size: 14px;
  letter-spacing: .5px;
  color: rgba(214, 226, 242, .72);
}

/* 核心能力列表 */
.la-points {
  list-style: none;
  margin: 30px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.la-points li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.lap-ic {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(200, 163, 90, .30);
}

.la-points li b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  color: #ffffff;
}

.la-points li em {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  font-style: normal;
  color: rgba(200, 213, 232, .72);
}

/* 信任背书数据条：三枚半透明胶囊，深色背景上更有层次 */
.la-stats {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}

.la-stat {
  flex: 1;
  text-align: center;
  padding: 13px 8px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 16px;
}

.la-stat b {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: #e3c987;
  letter-spacing: .5px;
}

.la-stat span {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: rgba(212, 224, 242, .72);
}

.la-note {
  margin: 20px 0 0;
  font-size: 11.5px;
  line-height: 1.7;
  color: rgba(200, 214, 234, .58);
}

/* ---- 右侧表单区 ---- */
.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 16px calc(26px + env(safe-area-inset-bottom, 0px));
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 428px;
  background: #ffffff;
  border: 1px solid rgba(15, 42, 74, .08);
  border-radius: 24px;
  padding: 28px 24px 22px;
  box-shadow: 0 30px 70px rgba(15, 42, 74, .18), 0 4px 14px rgba(15, 42, 74, .06);
  overflow: hidden;
}

/* 卡内渐变描边，提升质感（深蓝 → 香槟金） */
.login-card::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(15, 42, 74, .32), rgba(200, 163, 90, .50) 50%, rgba(15, 42, 74, .32));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* 卡顶一道精致描金线：深蓝 → 香槟金 → 深蓝 */
.login-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f2a4a, #c8a35a 50%, #0f2a4a);
}

/* 移动端顶部品牌头（PC 由左侧品牌区代替） */
.lc-head {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e8edf3;
}

.lc-logo {
  position: relative;
  width: 50px;
  height: 50px;
  flex: none;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  background: linear-gradient(140deg, #1a3f6e, #0f2a4a);
  border: 1.5px solid rgba(200, 163, 90, .55);
  box-shadow: 0 8px 18px rgba(15, 42, 74, .28);
  color: #e9d9a8;
}

/* 卡片头保持清爽，不保留旋转装饰 */

.lc-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #0f2a4a;
  letter-spacing: .5px;
}

.lc-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: #7c8aa0;
}

@media (min-width: 900px) {
  .login-aside { display: flex; }
  .lc-head { display: none; }
  .login-main { padding: 44px 40px; }
  .login-card { padding: 32px 30px 24px; max-width: 440px; }
}

/* 大屏：内容再放大一档，填满 1180px 容器，避免中间空荡 */
@media (min-width: 1240px) {
  .login-wrap { max-width: 1240px; }
  .login-aside { padding: 64px 62px; }
  .la-title { font-size: 32px; }
  .login-main { padding: 52px 48px; }
  .login-card { max-width: 468px; padding: 34px 34px 26px; }
}

/* 中等宽度（笔记本 900~1100px）：压缩留白，卡片不被挤扁 */
@media (min-width: 900px) and (max-width: 1099px) {
  .login-aside { padding: 40px 34px; }
  .login-main { padding: 32px 26px; }
  .login-card { max-width: 400px; }
}

.login-tabs {
  display: flex;
  gap: 4px;
  background: #f1f4f9;
  padding: 5px;
  border-radius: 14px;
  margin-bottom: 20px;
}

.login-tabs button {
  flex: 1;
  padding: 11px 4px;
  font-size: 13.5px;
  font-weight: 700;
  color: #5e6f86;
  border-radius: 11px;
  transition: all .2s ease;
}

.login-tabs button:hover {
  color: #0f2a4a;
}

.login-tabs button.on {
  background: #0f2a4a;
  color: #f4e8c8;
  box-shadow: 0 6px 16px rgba(15, 42, 74, .28);
}

.login-pane label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #3a4a5e;
  margin: 12px 2px 6px;
}

.lg-input {
  width: 100%;
  padding: 13px 14px;
  font-size: 15px;
  border: 1.5px solid #dfe5ee;
  border-radius: 14px;
  background: #fbfcfe;
  color: #1e2a3a;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}

.lg-input:focus {
  border-color: #0f2a4a;
  box-shadow: 0 0 0 4px rgba(15, 42, 74, .10);
  background: #fff;
}

.lg-hint {
  font-size: 11px;
  color: #7c8aa0;
  margin: 8px 2px 0;
  line-height: 1.5;
}

.lg-tip {
  font-size: 12px;
  color: #3a4a5e;
  background: #f3f6fb;
  border-radius: 14px;
  padding: 10px 12px;
  line-height: 1.6;
}

.lg-who {
  font-size: 13px;
  font-weight: 800;
  color: #0f2a4a;
  background: #eef2f8;
  border-radius: 14px;
  padding: 9px 12px;
  margin-bottom: 10px;
}

.lg-tip.warn {
  color: #9a5b1a;
  background: #fbf2e6;
}

.lg-devlist {
  margin-top: 10px;
  border: 1px solid #e6ebf2;
  border-radius: 14px;
  overflow: hidden;
}

.lg-dev {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  font-size: 12px;
  color: #41506a;
  border-bottom: 1px solid #eef1f6;
}

.lg-dev:last-child { border-bottom: 0; }

.lg-dev.oldest {
  background: #fbf2e6;
  color: #9a5b1a;
  font-weight: 700;
}

.lg-dev-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lg-dev-no {
  font-family: ui-monospace, Consolas, monospace;
}

.lg-dev-t {
  color: #93a1b5;
  white-space: nowrap;
  font-weight: 400;
}

.lg-dev-kick {
  flex: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #c8a35a;
  background: #fbf4e6;
  color: #8a6a2b;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.lg-dev-kick:hover {
  background: #f6ead0;
  border-color: #b8923f;
}

/* 「换设备」开关已移除：设备已满时统一走弹窗提示（showFull） */

.lg-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #f4e8c8;
  border-radius: 16px;
  background: linear-gradient(135deg, #15406e 0%, #0f2a4a 55%, #0a2138 100%);
  box-shadow: 0 14px 30px rgba(15, 42, 74, .32);
  transition: transform .15s ease, box-shadow .15s ease;
}

/* 掠过按钮的一道香槟金柔光（每 3.6s 一次，幅度轻、不刺眼） */
.lg-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: -70%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(200, 163, 90, .35), transparent);
  animation: rqShine 3.6s ease-in-out infinite;
}

.lg-btn:hover {
  box-shadow: 0 18px 36px rgba(15, 42, 74, .42);
}

.lg-btn:active {
  transform: scale(.98);
}

.lg-btn:disabled {
  opacity: .65;
}

@keyframes rqShine {
  0%, 62% { left: -70%; }
  100%    { left: 130%; }
}

@keyframes rqSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.lg-link {
  display: block;
  width: 100%;
  margin-top: 12px;
  font-size: 13px;
  color: #0f2a4a;
  font-weight: 700;
  text-align: center;
}

.login-msg {
  min-height: 0;
  margin-top: 12px;
  font-size: 13px;
  text-align: center;
  color: #5e6f86;
  line-height: 1.5;
  border-radius: 14px;
  padding: 0;
  transition: all .18s ease;
}

.login-msg:not(:empty) {
  padding: 9px 12px;
  background: #f3f6fb;
}

.login-msg.err {
  color: #c0342c;
  font-weight: 700;
  background: #fef2f2;
  border: 1px solid #fbd5d1;
}

.login-msg.ok {
  color: #158a52;
  font-weight: 700;
  background: #ecfdf5;
  border: 1px solid #bfe9d3;
}

.login-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e8edf3;
  font-size: 12px;
  text-align: center;
  color: #8aa0b6;
  line-height: 1.9;
}

.login-foot a {
  color: #0f2a4a;
  text-decoration: none;
  font-weight: 700;
}

.login-foot a:hover {
  text-decoration: underline;
}

.login-slogan {
  margin: 0 0 2px;
  letter-spacing: 1px;
}

/* ---------- 首页 hero 微调 ---------- */
.hero {
  background: linear-gradient(140deg, rgba(255, 255, 255, .92), rgba(240, 247, 255, .85));
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--rq-r1);
  box-shadow: var(--rq-shadow);
}

.hero h1 {
  font-size: 21px;
}

/* ============================================================
   PC 端（>=1100px）：左侧栏 + 三列网格
   断点从 900 提到 1100：平板（iPad 横屏 1024 / 竖屏 768~834）不再
   被塞进"侧栏 + 中间留白"的 PC 布局，而是满屏的 APP 布局。
   ============================================================ */
@media (min-width: 1100px) {
  body {
    padding-left: 236px;
  }

  /* 满屏自适应：内容区贴着侧栏铺满剩余宽度，不再居中留大白边 */
  #app {
    max-width: 100%;
    margin: 0;
    padding-bottom: 32px;
  }

  .screen {
    padding: 20px 26px calc(26px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 236px;
    padding: 18px 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
    border-right: 1px solid #e2ebf6;
    box-shadow: 4px 0 24px rgba(58, 96, 160, .08);
    overflow-y: auto;
    z-index: 30;
  }

  .sb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 16px;
  }

  .sb-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, #5b9dff, #7c6cff);
    box-shadow: 0 6px 14px rgba(92, 108, 255, .3);
  }

  .sb-name {
    font-size: 17px;
    font-weight: 800;
    color: #22406b;
    letter-spacing: .5px;
  }

  .sb-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .sb-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 13px;
    font-size: 14px;
    color: #41597a;
    text-align: left;
    transition: background .16s, color .16s;
  }

  .sb-item span {
    flex: 1;
  }

  .sb-item em {
    font-style: normal;
    font-size: 11px;
    color: #9db0c9;
    background: #eef4fc;
    padding: 2px 7px;
    border-radius: 999px;
  }

  .sb-item:hover {
    background: #eaf2ff;
    color: var(--rq-blue);
  }

  /* 侧栏底部的分组分隔线：把「个人资料」这类账号项与训练项区分开 */
  .sb-sep {
    display: block;
    height: 1px;
    margin: 8px 10px 4px;
    background: linear-gradient(90deg, rgba(160, 180, 210, .05), rgba(160, 180, 210, .38), rgba(160, 180, 210, .05));
  }

  .sb-item.active {
    background: linear-gradient(120deg, rgba(74, 140, 255, .16), rgba(124, 108, 255, .12));
    color: var(--rq-blue);
    font-weight: 700;
  }

  .bottomnav {
    display: none;
  }

  .module-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .topbar {
    border-radius: 0 0 16px 16px;
  }
}

/* 大屏：卡片跟着屏幕变密，铺满不留空 */
@media (min-width: 1500px) {
  body {
    padding-left: 252px;
  }

  .sidebar {
    width: 252px;
  }

  .module-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .cat-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .screen {
    padding: 22px 30px calc(30px + env(safe-area-inset-bottom, 0px));
  }
}

/* 超宽屏：再多一列，避免卡片被拉得过宽 */
@media (min-width: 1900px) {
  body {
    padding-left: 268px;
  }

  .sidebar {
    width: 268px;
  }

  .module-grid {
    grid-template-columns: repeat(9, 1fr);
  }

  .cat-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ---------- 平板 / 小窗口：满屏 APP 布局，两侧不留白 ---------- */
@media (max-width: 1099px) {
  #app {
    max-width: 100%;
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar {
    display: none !important;
  }

  /* 底栏铺满整屏宽度，不要在大平板上缩成中间一条 */
  .bottomnav {
    max-width: 100%;
  }
}

@media (min-width: 620px) {
  .login-main { padding: 40px 32px; }
  .login-card { max-width: 520px; padding: 30px 28px 22px; }
}

/* 平板：栏目卡两列、训练卡四列，铺满整屏 */
@media (min-width: 620px) and (max-width: 1099px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .module-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .screen {
    padding: 14px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  }
}

/* 宽平板横屏（>=900 且 <1100）：卡片再密一点，更像 APP 桌面 */
@media (min-width: 900px) and (max-width: 1099px) {
  .module-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================
   训练页：整屏游戏布局（手机 / 平板 / PC 一致）
   - 撤掉侧栏留白与外框，画布撑满整屏
   - 开场说明全屏可滚动，「开始训练」固定在底部，永不遮挡说明与控件
   - 左上角圆形返回键 = 游戏返回，不依赖顶部栏
   ============================================================ */
body.is-training {
  padding-left: 0 !important;
  overflow: hidden;
}

body.is-training #app {
  max-width: 100%;
  padding-bottom: 0;
}

body.is-training .screen-training {
  position: fixed;
  inset: 0;
  z-index: 40;
  padding: 0;
  /* 用 fixed+inset:0 直接按 WebView 真实视口铺满，
     不再依赖 100dvh（安卓 WebView 沉浸式下 dvh 常只算可见区，
     会让训练屏高度停在导航栏上方，底部露出一条背景——即"半屏"）。 */
  display: flex;
  flex-direction: column;
  /* 整屏框架：深蓝渐变 + 两团静态柔光（无闪烁，儿童友好），
     让训练外壳本身也是"设计过的"，不再是空黑底。 */
  background-color: #081425;
  background-image:
    radial-gradient(820px 520px at 82% -8%, rgba(56, 150, 255, .12), transparent 60%),
    radial-gradient(720px 520px at 8% 112%, rgba(124, 108, 255, .12), transparent 60%),
    linear-gradient(165deg, #0d1c33 0%, #081425 55%, #060f1d 100%);
}

body.is-training .module-stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.is-training .training-shell {
  border-radius: 0;
  box-shadow: none;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 顶部 HUD：名称 / 计时 / 暂停 + 圆形返回 */
body.is-training .training-head {
  flex: none;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: 8px;
  padding-left: calc(10px + env(safe-area-inset-left, 0px));
  padding-right: calc(10px + env(safe-area-inset-right, 0px));
  gap: 8px;
  background-color: #0e1c33;
  background-image: linear-gradient(180deg, #15263f 0%, #0e1c33 100%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .35), inset 0 -1px 0 rgba(120, 160, 255, .12);
}

.th-back {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  padding: 0 0 3px;
  color: #eaf2ff;
  background: linear-gradient(160deg, #2f80ed, #5b6cff);
  box-shadow: 0 6px 16px rgba(47, 128, 237, .45);
  transition: transform .12s ease;
}

.th-back:active {
  transform: scale(.92);
}

body.is-training .training-head .th-name {
  font-size: 14px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 画布区：吃掉剩余高度，画布居中（画面完整不变形） */
body.is-training .training-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #060d18;
  background-image: linear-gradient(180deg, #0a1426 0%, #060d18 100%);
  overflow: hidden;
}

/* 画布尺寸由 JS（util.js canvasBudget）按实际可用高度算准，
   这里绝不能用 max-height 去压：显示尺寸与逻辑坐标必须 1:1，否则触摸会错位。 */
body.is-training .training-canvas-wrap canvas {
  flex: none;
}

/* 调节控件：固定在底部，超长可滚动，不会被画布顶出屏幕 */
body.is-training .training-controls {
  flex: none;
  max-height: 38vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(12px + env(safe-area-inset-left, 0px));
  padding-right: calc(12px + env(safe-area-inset-right, 0px));
  border-top: 1px solid rgba(255, 255, 255, .07);
}

/* 答案/选择按钮行：并排居中，不再被 margin-left:auto 拉到两端互相远离 */
body.is-training .training-controls .rq-ans-row {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}
body.is-training .training-controls .rq-ans-row .ctrl-btn {
  flex: 0 1 auto;
  margin-left: 0;
  margin-right: 0;
  min-width: 0;
  padding: 10px 14px;
  font-size: 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .28);
}
body.is-training .training-controls .rq-ans-row .ctrl-btn:active {
  transform: scale(.95);
}

body.is-training .glasses-hint {
  flex: none;
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
}

/* ---------- 全屏开场 / 结束页 ---------- */
.training-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background-color: rgba(6, 15, 29, .99);
  background-image:
    radial-gradient(760px 480px at 80% -10%, rgba(56, 150, 255, .14), transparent 60%),
    radial-gradient(680px 460px at 12% 112%, rgba(124, 108, 255, .14), transparent 60%),
    linear-gradient(165deg, rgba(13, 28, 51, .98), rgba(6, 15, 29, .99));
  backdrop-filter: blur(3px);
  color: #eaf2ff;
  text-align: center;
  padding: calc(14px + env(safe-area-inset-top, 0px))
           calc(18px + env(safe-area-inset-right, 0px))
           calc(16px + env(safe-area-inset-bottom, 0px))
           calc(18px + env(safe-area-inset-left, 0px));
}

.training-overlay.hidden {
  display: none !important;
}

/* 说明区：内容超高时自己滚动，按钮永远留在底部不遮内容 */
.ov-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 8px 2px 14px;
}

/* 内容少时垂直居中，内容多时从顶部开始（避免 flex 居中裁掉头部） */
.ov-body > :first-child { margin-top: auto; }
.ov-body > :last-child { margin-bottom: auto; }

.ov-foot {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .09);
}

.ov-foot .big-btn {
  width: 100%;
  max-width: 420px;
}

/* 开场 / 结束页的次级按钮：和「开始训练」同宽的实心玻璃按钮，带箭头图标指引 */
.ov-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  min-height: 47px;
  padding: 0 20px;
  border-radius: 15px;
  border: 1.6px solid rgba(163, 200, 255, .34);
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .10);
  color: #cfe0ff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .6px;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

.ov-back .ob-ic {
  flex: none;
  width: 19px; height: 19px;
  stroke: currentColor;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .18));
}

.ov-back:active {
  transform: scale(.97);
  background: rgba(255, 255, 255, .13);
}

@media (hover: hover) {
  .ov-back:hover {
    color: #eaf2ff;
    background: rgba(255, 255, 255, .13);
    border-color: rgba(163, 200, 255, .58);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ov-back { transition: none; }
  .ov-back:active { transform: none; }
}

/* 竖屏手机：说明更紧凑，按钮仍然是整行大按钮 */
@media (max-width: 480px) {
  .ov-body { gap: 11px; }
  .ov-foot .big-btn,
  .ov-back { max-width: 100%; }
}

/* 小屏：星体收拢，别挤到登录卡 */
@media (max-width: 620px) {
  .rq-space .p1 { width: 220px; height: 220px; left: -80px; top: -2%; }
  .rq-space .p2 { width: 92px; height: 92px; right: 3%; top: 4%; }
  .rq-space .p2::after { height: 30px; border-width: 5px; }
  .rq-space .p3 { width: 110px; height: 110px; right: 1%; bottom: 3%; }
  .rq-space .p4 { width: 52px; height: 52px; left: 5%; bottom: 7%; }
  .rq-space .p5 { display: none; }
  .rq-space .sp-rocket { left: 3%; top: 22%; font-size: 30px; }
  .rq-space .sp-shoot { right: 14%; }
  .rq-space .sp-shoot.s2 { display: none; }
  .rq-space .sp-spark.s3 { left: 40%; top: 60%; }
}

/* 横屏矮屏：开场页横向排布，说明与按钮并排，互不遮挡 */
@media (max-height: 520px) and (orientation: landscape) {
  .training-overlay {
    flex-direction: row;
    align-items: stretch;
    gap: 16px;
    text-align: left;
  }
  .ov-body {
    flex: 1 1 auto;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
  }
  .ov-body > :first-child { margin-top: 0; }
  .ov-body > :last-child { margin-bottom: 0; }
  .ov-foot {
    flex: 0 0 200px;
    justify-content: center;
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, .09);
    padding: 0 0 0 16px;
  }
  .ov-foot .big-btn,
  .ov-back { max-width: 200px; }
}

/* ---------- 无障碍：降低动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .cat-card,
  .module-card,
  .lg-btn {
    transition: none;
  }

  /* 关闭星空/星球/流星的漂浮与闪烁，避免对光敏感的孩子不适 */
  .rq-space span,
  .rq-space i,
  .la-logo::after,
  .lc-logo::after,
  .lg-btn::after {
    animation: none !important;
  }

  .rq-space .sp-shoot,
  .rq-space .sp-comet {
    display: none;
  }
}

/* ---------- 个人资料：页头（返回胶囊 + 居中标题） ---------- */
.pf-top {
  margin: 2px 0 8px;
}
.pf-title {
  margin: 0 0 4px;
  text-align: center;
  font-size: 19px;
  font-weight: 800;
  color: #22406b;
  letter-spacing: .5px;
}
.pf-sub {
  margin: 0 0 12px;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.6;
  color: #8496ad;
}
/* 操作卡里的「退出登录」用红色，替代原来底部单独漂浮的 danger-btn */
.pf-act.danger .pf-act-ic {
  background: linear-gradient(135deg, rgba(255, 138, 128, .26), rgba(239, 75, 75, .18));
}
.pf-act.danger b { color: #d0342c; }
.pf-act.danger .pf-act-ar { color: #ecb3b0; }
.pf-act.danger:hover { background: rgba(239, 75, 75, .06); }
.pf-act.danger:hover .pf-act-ar { color: #ef4b4b; }

/* ---------- 个人资料：头像 Hero + 数据条 + 明细卡 ---------- */
.pf-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 16px; margin-bottom: 10px;
  border-radius: 22px; color: #fff;
  background: linear-gradient(125deg, #5aa8ff 0%, #4a86ff 45%, #6b6cff 100%);
  box-shadow: 0 14px 30px rgba(58, 96, 160, .26);
}
/* 右上 / 左下柔光，避免大面积渐变显得平板 */
.pf-hero::before,
.pf-hero::after {
  content: ''; position: absolute; border-radius: 50%; pointer-events: none;
}
.pf-hero::before { right: -34px; top: -44px; width: 132px; height: 132px; background: rgba(255, 255, 255, .22); }
.pf-hero::after  { left: 92px; bottom: -70px; width: 156px; height: 156px; background: rgba(255, 255, 255, .13); }
/* 剩余天数越少越醒目 */
.pf-hero.near { background: linear-gradient(125deg, #7ed0ff 0%, #3f8cf7 55%, #6b6cff 100%); }
.pf-hero.warn { background: linear-gradient(125deg, #ffb057 0%, #ff7a45 100%); box-shadow: 0 14px 30px rgba(255, 122, 69, .28); }
.pf-hero.bad  { background: linear-gradient(125deg, #ff9494 0%, #ef4b4b 100%); box-shadow: 0 14px 30px rgba(239, 75, 75, .28); }

.pf-av {
  position: relative; z-index: 1; flex: none; width: 64px; height: 64px;
  border-radius: 50%; padding: 3px; background: rgba(255, 255, 255, .55);
  box-shadow: 0 6px 18px rgba(20, 40, 90, .26), inset 0 0 0 1px rgba(255, 255, 255, .75);
}
.pf-av .ub-av-svg { display: block; border-radius: 50%; }

.pf-hero-tx { position: relative; z-index: 1; flex: 1; min-width: 0; }
.pf-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 800; color: #fff; line-height: 1.35;
  text-shadow: 0 1px 6px rgba(20, 40, 90, .22);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-badge {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 9px; border-radius: 999px; color: #fff;
  background: rgba(255, 255, 255, .24); border: 1px solid rgba(255, 255, 255, .5);
}
.pf-plan { margin-top: 3px; font-size: 12.5px; color: rgba(255, 255, 255, .92); }

.pf-metrics { display: flex; gap: 10px; margin-bottom: 10px; }
.pf-metric {
  flex: 1; min-width: 0; text-align: center;
  background: #fff; border: 1px solid rgba(58, 96, 160, .12);
  border-radius: 16px; padding: 11px 10px;
  box-shadow: 0 6px 16px rgba(58, 96, 160, .08);
}
.pf-metric b {
  display: block; font-size: 20px; font-weight: 800; color: #22406b;
  line-height: 1.3; letter-spacing: .2px; word-break: break-all;
}
.pf-metric b.ok   { color: #1a9e6e; }
.pf-metric b.near { color: #2d6fe0; }
.pf-metric b.warn { color: #e2761b; }
.pf-metric b.bad  { color: #d63a3a; }
.pf-metric span { font-size: 11.5px; color: #7b91ab; }

.pf-card {
  background: #fff; border: 1px solid rgba(58, 96, 160, .12);
  border-radius: 18px; padding: 2px 14px; margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(58, 96, 160, .08);
}
.pf-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 0; font-size: 13.5px;
  border-bottom: 1px dashed rgba(58, 96, 160, .16);
}
.pf-row:last-child { border-bottom: 0; }
.pf-ic {
  flex: none; width: 26px; height: 26px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px;
  background: linear-gradient(135deg, rgba(110, 198, 255, .22), rgba(91, 108, 255, .18));
}
.pf-k { flex: none; color: #7b91ab; }
.pf-row b { margin-left: auto; color: #22406b; font-weight: 600; text-align: right; word-break: break-all; }

.pf-key {
  border-radius: 18px; padding: 12px 14px; margin-bottom: 10px;
  background: linear-gradient(135deg, rgba(110, 198, 255, .14), rgba(91, 108, 255, .12));
  border: 1px dashed rgba(74, 140, 255, .42);
}
.pf-key-hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.pf-key-t { font-size: 12px; font-weight: 700; color: #4a68a0; }
.pf-copy {
  flex: none; padding: 4px 13px; border-radius: 999px; cursor: pointer; transition: .18s;
  border: 1px solid rgba(74, 140, 255, .45); background: #fff; color: #2b62c9;
  font-size: 12px; font-weight: 700;
}
.pf-copy:hover { background: #2b62c9; border-color: #2b62c9; color: #fff; }
.pf-key-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
  color: #1b4fa0; word-break: break-all; user-select: all;
}

.pf-acts {
  background: #fff; border: 1px solid rgba(58, 96, 160, .12);
  border-radius: 18px; overflow: hidden; margin-bottom: 10px;
  box-shadow: 0 6px 16px rgba(58, 96, 160, .08);
}
.pf-act {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 14px; background: #fff; border: 0;
  border-bottom: 1px solid rgba(58, 96, 160, .1); cursor: pointer; transition: background .18s;
}
.pf-act:last-child { border-bottom: 0; }
.pf-act:hover { background: rgba(74, 140, 255, .06); }
.pf-act-ic {
  flex: none; width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(135deg, rgba(110, 198, 255, .2), rgba(91, 108, 255, .16));
}
.pf-act-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.pf-act-tx b { font-size: 13.5px; font-weight: 600; color: #22406b; }
.pf-act-tx em { font-style: normal; font-size: 11.5px; color: #8496ad; }
.pf-act-ar { flex: none; width: 16px; height: 16px; color: #a7b6cb; transition: .18s; }
.pf-act:hover .pf-act-ar { color: #4a8cff; transform: translateX(2px); }

@media (max-width: 380px) {
  .pf-av { width: 56px; height: 56px; }
  .pf-name { font-size: 16px; }
  .pf-metric b { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .pf-act, .pf-copy, .pf-act-ar { transition: none; }
}

/* ---------- 个人资料：昵称可编辑 ---------- */
.pf-edit {
  flex: none; margin-left: 6px; padding: 3px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(74, 140, 255, .4); background: rgba(74, 140, 255, .08);
  color: #2b62c9; font-size: 12px; font-weight: 700; transition: .18s;
}
.pf-edit:hover { background: #2b62c9; border-color: #2b62c9; color: #fff; }

.pf-edit-card {
  background: #fff; border: 1px solid rgba(74, 140, 255, .3);
  border-radius: 18px; padding: 14px; margin-bottom: 10px;
  box-shadow: 0 8px 20px rgba(58, 96, 160, .12);
  animation: pfSlideIn .22s ease-out;
}
.pf-edit-card > b { display: block; font-size: 14px; font-weight: 700; color: #22406b; }
.pf-edit-hint { margin: 3px 0 9px; font-size: 11.5px; line-height: 1.55; color: #8496ad; }
.pf-edit-msg { min-height: 17px; margin-top: 7px; font-size: 12.5px; font-weight: 600; color: #d63a3a; }
.pf-edit-msg:empty { min-height: 0; margin-top: 0; }
.pf-edit-btns { display: flex; gap: 8px; margin-top: 8px; }
.pf-edit-btns .primary-btn,
.pf-edit-btns .ghost-btn { flex: 1; margin-top: 0; }

@keyframes pfSlideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pf-edit-card { animation: none; }
  .pf-edit { transition: none; }
}
