/* ============================================================
   Topstar 市场参考工具 · 深色主题（参考 EMBER 行情监控风格）
   火焰橙强调色 · 涨红跌绿 · PC 顶栏 + 移动端底部 Tab 自适应
   ============================================================ */
:root {
  --bg: #0c0d10;
  --bg-soft: #121317;
  --panel: #1a1c21;
  --panel-2: #212429;
  --line: #2a2d34;
  --line-soft: #23262c;
  --ink: #f2f3f5;
  --ink-soft: #9aa1ab;
  --ink-faint: #6b7280;
  --brand: #ff6d1f;
  --brand-2: #ff9a3d;
  --brand-deep: #e2570a;
  --brand-soft: rgba(255, 109, 31, .13);
  --up: #ff4d5e;      /* 涨 = 红 */
  --up-soft: rgba(255, 77, 94, .12);
  --down: #2ecc71;    /* 跌 = 绿 */
  --down-soft: rgba(46, 204, 113, .12);
  --warn: #f59e0b;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --radius: 16px;
  --radius-sm: 11px;
  --tabbar-h: 62px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(255, 109, 31, .07), transparent 60%),
    radial-gradient(700px 380px at -10% 0%, rgba(255, 154, 61, .05), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); }
::selection { background: rgba(255, 109, 31, .35); }

/* ---------- 顶部导航 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 22px;
  background: rgba(14, 15, 18, .82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #ff9a3d, #ff5400);
  display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(255, 109, 31, .4);
  font-size: 17px; line-height: 1;
}
.brand-name { font-weight: 800; letter-spacing: .5px; font-size: 15px; }
.brand-name em { font-style: normal; color: var(--brand-2); }
.nav { display: none; }

/* ---------- 容器 / 页脚 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 22px 40px; }
.footer { max-width: 1200px; margin: 10px auto 0; padding: 0 22px calc(28px + var(--tabbar-h)); }
.disclaimer {
  background: var(--brand-soft); border: 1px solid rgba(255, 109, 31, .25); color: #ffb37e;
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 12.5px; margin: 0 0 8px;
}
.copyright { color: var(--ink-faint); font-size: 12px; text-align: center; margin: 6px 0 0; }

/* ---------- 页面标题 ---------- */
.page-head { margin: 0 0 20px; }
.page-head h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: .3px; }
.page-head .sub { color: var(--ink-soft); font-size: 13px; }
.page-head .sub b { color: var(--brand-2); }

/* ---------- KPI 卡片 ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 14px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.kpi .label .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 8px var(--brand); }
.kpi .value { font-size: 25px; font-weight: 800; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.kpi .spark { height: 52px; margin-top: 8px; }
.kpi.accent {
  background: linear-gradient(135deg, #ff8a2b, #ff5400);
  border: 1px solid rgba(255, 168, 90, .5);
  color: #fff;
}
.kpi.accent .label { color: rgba(255, 255, 255, .85); }
.kpi.accent .label .dot { background: #fff; box-shadow: 0 0 8px #fff; }
.kpi.accent .value { color: #fff; text-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.kpi.accent .value small { color: rgba(255, 255, 255, .88); }

/* ---------- 情绪徽章 ---------- */
.sentiment { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.s2 { background: var(--up-soft); color: #ff8a94; }
.s1 { background: rgba(245, 158, 11, .14); color: #fbbf24; }
.s0 { background: rgba(148, 163, 184, .14); color: #cbd5e1; }
.g0 { background: var(--down-soft); color: #6ee7a0; }
.g1 { background: var(--down-soft); color: #2ecc71; }

/* ---------- 卡片 / 图表 ---------- */
.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card h3 { margin: 0 0 12px; font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .h-bar { width: 4px; height: 16px; border-radius: 2px; background: linear-gradient(180deg, var(--brand-2), var(--brand)); display: inline-block; }
.card h3 .h-time { margin-left: auto; color: var(--ink-faint); font-size: 12px; font-weight: 400; }
.chart { width: 100%; height: 280px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* 分段时间按钮（1H / 12H / 24H 风格） */
.seg { display: inline-flex; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg .seg-btn {
  padding: 4px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
  color: var(--ink-soft); text-decoration: none; transition: .15s;
}
.seg .seg-btn:hover { color: var(--ink); }
.seg .seg-btn.active { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(255, 109, 31, .4); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.tbl th { color: var(--ink-soft); font-weight: 600; font-size: 12.5px; background: rgba(255, 255, 255, .025); }
table.tbl td { color: var(--ink); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover td { background: rgba(255, 255, 255, .035); }
.up { color: var(--up); font-weight: 700; }
.down { color: var(--down); font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand-2); border: 1px solid rgba(255, 109, 31, .28);
}
.tag.hot { background: var(--up-soft); color: var(--up); border-color: rgba(255, 77, 94, .35); }
.row-abnormal td { background: rgba(255, 77, 94, .05) !important; }
.row-abnormal .item-name::after { content: " ⚡"; color: var(--up); }
.mkt-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: rgba(255,255,255,.06); vertical-align: middle; }
.row-market .item-name { font-weight: 600; }
.row-market .item-name .muted { font-weight: 400; font-size: 12px; margin-top: 2px; }
.muted { color: var(--ink-faint); }
.expired { opacity: .45; filter: grayscale(1); }
.empty { text-align: center; color: var(--ink-faint); padding: 30px 20px; font-size: 13px; }
.status-on { color: var(--down); font-weight: 600; }
mark { background: rgba(255, 109, 31, .35); color: #ffd9b8; padding: 0 2px; border-radius: 3px; }

/* ---------- 表单 / 筛选 ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
input, select, textarea {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255, 109, 31, .18); }
select { cursor: pointer; }
select option { background: var(--panel); color: var(--ink); }
.btn {
  display: inline-block; padding: 9px 18px; border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff;
  font-weight: 700; text-decoration: none; font-size: 13.5px; transition: .15s;
  box-shadow: 0 3px 12px rgba(255, 109, 31, .3);
}
.btn:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand-2); border: 1px solid rgba(255, 109, 31, .5); box-shadow: none; }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.warn { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 3px 12px rgba(245, 158, 11, .3); }
.btn.danger { background: linear-gradient(135deg, #ff4d5e, #d92637); box-shadow: 0 3px 12px rgba(255, 77, 94, .3); }
.btn.sm { padding: 6px 12px; font-size: 12.5px; border-radius: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--ink-soft); text-decoration: none; font-size: 13px; transition: .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-faint); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }

/* ---------- 详情 ---------- */
.notice-body {
  font-size: 14.5px; line-height: 1.9; white-space: pre-wrap;
  background: var(--bg-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 16px;
}
.keyinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.keyinfo .k { background: var(--brand-soft); border: 1px solid rgba(255, 109, 31, .22); border-radius: var(--radius-sm); padding: 12px 14px; }
.keyinfo .k .t { color: var(--ink-soft); font-size: 12px; }
.keyinfo .k .v { font-weight: 700; font-size: 15px; }
.alert { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.alert.ok { background: var(--down-soft); color: #6ee7a0; border: 1px solid rgba(46, 204, 113, .3); }
.alert.err { background: var(--up-soft); color: #ff8a94; border: 1px solid rgba(255, 77, 94, .3); }
.alert.info { background: rgba(255, 154, 61, .1); color: #ffb37e; border: 1px solid rgba(255, 109, 31, .3); }

/* ---------- 公告列表（公告模块 / 演示页） ---------- */
.notice-list { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.notice-item { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.notice-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; margin-bottom: 8px; }
.notice-title { font-size: 15px; font-weight: 700; line-height: 1.5; }
.notice-item details { margin-top: 8px; }
.notice-item summary { cursor: pointer; color: var(--brand-2); font-size: 13px; }
.notice-item .notice-body { margin-top: 8px; max-height: 420px; overflow: auto; }
.notice-link { display: inline-block; margin-top: 10px; color: var(--brand-2); font-size: 13px; text-decoration: none; }
.tag.on { background: rgba(46, 204, 113, .14); color: #4ade80; border-color: rgba(46, 204, 113, .4); }
.tag.off { background: rgba(148, 163, 184, .14); color: #94a3b8; border-color: rgba(148, 163, 184, .35); }

/* ---------- 藏品目录（演示页） ---------- */
.series-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 6px; }
.series-box { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; }
.series-name { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }
.series-items { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--panel); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.pill.more { color: var(--brand-2); border-color: rgba(255, 109, 31, .4); }

/* ---------- 安装页 ---------- */
.install-wrap {
  max-width: 560px; margin: 40px auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow);
}
.install-wrap h1 { font-size: 22px; margin: 0 0 6px; font-weight: 800; }
.install-wrap h1 .flame { color: var(--brand-2); }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.form-row .hint { color: var(--ink-faint); font-size: 12px; margin-top: 4px; }
.log-box {
  background: #0a0b0d; color: #7dd3fc; border: 1px solid var(--line);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; padding: 14px; border-radius: var(--radius-sm);
  max-height: 260px; overflow: auto; white-space: pre-wrap;
}

/* ---------- 底部菜单栏（全端显示，参考 EMBER） ---------- */
.tabbar {
  display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: var(--tabbar-h);
  background: rgba(16, 17, 21, .94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line-soft);
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tabbar a {
  flex: 0 1 150px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-faint); font-size: 11.5px; text-decoration: none; transition: .15s;
  position: relative;
}
.tabbar a svg { width: 22px; height: 22px; display: block; transition: .15s; }
.tabbar a:hover { color: var(--ink-soft); }
.tabbar a.active { color: var(--brand-2); font-weight: 600; }
.tabbar a.active svg { filter: drop-shadow(0 0 6px rgba(255, 109, 31, .6)); }
.tabbar a.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-deep));
  box-shadow: 0 2px 8px rgba(255, 109, 31, .5);
}

/* ============================================================
   响应式：移动端
   ============================================================ */
@media (max-width: 820px) {
  .topbar { height: 54px; padding: 0 16px; }
  .container { padding: 16px 14px 30px; }
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 13px 14px 12px; }
  .kpi .value { font-size: 20px; }
  .kpi .spark { height: 42px; }
  .kpi-grid .kpi:first-child { grid-column: 1 / -1; }
  .card { padding: 14px; border-radius: 14px; }
  .chart { height: 220px; }
  .page-head h1 { font-size: 19px; }

  .tabbar a { flex: 1 1 0; font-size: 10.5px; }
  .tabbar a svg { width: 21px; height: 21px; }
  .footer { padding-bottom: calc(20px + var(--tabbar-h) + env(safe-area-inset-bottom, 0)); }
  table.tbl th, table.tbl td { padding: 10px 8px; font-size: 12.5px; }
  .toolbar input, .toolbar select { flex: 1 1 140px; }
}

/* 超窄屏 */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 13.5px; }
}

/* ===== 市场板块行情 / 资金流向（V1.2） ===== */
.flow-list { display: flex; flex-direction: column; gap: 9px; margin: 8px 0 4px; }
.flow-row { display: grid; grid-template-columns: 96px 1fr 100px; align-items: center; gap: 10px; }
.flow-name { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-track { position: relative; height: 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line-soft); overflow: hidden; }
.flow-fill { display: block; height: 100%; border-radius: 999px; background: var(--ink-faint); transition: width .5s ease; }
.flow-fill.pos { background: linear-gradient(90deg, rgba(255,77,94,.45), var(--up)); }
.flow-fill.neg { background: linear-gradient(90deg, rgba(46,204,113,.45), var(--down)); }
.flow-fill.zero { background: var(--line); }
.flow-val { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; }
.flow-text { font-size: 13px; line-height: 1.8; color: var(--ink-soft); margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
@media (max-width: 560px) { .flow-row { grid-template-columns: 76px 1fr 88px; } .flow-name { font-size: 11.5px; } }

/* ===== 自定义站点图标（V1.3） ===== */
.logo.logo-img { background: #1a1b20; box-shadow: 0 4px 14px rgba(0,0,0,.45); overflow: hidden; }
.logo.logo-img img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }

/* ===== 恐慌贪婪指数 · 情绪解读（V1.3） ===== */
.fg-wrap { display: grid; grid-template-columns: 250px 1fr; gap: 22px; align-items: center; margin-top: 6px; }
.fg-gauge svg { width: 100%; max-width: 250px; display: block; margin: 0 auto; }
.fg-score { text-align: center; margin-top: -6px; }
.fg-score b { display: block; font-size: 30px; line-height: 1.15; }
.fg-score span { font-size: 13.5px; font-weight: 700; letter-spacing: 1px; }
.fg-score em { display: block; font-style: normal; font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.fg-factors { display: flex; flex-direction: column; gap: 11px; }
.fg-factor { display: grid; grid-template-columns: 1fr 130px 46px; align-items: center; gap: 10px; }
.fg-factor .fname { font-size: 12.5px; color: var(--ink-soft); }
.fg-factor .fname em { font-style: normal; color: var(--ink-faint); font-size: 11px; margin-left: 4px; }
.fg-factor .ftrack { position: relative; height: 8px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--line-soft); overflow: hidden; }
.fg-factor .ftrack i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.fg-factor .fval { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.fg-bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-top: 18px; }
.fg-band { background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 11px; padding: 9px 11px; opacity: .62; }
.fg-band.active { opacity: 1; border-color: currentColor; background: var(--panel); }
.fg-band .lb { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.fg-band .lb i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.fg-band .rng { font-size: 10.5px; color: var(--ink-faint); margin-top: 1px; font-variant-numeric: tabular-nums; }
.fg-band .ds { font-size: 11px; color: var(--ink-soft); line-height: 1.55; margin-top: 5px; }
@media (max-width: 760px) {
  .fg-wrap { grid-template-columns: 1fr; }
  .fg-bands { grid-template-columns: repeat(2, 1fr); }
  .fg-factor { grid-template-columns: 1fr 90px 42px; }
}
