/* ══════════════════════════════════════════════════════════
   Polymarket Desk
   中性表面 + 发丝边框 + 高对比中性主按钮（shadcn 语汇）
   原生字体 / 44px 触控 / 底部 sheet / 安全区（Apple 语汇）
   签名元素：概率轨 .rail —— 按 Yes 概率分割的一根轴
   ══════════════════════════════════════════════════════════ */

:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --elev: #ffffff;
  --muted: #f1f1f3;
  --border: #e5e5e8;
  --border-strong: #d6d6da;

  --fg: #09090b;
  --fg-2: #52525b;
  --fg-3: #8b8b94;

  --primary: #18181b;
  --primary-fg: #fafafa;
  --ring: #18181b;

  --up: #15a34a;
  --up-bg: #15a34a14;
  --down: #dc2626;
  --down-bg: #dc262614;

  --r-xs: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(9, 9, 11, 0.05);
  --shadow: 0 4px 14px -4px rgba(9, 9, 11, 0.12), 0 1px 3px rgba(9, 9, 11, 0.06);
  --shadow-lg: 0 -8px 40px rgba(9, 9, 11, 0.16);

  /* iOS sheet 缓动 */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 260ms;
  --dur-fast: 140ms;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --bar-h: 52px;
  --tab-h: 56px;
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --card: #111113;
  --elev: #17171a;
  --muted: #1a1a1e;
  --border: #232327;
  --border-strong: #303036;

  --fg: #fafafa;
  --fg-2: #a1a1aa;
  --fg-3: #71717a;

  --primary: #fafafa;
  --primary-fg: #18181b;
  --ring: #d4d4d8;

  --up: #2fbf6b;
  --up-bg: #2fbf6b1f;
  --down: #f05563;
  --down-bg: #f055631f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 -8px 40px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --card: #111113;
    --elev: #17171a;
    --muted: #1a1a1e;
    --border: #232327;
    --border-strong: #303036;

    --fg: #fafafa;
    --fg-2: #a1a1aa;
    --fg-3: #71717a;

    --primary: #fafafa;
    --primary-fg: #18181b;
    --ring: #d4d4d8;

    --up: #2fbf6b;
    --up-bg: #2fbf6b1f;
    --down: #f05563;
    --down-bg: #f055631f;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 -8px 40px rgba(0, 0, 0, 0.55);
  }
}

/* ─────────────────────────── base ─────────────────────── */

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; }

.num {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* micro label —— 唯一的装饰性排版手法，克制使用 */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  white-space: nowrap;
}

/* ─────────────────────── 概率轨（签名）────────────────── */

.rail {
  display: block; /* 列表里用的是 <span>，不设 display 则 height 不生效 */
  position: relative;
  height: 3px;
  border-radius: 99px;
  /* 列表里压低强度：读数是「Yes 占多少」，余量不需要同等分量 */
  background: color-mix(in srgb, var(--down) 26%, transparent);
  overflow: hidden;
}

.rail > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p, 50%);
  background: color-mix(in srgb, var(--up) 78%, transparent);
  border-radius: 99px;
  transition: width var(--dur) var(--ease);
}

/* 详情页的仪表才用满强度 */
.rail-lg { height: 6px; background: color-mix(in srgb, var(--down) 70%, transparent); }
.rail-lg > i { background: var(--up); }

/* ─────────────────────────── controls ─────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.btn:hover:not(:disabled) { background: var(--muted); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: transparent;
  font-weight: 560;
}
.btn-primary:hover:not(:disabled) { background: var(--primary); opacity: 0.9; }

.btn-up { background: var(--up); color: #fff; border-color: transparent; font-weight: 560; }
.btn-up:hover:not(:disabled) { background: var(--up); opacity: 0.9; }
.btn-down { background: var(--down); color: #fff; border-color: transparent; font-weight: 560; }
.btn-down:hover:not(:disabled) { background: var(--down); opacity: 0.9; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-2); }
.btn-ghost:hover:not(:disabled) { background: var(--muted); color: var(--fg); }

.btn-lg { min-height: 48px; font-size: 15px; width: 100%; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-icon { min-height: 36px; width: 36px; padding: 0; }

.input {
  width: 100%;
  min-height: 44px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.input::placeholder { color: var(--fg-3); }
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 16%, transparent); }

input[type="number"].input { -moz-appearance: textfield; }
input[type="number"].input::-webkit-outer-spin-button,
input[type="number"].input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.field { display: block; }
.field > .lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--fg-2);
  margin-bottom: 6px;
}

/* 分段控件 —— shadcn Tabs 语汇 */
.seg {
  display: flex;
  gap: 2px;
  background: var(--muted);
  padding: 3px;
  border-radius: var(--r);
}

.seg > button {
  flex: 1;
  min-height: 36px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  border-radius: calc(var(--r) - 3px);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.seg > button[aria-selected="true"] {
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.error-text {
  color: var(--down);
  font-size: 13px;
  min-height: 18px;
  line-height: 1.4;
}

/* ─────────────────────────── login ────────────────────── */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ─────────────────────────── shell ────────────────────── */

.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--bar-h);
  padding: 0 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-size: 15px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.spacer { flex: 1; }

.money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.money b { font-size: 14.5px; font-weight: 620; letter-spacing: -0.02em; }
.money span { font-size: 10.5px; color: var(--fg-3); }

.chip {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg-2);
  white-space: nowrap;
}

/* 桌面顶部 tabs —— 移动端隐藏，改用底部 tabbar */
.tabs { display: none; gap: 2px; }

.tabs > button {
  border: none;
  background: transparent;
  color: var(--fg-2);
  padding: 7px 12px;
  border-radius: var(--r);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tabs > button:hover { background: var(--muted); color: var(--fg); }
.tabs > button[aria-selected="true"] { background: var(--muted); color: var(--fg); font-weight: 550; }

main { flex: 1; min-height: 0; position: relative; }

.view { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* 底部 tabbar —— 拇指区 */
.tabbar {
  display: flex;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 20;
}

.tabbar > button {
  flex: 1;
  height: var(--tab-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--fg-3);
  font-size: 10.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}

.tabbar > button svg { width: 21px; height: 21px; stroke-width: 1.7; }
.tabbar > button[aria-selected="true"] { color: var(--fg); }

/* ─────────────────────── 行情列表 ─────────────────────── */

.search-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.group { padding: 14px 12px 6px; }

.group-head {
  display: flex;
  gap: 9px;
  align-items: center;
  width: 100%;
  margin-bottom: 10px;
  padding: 4px 6px;
  border: none;
  background: transparent;
  border-radius: var(--r);
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.group-head:hover { background: var(--muted); }
.group-head[aria-expanded] .chev {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--fg-3);
  transition: transform var(--dur) var(--ease);
}
.group-head[aria-expanded="true"] .chev { transform: rotate(180deg); }

.group-head img {
  width: 26px; height: 26px;
  border-radius: 7px;
  object-fit: cover;
  background: var(--muted);
  flex-shrink: 0;
}

.group-tt { flex: 1; min-width: 0; }

.group-title {
  display: block;
  font-size: 13.5px;
  font-weight: 560;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.group-meta { display: block; font-size: 11px; color: var(--fg-3); margin-top: 1px; }

.more {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--fg-2);
  border-radius: var(--r);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.more:hover { background: var(--muted); color: var(--fg); }

/* 事件名用正常大小写，eyebrow 的全大写只适合短标签 */
.sib-event {
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.4;
  margin: -2px 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 详情里的同事件其他选项：给个上限高度，128 个选项也不会撑爆页面 */
.siblings {
  max-height: 296px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.market {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--r);
  padding: 9px 10px;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.market:hover { background: var(--muted); }
.market[aria-current="true"] { background: var(--muted); border-color: var(--border); }

.market-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}

.market-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-pct { font-size: 14px; font-weight: 620; letter-spacing: -0.02em; }
.market-pct i { font-style: normal; font-size: 11px; font-weight: 500; color: var(--fg-3); margin-left: 1px; }


/* ─────────────────────── 详情 / sheet ─────────────────── */

/* 移动端：详情作为底部 sheet 推上来 */
.detail {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transform: translateY(100%);
  transition: transform var(--dur) var(--ease);
  overflow: hidden;
}

.detail[data-open="true"] { transform: translateY(0); }

.detail-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--bar-h);
  padding: 0 8px 0 4px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* 大标题行为：滚过正文标题后顶栏标题才淡入，避免同屏重复 */
.detail-bar .t {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease);
}

.detail-bar .t[data-shown="true"] { opacity: 1; }

.detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 12px calc(28px + env(safe-area-inset-bottom));
}

.detail-empty {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  color: var(--fg-3);
  font-size: 14px;
}

.q {
  font-size: 19px;
  font-weight: 620;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin: 0 0 10px;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 18px;
}

/* 概率读数 —— 详情页的仪表 */
.gauge { margin-bottom: 18px; }

.gauge-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.gauge-side { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.gauge-side b { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.gauge-side.yes b { color: var(--up); }
.gauge-side.no  b { color: var(--down); }
.gauge-side span { color: var(--fg-3); }

.panel { margin-bottom: 14px; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 0;
}

.panel-body { padding: 12px 14px 14px; }

/* 订单簿 */
.book { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.book-col { min-width: 0; }

.book-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--fg-3);
  padding: 0 6px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3px;
}

.book-row {
  position: relative;
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  font-size: 12.5px;
  border-radius: var(--r-xs);
  cursor: pointer;
  overflow: hidden;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.book-row:hover { background: var(--muted); }
.book-row .depth { position: absolute; inset: 0 auto 0 0; opacity: 0.13; pointer-events: none; }
.book-row span { position: relative; }
.book-bid .depth { background: var(--up); }
.book-ask .depth { background: var(--down); }
.book-bid .p { color: var(--up); font-weight: 550; }
.book-ask .p { color: var(--down); font-weight: 550; }
.book-row .s { color: var(--fg-3); }

.book-empty { color: var(--fg-3); font-size: 12.5px; padding: 12px 6px; }

/* 全量档位，超出就在列内滚动 */
.book-levels {
  max-height: 264px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.book-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--fg-3);
}

.book-foot b { font-weight: 600; margin-left: 4px; }

/* ─────────────────────── 下单区 ───────────────────────── */

.ticket { display: flex; flex-direction: column; gap: 12px; }

/* 选边 —— 概率轨放大成可点控件 */
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.side {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--r);
  padding: 10px 12px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.side .n { font-size: 12.5px; color: var(--fg-2); }
.side .v { font-size: 19px; font-weight: 640; letter-spacing: -0.03em; }

.side[aria-checked="true"] { border-color: currentColor; }
.side.yes[aria-checked="true"] { background: var(--up-bg); color: var(--up); }
.side.no[aria-checked="true"]  { background: var(--down-bg); color: var(--down); }
.side[aria-checked="true"] .n { color: inherit; opacity: 0.85; }

.quote {
  background: var(--muted);
  border-radius: var(--r);
  padding: 12px;
  display: grid;
  gap: 7px;
  font-size: 13px;
}

.quote > div { display: flex; justify-content: space-between; gap: 12px; }
.quote .k { color: var(--fg-2); }
.quote .v { font-weight: 550; text-align: right; }
.quote .v.warn { color: var(--down); }
.quote .v.up { color: var(--up); font-weight: 620; }
.quote .v.down { color: var(--down); }

.hint { font-size: 11.5px; color: var(--fg-3); line-height: 1.55; }

/* ─────────────────────── 数据列表 ─────────────────────── */

.page { padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); }

.page h2 {
  margin: 0 0 3px;
  font-size: 19px;
  font-weight: 640;
  letter-spacing: -0.025em;
}

.page-sub { margin: 0 0 16px; color: var(--fg-3); font-size: 13px; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
}

.stat b {
  display: block;
  font-size: 20px;
  font-weight: 640;
  letter-spacing: -0.03em;
  margin-top: 2px;
}

/* 一套标记，两种布局：移动端卡片 / 桌面网格表 */
.dl { display: flex; flex-direction: column; gap: 8px; }

.dl-head { display: none; }

.dl-row {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dl-main { display: flex; align-items: center; gap: 9px; min-width: 0; }

.dl-main img {
  width: 26px; height: 26px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--muted);
  flex-shrink: 0;
}

.dl-main .tt { min-width: 0; }

.dl-main b {
  display: block;
  font-size: 13.5px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-main small { font-size: 11.5px; color: var(--fg-3); }

.dl-cell { display: flex; justify-content: space-between; font-size: 13px; }
.dl-cell::before { content: attr(data-k); color: var(--fg-3); }
.dl-cell > span { font-weight: 500; }

.dl-act { display: flex; justify-content: flex-end; }

.up { color: var(--up); }
.down { color: var(--down); }

.empty {
  padding: 44px 20px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}

.log { font-family: var(--mono); font-size: 11.5px; word-break: break-all; }

/* ─────────────────────── modal / toast ────────────────── */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(9, 9, 11, 0.45);
  animation: fade var(--dur-fast) var(--ease);
  padding: 0;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: rise var(--dur) var(--ease);
}

.modal-card h3 { margin: 0 0 4px; font-size: 17px; font-weight: 620; letter-spacing: -0.02em; }
.modal-card > p { margin: 0 0 14px; color: var(--fg-2); font-size: 13px; line-height: 1.5; }
.modal-acts { display: flex; gap: 8px; margin-top: 16px; }
.modal-acts > .btn { flex: 1; min-height: 44px; }

@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(14px); } }

#toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tab-h) + 12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 70;
  pointer-events: none;
}

.toast {
  background: var(--elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--fg-3);
  border-radius: var(--r);
  padding: 11px 14px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow);
}

.toast-ok { border-left-color: var(--up); }
.toast-err { border-left-color: var(--down); }
.toast b { display: block; font-weight: 600; margin-bottom: 1px; }
.toast span { color: var(--fg-2); }

.skel {
  background: linear-gradient(90deg, var(--muted) 25%, var(--border) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: shim 1.4s linear infinite;
  border-radius: var(--r-xs);
  height: 12px;
}

@keyframes shim { to { background-position: -200% 0; } }

/* ═════════════════════ 桌面增强 ≥768px ═════════════════ */

@media (min-width: 768px) {
  body { font-size: 14px; overflow: hidden; }

  :root { --bar-h: 56px; }

  .tabs { display: flex; }
  .tabbar { display: none; }

  #toasts { left: auto; right: 16px; bottom: 16px; max-width: 380px; }

  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: var(--r-xl); padding: 22px; animation: pop var(--dur) var(--ease); }
  @keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

  /* 行情页拆成 列表 | 详情 双栏 */
  #view-markets {
    display: grid;
    grid-template-columns: minmax(300px, 380px) 1fr;
    overflow: hidden;
  }

  .list-pane {
    min-height: 0;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--card);
  }

  .search-wrap { background: var(--card); }

  /* 详情从 sheet 变回静态右栏 */
  .detail {
    position: static;
    transform: none;
    transition: none;
    background: transparent;
    min-height: 0;
  }

  .detail-bar { display: none; }
  .detail-body { padding: 22px 24px 40px; }

  .detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 18px;
    align-items: start;
  }

  .q { font-size: 22px; }

  .page { padding: 22px 26px 40px; max-width: 1100px; }
  .stats { grid-template-columns: repeat(4, 1fr); gap: 10px; }

  /* 数据列表变网格表 */
  .dl { gap: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--card); }

  .dl-head {
    display: grid;
    grid-template-columns: var(--cols);
    gap: 12px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--fg-3);
  }

  .dl-row {
    display: grid;
    grid-template-columns: var(--cols);
    gap: 12px;
    align-items: center;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 11px 14px;
  }

  .dl-row:last-child { border-bottom: none; }
  .dl-cell { display: block; text-align: right; }
  .dl-cell::before { display: none; }
  .dl-head > span:not(:first-child) { text-align: right; }
}

@media (min-width: 1180px) {
  .detail-grid { grid-template-columns: 1fr 360px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
