/* H5 移动端专属样式：顶部栏、抽屉、底部 tab、单列内容。
   只在窄屏生效；桌面端完全不受影响。 */

/* 默认隐藏 —— 桌面不出现底部 tab 与 H5 顶栏 */
.h5-tabbar,
.h5-topbar,
.h5-drawer {
  display: none;
}

/* 顶部与底部为固定栏，给内容让出空间（含刘海/手势条安全区） */
body {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
}

/* ── H5 顶栏 ───────────────────────────────────────── */
.h5-topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  position: sticky;
  top: 0;
  z-index: 60;
  background: #fff;
  border-bottom: 1px solid #eceef2;
  padding: 0 10px;
  padding-top: env(safe-area-inset-top, 0px);
  min-height: 54px;
}
.h5-topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: #44475b;
  border-radius: 10px;
  padding: 0;
}
.h5-topbar-btn:active {
  background: #f2f4f7;
}
.h5-icon {
  width: 22px;
  height: 22px;
}
.h5-topbar-brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: #00b386;
  text-decoration: none;
  margin-right: auto;
  padding-left: 2px;
}
.h5-topbar-search {
  margin-left: auto;
}
.h5-topbar-login {
  border: 0;
  background: #00b386;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  margin-left: 4px;
  white-space: nowrap;
}

/* PC / H5 双外壳下，桌面头部只在 PC 壳里出现。
 * 以前这里是无条件 display:none（当时只有手机版），
 * 现在改成按 body 外壳类判断，PC 壳里要能显示出来。 */
body.gw-h5 .groww-header {
  display: none;
}

body.gw-pc .groww-header {
  display: block;
}

/* ── 抽屉菜单 ─────────────────────────────────────── */
.h5-drawer {
  display: block;
  position: fixed;
  inset: 0 auto 0 0;
  width: 78%;
  max-width: 320px;
  background: #fff;
  z-index: 80;
  box-shadow: 0 0 40px rgba(20, 24, 31, 0.18);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  -webkit-overflow-scrolling: touch;
}
.h5-drawer[hidden] {
  display: block;
}
.h5-drawer.open {
  transform: translateX(0);
}
.h5-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid #eceef2;
  font-weight: 600;
  color: #44475b;
}
.h5-drawer-close {
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #7c7e8c;
  padding: 0 4px;
  cursor: pointer;
}
.h5-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 6px 0 24px;
}
.h5-drawer-nav a {
  padding: 13px 18px;
  color: #313549;
  text-decoration: none;
  font-size: 15px;
  border-bottom: 1px solid #f6f6f7;
}
.h5-drawer-nav a:active {
  background: #f4fbf8;
}
/* 抽屉打开时压暗背景 */
.h5-scrim {
  position: fixed;
  inset: 0;
  background: rgba(17, 20, 24, 0.42);
  z-index: 70;
  display: none;
}
.h5-scrim.show {
  display: block;
}

/* ── 底部 tab 栏 ──────────────────────────────────── */
/* 底栏按参考图测量：分隔线在 y742、图标 18px 顶 y760、文字 10px 底 y795。
   五个 tab 等分整宽（375/5=75）。激活态是蓝色，不是 Groww 绿。 */
/* ── 全站统一外壳：22px 提示条 + 46px 居中标题行（数值同 Market 页实测） ──
   顶栏同时带 .h5-topbar 类（复用显示/隐藏规则），这里把旧规则的高度与布局全部改掉。 */
.h5-banner {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--mkt-banner-bg, #f1f5ff);
  color: var(--mkt-banner-fg, #9da3af);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.085em;
  line-height: 1;
}
.h5-banner .mkt-banner-info {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  opacity: 0.75;
}

.h5-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  height: 46px;
  min-height: 46px;
  background: #fff;
  border-bottom: 0;
  padding: 0 14px;
  padding-top: 0;
}
.h5-head-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--mkt-ink, #12161c);
}
.h5-head-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--mkt-ink, #12161c);
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.h5-head-menu {
  left: 12px;
}
.h5-head-action {
  right: 14px;
}
.h5-head-btn .h5-icon {
  width: 22px;
  height: 22px;
  stroke-width: 1.9;
}
/* 未登录时的登录按钮吸附在标题行右侧图标左侧 */
.h5-head-login {
  position: absolute;
  right: 50px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  border-radius: 16px;
  background: var(--mkt-blue, #2f6bff);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.h5-tabbar {
  display: flex;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* 宽度必须锚到 #app 而不是视口：fixed 元素的 100% 是视口宽度，
     min(430,100%) 在宽视口下永远取 430，比收窄后的内容宽。
     100cqi = 最近容器（#app）的行内尺寸，正是想要的。 */
  width: 100cqi;
  max-width: 430px;
  bottom: 0;
  z-index: 65;
  height: 70px;
  background: #fff;
  border-top: 1px solid #eceff3;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-sizing: content-box;
}
.h5-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  padding: 17px 2px 0;
  color: #a9adb6;
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.h5-tab .h5-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.7;
}
.h5-tab.active {
  color: #2f6bff;
  font-weight: 600;
}

/* ── 内容：单列、收窄留白 ────────────────────────── */  /* 标题：official-parity 用 .groww-home 前缀把 h1 钉在 88px，
   这里必须同前缀同优先级才不会被打回桌面字号。 */
.groww-home .groww-hero :is(h1,h2) {
  font-size: 44px;
  letter-spacing: -1.6px;
  line-height: 1.08;
  margin: 0 18px 16px;
}
.groww-home .groww-section h2,
.groww-home .groww-fno-inner h2,
.groww-home .groww-start-section h2 {
  font-size: 27px;
  letter-spacing: -0.6px;
  line-height: 1.15;
}
.groww-hero {
  padding-top: 44px;
}
.groww-hero > p {
  font-size: 14px;
  margin: 0 20px 22px;
}
.groww-section {
  padding: 44px 18px;
}

.groww-home,
.groww-footer {
  padding-left: 0;
  padding-right: 0;
}
/* 表格在窄屏允许横向滚动，不硬挤 */
.work-table,
.stock-detail-section table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.work-table table,
.stock-detail-section table {
  min-width: 560px;
}

/* F&O 横向长条在窄屏改成上下堆叠（已在 official-parity 定义基础，这里补足间距） */
.groww-home .groww-dark-block .groww-fno-rows {
  gap: 52px;
  margin-top: 36px;
  padding-bottom: 40px;
}

/* 超窄屏（≤360）：页脚四列在 320 下会被内边距挤出行外，压成单列。
   groww.css 的窄屏规则是 .groww-footer-inner{grid-template-columns:1fr 1fr}，
   这里必须同选择器、更晚加载才能赢，故写在 h5.css 末尾并加 !important 兜底。 */
@container groww-app (max-width: 360px){
  .groww-footer .groww-footer-inner {
    grid-template-columns: 1fr !important;
    padding: 36px 18px 18px;
    gap: 22px;
  }
  .groww-footer .groww-footer-brand {
    grid-column: 1 / -1;
    min-width: 0;
  }
  .groww-footer .groww-footer-inner > * {
    min-width: 0;
  }
  .groww-footer-bottom {
    margin: 0 18px;
  }
  .groww-home .groww-hero :is(h1,h2) {
    font-size: 36px;
    margin: 0 14px 14px;
  }
  .h5-topbar {
    padding: 0 6px;
  }
  .h5-tab {
    font-size: 9px;
  }
}

/* 桌面：抽屉的 scrim 永远不出现 */
.h5-scrim {
  display: none;
}

/* 业务页（IPO/loan/services/board 等）仍是宽屏桌面布局，不带 H5 顶底栏 */
body.biz-mode .h5-topbar,
body.biz-mode .h5-tabbar,
body.biz-mode .h5-drawer {
  display: none !important;
}
body.biz-mode {
  padding-bottom: 0;
}
