/* ==========================================================================
   番股行情 · 样式表
   移动优先。≥900px 切换成「左侧导航栏 + 宽内容区」的桌面布局。
   涨跌配色遵循 A 股习惯：涨=红，跌=绿。
   ========================================================================== */

/* ============ 设计变量 ============ */
:root {
  --bg: #f4f5f9;
  --bg-soft: #fafbfe;
  --card: #ffffff;
  --text: #171a23;
  --text-2: #4a5060;
  --muted: #8a8fa3;
  --line: #eceef4;
  --line-2: #e2e5ee;
  --accent: #ff6b35;
  --accent-2: #ff8b5e;
  --accent-soft: #fff0ea;
  --up: #f0403c;          /* 涨：红 */
  --down: #16a34a;        /* 跌：绿 */
  --violet: #7c3aed;      /* 做空 */
  --blue: #0ea5e9;        /* 平空 */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(23, 26, 35, .04);
  --shadow-2: 0 1px 2px rgba(23, 26, 35, .04), 0 10px 26px -18px rgba(23, 26, 35, .28);
  --shadow-3: 0 2px 6px rgba(23, 26, 35, .06), 0 18px 40px -22px rgba(23, 26, 35, .34);
  --rail: 208px;
  --gap: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "tnum" 1;
  padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent-soft); color: var(--accent); }

.hidden { display: none !important; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* 键盘可达性 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible) { outline: none; }

/* 自定义滚动条（桌面端） */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: #d4d8e4 transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb { background: #d4d8e4; border-radius: 8px; border: 3px solid var(--bg); }
  ::-webkit-scrollbar-thumb:hover { background: #bfc5d6; }
}

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto; height: 52px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.4px; }
.brand em { color: var(--accent); font-style: normal; }
.spacer { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }

/* ============ 容器 ============ */
.wrap { max-width: 720px; margin: 0 auto; padding: 14px 14px 24px; }

.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  padding: 14px; margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }
.card:last-child { margin-bottom: 0; }

.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}
h1, h2, h3 { margin: 0; }

.h-title {
  font-size: 15px; font-weight: 700; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.h-title .dot { width: 3px; height: 13px; border-radius: 2px; background: var(--accent); flex: 0 0 auto; }

/* ============ 指数条 ============ */
.index-bar {
  display: flex; align-items: baseline; gap: 10px;
  background: linear-gradient(135deg, #fff 0%, #fff8f4 62%, #fff2ea 100%);
  border-color: #fbe3d7;
}
.index-value { font-size: 26px; font-weight: 800; letter-spacing: -.8px; }
.index-meta { font-size: 12px; color: var(--muted); }
/* 基本面子指数 / 交易市场子指数：小字一行，不抢主指数的视觉权重 */
.idx-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.idx-sub b { font-weight: 600; }

/* 桌面端在指数条右侧补三个小统计，移动端隐藏 */
.index-side { display: none; }
@media (min-width: 640px) {
  .index-bar { align-items: center; }
  .index-side {
    display: block; text-align: right; min-width: 62px;
    padding-left: 14px; margin-left: 4px; border-left: 1px solid #f6e0d4;
  }
  .index-side .k { font-size: 11px; color: var(--muted); }
  .index-side .v { font-size: 16px; font-weight: 800; margin-top: 2px; }
}

/* ============ 工具条 ============ */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 140px; display: flex; align-items: center; gap: 6px;
  background: var(--card); border-radius: 12px; padding: 0 12px; height: 38px;
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: none; width: 100%; font-size: 14px; }

.chip {
  height: 38px; padding: 0 14px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.chip:hover { background: var(--bg-soft); color: var(--text-2); }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip.on:hover { background: var(--accent-2); color: #fff; }
.chip .sub { color: rgba(255, 255, 255, .8); }

/* ============ 番剧行 / 卡片 ============ */
.market-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.anime {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.anime:active { transform: scale(.996); }
.anime:hover { border-color: var(--line-2); box-shadow: var(--shadow-3); transform: translateY(-1px); }

/* 封面图 / 头像占位
   注意：这里不要写裸 .cover —— 交易面板的「平空」按钮也用 class="cover"，会撞车。
   所以统一限定在 .cover-box 内，或者要求带 .ph（头像占位）。 */
.cover-box {
  position: relative; flex: 0 0 auto; border-radius: 9px; overflow: hidden;
  background: #f1f3f8; box-shadow: inset 0 0 0 1px rgba(23, 26, 35, .04);
}
.cover-box.sm { width: 54px; height: 72px; }
.cover-box.md { width: 96px; height: 128px; border-radius: 12px; }
.cover-box.lg { width: 108px; height: 144px; border-radius: 12px; }

.cover-box .cover, .cover.ph {
  border-radius: 8px; object-fit: cover; flex: 0 0 auto;
  background: linear-gradient(135deg, #ffe6dc, #ffeef7);
}
.cover-box .cover {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 0; font-size: 22px;
  animation: coverIn .28s ease both;
}
.cover-box.md .cover { font-size: 34px; }
.cover.ph {
  display: grid; place-items: center; color: #ffb59a;
  font-weight: 800; font-size: 22px;
}
@keyframes coverIn { from { opacity: 0 } to { opacity: 1 } }

/* ---------- 用户头像 ---------- */
.av { border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: block; }
.av.ph {
  display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 50%; color: #ffb59a; font-weight: 800;
  background: linear-gradient(135deg, #ffe6dc, #ffeef7);
}
/* 「我的」页左上角可点头像 */
.av-btn {
  position: relative; padding: 0; border: 0; background: none;
  cursor: pointer; flex: 0 0 auto; line-height: 0; border-radius: 50%;
}
.av-btn:active { transform: scale(.96); }
.av-badge {
  position: absolute; right: -2px; bottom: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px;
  background: var(--bg); border: 1px solid var(--line);
}
.chip.mini { height: 22px; padding: 0 8px; font-size: 11px; }

/* ---------- 意见反馈悬浮按钮 ---------- */
.fab {
  position: fixed; right: 18px; bottom: 74px; z-index: 35;
  width: 48px; height: 48px; padding: 0;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 22px -8px rgba(255, 107, 53, .85), 0 2px 6px rgba(0, 0, 0, .08);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.fab:hover { background: var(--accent-2); transform: translateY(-2px); }
.fab:active { transform: scale(.94); }
@media (min-width: 900px) {
  .fab { right: 26px; bottom: 26px; }
}
/* 弹窗打开时把按钮让出来，避免压住遮罩 */
body.has-modal .fab { display: none; }

.fb-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.fb-item { border-top: 1px solid var(--line); padding: 9px 0; font-size: 12px; }
.fb-item:first-of-type { border-top: 0; }
.fb-item .c { white-space: pre-wrap; line-height: 1.6; margin: 3px 0 5px; }
.fb-item.done { opacity: .55; }

/* ---------- 多选清单（导出弹窗）---------- */
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 46vh; overflow: auto; margin-bottom: 6px; }
.pick {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px; cursor: pointer;
}
.pick:hover { background: var(--bg-soft); }
.pick input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.pick b { font-size: 13px; font-weight: 650; }

.anime .name {
  font-weight: 650; font-size: 14px; margin-bottom: 4px; line-height: 1.35;
  white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.anime .sub { font-size: 11px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.price-col { text-align: right; min-width: 76px; flex: 0 0 auto; }
.price { font-weight: 750; font-size: 16px; letter-spacing: -.2px; }
.pct { font-size: 12px; font-weight: 600; }

.badge {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10px;
  background: var(--bg); color: var(--muted); font-weight: 600; white-space: nowrap;
}
.badge.warn { background: #fff7e6; color: #b76e00; }
.badge.off { background: #f2f3f7; color: #9aa0b0; }
.badge.hot { background: var(--accent-soft); color: var(--accent); }

/* 排行榜名字后面的实力字母：S 最亮，往下逐级变淡，D 直接灰掉 */
.badge.st {
  font-size: 11px; font-weight: 800; min-width: 19px; text-align: center;
  padding: 1px 5px; letter-spacing: .2px;
}
.badge.st-s { background: var(--accent); color: #fff; }
.badge.st-a { background: var(--accent-soft); color: var(--accent); }
.badge.st-b { background: #e8f1fd; color: #3271c9; }
.badge.st-c { background: #f0f1f6; color: #767d8d; }
.badge.st-d { background: #f5f6f9; color: #a6abb8; }

/* ============ 详情页 ============ */
.detail-grid { display: flex; flex-direction: column; }
.detail-main { min-width: 0; }
.detail-side { min-width: 0; }
.detail-trades { min-width: 0; }

.hero { padding: 16px; }
.hero .title { font-size: 19px; font-weight: 800; letter-spacing: -.4px; line-height: 1.3; }
.hero .jp { font-size: 11px; color: var(--muted); margin-top: 3px; }
.hero-price {
  font-size: 30px; font-weight: 800; letter-spacing: -1.2px; line-height: 1.1;
  margin: 12px 0 6px;
}
.breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.bd-item {
  background: var(--bg-soft); border-radius: 10px; padding: 8px 10px;
  border: 1px solid var(--line);
}
.bd-item .k { font-size: 11px; color: var(--muted); }
.bd-item .v { font-weight: 700; font-size: 13px; margin-top: 1px; }

.chart { width: 100%; height: 120px; display: block; margin-top: 10px; }

/* ============ 交易面板 ============ */
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; height: 34px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--muted); transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text-2); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(23, 26, 35, .1); }
.seg button.on.buy { color: var(--up); }
.seg button.on.sell { color: var(--down); }
.seg button.on.short { color: var(--violet); }
.seg button.on.cover { color: var(--blue); }

.field { margin-top: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper input {
  flex: 1; height: 42px; border-radius: 11px; border: 1px solid var(--line);
  text-align: center; font-size: 17px; font-weight: 700; outline: none;
  background: var(--bg-soft); transition: border-color .15s, box-shadow .15s;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.step {
  width: 42px; height: 42px; border-radius: 11px; background: var(--bg);
  font-size: 20px; color: var(--muted); display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.step:hover { background: var(--accent-soft); color: var(--accent); }
.quick { display: flex; gap: 6px; margin-top: 8px; }
.quick button {
  flex: 1; height: 30px; border-radius: 8px; background: var(--bg);
  font-size: 12px; color: var(--muted); transition: background .15s, color .15s;
}
.quick button:hover { background: var(--accent-soft); color: var(--accent); }

.levers { display: flex; gap: 6px; }
.levers button {
  flex: 1; height: 36px; border-radius: 10px; background: var(--bg);
  font-size: 13px; font-weight: 650; color: var(--muted);
  transition: background .15s, color .15s;
}
.levers button:hover:not(:disabled) { background: #efe7ff; color: var(--violet); }
.levers button.on {
  background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 53, .3);
}
.levers button:disabled { opacity: .4; cursor: not-allowed; }

.summary {
  margin-top: 12px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 12px; font-size: 12px;
}
.summary .r { display: flex; justify-content: space-between; padding: 2px 0; }
.summary .r span:last-child { font-weight: 700; }

.btn {
  width: 100%; height: 46px; border-radius: 12px; font-size: 15px; font-weight: 700;
  background: var(--accent); color: #fff; margin-top: 12px;
  box-shadow: 0 6px 18px -10px rgba(255, 107, 53, .9);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover:not(:disabled) { background: var(--accent-2); }
.btn:active:not(:disabled) { transform: scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: var(--bg); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.btn.ghost:hover:not(:disabled) { background: #f0f2f8; }
.btn.danger { background: #fff1f0; color: #d4380d; box-shadow: none; }
.btn.danger:hover:not(:disabled) { background: #ffe3df; }
.btn.sm { height: 34px; font-size: 13px; border-radius: 9px; margin-top: 8px; }

/* ============ 持仓 ============ */
.pos {
  padding: 12px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: box-shadow .15s, border-color .15s;
}
.pos:hover { box-shadow: var(--shadow-2); border-color: var(--line-2); }
.pos .tag { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 5px; }
.pos .tag.long { background: #fff1f0; color: var(--up); }
.pos .tag.short { background: #f3e8ff; color: var(--violet); }
.pos-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 6px; margin-top: 10px; }
.pos-grid .k { font-size: 10px; color: var(--muted); }
.pos-grid .v { font-size: 13px; font-weight: 700; }

/* ============ 统计块 ============ */
.assets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.asset {
  background: var(--card); border-radius: 12px; padding: 12px;
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.asset .k { font-size: 11px; color: var(--muted); }
.asset .v { font-size: 19px; font-weight: 800; margin-top: 3px; letter-spacing: -.5px; }

.menu {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 14px;
  border-bottom: 1px solid var(--line); transition: background .15s;
}
.menu a:last-child { border-bottom: 0; }
.menu a:hover { background: var(--bg-soft); }

/* ============ 表格 ============ */
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th {
  text-align: left; color: var(--muted); font-weight: 600;
  padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }

/* 通用：卡片列表（移动端单列，桌面端自动多列） */
.card-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* 通用：卡片内的列表项 */
.li {
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.li:last-child { border-bottom: 0; }

/* ============ 底部导航 ============ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-inner { display: flex; width: 100%; max-width: 720px; }
.tabbar a {
  flex: 1; height: 58px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; font-size: 10px; color: var(--muted);
  transition: color .15s; position: relative;
}
.tabbar a .i { font-size: 17px; line-height: 1; filter: grayscale(1) opacity(.65); transition: filter .15s; }
.tabbar a.on { color: var(--accent); font-weight: 700; }
.tabbar a.on .i { filter: none; }

/* 未读回复红点（我的） */
.tabbar a .dot {
  position: absolute; top: 9px; left: 50%; margin-left: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--up); box-shadow: 0 0 0 2px var(--card);
  animation: dotPulse 1.8s ease-in-out infinite;
}
@keyframes dotPulse { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.22) } }

/* 桌面端侧栏专用元素，移动端隐藏 */
.rail-brand, .rail-foot { display: none; }

/* ============ 弹层 ============ */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(20, 22, 30, .42);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  backdrop-filter: blur(2px);
  animation: fadeIn .16s ease both;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal-inner {
  background: var(--card); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  max-height: 90vh; overflow: auto;
  box-shadow: 0 -10px 40px -20px rgba(23, 26, 35, .4);
  animation: slideUp .2s cubic-bezier(.22, .8, .3, 1) both;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
.modal h3 { font-size: 17px; margin-bottom: 4px; }
.modal .sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.input {
  width: 100%; height: 44px; border-radius: 11px; border: 1px solid var(--line);
  padding: 0 12px; outline: none; margin-bottom: 10px; background: var(--bg-soft);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ============ Toast ============ */
#toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: rgba(23, 26, 35, .92); color: #fff;
  padding: 9px 16px; border-radius: 10px;
  font-size: 13px; z-index: 80; opacity: 0;
  transition: opacity .18s, transform .18s;
  pointer-events: none; max-width: 84vw; text-align: center;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .5);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

/* ============ 空态 ============ */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }

/* ============ 骨架 ============ */
.skel {
  height: 74px; border-radius: var(--radius);
  background: linear-gradient(90deg, #eef0f5, #f7f8fb, #eef0f5);
  background-size: 300% 100%; animation: sk 1.2s infinite; margin-bottom: 8px;
}
@keyframes sk { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }

/* ============ 窄栏（阅读型页面） ============ */
.narrow { max-width: 760px; margin: 0 auto; }
/* 窄栏里的分段控件别拉满整行，两个按钮撑 760px 太空 */
.narrow .seg { max-width: 340px; margin-left: auto; margin-right: auto; }

/* 中等宽度：我的 / 持仓这类信息密度中等的页面 */
.wrap.mid { max-width: 980px; margin: 0 auto; }

/* 管理后台：表格多，控制在易读宽度 */
.wrap.admin { max-width: 940px; margin: 0 auto; }

/* 空态卡片不要横跨整个屏幕 */
.card.empty { max-width: 620px; margin-left: auto; margin-right: auto; }

/* ==========================================================================
   小屏微调
   ========================================================================== */
@media (max-width: 380px) {
  .price-col { min-width: 66px; }
  .index-value { font-size: 23px; }
  .hero-price { font-size: 26px; }
}

/* 顶栏赛季标签在窄屏上别把品牌挤掉 */
@media (max-width: 460px) {
  #season-tag {
    max-width: 132px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; font-size: 11px;
  }
  .toolbar .search { flex: 1 1 100%; }
}

/* ==========================================================================
   中屏：平板 / 小笔记本，先上双列
   ========================================================================== */
@media (min-width: 640px) {
  /* PC/平板统一双列；单列由 .market-grid.single 覆盖 */
  .assets { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .breakdown { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .modal { align-items: center; padding: 20px; }
  .modal-inner { border-radius: 18px; animation: zoomIn .18s cubic-bezier(.22, .8, .3, 1) both; }
  @keyframes zoomIn { from { transform: scale(.97); opacity: .6 } to { transform: none; opacity: 1 } }
}

/* ==========================================================================
   桌面端：左侧导航栏 + 宽内容区
   ========================================================================== */
@media (min-width: 900px) {
  body { padding-bottom: 0; font-size: 14px; }

  /* --- 顶栏横跨内容区，让出侧栏 --- */
  .topbar { border-bottom: 1px solid var(--line); }
  .topbar-inner {
    max-width: none; height: 58px;
    padding-left: calc(var(--rail) + 28px); padding-right: 28px;
  }
  .topbar .brand { display: none; }        /* 品牌移到侧栏顶部 */

  /* --- 底部导航变左侧导航 --- */
  .tabbar {
    top: 0; bottom: 0; right: auto; left: 0; width: var(--rail);
    border-top: 0; border-right: 1px solid var(--line);
    background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none;
    flex-direction: column; justify-content: flex-start;
    padding: 0 12px 16px; z-index: 40; box-shadow: none;
  }
  .rail-brand {
    display: flex; align-items: center; height: 58px; padding: 0 10px;
    font-weight: 800; font-size: 17px; letter-spacing: -.4px; flex: 0 0 auto;
  }
  .rail-brand em { color: var(--accent); font-style: normal; }

  .tabbar-inner { flex-direction: column; width: 100%; max-width: none; gap: 2px; margin-top: 6px; }
  .tabbar a {
    flex: 0 0 auto; width: 100%; height: 42px;
    flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 0 12px; border-radius: 11px; font-size: 14px;
  }
  .tabbar a .i {
    font-size: 16px; width: 20px; text-align: center;
    filter: grayscale(1) opacity(.7);
  }
  .tabbar a:hover { background: var(--bg-soft); color: var(--text); }
  .tabbar a:hover .i { filter: none; }
  .tabbar a.on { background: var(--accent-soft); color: var(--accent); }
  .tabbar a.on .i { filter: none; }
  /* 桌面端红点放到右侧，和文字同一行 */
  .tabbar a .dot {
    top: 50%; left: auto; right: 14px; margin-left: 0;
    transform: translateY(-50%); animation: none;
  }

  .rail-foot {
    display: block; margin-top: auto; padding: 14px 10px 0;
    border-top: 1px solid var(--line);
    font-size: 11px; color: var(--muted); line-height: 1.75;
  }
  .rail-foot b { color: var(--text-2); font-weight: 700; }
  .rail-foot .link { color: var(--accent); cursor: pointer; }
  .rail-foot .link:hover { text-decoration: underline; }

  /* --- 主内容区 --- */
  #app { margin-left: var(--rail); }
  .wrap { max-width: 1320px; padding: 22px 28px 56px; }
  .narrow { max-width: 780px; }

  /* --- 封面放大一点，桌面屏够大 --- */
  .cover-box.sm { width: 96px; height: 128px; border-radius: 10px; }
  .cover-box.md { width: 132px; height: 176px; border-radius: 14px; }
  .cover-box.lg { width: 140px; height: 187px; border-radius: 14px; }
  .anime { padding: 12px 14px; }
  .anime .name { font-size: 14.5px; }
  .price { font-size: 16px; }

  /* --- 详情页两栏：主内容 + 右侧常驻交易面板 --- */
  .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 372px;
    grid-template-areas: "main side" "trades side";
    gap: 0 18px;
    align-items: start;
  }
  .detail-main { grid-area: main; }
  .detail-side { grid-area: side; position: sticky; top: 76px; }
  .detail-trades { grid-area: trades; }
  .detail-side .card { margin-bottom: 0; }

  .hero { padding: 20px; }
  .hero .title { font-size: 21px; }
  .hero-price { font-size: 34px; }
  .chart { height: 150px; }

  /* --- 交易面板更舒展 --- */
  .seg button { height: 36px; }
  .stepper input { height: 44px; font-size: 18px; }
  .step { width: 44px; height: 44px; }
  .levers button { height: 38px; }

  /* --- 列表型页面：多列 --- */
  .card-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
  .card-list > * { margin-bottom: 0; }

  .assets { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

  /* 提示条别贴到屏幕最下 */
  #toast { bottom: 40px; }

  /* 悬停时给可点卡片一点反馈 */
  .card.tight:hover { border-color: var(--line-2); }
}

/* ==========================================================================
   超宽屏：行情四列
   ========================================================================== */
/* PC 端固定双列（单列切换见 .market-grid.single） */
@media (min-width: 640px) {
  .market-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 单列卡片别拉满整个宽屏，收窄一点更紧凑好读 */
  .market-grid.single { grid-template-columns: minmax(0, 1fr); max-width: 1040px; margin: 0 auto; }
}

/* ==========================================================================
   左侧栏：收起 / 展开（仅桌面端）
   ========================================================================== */
.rail-mark { display: none; }
.rail-toggle { display: none; }

@media (min-width: 900px) {
  #app, .topbar-inner, .tabbar {
    transition: margin-left .18s ease, width .18s ease,
                padding-left .18s ease, padding-right .18s ease;
  }

  /* 收起按钮：钉在侧栏右边线上、垂直居中。
     用绝对定位而不是跟着导航列表往下排，展开/收起两种状态下 y 轴位置完全不变。 */
  .rail-toggle {
    position: absolute; top: 50%; right: -16px;
    transform: translateY(-50%);
    display: grid; place-items: center;
    width: 32px; height: 32px; margin: 0; padding: 0;
    border-radius: 50%; border: 1px solid var(--line);
    background: var(--card); color: var(--muted);
    box-shadow: 0 2px 10px -4px rgba(23, 22, 26, .22);
    z-index: 41; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .15s;
  }
  .rail-toggle svg { transition: transform .24s cubic-bezier(.3,.8,.3,1); }
  .rail-toggle:hover {
    background: var(--accent-soft); color: var(--accent);
    border-color: transparent; box-shadow: 0 3px 12px -5px rgba(255, 107, 53, .8);
  }
  .rail-toggle:active { transform: translateY(-50%) scale(.94); }

  /* ---- 收起态：只留图标 ---- */
  html.rail-collapsed { --rail: 64px; }
  html.rail-collapsed .topbar-inner { padding-left: calc(var(--rail) + 20px); }
  html.rail-collapsed .rail-name { display: none; }
  html.rail-collapsed .rail-mark { display: inline; font-size: 20px; line-height: 1; }
  html.rail-collapsed .rail-brand { justify-content: center; padding: 0; }
  html.rail-collapsed .tabbar { padding: 0 8px 12px; }
  html.rail-collapsed .tabbar a { justify-content: center; padding: 0; font-size: 0; gap: 0; }
  html.rail-collapsed .tabbar a .i { font-size: 18px; width: auto; }
  html.rail-collapsed .tabbar a .dot { right: 9px; top: 9px; transform: none; }
  html.rail-collapsed .rail-foot { display: none; }
  html.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }
}

/* ==========================================================================
   单列布局专用卡片（大封面 + 大标题 + 右侧价格区，和双列紧凑行完全不同的版式）
   ========================================================================== */
.anime-wide {
  display: flex; align-items: stretch; gap: 16px; min-width: 0;
  padding: 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.anime-wide:hover {
  transform: translateY(-1px); border-color: var(--line-2); box-shadow: var(--shadow-3);
}

/* ---------- 停牌卡片：整块蒙一层斜纹，明确「看得见、但不能买」 ---------- */
.anime, .anime-wide { position: relative; }
.anime.is-suspended, .anime-wide.is-suspended { cursor: not-allowed; }
.anime.is-suspended .cover-box,
.anime.is-suspended .cover-box .cover,
.anime.is-suspended .cover.ph,
.anime-wide.is-suspended .cover-box,
.anime-wide.is-suspended .cover-photo,
.anime-wide.is-suspended .aw-title { filter: grayscale(1); opacity: .72; }
.anime.is-suspended .price,
.anime.is-suspended .pct,
.anime-wide.is-suspended .aw-price,
.anime-wide.is-suspended .aw-pct { filter: grayscale(1); opacity: .6; }
.anime.is-suspended::after,
.anime-wide.is-suspended::after {
  content: '';
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    repeating-linear-gradient(135deg,
      rgba(255, 255, 255, .52) 0 9px,
      rgba(245, 243, 242, .22) 9px 18px);
}
.anime.is-suspended:hover, .anime-wide.is-suspended:hover {
  transform: none; box-shadow: var(--shadow-1); border-color: var(--line);
}
.aw-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; gap: 7px;
}
.aw-title {
  font-size: 18px; font-weight: 750; line-height: 1.3; letter-spacing: -.3px;
  white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.aw-jp { font-size: 12px; color: var(--muted); }
.aw-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.aw-meta { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

.aw-side {
  flex: 0 0 auto; min-width: 140px; padding-left: 16px;
  border-left: 1px dashed var(--line-2);
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px;
}
.aw-price { font-size: 28px; font-weight: 800; letter-spacing: -1.1px; line-height: 1.1; }
.aw-pct { font-size: 14px; font-weight: 700; }
.aw-sub { font-size: 11px; color: var(--muted); }

@media (max-width: 899px) {
  .anime-wide { gap: 12px; padding: 12px; }
  .aw-title { font-size: 15px; }
  .aw-side { min-width: 92px; padding-left: 10px; }
  .aw-price { font-size: 20px; }
  .aw-pct { font-size: 12px; }
}

/* 布局切换只在桌面端显示（手机上永远是单列紧凑行） */
.layout-toggle { display: none !important; }
@media (min-width: 900px) {
  .layout-toggle { display: inline-flex !important; }
}

/* ==========================================================================
   走势图（详情页）
   ========================================================================== */
.charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 900px) {
  .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
.chart-card {
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 12px 8px;
}
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 6px;
}
.chart-title { font-size: 12px; font-weight: 650; color: var(--text-2); }
.chart-now { font-size: 17px; font-weight: 800; letter-spacing: -.4px; }
.chart-now .unit { font-size: 11px; font-weight: 600; color: var(--muted); margin-left: 3px; letter-spacing: 0; }
.chart-svg { width: 100%; height: 128px; display: block; }
.chart-empty {
  height: 128px; display: grid; place-items: center;
  color: var(--muted); font-size: 12px;
}
.chart-foot {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; color: var(--muted); margin-top: 6px;
}

/* ==========================================================================
   减少动效偏好
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ==========================================================================
   PC 端封面放大 1.5×（基准值来自 640 档：sm 96×128 / md 132×176 / lg 140×187）
   拆两档是为了兼顾窄桌面：1024 左右内容区只有 760px，双列卡片一张 376px，
   直接上 162 宽封面会把标题挤成一两个字一行，所以先给 1.5× 的整数档，
   1280 以上再补到 162×216（= 原 108×144 的 1.5 倍）。
   ========================================================================== */
@media (min-width: 1024px) {
  .cover-box.sm { width: 144px; height: 192px; border-radius: 12px; }
  .cover-box.md { width: 190px; height: 253px; border-radius: 16px; }
  .cover-box.lg { width: 200px; height: 267px; border-radius: 16px; }
  .cover-box.md .cover { font-size: 46px; }
  .cover-box.lg .cover { font-size: 38px; }
}

/* 大屏再加一档：162×216 = 原 108×144 的 1.5 倍，和上面的 144 保持同一层级差 */
@media (min-width: 1280px) {
  .cover-box.sm { width: 162px; height: 216px; }
  .cover-box.md { width: 198px; height: 264px; }
  .cover-box.lg { width: 210px; height: 280px; }
  .cover-box.md .cover { font-size: 50px; }
  .cover-box.lg .cover { font-size: 40px; }
  .anime { padding: 14px; gap: 14px; }
}

/* ---------- 头像裁剪编辑器 ---------- */
.av-editor {
  position: relative; width: 280px; height: 280px; margin: 8px auto 0;
  border-radius: 16px; overflow: hidden; background: #f1f3f8;
  touch-action: none;                 /* 手机上拖动不要触发页面滚动 */
}
.av-editor canvas { display: block; border-radius: 16px; cursor: grab; }
/* 圆形开窗：外圈压暗，用超大 spread 的 shadow 一次性画出来 */
.av-ring {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .9), 0 0 0 9999px rgba(20, 18, 24, .26);
}
#av-preview {
  width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--line);
}
.av-range {
  width: 100%; height: 22px; accent-color: var(--accent); cursor: pointer;
}

/* ==========================================================================
   首页公告条：一行高度、横向滚动、hover 暂停，点击看全文
   ========================================================================== */
.notice {
  display: flex; align-items: center; gap: 9px;
  height: 34px; margin-bottom: 12px; padding: 0 10px 0 0;
  background: linear-gradient(90deg, #fff6f1, #fff);
  border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.notice:hover { border-color: var(--accent-soft); box-shadow: var(--shadow-1); }
.notice-tag {
  flex: 0 0 auto; height: 100%; display: grid; place-items: center;
  padding: 0 9px; font-size: 11px; font-weight: 700; color: #fff;
  background: var(--accent); letter-spacing: .5px;
}
.notice-view { flex: 1 1 auto; overflow: hidden; min-width: 0; }
.notice-track {
  display: inline-flex; align-items: center; gap: 26px;
  white-space: nowrap; font-size: 12.5px; color: var(--text-2);
  animation-name: noticeScroll; animation-timing-function: linear;
  animation-iteration-count: infinite; will-change: transform;
}
.notice:hover .notice-track { animation-play-state: paused; }
.notice-gap { color: var(--accent); opacity: .6; }
.notice-more { flex: 0 0 auto; color: var(--muted); font-size: 15px; padding-left: 2px; }
@keyframes noticeScroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .notice-track { animation: none; }
}

/* ---------- 走势图悬停提示 ---------- */
.chart-wrap { position: relative; }
.chart-svg { cursor: crosshair; touch-action: pan-y; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none;
  transform: translate(-50%, -128%);
  display: flex; flex-direction: column; gap: 1px;
  padding: 6px 9px; border-radius: 9px;
  background: rgba(24, 22, 28, .93); color: #fff;
  font-size: 11px; line-height: 1.5; white-space: nowrap;
  box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .6);
}
.chart-tip[hidden] { display: none; }
.chart-tip.flip { transform: translate(-85%, -128%); }
.chart-tip.flip-left { transform: translate(-8%, -128%); }
.chart-tip b { font-weight: 600; font-size: 10px; opacity: .72; }
.chart-tip .tip-val { font-weight: 750; font-variant-numeric: tabular-nums; }
.chart-tip .tip-delta { font-size: 10px; font-variant-numeric: tabular-nums; }
.chart-tip .tip-delta.up { color: #ff9f80; }
.chart-tip .tip-delta.down { color: #6fd39a; }

/* ---------- 指数卡上的市场情绪小标签 ---------- */
.senti {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line); cursor: help;
}
.senti.up { color: var(--up); background: rgba(255, 107, 53, .08); border-color: transparent; }
.senti.down { color: var(--down); background: rgba(22, 163, 74, .08); border-color: transparent; }

/* 玩法说明（后台可编辑，轻量 markdown 渲染） */
.rules-body { font-size: 13px; line-height: 1.85; color: var(--muted); margin-top: 6px; max-height: 62vh; overflow-y: auto; }
.rules-h3 { font-size: 15px; color: var(--text); margin: 14px 0 6px; font-weight: 700; }
.rules-h4 { font-size: 13px; color: var(--text); margin: 14px 0 6px; font-weight: 700; }
.rules-p { margin: 0 0 8px; }
.rules-ul { margin: 0 0 10px; padding-left: 18px; }
.rules-ul li { margin: 3px 0; }
.rules-body b { color: var(--text); }
.rules-body code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; padding: 1px 4px; border-radius: 4px; background: rgba(127,127,127,.14); }

/* 走势图粒度切换 */
.gran-tabs { display: inline-flex; gap: 2px; margin-left: auto; background: rgba(127,127,127,.10); border-radius: 8px; padding: 2px; }
.gran-tab { border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 6px; cursor: pointer; transition: background .15s, color .15s; }
.gran-tab:hover { color: var(--text); }
.gran-tab.on { background: var(--card, #fff); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.10); }
