/* ============================================================
   家庭股票计划 — design tokens
   Aesthetic: 温暖、克制、易读 (warm + restrained + readable)
   Audience: 60+ 父母在手机上阅读 → 大字号 / 高对比 / 大点击区
   ============================================================ */

:root {
  /* palette */
  --cream:        #faf7f2;
  --cream-warm:   #f4ede1;
  --ink:          #1a2332;
  --ink-soft:     #3d4859;
  --ink-muted:    #6b7588;
  --line:         #e4dfd3;
  --line-soft:    #efece4;

  --green:        #16a34a;
  --green-bg:     #e7f5ec;
  --red:          #dc2626;
  --red-bg:       #fdebea;
  --gold:         #c08a00;
  --gold-bg:      #fff5d6;
  --blue:         #1e6f9f;
  --blue-bg:      #e8f1f7;
  --gray:         #8a93a3;
  --gray-bg:      #eef0f3;

  /* type */
  --font-display: 'Manrope', system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', sans-serif;
  --font-body:    'Noto Sans SC', 'PingFang SC', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;

  /* sizing */
  --container:    640px;
  --radius:       14px;
  --radius-sm:    8px;
  --shadow-card:  0 1px 2px rgba(26,35,50,.04), 0 4px 16px rgba(26,35,50,.06);
}

* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 480px) {
  html { font-size: 17px; }
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(180deg, var(--cream-warm) 0%, var(--cream) 100%);
  padding: 28px 0 36px;
  border-bottom: 1px solid var(--line);
}
.updated-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  background: rgba(255,255,255,.6);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.02em;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--ink);
}
.hero-subtitle {
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0 0 18px;
  font-weight: 500;
}
.hero-intro {
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 22px;
  padding: 16px 18px;
  background: rgba(255,255,255,.7);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}
.stat-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ============================================================
   ANCHOR NAV
   ============================================================ */
.anchor-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-row {
  display: flex;
  gap: 4px;
  padding: 10px 20px;
  justify-content: center;
}
.anchor-nav a {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
.anchor-nav a:hover { background: var(--cream-warm); color: var(--ink); }

/* ============================================================
   SECTIONS
   ============================================================ */
.section { padding: 36px 0 28px; }
.section-alt { background: var(--cream-warm); }
.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.section-num {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.section-sub {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 20px;
}

/* ============================================================
   STOCK CARDS
   ============================================================ */
.stocks-list { display: grid; gap: 18px; margin-top: 18px; }
.loading { text-align: center; color: var(--ink-muted); padding: 40px 0; }

.stock-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.stock-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--gray);
  transition: background .2s ease;
}
.stock-card[data-status="ready"]::before   { background: var(--green); }
.stock-card[data-status="watch"]::before   { background: var(--gold); }
.stock-card[data-status="wait"]::before    { background: var(--blue); }
.stock-card[data-status="caution"]::before { background: var(--gold); }
.stock-card[data-status="stop"]::before    { background: var(--red); }

.stock-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.stock-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.stock-meta {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}
.stock-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
.tier-badge {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}
.tier-badge.tier-S { background: var(--gold-bg); color: var(--gold); }
.tier-badge.tier-A { background: var(--blue-bg); color: var(--blue); }
.tier-badge.tier-B { background: var(--gray-bg); color: var(--ink-soft); }
.position-pill {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--cream-warm);
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.stock-theme {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

/* price row */
.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.price-block {}
.price-label {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.price-big {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 32px;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.price-change {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  margin-top: 2px;
}
.price-change.up   { color: var(--green); }
.price-change.down { color: var(--red); }
.price-change.flat { color: var(--ink-muted); }

.status-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--gray-bg);
  color: var(--ink-soft);
}
.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray);
  box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}
.status-chip.ready   { background: var(--green-bg); color: var(--green); }
.status-chip.ready   .status-dot { background: var(--green); animation: pulse 2s infinite; }
.status-chip.watch   { background: var(--gold-bg); color: var(--gold); }
.status-chip.watch   .status-dot { background: var(--gold); }
.status-chip.wait    { background: var(--blue-bg); color: var(--blue); }
.status-chip.wait    .status-dot { background: var(--blue); }
.status-chip.caution { background: var(--gold-bg); color: var(--gold); }
.status-chip.caution .status-dot { background: var(--gold); }
.status-chip.stop    { background: var(--red-bg);  color: var(--red); }
.status-chip.stop    .status-dot { background: var(--red); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.status-detail {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: right;
  line-height: 1.4;
}

/* MA row */
.ma-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.ma-item { text-align: center; }
.ma-label {
  font-size: 11px;
  color: var(--ink-muted);
  margin-bottom: 2px;
}
.ma-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ladder */
.ladder { margin-bottom: 12px; }
.ladder-head {
  margin-bottom: 8px;
}
.ladder-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}
.ladder-rows {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.ladder-row {
  display: grid;
  grid-template-columns: 88px 56px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  position: relative;
}
.ladder-row:last-child { border-bottom: none; }
.ladder-buy  .ladder-row { background: #fff; }
.ladder-buy  .ladder-row:hover { background: var(--green-bg); }
.ladder-sell .ladder-row:hover { background: var(--gold-bg); }
.ladder-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
}
.ladder-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}
.ladder-note {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.4;
}
.ladder-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  background: var(--gray-bg);
  color: var(--ink-muted);
}
.ladder-status.hit     { background: var(--green-bg); color: var(--green); }
.ladder-status.near    { background: var(--gold-bg);  color: var(--gold); }
.ladder-status.far     { background: var(--gray-bg);  color: var(--ink-muted); }

/* stop loss row */
.stop-loss-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--red-bg);
  border: 1px solid #f3c2bf;
  border-radius: var(--radius-sm);
  margin: 4px 0 14px;
}
.stop-loss-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
}
.stop-loss-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--red);
}
.stop-loss-note {
  grid-column: 1 / -1;
  font-size: 12px;
  color: #8a3127;
  line-height: 1.4;
}

/* details */
.details {
  border-top: 1px solid var(--line-soft);
  padding: 12px 0;
}
.details:last-of-type { padding-bottom: 0; }
.details summary {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.details summary::-webkit-details-marker { display: none; }
.details summary::after {
  content: '+';
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink-muted);
  transition: transform .2s ease;
}
.details[open] summary::after { content: '−'; }
.details p {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-soft);
}
.details-risk summary { color: var(--red); }
.details-risk p { color: var(--ink-soft); }

/* ============================================================
   RULES
   ============================================================ */
.rules-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}
.rule-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
}
.rule-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  color: var(--gold);
  line-height: 1;
}
.rule-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 4px;
}
.rule-body {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0;
}

/* ============================================================
   BLACKLIST
   ============================================================ */
.blacklist {
  list-style: none;
  padding: 0;
  margin: 18px 0 20px;
  display: grid;
  gap: 8px;
}
.blacklist li {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--ink-soft);
  position: relative;
  padding-left: 36px;
}
.blacklist li::before {
  content: '✕';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
}
.closing {
  margin-top: 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-style: italic;
  text-align: center;
  padding: 18px;
  background: var(--gold-bg);
  border-radius: var(--radius-sm);
  border: 1px solid #ead38c;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 36px;
  background: var(--cream-warm);
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
}
.footer p { margin: 4px 0; }
.footer-by { font-family: var(--font-mono); }
