:root {
  --red: #ff5252;
  --green: #22c58b;
  --flat: #8f959e;
  --bg: #0d0d0d;
  --card: #161616;
  --text: #f2f2f2;
  --sub: #9aa0a8;
  --line: #2a2a2a;
  --primary: #d4a017;
  --tabbar-h: 54px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft Yahei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
#page { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- 顶部: 黑底 logo 左 + 二维码 右 ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: #141414;
  border-bottom: 2px solid #ffffff;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand img { height: 58px; display: block; }
.qr-zone { display: flex; gap: 8px; }
.qr {
  width: 72px; background: #fff; border-radius: 4px; overflow: hidden; text-align: center;
}
.qr img { width: 68px; height: 68px; display: block; margin: 2px auto 0; }
.qr span {
  display: block; font-size: 10px; color: #1a1a1a; line-height: 1.35;
  padding: 2px 1px 3px; font-weight: 600;
}

/* ---- 时间 | 开市状态 (红色, 靠右) ---- */
.status-line {
  background: #000;
  text-align: right;
  padding: 7px 14px 5px;
  font-size: 13px;
  font-weight: 600;
  color: #ff3b30;
  font-variant-numeric: tabular-nums;
}
.status-line .sep { margin: 0 6px; opacity: .85; }

/* ---- 公告: 白字滚动, 高度即一行字 ---- */
.notice-bar {
  background: #000;
  overflow: hidden;
  padding: 0;
  font-size: 13.5px;
  line-height: 20px;
  height: 20px;
}
.marquee {
  display: inline-flex;
  white-space: nowrap;
  animation: mq 16s linear infinite;
}
.marquee span { padding-right: 64px; color: #f2f2f2; }
@keyframes mq {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.loading { text-align: center; color: var(--sub); padding: 60px 0; }

/* ---- 行情卡片 ---- */
#board { flex: 1; padding: 10px 10px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); }
/* 有页脚信息条时, 行情区底部只留小间距, 让信息条紧跟最后一个品种卡片 */
#page:has(.site-footer:not([hidden])) #board { padding-bottom: 12px; }
.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.cat-head {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px 8px; font-weight: 600; font-size: 15px;
}
.cat-head::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--primary); }
.list-head, .qrow {
  display: grid;
  grid-template-columns: 1.1fr .95fr .95fr 1.05fr;
  gap: 4px; align-items: center;
  padding: 8px 14px;
}
.list-head { color: var(--sub); font-size: 11px; padding-top: 0; padding-bottom: 4px; }
.list-head span:nth-child(2), .list-head span:nth-child(3), .list-head span:nth-child(4) { text-align: right; }
.qrow { border-top: 1px solid var(--line); }
.q-name { min-width: 0; }
.q-name .nm { font-weight: 600; font-size: 15px; }
.q-price { text-align: right; font-variant-numeric: tabular-nums; }
.q-price .pv { font-size: 17px; font-weight: 700; }
.q-range {
  text-align: right; font-size: 11px; color: var(--sub);
  font-variant-numeric: tabular-nums; line-height: 1.55;
}
.q-range .pct {
  display: inline-block; min-width: 52px; padding: 1px 2px 1px 6px;
  border-radius: 4px; font-size: 11px; font-weight: 600; margin-top: 1px;
  text-align: right;
}
.up { color: var(--red); }
.down { color: var(--green); }
.flat { color: var(--flat); }
.pct.up { background: rgba(255,82,82,.12); }
.pct.down { background: rgba(34,197,139,.12); }
.pct.flat { background: rgba(143,149,158,.12); }

/* ---- 页内嵌框视图(快讯/商城): 全屏覆盖, 隐藏顶部logo/时间/公告 ---- */
body.frame-mode .topbar,
body.frame-mode .status-line,
body.frame-mode .notice-bar { display: none !important; }
body.frame-mode #frameView {
  position: fixed;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom));
  padding: 0;
  z-index: 15;
}
#frameView {
  flex: 1;
  display: flex;
  padding: 10px 10px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
}
#frameView iframe {
  flex: 1;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #fff;
}
body.frame-mode #frameView iframe { border-radius: 0; }
#page:has(#frameView:not([hidden])) .site-footer { display: none; }

/* ---- 页脚信息: 每项一行, 左对齐, 背景与页面一致 ---- */
.site-footer {
  background: var(--bg);
  text-align: left;
  color: #9aa0a8;
  font-size: 11.5px;
  line-height: 2;
  padding: 8px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
.site-footer .beian-link { color: inherit; text-decoration: none; }
#page:has(.tabbar:not([hidden])) .site-footer {
  padding-bottom: 12px;
  margin-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

/* ---- 底部导航(后台可配) ---- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  display: flex; background: #141414; border-top: 1px solid #262626;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; height: var(--tabbar-h); color: #9aa0a8; font-size: 10px; text-decoration: none;
}
.tabbar a.active { color: var(--primary); font-weight: 600; }
.tabbar svg { width: 22px; height: 22px; }

/* ---- 客服悬浮按钮(可拖拽) ---- */
.float-cs {
  position: fixed; z-index: 30;
  right: 14px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
  width: 50px; height: 50px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #1a1a1a; text-decoration: none; font-size: 10px; font-weight: 600;
  background: linear-gradient(135deg, #e8bc3f, #c8930e);
  box-shadow: 0 3px 12px rgba(0,0,0,.5);
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: pointer; overflow: hidden;
}
.float-cs:active { transform: scale(.94); }
