:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --border: #e3e6eb;
  --text: #111827;
  --muted: #4b5563;
  --accent: #1f3a5f;
  --blue: #2563eb;
  --orange: #d97706;   /* 只用于图形元素，不用于文字 */
  --grid: #eef0f3;
  --radius: 10px;
  --gap: 24px;
  --pad: 20px;
  --chart-h: 320px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); }
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 24px; } }

/* 顶栏 */
.topbar { border-bottom: 1px solid var(--border); background: var(--bg); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; color: var(--accent); }
.stamp { margin: 0; font-size: 14px; color: var(--muted); }

/* 一句话说明 */
.hero { padding: 18px 0 6px; }
.lead { margin: 0; font-size: 22px; line-height: 1.35; font-weight: 600; letter-spacing: -0.01em; max-width: 46ch; }
@media (min-width: 1024px) { .lead { font-size: 26px; max-width: none; } }
.fineprint { margin: 6px 0 0; font-size: 14px; }
.fineprint a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

/* 控制栏 */
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; padding: 14px 0 18px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 14px; color: var(--muted); }
select {
  font: inherit; color: var(--text); min-width: 240px; height: 42px; padding: 0 36px 0 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234b5563' stroke-width='1.6'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  appearance: none; -webkit-appearance: none;
}
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; height: 42px; }
.segmented button {
  font: inherit; font-weight: 600; min-width: 56px; padding: 0 16px; border: 0; background: var(--bg);
  color: var(--muted); cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-checked="true"] { background: var(--accent); color: #fff; }
/* 实时价格 */
.live { margin-left: auto; min-width: 280px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); }
.live-skeleton { height: 40px; display: grid; align-items: center; color: var(--muted); font-size: 14px; }
.live-top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.live-label { font-size: 13px; color: var(--muted); }
.live-price { font-size: 22px; font-weight: 650; }
.live-change { font-size: 15px; font-weight: 600; }
.live-meta { font-size: 13px; color: var(--muted); }
.live-note { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; font-weight: 600;
  color: var(--text); }   /* 缓存提示：深色文字 + 图标，不用橙色 */
.live-note svg { flex: none; width: 14px; height: 14px; }
@media (max-width: 639px) {
  select { min-width: 0; width: 100%; }
  .controls { padding: 10px 0 14px; gap: 10px 14px; }
  .controls .field:first-child { flex: 1 1 100%; }
  .live { margin-left: 0; min-width: 0; flex: 1 1 100%; padding: 5px 12px; }
  .live-note { margin-top: 2px; }
  .live-price { font-size: 19px; }
  /* 手机首屏要能看到选股和图 1 */
  .topbar-inner { padding-top: 10px; padding-bottom: 10px; }
  .topbar .stamp { font-size: 12.5px; }
  .hero { padding-top: 10px; padding-bottom: 2px; }
  .lead { font-size: 19px; line-height: 1.3; }
  .fineprint { font-size: 13px; }
  .what { font-size: 13.5px; line-height: 1.45; margin: 4px 0 4px; }
  .stock-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .period-field { flex-direction: row; align-items: center; gap: 10px; }
}
.short { display: none; }
@media (max-width: 639px) { .long { display: none; } .short { display: inline; } }

/* 版面：电脑两栏，手机单栏（卡片紧跟在图 1 后面） */
.layout {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "price" "glance" "sent" "equity" "portfolio";
}
@media (min-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    grid-template-areas: "price glance" "sent glance" "equity portfolio";
  }
  .glance, .portfolio { align-self: start; }
}

.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--pad); }
@media (max-width: 639px) { :root { --pad: 16px; --gap: 16px; --chart-h: 240px; } }
.card h2 { margin: 0; font-size: 18px; font-weight: 650; }
.num {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); font-size: 13px; vertical-align: 2px;
}
.what { margin: 6px 0 10px; color: var(--muted); font-size: 15px; }
.what strong { color: var(--text); font-weight: 600; }
.sym { width: 11px; height: 11px; vertical-align: -1px; }   /* 买卖符号用图形，不用彩色文字 */
.sub { margin: 4px 0 12px; color: var(--muted); font-size: 14px; }

/* 图表区域与加载状态 */
.chart { position: relative; height: var(--chart-h); }
.skeleton, .skeleton-row {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface) 25%, #eceef2 50%, var(--surface) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite linear;
}
.skeleton { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.skeleton-row { height: 44px; margin-bottom: 10px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton, .skeleton-row { animation: none; } }
.overlay {
  position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.72); color: var(--text); font-size: 15px; font-weight: 600; border-radius: 8px;
}
.error { position: absolute; inset: 0; z-index: 6; display: grid; place-content: center; gap: 10px; text-align: center;
  background: var(--surface); border-radius: 8px; color: var(--text); }
.error button { font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }

/* 单只股票卡片 */
.stats { margin: 0; display: grid; gap: 14px; }
.stat { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.stat:last-child { border-bottom: 0; padding-bottom: 0; }
.stat dt { font-weight: 600; font-size: 15px; }
.stat dd { margin: 0; font-size: 26px; font-weight: 650; text-align: right; white-space: nowrap; }
.stat .hint { grid-column: 1 / -1; font-size: 13px; color: var(--muted); margin-top: 2px; }
.arrow { font-size: 0.6em; vertical-align: 0.25em; margin-right: 2px; }

/* 组合指标：每项一块，名称和解释在上，两组数值并排在下 */
.metrics { display: grid; gap: 12px; }
.metric { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.metric:last-child { border-bottom: 0; padding-bottom: 0; }
.m-name { font-weight: 600; font-size: 15px; }
.m-hint { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.m-vals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-val { display: flex; flex-direction: column; }
.m-lab { font-size: 12px; color: var(--muted); }
.m-num { font-size: 22px; font-weight: 650; white-space: nowrap; }
.m-val.bench .m-num { color: var(--muted); font-weight: 600; }

/* 术语提示 ⓘ */
.term { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.info {
  width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--accent); font: 600 12px/1 Georgia, serif; font-style: italic; cursor: pointer;
}
.tip {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(280px, 80vw); padding: 10px 12px;
  background: var(--text); color: #fff; font-size: 13px; font-weight: 400; line-height: 1.45; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(17, 24, 39, 0.18); display: none;
}
.term.open .tip { display: block; }
@media (hover: hover) { .term:hover .tip, .term:focus-within .tip { display: block; } }

/* 页面底部：免责声明 */
.footer { padding-top: 32px; padding-bottom: 40px; }
.limits { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius);
  background: var(--surface); padding: var(--pad); margin-bottom: 16px; }
.limits h2 { margin: 0 0 8px; font-size: 18px; }
.limits ul { margin: 0; padding-left: 20px; }
.limits li { margin: 6px 0; }
.footer .stamp { margin: 6px 0; }
.noscript { padding: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
