/* crypto_tracker.css v3 — 2026-05-16 aligned with stock_detail_html.css */

/* ── Base ── */
body{margin:0;background:#04080e;color:#e2e8f0;font-family:-apple-system,Segoe UI,'PingFang SC','Noto Sans SC',sans-serif;--mono:Menlo,Consolas,monospace;-webkit-font-smoothing:antialiased}
.wrap{max-width:700px;margin:0 auto;padding:16px 16px 60px}
.back{display:inline-flex;align-items:center;gap:4px;font-size:13px;color:#64748b;text-decoration:none;margin-bottom:14px;transition:color .15s}
.back:hover{color:#94a3b8}

/* ── Colors (中式红涨绿跌) ── */
.pos{color:#ef4444;background:rgba(239,68,68,.1)}
.neg{color:#22c55e;background:rgba(34,197,94,.1)}

/* ── Header (aligned with stock_detail_html) ── */
.sh{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:18px 20px;background:#111827;border:1px solid #1e293b;border-radius:14px;margin:0 0 0}
.sh-left{display:flex;flex-direction:row;align-items:center;gap:10px;min-width:0;flex:1}
.sh-img{width:28px;height:28px;border-radius:50%;flex-shrink:0}
.sh-ticker{font-size:22px;font-weight:900;color:#f8fafc;font-family:var(--mono);letter-spacing:0}
.sh-name{font-size:14px;color:#94a3b8;font-weight:500}
.sh-rank{font-size:11px;color:#60a5fa;font-weight:700;background:rgba(96,165,250,.08);padding:2px 7px;border-radius:4px;border:1px solid rgba(96,165,250,.15)}
.sh-right{text-align:right;flex-shrink:0}
.sh-price{font-size:24px;font-weight:900;color:#f8fafc;font-family:var(--mono);line-height:1.1}
.sh-chg{font-size:13px;font-weight:700;font-family:var(--mono);margin-top:2px;padding:2px 8px;border-radius:5px;display:inline-block}
.sh-tags{display:flex;gap:6px;flex-wrap:wrap;padding:8px 20px 0;margin:0 0 10px}
.sh-tag{font-size:10px;padding:3px 10px;border-radius:6px;font-weight:600;letter-spacing:0}
.sh-tag.sector{background:rgba(34,211,238,.06);color:#22d3ee;border:1px solid rgba(34,211,238,.15)}
.sh-tag.risk{background:rgba(245,158,11,.06);color:#f59e0b;border:1px solid rgba(245,158,11,.15)}

/* ── Summary one-liner ── */
.sh-summary{margin-top:8px;padding:10px 14px;background:#0a0e17;border:1px solid #1e293b;border-radius:10px;color:#94a3b8;font-size:12px;line-height:1.5;margin-bottom:10px}

/* ── Metrics grid (replaces stats-pct + stats) ── */
.sh-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-bottom:12px}
.sh-metric{background:linear-gradient(135deg,#0f172a,#1e293b);border:1px solid rgba(255,255,255,0.04);border-radius:10px;padding:10px 6px;text-align:center;overflow:hidden}
.sh-metric-v{font-size:13px;font-weight:700;color:#e2e8f0;font-family:var(--mono);line-height:1.4}
.sh-metric-l{font-size:9px;color:#64748b;letter-spacing:.5px;margin-top:4px;font-weight:500}

/* ── AI Sentiment (stock-page style) ── */
.ai-sent{background:#111827;border:1px solid #1e293b;border-radius:14px;padding:16px 20px;margin-bottom:10px}
.ai-sent .ai-top{display:flex;align-items:center;gap:16px}
.ai-sent .ai-info{flex:1;min-width:0}
.ai-sent .ai-rec{display:inline-block;padding:3px 12px;border-radius:6px;font-size:12px;font-weight:800;border:1px solid;margin-bottom:4px}
.ai-sent .ai-summary{font-size:13px;color:#94a3b8;line-height:1.6}
.ai-sent .gauge-wrap{flex-shrink:0;position:relative;width:80px;height:50px}
.ai-sent .gauge-wrap svg{width:80px;height:50px}
.ai-sent .gauge-score{position:absolute;bottom:0;left:50%;transform:translateX(-50%);font-size:20px;font-weight:900;font-family:var(--mono)}
.ai-sent .pts{display:flex;gap:8px;margin-top:12px}
.ai-sent .pt{flex:1;background:#0a0e17;border:1px solid #1e293b;border-radius:8px;padding:8px 10px;text-align:center}
.ai-sent .pt-l{font-size:9px;color:#475569;text-transform:uppercase;margin-bottom:2px}
.ai-sent .pt-v{font-size:13px;font-weight:800;font-family:var(--mono)}
.ai-sent .ai-rationale{font-size:12px;color:#94a3b8;line-height:2.0;padding:12px 14px;background:#0a0e17;border:1px solid #1e293b;border-radius:8px;margin-top:10px;white-space:pre-wrap}

/* ── Legacy AI Block (keep for compat) ── */
.ai-rationale{font-size:12px;color:#94a3b8;line-height:2.0;padding:12px 14px;background:#0a0e17;border:1px solid #1e293b;border-radius:8px;margin-top:8px;white-space:pre-wrap}

/* ── Intro ── */
.intro-wrap{background:#111827;border:1px solid #1e293b;border-radius:14px;padding:14px 16px;margin-bottom:10px}
.intro-meta{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.intro-meta .intro-tag{font-size:9px;color:#94a3b8;background:#0a0e17;border:1px solid #1e293b;padding:2px 7px;border-radius:6px}
.intro-meta .intro-tag b{color:#22d3ee;font-weight:600;margin-right:3px}
.intro-body{font-size:12px;color:#94a3b8;line-height:1.7}
.intro-body p{margin:0 0 6px;font-size:12px}
.intro-body p:last-child{margin-bottom:0}
.intro-sec{background:#0a0e17;border:1px solid #1e293b;border-radius:8px;padding:8px 10px;margin-bottom:6px}
.intro-sec:last-child{margin-bottom:0}
.intro-sec-title{font-size:10px;font-weight:700;color:#22d3ee;margin-bottom:3px;padding-bottom:2px;border-bottom:1px dashed rgba(34,211,238,.1)}
.intro-sec-body{font-size:12px;color:#94a3b8;line-height:1.7}
.intro-sec-body p{margin:0 0 4px;font-size:12px}
.intro-sec-body p:last-child{margin-bottom:0}
.intro-footer{margin-top:8px;font-size:9px;color:#475569;padding-top:6px;border-top:1px solid #1e293b}
.intro-footer a{color:#22d3ee;text-decoration:none}

/* ── Section Title (inside card) ── */
.section-title{font-size:14px;font-weight:700;color:#f1f5f9;margin:0 0 10px;display:flex;align-items:center;gap:6px}
.section-title span{font-size:10px;color:#475569;font-weight:400}

/* ── Data Cards ── */
.deriv-wrap{background:#111827;border:1px solid #1e293b;border-radius:14px;padding:14px 18px;margin-bottom:10px}
.deriv-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px}
.deriv-cell{background:#0a0e17;border:1px solid #1e293b;border-radius:8px;padding:8px 10px;text-align:center}
.deriv-label{font-size:9px;color:#475569;margin-bottom:4px}
.deriv-value{font-size:15px;font-weight:800;font-family:var(--mono);color:#f8fafc}
.deriv-sub{font-size:9px;color:#475569;margin-top:3px;line-height:1.3}
.deriv-ls-bar{height:5px;background:#1e293b;border-radius:3px;overflow:hidden;margin-top:4px;display:flex}
.deriv-ls-long{background:#ef4444}
.deriv-ls-short{background:#22c55e}

/* ── Tips (always expanded) ── */
.deriv-tip{font-size:11px;color:#94a3b8;margin-top:10px;padding:10px 12px;background:#0a0e17;border:1px solid #1e293b;border-radius:8px;line-height:1.6}
.deriv-tip .tip-head{font-weight:700;color:#e2e8f0;font-size:11px;margin-bottom:4px}
.deriv-tip .tip-row{margin-bottom:4px}
.deriv-tip .tip-row:last-child{margin-bottom:0}
.deriv-tip .tip-k{color:#64748b;margin-right:3px}
.deriv-tip .tip-red{color:#ef4444;font-weight:600}
.deriv-tip .tip-green{color:#22c55e;font-weight:600}
.deriv-tip .tip-amber{color:#f59e0b;font-weight:600}
.deriv-tip .tip-cyan{color:#22d3ee;font-weight:600}

/* ── K Chart ── */
.chart-wrap{height:320px;border-radius:14px;overflow:hidden;margin-bottom:10px;background:#0a0e17;position:relative;border:1px solid #1e293b}
.chart-interval{position:absolute;top:10px;right:10px;z-index:10;display:flex;gap:3px;background:rgba(17,24,39,.95);padding:3px;border-radius:6px;border:1px solid #1e293b}
.chart-interval button{background:none;border:none;color:#64748b;font-size:11px;padding:4px 10px;border-radius:5px;cursor:pointer;font-family:var(--mono);font-weight:500;transition:all .15s}
.chart-interval button:hover{color:#e2e8f0}
.chart-interval button.active{background:#22d3ee18;color:#22d3ee;font-weight:700}
.chart-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:#475569;font-size:12px;pointer-events:none}

/* ── Tabs ── */
.tabs{display:flex;gap:0;border-bottom:2px solid #1e293b;margin-bottom:14px;position:sticky;top:0;z-index:5;background:#04080e;padding-top:4px}
.tab{flex:1;padding:12px 0;border:none;border-bottom:3px solid transparent;background:none;color:#475569;font-size:14px;font-weight:700;cursor:pointer;font-family:inherit;display:flex;align-items:center;justify-content:center;gap:6px;margin-bottom:-2px;transition:all .15s}
.tab:hover{color:#94a3b8}
.tab.active{color:#f1f5f9;border-bottom-color:#22d3ee}
.tab-count{font-size:11px;color:#475569;font-weight:600;background:#111827;padding:1px 8px;border-radius:10px;font-family:var(--mono)}
.tab.active .tab-count{color:#22d3ee;background:#22d3ee18}
.tab-panel{display:none}.tab-panel.active{display:block}

/* ── Events & News ── */
.ev-list,.news-list{display:flex;flex-direction:column;gap:8px}
.ev-card{padding:12px 14px;background:#111827;border:1px solid #1e293b;border-radius:10px;border-left:3px solid #f59e0b;cursor:pointer;transition:border-color .15s}
.ev-card:hover{border-color:#334155}
.ev-time{font-size:10px;color:#60a5fa;margin-bottom:2px;font-family:var(--mono);display:flex;align-items:center;gap:8px}
.ev-title{font-size:13px;font-weight:700;color:#f1f5f9}
.ev-detail{font-size:12px;color:#64748b;line-height:1.5;margin-top:4px}
.ev-badge{font-size:9px;padding:1px 6px;border-radius:4px;border:1px solid;font-weight:700;margin-left:auto}
.load-more{margin-top:10px}
.load-btn{background:none;border:1px solid #1e293b;color:#64748b;padding:8px 20px;border-radius:8px;font-size:12px;cursor:pointer;font-family:inherit;transition:all .15s}
.load-btn:hover{border-color:#22d3ee;color:#22d3ee}
.news-card{padding:12px 14px;background:#111827;border:1px solid #1e293b;border-radius:10px;cursor:pointer;transition:border-color .15s}
.news-card:hover{border-color:#334155}
.news-src{font-size:10px;color:#64748b;margin-bottom:3px}
.news-title{font-size:13px;font-weight:700;color:#e2e8f0;margin-bottom:3px}
.news-summary{font-size:12px;color:#475569;line-height:1.6}
.modal-text.rich{font-size:13px;color:#94a3b8;line-height:1.8}
.modal-text.rich p{margin:0 0 10px}
.modal-text.rich p:last-child{margin-bottom:0}
.modal-text.rich strong{color:#f1f5f9;font-weight:600}

/* ── Alert Panel ── */
.settings-toggle{display:flex;align-items:center;gap:6px;font-size:12px;color:#475569;cursor:pointer;padding:8px 0;transition:color .15s}
.settings-toggle:hover{color:#94a3b8}
#alertArrow{font-size:8px;transition:transform .2s}
.settings-panel{background:#0a0e17;border:1px solid #1e293b;border-radius:12px;padding:16px;margin-bottom:10px}
.sp-row{display:flex;gap:8px;margin-bottom:10px}
.sp-field{flex:1}
.sp-label{font-size:11px;font-weight:700;color:#94a3b8;margin-bottom:5px}
.sp-input,.sp-note{width:100%;padding:8px 12px;background:#111827;border:1px solid #1e293b;border-radius:8px;color:#e2e8f0;font-size:12px;font-family:var(--mono);outline:none;box-sizing:border-box}
.sp-input:focus,.sp-note:focus{border-color:#22d3ee}
.sp-actions{display:flex;gap:8px;align-items:center;margin-top:6px}
.sp-btn{padding:4px 14px;border-radius:6px;border:none;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;transition:all .15s}
.sp-save{background:#22d3ee;color:#04080e}
.sp-clr{background:none;border:1px solid #1e293b;color:#475569}
.sp-status{font-size:10px;color:#22c55e}

/* ── Footer ── */
.updated{text-align:center;color:#475569;font-size:10px;margin-top:20px}

/* ── Index page ── */
.hero.crypto h1{background:linear-gradient(135deg,#22d3ee,#f7931a);-webkit-background-clip:text;background-clip:text}
.c-price-chg{font-size:11px;font-weight:800;font-family:var(--mono);padding:2px 7px;border-radius:5px}
.c-score{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-size:11px}
.c-score-bar{flex:1;height:5px;background:#1e293b;border-radius:3px;overflow:hidden}
.c-score-fill{height:100%;border-radius:3px}
.c-score-val{font-weight:900;font-family:var(--mono)}
.c-rec{display:inline-block;padding:2px 8px;border-radius:10px;font-size:10px;font-weight:700;background:#1e293b;color:#94a3b8}
.c-rec.buy{background:rgba(239,68,68,.12);color:#ef4444}
.c-rec.hold{background:rgba(245,158,11,.12);color:#f59e0b}
.c-rec.sell{background:rgba(34,197,94,.12);color:#22c55e}
.c-sum{font-size:11px;color:#94a3b8;margin-top:6px;line-height:1.5}
.c-tags{margin-top:6px;display:flex;gap:4px;flex-wrap:wrap}
.c-tag{font-size:9px;color:#64748b;background:#1e293b;padding:1px 6px;border-radius:4px}

/* ── Search Modal ── */
.add-modal{display:none;position:fixed;inset:0;background:rgba(0,0,0,.8);z-index:999;align-items:flex-end;justify-content:center}
.add-modal.open{display:flex}
@media(min-width:700px){.add-modal.open{align-items:center}}
.add-box{background:#141820;border:1px solid #1e293b;border-radius:16px 16px 0 0;width:100%;max-width:520px;padding:20px 18px;max-height:80vh;overflow-y:auto}
@media(min-width:700px){.add-box{border-radius:16px;margin:auto}}
.add-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.add-title{font-size:16px;font-weight:800;color:#f8fafc}
.add-close{background:none;border:none;color:#64748b;font-size:22px;cursor:pointer}
.add-input{width:100%;padding:10px 14px;border-radius:10px;border:1px solid #334155;background:#0a0e17;color:#e2e8f0;font-size:14px;outline:none;font-family:inherit;box-sizing:border-box}
.add-input:focus{border-color:#22d3ee}
.add-results{margin-top:12px;max-height:50vh;overflow-y:auto}
.ar-item{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#0a0e17;border:1px solid #1e293b;border-radius:10px;margin-bottom:6px;cursor:pointer;transition:border-color .15s}
.ar-item:hover{border-color:#22d3ee}
.ar-img{width:28px;height:28px;border-radius:50%;flex-shrink:0;background:#1e293b}
.ar-info{flex:1;min-width:0}
.ar-sym{font-size:14px;font-weight:800;color:#f8fafc;font-family:var(--mono)}
.ar-name{font-size:11px;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ar-rank{font-size:10px;color:#64748b;background:#1e293b;padding:2px 6px;border-radius:4px;font-family:var(--mono)}
.ar-btn{padding:5px 12px;border-radius:6px;border:none;font-size:11px;font-weight:700;cursor:pointer;background:#22d3ee;color:#04080e}
.add-msg{font-size:12px;color:#22c55e;margin-top:10px;text-align:center;min-height:18px}
.add-msg.err{color:#ef4444}

/* ── Responsive ── */
@media(max-width:640px){
  .wrap{padding:10px 10px 40px}
  .sh{padding:14px 16px;flex-direction:row}
  .sh-left{flex-direction:row}
  .sh-right{text-align:right}
  .sh-ticker{font-size:18px}.sh-price{font-size:20px}.sh-chg{font-size:12px}
  .sh-name{font-size:12px}
  .sh-img{width:24px;height:24px}
  .sh-metrics{grid-template-columns:repeat(4,1fr);gap:4px}
  .sh-metric{padding:8px 4px}
  .sh-metric-v{font-size:11px}
  .sh-metric-l{font-size:8px}
  .sh-summary{font-size:11px;padding:8px 12px}
  .deriv-grid{grid-template-columns:repeat(2,1fr)}
  .ai-sent{padding:14px 16px}
  .ai-sent .gauge-wrap{width:60px;height:38px}.ai-sent .gauge-wrap svg{width:60px;height:38px}.ai-sent .gauge-score{font-size:16px}
  .chart-wrap{height:280px}
  .ev-card,.news-card{padding:10px 12px}.ev-title,.news-title{font-size:12px}
}
@media(max-width:380px){
  .sh-ticker{font-size:16px}.sh-price{font-size:18px}
  .sh-name{display:none}
  .sh-metrics{grid-template-columns:repeat(3,1fr)}
  .ai-sent .gauge-wrap{width:50px;height:32px}.ai-sent .gauge-wrap svg{width:50px;height:32px}.ai-sent .gauge-score{font-size:14px}
}
