/* 简阅小集 H5 样式
   设计系统来源：DESIGN/DESIGN.md（AI 学习教育 App 视觉语言映射）
   设计约定：1rem = 100rpx（由 app.js 按屏幕宽度动态设置 html font-size），24rpx 写作 0.24rem
   令牌：primary #48B11E / darkSurface #16300E / onDark #F2E3AB / canvas #F4F9E8 / surfaceMuted #C1DD79
   涨跌语义（中国市场红涨绿跌）：up #E05D4E / down #3F9D1F */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #f4f9e8;
  font-size: 0.28rem;
  color: #173010;
  font-family: "Plus Jakarta Sans", "PingFang SC", -apple-system, "Helvetica Neue",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.app {
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  background: #f4f9e8;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 1rem;
  padding: 0 0.24rem;
  padding-top: env(safe-area-inset-top);
  background: #ffffff;
  border-bottom: 1px solid #edf5d8;
}

/* 首页悬浮刷新模式：隐藏顶部导航栏 */
.navbar[hidden] {
  display: none;
}

.nav-back,
.nav-refresh {
  width: 0.9rem;
  height: 0.9rem;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* hidden 必须优先于上面的 display:flex，否则首页返回按钮会被强制显示 */
.nav-back[hidden],
.nav-refresh[hidden] {
  display: none;
}

.nav-back {
  color: #173010;
}

.nav-refresh {
  position: absolute;
  right: 0.24rem;
  top: 50%;
  transform: translateY(-50%);
  color: #48b11e;
}

/* 无标题时刷新按钮居中（首页） */
.nav-refresh.center {
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%);
}

/* 右下角悬浮刷新按钮（首页）——右侧中下部，符合右手单手操作拇指最佳点击区 */
.float-refresh {
  position: fixed;
  right: 0.32rem;
  left: auto;
  bottom: 1.2rem;
  width: 1rem;
  height: 1rem;
  border: none;
  border-radius: 50%;
  background: #48b11e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.08rem 0.24rem rgba(23, 48, 16, 0.25);
  cursor: pointer;
  z-index: 100;
}

.float-refresh svg {
  width: 0.48rem;
  height: 0.48rem;
}

.float-refresh[hidden] {
  display: none;
}

.nav-back svg,
.nav-refresh svg {
  width: 0.46rem;
  height: 0.46rem;
}

.nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  font-size: 0.32rem;
  font-weight: 700;
  color: #0e2408;
  white-space: nowrap;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-title[hidden] {
  display: none;
}

.page {
  padding: 0.24rem;
  padding-bottom: calc(0.48rem + env(safe-area-inset-bottom));
}

/* ---------- 首页卡片 ---------- */
.cards {
  display: flex;
  gap: 0.24rem;
  margin-top: 0.24rem;
}

.card {
  flex: 1;
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.32rem 0.28rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
  cursor: pointer;
}

.card-label {
  font-size: 0.24rem;
  color: #6b7a5c;
}

.card-value {
  margin-top: 0.12rem;
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: -0.01rem;
  color: #0e2408;
}

.card-sub {
  margin-top: 0.08rem;
  font-size: 0.24rem;
}

.card-loading {
  margin-top: 0.2rem;
  font-size: 0.24rem;
  color: #6b7a5c;
}

/* ---------- 热搜列表 ---------- */
.section {
  margin-top: 0.32rem;
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.24rem 0.28rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
}

.section-title {
  font-size: 0.3rem;
  font-weight: 700;
  color: #0e2408;
  padding-bottom: 0.16rem;
  border-bottom: 1px solid #edf5d8;
}

.hot-item {
  display: flex;
  align-items: center;
  padding: 0.24rem 0;
  border-bottom: 1px solid #edf5d8;
  cursor: pointer;
}

.hot-item:last-child {
  border-bottom: none;
}

.hot-rank {
  width: 0.48rem;
  height: 0.48rem;
  line-height: 0.48rem;
  text-align: center;
  border-radius: 0.1rem;
  background: #eef4dd;
  color: #6b7a5c;
  font-size: 0.26rem;
  font-weight: 700;
  margin-right: 0.2rem;
  flex-shrink: 0;
}

.hot-rank.hot {
  background: rgba(224, 93, 78, 0.12);
  color: #e05d4e;
}

.hot-title {
  font-size: 0.28rem;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #173010;
}

/* ---------- 详情页头部 ---------- */
.header {
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.36rem 0.32rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
}

.price {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: -0.01rem;
  color: #0e2408;
}

.change {
  margin-top: 0.08rem;
  font-size: 0.32rem;
  font-weight: 700;
}

.meta {
  margin-top: 0.12rem;
  font-size: 0.24rem;
  color: #6b7a5c;
}

/* ---------- 分段选择（映射设计系统 quickAction/seg） ---------- */
.seg {
  display: flex;
  margin-top: 0.28rem;
  background: #e3edc9;
  border-radius: 0.14rem;
  padding: 0.06rem;
}

.seg-item {
  flex: 1;
  text-align: center;
  font-size: 0.28rem;
  padding: 0.14rem 0;
  border-radius: 0.1rem;
  color: #6b7a5c;
  cursor: pointer;
}

.seg-item.active {
  background: #ffffff;
  color: #0e2408;
  font-weight: 700;
  box-shadow: 0 0.04rem 0.12rem rgba(22, 48, 14, 0.08);
}

/* ---------- 图表 ---------- */
.chart-wrap {
  margin-top: 0.28rem;
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.12rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
}

.chart {
  width: 100%;
  height: 5.2rem;
  display: block;
}

.chart.short {
  height: 4.2rem;
}

/* ---------- 上证列表 ---------- */
.list {
  margin-top: 0.28rem;
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.12rem 0.28rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
}

.list-head,
.list-row {
  display: flex;
  align-items: center;
  padding: 0.2rem 0;
  border-bottom: 1px solid #edf5d8;
}

.list-head {
  font-size: 0.24rem;
  color: #6b7a5c;
}

.list-row {
  font-size: 0.28rem;
  color: #173010;
}

.list-row:last-child {
  border-bottom: none;
}

.list-head span:first-child,
.list-row span:first-child {
  width: 2.2rem;
}

.list-head span:nth-child(2),
.list-row span:nth-child(2) {
  flex: 1;
  text-align: right;
}

.list-head span:last-child,
.list-row span:last-child {
  width: 1.8rem;
  text-align: right;
}

/* ---------- 热搜详情 ---------- */
.detail {
  background: #ffffff;
  border-radius: 0.2rem;
  padding: 0.36rem 0.32rem;
  box-shadow: 0 0.08rem 0.24rem rgba(22, 48, 14, 0.08);
}

.detail .title {
  font-size: 0.38rem;
  font-weight: 700;
  line-height: 1.5;
  color: #0e2408;
}

.meta-row {
  display: flex;
  margin-top: 0.28rem;
  background: #f4f9e8;
  border-radius: 0.16rem;
  padding: 0.24rem 0;
}

.meta-item {
  flex: 1;
  text-align: center;
}

.meta-label {
  font-size: 0.22rem;
  color: #6b7a5c;
}

.meta-value {
  margin-top: 0.08rem;
  font-size: 0.26rem;
  font-weight: 700;
  color: #173010;
}

.time {
  margin-top: 0.2rem;
  font-size: 0.24rem;
  color: #6b7a5c;
}

.abstract {
  margin-top: 0.28rem;
}

.abstract-title {
  font-size: 0.26rem;
  color: #6b7a5c;
}

.abstract-text {
  margin-top: 0.12rem;
  font-size: 0.28rem;
  line-height: 1.8;
  color: #173010;
  word-break: break-all;
}

.news {
  margin-top: 0.32rem;
  padding-top: 0.32rem;
  border-top: 1px solid rgba(23, 48, 16, 0.08);
}

.news-title {
  font-size: 0.32rem;
  font-weight: 700;
  color: #173010;
  line-height: 1.5;
}

.news-meta {
  margin-top: 0.12rem;
  font-size: 0.24rem;
  color: #6b7a5c;
}

.news-abstract {
  margin-top: 0.2rem;
  font-size: 0.28rem;
  line-height: 1.8;
  color: #173010;
  word-break: break-all;
  text-align: justify;
}

.btn-row {
  display: flex;
  gap: 0.2rem;
  margin-top: 0.4rem;
}.btn {
  flex: 1;
  border-radius: 999px;
  font-size: 0.3rem;
  font-weight: 700;
  padding: 0.24rem 0;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  border: none;
}

.btn-primary {
  background: #48b11e;
  color: #173010;
}

/* ---------- 通用 ---------- */
.up {
  color: #e05d4e;
}

.down {
  color: #3f9d1f;
}

.footer {
  margin-top: 0.4rem;
  text-align: center;
  font-size: 0.22rem;
  color: #6b7a5c;
  line-height: 1.7;
}

.loading,
.empty {
  padding: 0.48rem 0;
  text-align: center;
  color: #6b7a5c;
  font-size: 0.26rem;
}

.loading::before {
  content: '';
  display: inline-block;
  width: 0.28rem;
  height: 0.28rem;
  margin-right: 0.1rem;
  border: 2px solid #dcebb5;
  border-top-color: #48b11e;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  background: rgba(22, 48, 14, 0.88);
  color: #f2e3ab;
  padding: 0.2rem 0.32rem;
  border-radius: 0.12rem;
  font-size: 0.28rem;
  z-index: 999;
  max-width: 80%;
  text-align: center;
}

@media (min-width: 750px) {
  body {
    background: #e3eac9;
  }

  .app {
    box-shadow: 0 0 0.3rem rgba(22, 48, 14, 0.12);
  }
}
