/**
 * 官网手机壳：对齐微信小程序 3.9.9 home + 底栏
 * html.shell-mobile / shell-desktop 切换
 */
:root {
  --rpx: calc(100vw / 750);
  --mp-topbar-h: calc(80 * var(--rpx));
  --mp-carousel-h: calc(300 * var(--rpx));
  --mp-dock-h: calc(110 * var(--rpx));
  --mp-sky-deep: #000428;
  --mp-sky-navy: #001a4d;
  --mp-sky-glow: #2b60b7;
  --mp-muted: #9db0cc;
  --mp-text: #e8eef8;
}

html.shell-desktop .mp-topbar,
html.shell-desktop .mp-dock,
html.shell-desktop .mp-home-body,
html.shell-desktop .mp-carousel-me-slot {
  display: none !important;
}

html.shell-mobile .nav-bar,
html.shell-mobile .workspace {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

html.shell-mobile .mp-topbar { display: flex; }
html.shell-mobile .mp-dock {
  display: block;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  z-index: 400 !important;
  width: 100%;
  margin: 0 !important;
}
html.shell-mobile .mp-home-body { display: block; }

html.shell-mobile,
html.shell-mobile body {
  height: auto;
  min-height: 100%;
  min-height: 100dvh;
}

html.shell-mobile body {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding-top: 0 !important;
  margin: 0 !important;
  padding-bottom: calc(var(--mp-dock-h) + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(43, 96, 183, 0.35), transparent 55%),
    linear-gradient(175deg, #000428 0%, #001a4d 40%, #173d7f 70%, #000428 100%);
}

html.shell-mobile .app-body {
  flex: 1 1 auto;
  overflow: visible;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding-top: 0 !important;
  margin-top: 0 !important;
}

html.shell-mobile .app-body > .carousel-wrap {
  position: relative;
  flex-shrink: 0;
  aspect-ratio: auto !important;
  height: var(--mp-carousel-h) !important;
  min-height: var(--mp-carousel-h) !important;
  max-height: var(--mp-carousel-h) !important;
  margin: 0 0 calc(4 * var(--rpx));
  padding: 0;
  border-radius: 0;
  order: -1; /* 确保轮播在手机壳内容最顶端 */
}
/* 首页轮播：用户图标独立锚点（与 mp-topbar / 子页顶栏解耦） */
html.shell-mobile .carousel-wrap > .mp-carousel-me-slot {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
html.shell-mobile .carousel-wrap > .mp-carousel-me-slot #mpMeBtn {
  position: absolute;
  left: calc(28 * var(--rpx));
  margin: 0;
  pointer-events: auto;
  z-index: 1;
}
html.shell-mp .carousel-wrap > .mp-carousel-me-slot #mpMeBtn {
  left: calc(24 * var(--rpx));
}
/* 旧版 index 若仍带轮播内 mp-topbar，隐藏以免双图层 */
html.shell-mobile .carousel-wrap > .mp-topbar {
  display: none !important;
}
html.shell-mobile .carousel-wrap .slide-content {
  display: none !important;
}

/* 手机版首页不展示备案；备案仅在「关于我们」 */
html.shell-mobile .home-footer {
  display: none !important;
}

html.shell-mobile .footer-full { display: none !important; }
html.shell-desktop .footer-beian-only { display: none !important; }

/* —— 顶栏：浮在轮播上，用户图标在轮播高度内垂直居中 —— */
.mp-topbar {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 60;
  align-items: center;
  justify-content: flex-start;
  gap: calc(16 * var(--rpx));
  height: var(--mp-carousel-h);
  min-height: 0;
  max-height: var(--mp-carousel-h);
  padding: env(safe-area-inset-top, 0px) calc(28 * var(--rpx)) 0;
  box-sizing: border-box;
  background: transparent;
  border-bottom: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.mp-topbar-inner {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  pointer-events: none;
}

.mp-topbar-title,
.mp-topbar-capsule-space {
  display: none;
}

html.shell-mobile .app-body {
  position: relative;
}

.mp-topbar-left,
.mp-me-btn {
  pointer-events: auto;
}

.mp-topbar-left {
  display: flex;
  align-items: center;
  gap: calc(16 * var(--rpx));
  min-width: 0;
}

.mp-me-btn {
  width: calc(88 * var(--rpx));
  height: calc(88 * var(--rpx));
  flex-shrink: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  color: #f97316;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  overflow: visible;
  box-sizing: border-box;
  padding: 0;
  position: relative;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.mp-me-btn .fa {
  font-size: calc(56 * var(--rpx));
  margin: 0;
  line-height: 1;
  color: #f97316;
}
.mp-me-btn .mp-me-text,
.mp-me-btn .btn-login-text {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.mp-me-btn.is-logged-in {
  width: calc(72 * var(--rpx));
  height: calc(72 * var(--rpx));
  border-radius: 50%;
  border: calc(2 * var(--rpx)) solid #93c5fd;
  background: #fff;
  padding: 0;
  overflow: hidden;
  filter: none;
}
.mp-me-btn .auth-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  border-radius: 50%;
}
.mp-me-btn.has-avatar .auth-avatar { display: block; }
.mp-me-letter {
  display: none;
  width: 100%; height: 100%;
  align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.mp-me-btn.has-letter {
  background: #2563eb !important;
  border-color: #93c5fd !important;
}
.mp-me-btn.has-letter .mp-me-letter { display: flex; }
.mp-me-btn.has-letter .fa,
.mp-me-btn.has-avatar .fa { display: none; }

/* —— 微信小程序 web-view：系统顶栏已有标题；H5 只放用户图标，避免双标题行 —— */
html.shell-mp {
  --mp-nav-bar-h: 0px;
}
html.shell-mp .mp-topbar {
  display: flex;
  justify-content: flex-start;
  width: auto;
  right: auto;
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
  pointer-events: none;
  box-sizing: border-box;
}
html.shell-mp .mp-topbar-inner {
  height: 100%;
  padding: 0;
  gap: 0;
  width: auto;
  align-items: center;
  pointer-events: none;
}
html.shell-mp .mp-topbar-left {
  flex: 0 0 auto;
  height: auto;
  pointer-events: auto;
}
html.shell-mp .mp-topbar-title,
html.shell-mp .mp-topbar-capsule-space {
  display: none !important;
}
/* 首页轮播用户区：登录前/后、游习/读书/软件各模块统一尺寸 */
html.shell-mobile .mp-topbar .mp-me-btn {
  width: calc(72 * var(--rpx)) !important;
  height: calc(72 * var(--rpx)) !important;
  min-width: calc(72 * var(--rpx));
  min-height: calc(72 * var(--rpx));
  border-radius: 50%;
  border: calc(2 * var(--rpx)) solid rgba(147, 197, 253, 0.65);
  background: rgba(15, 23, 42, 0.55);
  color: #fb923c;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: auto;
}
html.shell-mobile .mp-topbar .mp-me-btn .fa {
  font-size: calc(38 * var(--rpx)) !important;
  color: #fb923c;
}
html.shell-mobile .mp-topbar .mp-me-btn.is-logged-in,
html.shell-mobile .mp-topbar .mp-me-btn.has-avatar,
html.shell-mobile .mp-topbar .mp-me-btn.has-letter {
  width: calc(72 * var(--rpx)) !important;
  height: calc(72 * var(--rpx)) !important;
  border-color: #93c5fd;
  filter: none;
}
html.shell-mobile .mp-topbar .mp-me-btn.is-logged-in:not(.has-letter):not(.has-avatar) {
  background: #fff;
}
html.shell-mobile .mp-topbar .mp-me-btn.has-letter {
  background: #2563eb !important;
}
html.shell-mobile .mp-topbar .mp-me-btn.has-avatar {
  background: #fff !important;
}
html.shell-mobile .mp-topbar .mp-me-btn.has-avatar .auth-avatar {
  width: 100%;
  height: 100%;
  display: block;
}
html.shell-mp .mp-city {
  display: none !important;
}
html.shell-mp body {
  padding-top: 0 !important;
}
html.shell-mp .app-body {
  padding-top: 0;
}
html.shell-mp .carousel-wrap {
  margin-top: 0;
}

.mp-city {
  max-width: calc(280 * var(--rpx));
  font-size: calc(28 * var(--rpx));
  font-weight: 600;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mp-city:empty,
.mp-city[hidden] { display: none; }

.mp-brand { display: none !important; }

/* —— 内容区（对齐 home.wxss） —— */
.mp-home-body {
  display: none;
  flex: 1 1 auto;
  padding-bottom: calc(24 * var(--rpx));
  box-sizing: border-box;
  color: var(--mp-text);
}

.mp-home-body .youxi-back {
  padding: calc(4 * var(--rpx)) calc(28 * var(--rpx)) calc(8 * var(--rpx));
  color: #93c5fd;
  font-size: calc(26 * var(--rpx));
  cursor: pointer;
}

.mp-home-body .cats,
.mp-home-body .yx-subjects,
.mp-home-body .rd-cats,
.mp-home-body .svc-l1 {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: stretch;
  gap: calc(6 * var(--rpx));
  padding: calc(12 * var(--rpx)) calc(10 * var(--rpx)) calc(4 * var(--rpx));
  box-sizing: border-box;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* 游习一级学科：按内容宽度，不铺满屏（单科时也居中） */
.mp-home-body .yx-subjects {
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(10 * var(--rpx));
  padding-left: calc(24 * var(--rpx));
  padding-right: calc(24 * var(--rpx));
}
.mp-home-body .yx-badge {
  flex: 0 0 auto;
  min-width: calc(128 * var(--rpx));
  max-width: calc(320 * var(--rpx));
  padding: calc(12 * var(--rpx)) calc(28 * var(--rpx));
  text-align: center;
  border-radius: calc(14 * var(--rpx));
  font-size: calc(22 * var(--rpx));
  line-height: 1.25;
  color: #fff;
  border: calc(2 * var(--rpx)) solid transparent;
  box-sizing: border-box;
  white-space: nowrap;
  cursor: pointer;
}
.mp-home-body .cat,
.mp-home-body .rd-cat,
.mp-home-body .svc-badge {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  padding: calc(12 * var(--rpx)) calc(4 * var(--rpx));
  border-radius: calc(14 * var(--rpx));
  font-size: calc(22 * var(--rpx));
  line-height: 1.25;
  color: #fff;
  border: calc(2 * var(--rpx)) solid transparent;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.mp-home-body .cat.on,
.mp-home-body .rd-cat.on,
.mp-home-body .svc-badge.on { border-color: #fff; font-weight: 700; }
.mp-home-body .yx-badge.on { border-color: #fff; font-weight: 700; }
.mp-home-body .svc-badge.dim { opacity: 0.55; }

.mp-home-body .yx-subs,
.mp-home-body .rd-subs,
.mp-home-body .svc-subs {
  display: flex;
  flex-wrap: wrap;
  gap: calc(10 * var(--rpx));
  padding: calc(8 * var(--rpx)) calc(16 * var(--rpx)) calc(4 * var(--rpx));
}
/* 游习二、三级芯片：与一级学科行一致，居中排布 */
.mp-home-body .yx-subs {
  justify-content: center;
  padding-left: calc(24 * var(--rpx));
  padding-right: calc(24 * var(--rpx));
}
.mp-home-body .yx-sub {
  flex: 0 0 auto;
}
.mp-home-body .yx-sub,
.mp-home-body .rd-sub,
.mp-home-body .svc-sub {
  padding: calc(10 * var(--rpx)) calc(18 * var(--rpx));
  border-radius: 999px;
  font-size: calc(22 * var(--rpx));
  color: #9db0cc;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(147, 197, 253, 0.22);
  cursor: pointer;
}
.mp-home-body .yx-sub.on,
.mp-home-body .rd-sub.on,
.mp-home-body .svc-sub.on {
  color: #fff;
  background: #2b60b7;
  border-color: #2b60b7;
}

.mp-home-body .yx-trail {
  padding: calc(4 * var(--rpx)) calc(20 * var(--rpx)) calc(8 * var(--rpx));
  font-size: calc(22 * var(--rpx));
  color: #94a3b8;
  line-height: 1.4;
  word-break: break-all;
}

.mp-home-body .grid {
  display: flex;
  flex-wrap: wrap;
  padding: calc(8 * var(--rpx)) calc(12 * var(--rpx)) calc(24 * var(--rpx));
  box-sizing: border-box;
}
.mp-home-body .cell {
  width: 33.33%;
  box-sizing: border-box;
  padding: calc(8 * var(--rpx));
}
.mp-home-body .cell-card {
  background: linear-gradient(160deg, rgba(30, 58, 95, 0.55), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(147, 197, 253, 0.16);
  border-radius: calc(20 * var(--rpx));
  padding: calc(12 * var(--rpx)) calc(10 * var(--rpx)) calc(16 * var(--rpx));
  text-align: center;
  cursor: pointer;
}
.mp-home-body .cell:active .cell-card {
  transform: scale(0.97);
  background: rgba(43, 96, 183, 0.5);
}
.mp-home-body .cell-img {
  width: calc(150 * var(--rpx));
  height: calc(150 * var(--rpx));
  border-radius: calc(16 * var(--rpx));
  background: #0f172a;
  margin: 0 auto;
  display: block;
  object-fit: cover;
}
.mp-home-body .cell-icon {
  width: calc(150 * var(--rpx));
  height: calc(150 * var(--rpx));
  border-radius: calc(16 * var(--rpx));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: calc(48 * var(--rpx));
  font-weight: 700;
}
.mp-home-body .cell-name {
  margin-top: calc(12 * var(--rpx));
  font-size: calc(24 * var(--rpx));
  color: #e2e8f0;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mp-home-body .cell-name.ug-rtl {
  direction: rtl;
  font-family: ukijtuzt, UKIJTUZTOM, 'UKIJ Tuz Tom', 'Microsoft Uighur', sans-serif;
}
.mp-home-body .cell-name-bilingual {
  -webkit-line-clamp: 4;
  line-clamp: 4;
}
.mp-home-body .cell-name-bilingual .prod-bi-zh,
.prod-bi-zh {
  display: block;
  color: inherit;
}
.mp-home-body .cell-name-bilingual .prod-bi-ug,
.prod-bi-ug {
  display: block;
  margin-top: calc(6 * var(--rpx));
  font-size: calc(22 * var(--rpx));
  line-height: 1.4;
  color: #94a3b8;
  direction: rtl;
  font-family: ukijtuzt, UKIJTUZTOM, 'UKIJ Tuz Tom', 'Microsoft Uighur', sans-serif;
}
.mp-home-body .cell-sub {
  margin-top: calc(4 * var(--rpx));
  font-size: calc(20 * var(--rpx));
  color: #94a3b8;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.mp-home-body .empty {
  text-align: center;
  color: #64748b;
  font-size: calc(26 * var(--rpx));
  padding: calc(40 * var(--rpx)) 0;
}
.mp-home-body .tip {
  margin: calc(8 * var(--rpx)) calc(28 * var(--rpx));
  color: #fbbf24;
  font-size: calc(24 * var(--rpx));
  line-height: 1.5;
}

.mp-home-body .svc-list { padding: calc(8 * var(--rpx)) calc(16 * var(--rpx)) calc(28 * var(--rpx)); }
.mp-home-body .svc-card {
  margin-bottom: calc(14 * var(--rpx));
  padding: calc(22 * var(--rpx)) calc(20 * var(--rpx));
  border-radius: calc(16 * var(--rpx));
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(147, 197, 253, 0.18);
  cursor: pointer;
}
.mp-home-body .svc-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(12 * var(--rpx));
}
.mp-home-body .svc-name { font-size: calc(30 * var(--rpx)); font-weight: 700; color: #f8fafc; }
.mp-home-body .svc-badge-st {
  font-size: calc(20 * var(--rpx));
  padding: calc(4 * var(--rpx)) calc(12 * var(--rpx));
  border-radius: 999px;
}
.mp-home-body .svc-badge-st.on { color: #86efac; background: rgba(22, 163, 74, 0.25); }
.mp-home-body .svc-badge-st.off { color: #94a3b8; background: rgba(100, 116, 139, 0.25); }
.mp-home-body .svc-rate { margin-top: calc(8 * var(--rpx)); font-size: calc(22 * var(--rpx)); color: #cbd5e1; }
.mp-home-body .svc-rate-lab { color: #94a3b8; margin-right: calc(10 * var(--rpx)); }
.mp-home-body .svc-phone { margin-top: calc(10 * var(--rpx)); font-size: calc(26 * var(--rpx)); color: #38bdf8; }
.mp-home-body .svc-phone.muted { color: #94a3b8; }
.mp-home-body .svc-loc { margin-top: calc(8 * var(--rpx)); font-size: calc(22 * var(--rpx)); color: #9db0cc; }

/* —— 底栏 —— */
.mp-dock {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: #001a4d;
  border-top: 1px solid rgba(147, 197, 253, 0.18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: border-box;
  /* 避免祖先 transform 把 fixed 变成相对滚动容器 */
  transform: translateZ(0);
}
.mp-dock-modules {
  display: flex;
  gap: calc(8 * var(--rpx));
  padding: calc(10 * var(--rpx)) calc(12 * var(--rpx)) calc(8 * var(--rpx));
}
.mp-dock-modules button {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  border: 0;
  text-align: center;
  font-family: inherit;
  font-size: calc(28 * var(--rpx));
  font-weight: 700;
  line-height: 1.2;
  color: #9db0cc;
  padding: calc(18 * var(--rpx)) 0;
  border-radius: calc(12 * var(--rpx));
  background: rgba(15, 23, 42, 0.35);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mp-dock-modules button.is-active {
  color: #fff;
  background: #2b60b7;
}
.mp-dock-modules button[hidden] { display: none !important; }

html.shell-mobile.native-dock .mp-dock { display: none !important; }
html.shell-mobile.native-dock body { padding-bottom: env(safe-area-inset-bottom, 0px); }

.mp-home-toast {
  position: fixed;
  left: 50%;
  bottom: calc(160 * var(--rpx) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 90;
  max-width: 80vw;
  text-align: center;
}
.mp-home-toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
