/* SoloVest H5 · 设计令牌与通用组件
 *
 * 尺寸沿用小程序 rpx 口径，按 1rpx = 0.5px 换算（375pt 设计稿），
 * 因此这里写下的 px 数都能和小程序里对应的 rpx 数一一对上。
 * 明暗主题只切换令牌，组件样式不重复写一遍。
 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

:root {
  --paper: #f3eee3;
  --paper-deep: #ebe3d4;
  --surface: #fbf7ee;
  --surface-2: #f2ebdd;
  --surface-3: #e8dfcf;
  --ink: #20251f;
  --ink-2: #5b6158;
  --ink-3: #686d63;
  --line: #dcd2c1;
  --line-strong: #c8bca8;
  --forest: #1a392f;
  --forest-2: #102a21;
  --forest-ink: #f5efdf;
  --forest-muted: #aab8ac;
  --hero-gold: #d8b975;
  --accent: #b54531;
  --accent-ink: #973522;
  --accent-wash: #edd9d2;
  --gold: #b18a4d;
  --gold-ink: #7a5927;
  --gold-wash: #ede1cc;
  --up: #b84531;
  --up-text: #993521;
  --up-wash: #f2dfd9;
  --up-mid: #e7c7be;
  --down: #008b7e;
  --down-text: #006c61;
  --down-wash: #dcebe6;
  --down-mid: #c4ddd6;
  --nav-bg: rgba(251, 247, 238, 0.94);
  --scrim: rgba(7, 15, 11, 0.52);
  --tooltip-bg: #1b2a22;
  --tooltip-ink: #f8f2e5;
  --shadow-card: 0 8px 17px rgba(34, 43, 34, 0.06);
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --mono: "SFMono-Regular", "Roboto Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --paper: #111612;
  --paper-deep: #0c110d;
  --surface: #191f1a;
  --surface-2: #20271f;
  --surface-3: #293127;
  --ink: #efe9dc;
  --ink-2: #bbb8aa;
  --ink-3: #989b8d;
  --line: #30382f;
  --line-strong: #465046;
  --forest: #1d3e32;
  --forest-2: #173328;
  --forest-muted: #a7b6a9;
  --hero-gold: #e0c27d;
  --accent: #df7962;
  --accent-ink: #f0a28d;
  --accent-wash: #3a241f;
  --gold: #d0a967;
  --gold-ink: #ddba7f;
  --gold-wash: #393022;
  --up: #d26952;
  --up-text: #f0a08b;
  --up-wash: #33221e;
  --up-mid: #4b2b24;
  --down: #38a99a;
  --down-text: #7ed3c5;
  --down-wash: #172d28;
  --down-mid: #1c3f38;
  --nav-bg: rgba(25, 31, 26, 0.94);
  --scrim: rgba(0, 0, 0, 0.62);
  --tooltip-bg: #eae2d2;
  --tooltip-ink: #1d251f;
  --shadow-card: 0 8px 17px rgba(0, 0, 0, 0.12);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.num {
  font-variant-numeric: tabular-nums;
}

.up {
  color: var(--up-text);
}

.down {
  color: var(--down-text);
}

.flat {
  color: var(--ink-3);
}

.serif {
  font-family: var(--serif);
}

.mono {
  font-family: var(--mono);
}

/* ---------------- 顶栏 ---------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.appbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 50px;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.seal {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.brand-name {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 1.5px;
  line-height: 1.2;
  color: var(--ink);
}

.brand-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  line-height: 1.3;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: border-color 0.16s ease, color 0.16s ease;
}

.nav-link:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.nav-link.is-current {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--forest-ink);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1;
}

.theme-toggle:active {
  opacity: 0.7;
}

/* ---------------- 页面骨架 ---------------- */

.page {
  min-height: 100vh;
  overflow-x: hidden;
}

.page-body {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px calc(84px + env(safe-area-inset-bottom));
}

@media (min-width: 620px) {
  .page {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* ---------------- 报头 ---------------- */

.masthead {
  padding-top: 14px;
}

.kicker {
  display: flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  color: var(--ink-3);
}

.folio {
  margin-right: 7px;
  color: var(--accent);
  font-weight: 600;
}

.kicker-line {
  flex: 1;
  height: 1px;
  margin: 0 8px;
  background: var(--line);
}

.market-state {
  flex: none;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  color: var(--ink-3);
}

.masthead-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 11px;
  margin-top: 13px;
}

.masthead-title {
  flex: 1;
  min-width: 0;
}

.h1 {
  display: block;
  margin: 0;
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 3px;
}

.lede {
  display: block;
  margin-top: 9px;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.5px;
  color: var(--ink-2);
}

.page-date {
  flex: none;
  text-align: right;
  font-family: var(--mono);
}

.date-big {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.05;
  letter-spacing: 0.5px;
}

.date-mid {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--ink-3);
}

.date-small {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  line-height: 1.45;
  color: var(--ink-3);
}

/* ---------------- 章节 ---------------- */

.chapter {
  display: flex;
  align-items: center;
  margin: 22px 0 11px;
}

.chapter-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  white-space: nowrap;
}

.chapter-rule {
  flex: 1;
  height: 1px;
  margin: 0 10px;
  background: var(--line-strong);
}

.chapter-en {
  flex: none;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1px;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------------- 卡片 ---------------- */

.card {
  margin-bottom: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-head-main {
  flex: 1;
  min-width: 0;
}

.card-kicker {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1px;
  color: var(--ink-3);
}

.card-title {
  display: block;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.5px;
}

.card-tag {
  flex: none;
  margin-left: 8px;
  padding: 2.5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--ink-2);
}

/* ---------------- 筛选胶囊 ---------------- */

.chips {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chip {
  flex: none;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.chip.is-active {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--forest-ink);
}

.tag {
  display: inline-block;
  margin: 0 5px 5px 0;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 9.5px;
  color: var(--ink-2);
}

.tag.stable {
  border-color: var(--down-mid);
  background: var(--down-wash);
  color: var(--down-text);
}

.tag.warn {
  border-color: var(--accent-wash);
  background: var(--accent-wash);
  color: var(--accent-ink);
}

/* ---------------- 空态 / 版权 ---------------- */

.empty-block {
  padding: 18px 5px 13px;
  text-align: center;
}

.empty-title {
  display: block;
  margin-bottom: 5px;
  font-family: var(--serif);
  font-size: 15px;
  color: var(--ink);
}

.empty-desc {
  display: block;
  font-size: 11px;
  line-height: 1.65;
  color: var(--ink-3);
}

.colophon {
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.colophon-sign {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 1.5px;
  color: var(--ink-2);
}

.disclaimer {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--ink-3);
}

/* ---------------- 加载 / 错误态 ---------------- */

.state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 62vh;
  padding: 40px 20px 60px;
  text-align: center;
}

.state-skeleton {
  width: 100%;
  max-width: 310px;
  margin-bottom: 11px;
  border-radius: 12px;
  background: var(--surface-2);
  animation: shimmer 1.4s ease-in-out infinite;
}

.sk1 { height: 90px; }
.sk2 { height: 60px; }
.sk3 { height: 110px; }
.sk4 { height: 80px; }

@keyframes shimmer {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

.state-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 21px;
  color: var(--gold-ink);
}

.state-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.state-desc {
  max-width: 280px;
  margin-top: 7px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-3);
}

.state-btn {
  margin-top: 17px;
  padding: 7px 20px;
  border-radius: 999px;
  background: var(--forest);
  color: var(--forest-ink);
  font-size: 12px;
  letter-spacing: 1px;
}

.state-btn:active {
  opacity: 0.82;
}

/* ---------------- 抽屉 ---------------- */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-layer[hidden] {
  display: none;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: var(--scrim);
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  padding: 12px 20px calc(18px + env(safe-area-inset-bottom));
  border-radius: 17px 17px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  animation: sheet-up 0.24s ease-out;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  width: 36px;
  height: 3px;
  margin: 0 auto 11px;
  border-radius: 2px;
  background: var(--line-strong);
}

.sheet-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
}

.sheet-kicker {
  display: block;
  margin-bottom: 5px;
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1px;
  color: var(--ink-3);
}

.sheet-title {
  display: block;
  padding-right: 30px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sheet-scroll {
  max-height: 46vh;
  margin-top: 11px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sheet-body {
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-2);
  white-space: pre-line;
}

.sheet-note {
  display: block;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--ink-3);
}

/* ---------------- 轻提示 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 300;
  max-width: 78vw;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(27, 42, 34, 0.94);
  color: #f8f2e5;
  font-size: 11.5px;
  line-height: 1.5;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------- 骨架占位 ---------------- */

.skeleton {
  border-radius: 6px;
  background: var(--surface-2);
  animation: shimmer 1.4s ease-in-out infinite;
}
