/* ===== 基础 ===== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #f5f6fa;
  color: #1a1a2e;
  -webkit-font-smoothing: antialiased;
}
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 14px 40px;
  min-height: 100vh;
}

/* ===== 顶部 ===== */
.app-header { text-align: center; margin-bottom: 16px; }
.app-title { font-size: 26px; font-weight: 800; margin: 0; letter-spacing: 1px; color: #1a1a2e; }
.app-sub { margin: 6px 0 0; font-size: 13px; color: #999; }

/* ===== 查询栏 ===== */
.search-fields { display: flex; flex-direction: column; gap: 10px; }
.search-bar {
  display: flex; align-items: center;
  background: #fff; border-radius: 12px; padding: 8px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.search-input {
  flex: 1; height: 40px; border: none; outline: none;
  font-size: 15px; padding: 0 10px; background: transparent; color: #1a1a2e;
}
.search-btn {
  margin-left: 10px; background: #e63946; color: #fff; border: none;
  font-size: 15px; font-weight: 600; height: 40px; padding: 0 18px;
  border-radius: 10px; flex-shrink: 0; cursor: pointer;
  transition: opacity .2s;
}
.search-btn:active { opacity: .8; }
.search-btn:disabled { background: #ccc; cursor: default; }

.search-hint { margin: 10px 4px 0; font-size: 12px; color: #999; line-height: 1.5; }
.dev-banner {
  margin-top: 10px; padding: 8px 14px; background: #fff7ed;
  border: 1px solid #fed7aa; border-radius: 10px;
  font-size: 12px; color: #c2410c; text-align: center; line-height: 1.4;
}
.quota-tip { margin: 6px 4px 0; font-size: 12px; color: #e63946; line-height: 1.5; }

.error {
  margin-top: 18px; padding: 14px; background: #fff3f3; color: #e63946;
  font-size: 14px; border-radius: 10px; line-height: 1.6;
}

/* ===== 空态 / 加载 ===== */
.empty { margin-top: 50px; text-align: center; color: #999; }
.empty-emoji { font-size: 52px; }
.empty-title { font-size: 20px; font-weight: 600; color: #333; margin-top: 10px; }
.empty-sub { margin-top: 8px; font-size: 13px; color: #999; }

.loading { margin-top: 50px; text-align: center; font-size: 14px; color: #888; }
.loading-meme {
  width: 220px; height: auto; border-radius: 12px;
  margin: 0 auto 16px;
  animation: meme-bounce 1.6s ease-in-out infinite;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
@keyframes meme-bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-8px); }
  60% { transform: translateY(-4px); }
}
.loading-sub { margin-top: 8px; font-size: 12px; color: #aaa; }

/* ===== 结果区域 ===== */
.result { margin-top: 16px; }

/* --- 行情卡片 --- */
.quote-card {
  background: linear-gradient(135deg, #fff 0%, #fafbff 100%);
  border-radius: 18px; padding: 26px 22px; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06); border: 1px solid rgba(0,0,0,0.03);
}
.q-head { display: flex; justify-content: center; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.q-name { font-size: 22px; font-weight: 700; color: #1a1a2e; }
.q-code { font-size: 13px; color: #aaa; background: #f5f5f7; padding: 2px 10px; border-radius: 6px; }
.asset-badge { font-size: 12px; padding: 2px 10px; border-radius: 12px; margin-left: 8px; font-weight: 600; }
.badge-etf { background: #e8f0fe; color: #1a73e8; }
.badge-stock { background: #f0f0f0; color: #888; }
.q-price { font-size: 44px; font-weight: 800; margin-top: 10px; letter-spacing: -1px; }
.q-change { font-size: 18px; margin-top: 4px; font-weight: 500; }
.q-time { margin-top: 8px; font-size: 12px; color: #999; }
.q-metrics {
  display: flex; justify-content: center; gap: 24px; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid rgba(0,0,0,0.05);
}
.metric { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.metric-label { font-size: 12px; color: #aaa; }
.metric-val { font-size: 15px; color: #444; font-weight: 500; }
.quota-in-result {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid #f0f0f0;
  font-size: 12px; color: #999; text-align: center;
}

/* --- 卡片通用 --- */
.card {
  background: #fff; border-radius: 14px; padding: 18px;
  margin-top: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.card-title {
  font-size: 16px; font-weight: 700; color: #1a1a2e; margin-bottom: 12px;
  display: flex; align-items: center;
}

/* --- AI 评级卡片 --- */
.rating-card { background: linear-gradient(135deg, #fef9f0 0%, #fff 100%); border-left: 4px solid #888; }
.rating-card.up { border-left-color: #e63946; }
.rating-card.down { border-left-color: #2a9d8f; }
.rating-card.flat { border-left-color: #888; }
.rating-header { display: flex; justify-content: space-between; align-items: center; }
.rating-title { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.rating-badges { display: flex; align-items: center; gap: 8px; }
.rating-tag { font-size: 13px; padding: 4px 12px; border-radius: 14px; color: #fff; font-weight: 600; }
.rating-tag.up { background: #e63946; }
.rating-tag.down { background: #2a9d8f; }
.rating-tag.flat { background: #888; }
.rating-score { font-size: 22px; font-weight: 800; color: #e63946; }
.score-unit { font-size: 13px; color: #999; font-weight: 400; margin-left: 1px; }
.rating-summary { margin-top: 10px; font-size: 15px; line-height: 1.75; color: #333; font-weight: 500; }

/* --- 技术指标 --- */
.ind-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ind-item { display: flex; flex-direction: column; padding: 8px 10px; background: #f8f9fc; border-radius: 8px; }
.ind-item-wide { grid-column: span 2; } /* 均线占两格 */
.ind-label { font-size: 11px; color: #999; margin-bottom: 2px; }
.ind-val { font-size: 13px; color: #333; font-weight: 600; line-height: 1.4; word-break: break-word; }
/* MACD 信号文字（金叉/死叉）不要太大 */
.ind-val.up, .ind-val.down { font-size: 13px; }

/* --- 消息面 --- */
.sentiment-card { border-left: 4px solid #457b9d; }
.sentiment-tag {
  margin-left: auto; font-size: 12px; padding: 3px 10px; border-radius: 12px;
  color: #fff; font-weight: 500;
}
.news-summary { font-size: 14px; line-height: 1.7; color: #444; margin-bottom: 8px; }
.news-list { margin-top: 8px; }
.news-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(0,0,0,0.03); }
.news-item:last-child { border-bottom: none; }
.news-dot { font-size: 12px; line-height: 1.6; flex-shrink: 0; margin-top: 2px; }
.news-up { color: #e63946; }
.news-down { color: #2a9d8f; }
.news-neutral { color: #999; }
.news-text { font-size: 13px; color: #555; line-height: 1.6; flex: 1; }
.news-note { margin-top: 12px; padding-top: 8px; border-top: 1px solid #f0f0f0; font-size: 11px; color: #bbb; line-height: 1.5; }

/* --- 研报 / 机构观点 --- */
.report-card { border-left: 4px solid #6a4c93; }
.report-overall { font-size: 14px; line-height: 1.7; color: #444; margin-bottom: 10px; font-weight: 500; }
/* 共识数据条（EPS/PE/目标价等高亮标签） */
.consensus-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding: 8px 10px; background: linear-gradient(135deg, #f8f5ff, #f0eaf8); border-radius: 8px; }
.metric-tag { display: inline-block; font-size: 11.5px; color: #555; background: #fff; border: 1px solid #e0d8f0; padding: 3px 8px; border-radius: 12px; line-height: 1.4; }
.metric-highlight { color: #6a4c93; font-weight: 600; border-color: #c4b5dd; background: #faf7ff; }
.report-list { margin-top: 2px; }
.report-item { padding: 12px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.report-item:last-child { border-bottom: none; }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-org { font-size: 13px; font-weight: 600; color: #1a1a2e; }
.report-rating { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; font-weight: 600; }
.report-rating.up { background: linear-gradient(135deg, #e63946, #d62839); }
.report-rating.down { background: linear-gradient(135deg, #2a9d8f, #21867a); }
.report-rating.flat { background: #999; }
.report-date { font-size: 11px; color: #aaa; }
.report-title { font-size: 13.5px; color: #333; margin-top: 6px; font-weight: 500; line-height: 1.55; }
/* 研报正文区域（摘要 + 关键指标标签） */
.report-body { margin-top: 6px; }
.report-summary { font-size: 12.5px; color: #555; line-height: 1.65; }
.report-metrics { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

/* --- 利好 / 风险 --- */
.factors-card { border-left: 4px solid #a8dadc; }
.factor-section { margin-bottom: 12px; }
.factor-section:last-child { margin-bottom: 0; }
.factor-header {
  display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600;
  margin-bottom: 8px; padding-bottom: 6px;
}
.factor-up { color: #e63946; border-bottom: 2px solid rgba(230,57,70,0.18); }
.factor-down { color: #2a9d8f; border-bottom: 2px solid rgba(42,157,143,0.18); }
.factor-icon { font-size: 15px; }
.factor-list { padding-left: 2px; }
.factor-item { font-size: 14px; line-height: 1.8; color: #444; padding: 3px 0; display: flex; align-items: flex-start; gap: 8px; }
.factor-bullet {
  flex-shrink: 0; width: 18px; height: 18px; line-height: 18px; text-align: center;
  border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; margin-top: 3px;
}
.factor-bullet.up { background: rgba(230,57,70,0.15); color: #e63946; }
.factor-bullet.down { background: rgba(42,157,143,0.15); color: #2a9d8f; }

/* --- 核心要点 --- */
.key-points { margin-top: 2px; display: flex; flex-wrap: wrap; gap: 8px; }
.kp-item { font-size: 13px; line-height: 1.4; color: #444; padding: 5px 12px; background: #f8f9fc; border-radius: 14px; display: inline-flex; align-items: center; }
.kp-item::before { content: '✓'; color: #e63946; font-weight: 700; margin-right: 6px; flex-shrink: 0; }

/* --- 公司概况 --- */
.info-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.info-row:last-child { margin-bottom: 0; }
.info-label { font-size: 12px; color: #999; }
.info-value { font-size: 14px; color: #444; line-height: 1.6; }
.concept-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.concept-tag { font-size: 12px; color: #457b9d; background: #eef4f8; padding: 4px 12px; border-radius: 14px; }

/* --- K线（Lightweight Charts）--- */
.kline-chart { width: 100%; height: 360px; position: relative; }
/* 隐藏 TradingView 水印（JS 属性可能因版本不生效，CSS 兜底） */
.kline-chart .attribution-watermark,
.kline-chart [data-name="attribution"],
.kline-chart > div:last-of-type:not([class]) { display: none !important; }
.kline-note {
  margin-top: 10px; font-size: 11px; color: #bbb;
  text-align: center; line-height: 1.5;
}

/* --- 关联板块 --- */
.board-list { margin-top: 4px; }
.board-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px; border-bottom: 1px solid #f2f2f2;
}
.board-row:last-child { border-bottom: none; }
.board-name { display: flex; align-items: center; font-size: 15px; color: #333; }
.board-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; margin-right: 10px; color: #fff; }
.tag-industry { background: #457b9d; }
.tag-concept { background: #e76f51; }
.board-pct { font-size: 15px; font-weight: 600; }

/* --- ETF 基金特性 --- */
.etf-grid { display: flex; flex-wrap: wrap; margin-top: 4px; }
.etf-item { flex: 1; min-width: 30%; padding: 12px 0; text-align: center; border-right: 1px solid #f0f0f0; }
.etf-item:last-child { border-right: none; }
.etf-label { display: block; font-size: 12px; color: #999; margin-bottom: 6px; }
.etf-val { font-size: 16px; font-weight: 600; color: #333; }

/* --- 免责声明 --- */
.disclaimer { margin: 22px 4px 30px; font-size: 11px; color: #bbb; line-height: 1.6; text-align: center; }

/* ===== 颜色系统（红涨绿跌）===== */
.up { color: #e63946; }
.down { color: #2a9d8f; }
.flat { color: #888; }
.up.sentiment-tag { background: #e63946; }
.down.sentiment-tag { background: #2a9d8f; }
.flat.sentiment-tag { background: #888; }
