/* ==========================================================================
   拼读星球 · 布局层
   ========================================================================== */

/* ============================ 应用骨架 ============================ */
.app {
  min-height: 100dvh;
  background: var(--bg-soft);
}

.app-body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ============================ 桌面侧边栏 ============================ */
.app-side {
  display: none;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}
.side-brand .sb-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  overflow: hidden;
  flex: none;
  box-shadow: 0 4px 12px rgba(122, 85, 255, 0.25);
}
.side-brand .sb-name {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.side-brand .sb-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 1px;
}

.side-nav {
  padding: var(--sp-2) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-label {
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-4);
  letter-spacing: 0.06em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background 0.16s, color 0.16s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
.nav-item.is-on {
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 600;
}
.nav-item .nav-ico {
  width: 22px;
  display: grid;
  place-items: center;
  flex: none;
}
.nav-item .nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.side-foot {
  margin-top: auto;
  padding: var(--sp-4);
  border-top: 1px solid var(--line);
}
.side-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2);
  border-radius: var(--r-md);
  transition: background 0.16s;
  width: 100%;
  text-align: left;
}
.side-user:hover {
  background: var(--brand-50);
}
.side-user .su-name {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}
.side-user .su-role {
  font-size: var(--fs-xs);
  color: var(--text-3);
}

/* ============================ 顶部栏 ============================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 90;
  padding-top: var(--sa-t);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.22s, box-shadow 0.22s;
}
.app-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 2px 12px rgba(26, 26, 46, 0.05);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  height: var(--header-h);
  padding: 0 var(--sp-4);
}
.header-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  min-width: 0;
}
.header-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 1px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  margin-left: auto;
}
.header-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: none;
}

/* 顶栏进度胶囊 */
.header-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 34px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: var(--fs-xs);
  font-weight: 700;
}

/* ============================ 主区 ============================ */
.app-main {
  flex: 1;
  padding-bottom: calc(var(--tabbar-h) + var(--sa-b) + var(--sp-4));
}
.page-container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}
.page-container.is-narrow {
  max-width: var(--maxw-narrow);
}
.page-container.is-wide {
  max-width: 1320px;
}

/* 页面分节 */
.section {
  padding: var(--sp-8) 0;
}
.section.tight {
  padding: var(--sp-5) 0;
}
.section.is-soft {
  background: var(--bg);
}

/* ============================ 移动底部标签栏 ============================ */
.app-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  display: flex;
  align-items: stretch;
  height: calc(var(--tabbar-h) + var(--sa-b));
  padding-bottom: var(--sa-b);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-4);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.18s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.tab-item.is-on {
  color: var(--brand-600);
}
.tab-item.is-on::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 3px;
  border-radius: 0 0 var(--r-full) var(--r-full);
  background: var(--brand-500);
}
.tab-item:active {
  transform: scale(0.94);
}

/* ============================ 主视觉（紫色区） ============================ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 42%, var(--hero-c) 100%);
  color: #fff;
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  margin: 0 calc(var(--sp-4) * -1) var(--sp-6);
  padding: var(--sp-8) var(--sp-5) var(--sp-9);
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero::before {
  width: 320px;
  height: 320px;
  top: -140px;
  right: -90px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
}
.hero::after {
  width: 260px;
  height: 260px;
  bottom: -150px;
  left: -80px;
  background: radial-gradient(circle, rgba(20, 224, 181, 0.28), transparent 70%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-6);
  align-items: center;
}
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: #fff;
  backdrop-filter: blur(4px);
}
.hero-title {
  margin-top: var(--sp-4);
  font-size: var(--fs-3xl);
  font-weight: 800;
  line-height: 1.18;
  color: #fff;
  letter-spacing: -0.02em;
}
.hero-slogan {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-4);
}
.hero-slogan span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-en);
  font-size: var(--fs-lg);
  font-weight: 700;
  color: #fff;
}
.hero-slogan span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
}
.hero-desc {
  margin-top: var(--sp-4);
  font-size: var(--fs-base);
  /* 底色调浅后，白字的不透明度要跟着提，否则小字会发灰 */
  color: rgba(255, 255, 255, 0.9);
  max-width: 520px;
}
.hero-art {
  display: none;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}
.hero-actions .btn {
  border: none;
}
.hero-actions .btn-ghost {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.hero-actions .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* 主视觉上的服务数据条 */
.hero-serve {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-top: var(--sp-6);
}
.hero-serve .hs-item {
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  backdrop-filter: blur(6px);
}
.hero-serve .hs-n {
  font-family: var(--font-en);
  font-size: var(--fs-2xl);
  font-weight: 800;
  line-height: 1;
  color: #fff;
}
.hero-serve .hs-n small {
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-left: 1px;
}
.hero-serve .hs-t {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

/* ============================ 浮起面板（覆盖在 hero 上） ============================ */
.pull-up {
  margin-top: calc(var(--sp-7) * -1);
  position: relative;
  z-index: 2;
}

/* ============================ 全屏模式（课堂/试练） ============================ */
.app.is-fullscreen .app-side,
.app.is-fullscreen .app-header,
.app.is-fullscreen .app-tabbar {
  display: none;
}
.app.is-fullscreen .app-main {
  padding-bottom: 0;
}
.app.is-fullscreen .page-container {
  max-width: none;
  padding: 0;
}

/* ============================ 安装提示条 ============================ */
.install-host {
  padding-top: var(--sp-4);
}
.install-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--brand-100), var(--teal-50));
  border: 1px solid var(--brand-200);
}
.install-bar .ib-ico {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  overflow: hidden;
  flex: none;
}
.install-bar .ib-t {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-800);
}
.install-bar .ib-s {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 1px;
}

/* ============================ 抽屉（移动端侧栏） ============================ */
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 180;
}
.drawer-root .drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 18, 36, 0.5);
  animation: lhx-fade-up 0.2s var(--ease) both;
}
.drawer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(82vw, 300px);
  padding-top: var(--sa-t);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: lhx-drawer-in 0.28s var(--ease) both;
}
@keyframes lhx-drawer-in {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: none;
  }
}

/* ============================ 底部操作条 ============================ */
.sticky-bar {
  position: sticky;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--sa-b));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}

/* ============================ 吸顶筛选条 ============================ */
.filter-bar {
  position: sticky;
  top: calc(var(--header-h) + var(--sa-t));
  z-index: 80;
  padding: var(--sp-3) 0;
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ============================ 两栏（详情页） ============================ */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
  align-items: start;
}
/* 左列必须能收缩，否则里面的 scroll-x / 长单词会把整栏撑破 */
.split-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================ 响应式 ============================ */

/* 平板 */
@media (min-width: 640px) {
  .page-container {
    padding: 0 var(--sp-6);
  }
  .hero {
    margin-left: calc(var(--sp-6) * -1);
    margin-right: calc(var(--sp-6) * -1);
    padding: var(--sp-10) var(--sp-6) var(--sp-11);
  }
  .hero-title {
    font-size: var(--fs-4xl);
  }
  .hero-grid {
    grid-template-columns: 1.25fr 0.75fr;
  }
  .hero-art {
    display: grid;
  }
  .hero-serve .hs-n {
    font-size: var(--fs-3xl);
  }
}

/* 桌面 */
@media (min-width: 1024px) {
  .app {
    display: flex;
    align-items: stretch;
  }
  .app-side {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100dvh;
    width: var(--sidebar-w);
    flex: none;
    background: var(--bg);
    border-right: 1px solid var(--line);
    overflow-y: auto;
  }
  .app-body {
    flex: 1;
    min-width: 0;
  }
  .app-main {
    padding-bottom: var(--sp-10);
  }
  .app-tabbar {
    display: none;
  }
  .header-inner {
    padding: 0 var(--sp-6);
  }
  .header-logo {
    display: none;
  }
  .split {
    grid-template-columns: minmax(0, 1fr) 344px;
    gap: var(--sp-6);
  }
  .split.is-side-first {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .hero {
    border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  }
  .sticky-panel {
    position: sticky;
    top: calc(var(--header-h) + var(--sp-5));
  }
}

@media (max-width: 1023px) {
  .split-side {
    order: 2;
  }
}

/* 超宽 */
@media (min-width: 1440px) {
  :root {
    --maxw: 1240px;
  }
}

/* ============================================================================
   应用模式（从桌面图标启动 / display: standalone）
   ----------------------------------------------------------------------------
   装到桌面之后，浏览器自己的下拉刷新、长按选字、双击缩放都还在，
   这些正是「网页感」的来源。这里在应用模式下把外壳的那部分关掉，
   让手感贴近原生应用。
   （下拉刷新与橡皮筋回弹已在 base.css 的 body 上全局关掉了，此处不再重复。）
   用 data-display 而不是只靠 @media (display-mode)：
   前者由 index.html 的首帧前脚本写入，媒体查询在冷启动时会晚一拍才生效。
   ========================================================================== */
html[data-display="standalone"] .app-header,
html[data-display="standalone"] .app-side,
html[data-display="standalone"] .app-tabbar,
html[data-display="standalone"] .install-bar {
  -webkit-user-select: none;
  user-select: none;
}

/* 应用模式下没有浏览器地址栏，顶栏就是唯一的「应用栏」，给它一条常驻底线 */
html[data-display="standalone"] .app-header {
  border-bottom-color: var(--line);
}

/* 装了之后就不再提示「装到桌面」——即使 JS 被绕过也不会露出安装条 */
html[data-display="standalone"] .install-bar {
  display: none !important;
}

@media (display-mode: standalone) {
  /* 独立窗口里没有地址栏，底部安全区已经由 tabbar 自己吃掉；
     这里只补一条：去掉 iOS 主屏模式下的点击高亮 */
  html {
    -webkit-tap-highlight-color: transparent;
  }
}
