/* Market 页 —— 按 preview-market.jpg（375×812）一比一还原。
   全部数值来自像素测量，见 market-tokens.css 顶部注释。 */

.mkt-page {
  background: var(--mkt-page);
  min-height: 100%;
  /* 底栏 70 + 安全区，再留 8 缓冲，否则最后一行被底栏盖住 */
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px) + 8px);
  font-family: GrowwSans, -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--mkt-ink);
  -webkit-font-smoothing: antialiased;
}

/* ── 顶部纸账户提示条：高 22、淡蓝底、字距拉开的 11px 灰蓝大写 ── */
.mkt-banner {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--mkt-banner-bg);
  color: var(--mkt-banner-fg);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.085em;
  line-height: 1;
}
.mkt-banner-info {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  opacity: 0.75;
}

/* ── 标题行：居中 26px 粗体 + 右侧搜索图标（图标中心 x≈346,y≈40） ── */
.mkt-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46px;
}
.mkt-head h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--mkt-ink);
}
.mkt-search {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--mkt-ink);
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mkt-search-icon {
  width: 23px;
  height: 23px;
}

/* ── 三张指数卡：宽 107 / 间距 7 / 高 90 / 圆角 10 ── */
.mkt-indices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--mkt-gap);
  padding: 0 var(--mkt-gutter);
}
.mkt-index-card {
  height: 90px;
  border-radius: var(--mkt-radius);
  padding: 12px 4px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  box-sizing: border-box;
}
.mkt-index-card.up {
  background: var(--mkt-up-bg);
}
.mkt-index-card.down {
  background: var(--mkt-down-bg);
}
.mkt-index-name {
  font-size: 11px;
  line-height: 1.25;
  color: var(--mkt-ink-soft);
  font-weight: 500;
}
.mkt-index-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mkt-index-pct {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mkt-index-card.up .mkt-index-value,
.mkt-index-card.up .mkt-index-pct {
  color: var(--mkt-up-fg);
}
.mkt-index-card.down .mkt-index-value,
.mkt-index-card.down .mkt-index-pct {
  color: var(--mkt-down-fg);
}

/* ── 分区标题 Popular stocks：19px 粗体，距指数卡 17px ── */
.mkt-section-title {
  margin: 17px var(--mkt-gutter) 9px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--mkt-ink);
}

/* ── 热门股 3×2 网格：卡高 89 / 行距 9 ── */
.mkt-pop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--mkt-gap);
  padding: 0 var(--mkt-gutter);
}
.mkt-pop-card {
  min-height: 89px;
  border-radius: var(--mkt-radius);
  padding: 11px 7px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  box-sizing: border-box;
}
.mkt-pop-card.up {
  background: var(--mkt-up-bg);
}
.mkt-pop-card.down {
  background: var(--mkt-down-bg);
}
.mkt-pop-card.empty {
  background: #f6f7f9;
}
.mkt-pop-name {
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--mkt-ink-soft);
  font-weight: 500;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 26px;
}
.mkt-pop-price {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.mkt-pop-foot {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mkt-pop-card.up .mkt-pop-price,
.mkt-pop-card.up .mkt-pop-foot {
  color: var(--mkt-up-fg);
}
.mkt-pop-card.down .mkt-pop-price,
.mkt-pop-card.down .mkt-pop-foot {
  color: var(--mkt-down-fg);
}

/* ── NSE / BSE 分段：19px 粗体，选中项 3px 蓝下划线 ── */
.mkt-seg {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin: 24px var(--mkt-gutter) 0;
  padding-bottom: 0;
  border-bottom: 1px solid var(--mkt-line);
}
.mkt-seg-btn {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0 0 10px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
  color: #b9bec7;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mkt-seg-btn.active {
  color: var(--mkt-ink);
}
.mkt-seg-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--mkt-blue);
}

/* ── 表头：浅灰长条 y446..470（高 25），文字 10.5px 灰，右三列右对齐 ──
   参考图实测（内容区 x15..345 = 宽 330）：
     表头文字 Name x16..39 / Price 止于 193 / Chg 止于 261 / Chg% 止于 343
     胶囊底 x281..345（宽 65）、高 29（y499..527），文字右内缩 10
   换算列宽：名称 1fr，其余 57 / 68 / 82，正好 330。 */
.mkt-thead {
  display: grid;
  grid-template-columns: 1fr 57px 68px 82px;
  align-items: center;
  height: 25px;
  margin: 0 var(--mkt-gutter);
  padding: 0;
  background: var(--mkt-thead);
  font-size: 10.5px;
  color: var(--mkt-muted);
}
.mkt-thead span {
  padding: 0 8px;
}
.mkt-thead span:nth-child(2),
.mkt-thead span:nth-child(3),
.mkt-thead span:nth-child(4) {
  text-align: right;
  padding-right: 0;
}
.mkt-thead span:nth-child(4) {
  padding-right: 8px;
}

/* ── 数据行 ── */
.mkt-tbody {
  padding: 0 var(--mkt-gutter);
}
.mkt-row {
  display: grid;
  grid-template-columns: 1fr 57px 68px 82px;
  align-items: center;
  padding: 12px 0;
  text-decoration: none;
  color: inherit;
  /* 行间浅灰分隔线（参考图 y557 那条），只在行与行之间，首行和末行不加 */
  border-bottom: 1px solid #eef0f2;
}
.mkt-row:last-child {
  border-bottom: 0;
}
.mkt-row-name {
  min-width: 0;
  padding-left: 1px;
}
.mkt-row-name b {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.36;
  color: var(--mkt-ink);
}
.mkt-row-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}
.mkt-exch {
  flex: 0 0 auto;
  padding: 2px 5px;
  border-radius: 2px;
  background: var(--mkt-nse-bg);
  color: #fff;
  font-size: 8.5px;
  font-weight: 700;
  font-style: normal;
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.mkt-sym {
  font-size: 9.5px;
  font-style: normal;
  color: var(--mkt-sym-fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mkt-row-price,
.mkt-row-chg {
  text-align: right;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* 涨跌幅：宽 65 高 29 的浅底胶囊，右对齐到内容区右沿，文字右内缩 10 */
.mkt-row-pct {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 65px;
  height: 29px;
  padding: 0 10px;
  border-radius: 2px;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-sizing: border-box;
}
.mkt-row-price.up,
.mkt-row-chg.up,
.mkt-row-pct.up {
  color: var(--mkt-up-fg);
}
.mkt-row-price.down,
.mkt-row-chg.down,
.mkt-row-pct.down {
  color: var(--mkt-down-fg);
}
.mkt-row-pct.up {
  background: var(--mkt-up-bg);
}
.mkt-row-pct.down {
  background: var(--mkt-down-bg);
}
.mkt-empty {
  padding: 28px 6px;
  text-align: center;
  font-size: 12.5px;
  color: var(--mkt-muted);
}

/* Market 页顶部直接是纸账户横幅，隐藏通用 H5 外壳（横幅/标题行/语言开关），
   否则会出现两条 INTERFACE REPLICA 横幅、两个大标题。 */
body.mkt-active .h5-topbar,
body.mkt-active .h5-banner,
body.mkt-active .h5-head,
body.mkt-active .lang-switch-host,
body.mkt-active .h5-drawer-lang {
  display: none;
}
