/* Trader Arena — visual spec follows docs/product/Trader-Arena-V2-手机版结构稿.html (values copied from it).
   Density / layering rules: docs/design.md. */
:root {
  --blue: #2863f6;
  --navy: #14213a;
  --muted: #748198;
  --line: #e7ebf2;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --chip: #edf1f7;
  --field: #e9eef5;
  --soft: #f2f5f9;
  --notice: #eff3f9;
  --summary: #f0f4fa;
  --icon: #263956;
  --rise: #d9384e;
  --fall: #078866;
  --up: var(--rise);
  --down: var(--fall);
  --warn: #b86e00;
  /* component tints (light values straight from the mockup; dark values below) */
  --ai-bg: #efe9ff; --ai-fg: #6d4ad8;
  --avatar-bg: #e9efff; --chip-fg: #66758c; --chip-on-bg: #dfe8ff; --chip-on-fg: #2258d4;
  --ghost-bg: #eef2f7; --ghost-fg: #50617a; --seg-bg: #edf1f6; --seg-fg: #77859a;
  --field-line: #dbe2ec; --summary-line: #dde4ef; --reason-fg: #5f6e84; --btn-fg: #50617a; --toggle-off: #dfe5ee;
  --status-bg: #e4f5ef; --status-fg: #087d5d; --check-on-bg: #edf2ff; --check-on-line: #93afff; --check-on-fg: #214fae; --wide-bg: radial-gradient(circle at 20% 5%, #fff 0, transparent 28%), #eef2f7;
  /* gains on the navy hero card: the page's red/green are too dark there, so use lighter tints */
  --brand-from: #2863f6; --brand-to: #e5364b;
  --hero-rise: #ff9aa6; --hero-fall: #5fe0ad; --hero-up: var(--hero-rise); --hero-down: var(--hero-fall);
  --card-shadow: 0 6px 22px rgba(40, 60, 90, .055);
  --btn-shadow: 0 5px 16px rgba(44, 65, 98, .08);
  --hero: radial-gradient(circle at 100% 0, #587ff1 0, transparent 38%), #1d438f;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* aliases used by chart.js */
  --brand: var(--blue); --text: var(--navy); --text-2: var(--muted); --text-3: #8a96a9;
  color-scheme: light;
}
:root[data-colors="green"] { --up: var(--fall); --down: var(--rise); --hero-up: var(--hero-fall); --hero-down: var(--hero-rise); }
:root[data-theme="dark"] {
  --navy: #e8ecf3; --muted: #9aa5b6; --line: #252c38; --bg: #0e1116; --surface: #171b23; --chip: #222835; --field: #1e2430;
  --soft: #1e2430; --notice: #1a2029; --summary: #1e2430; --icon: #dfe6f1; --rise: #f0485c; --fall: #2bb582;
  --card-shadow: none; --btn-shadow: none; --text-3: #6b7688; color-scheme: dark; --brand-from: #7ea4ff; --brand-to: #ff6275;
  --ai-bg: #3a2e70; --ai-fg: #cdbcff;
  --avatar-bg: #1a2542; --chip-fg: #9aa5b6; --chip-on-bg: #1a2542; --chip-on-fg: #8fb0ff; --ghost-bg: #222835; --ghost-fg: #e8ecf3;
  --seg-bg: #222835; --seg-fg: #9aa5b6; --field-line: #252c38; --summary-line: #2c3442; --reason-fg: #9aa5b6; --wide-bg: #080a0e;
  --btn-fg: #c3ccd9; --toggle-off: #2c3442; --status-bg: #12352b; --status-fg: #4fd3a0; --check-on-bg: #1a2542; --check-on-line: #3d5fb8; --check-on-fg: #8fb0ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #e8ecf3; --muted: #9aa5b6; --line: #252c38; --bg: #0e1116; --surface: #171b23; --chip: #222835; --field: #1e2430;
    --soft: #1e2430; --notice: #1a2029; --summary: #1e2430; --icon: #dfe6f1; --rise: #f0485c; --fall: #2bb582;
    --card-shadow: none; --btn-shadow: none; --text-3: #6b7688; color-scheme: dark; --brand-from: #7ea4ff; --brand-to: #ff6275;
    --ai-bg: #3a2e70; --ai-fg: #cdbcff;
  --avatar-bg: #1a2542; --chip-fg: #9aa5b6; --chip-on-bg: #1a2542; --chip-on-fg: #8fb0ff; --ghost-bg: #222835; --ghost-fg: #e8ecf3;
    --seg-bg: #222835; --seg-fg: #9aa5b6; --field-line: #252c38; --summary-line: #2c3442; --reason-fg: #9aa5b6; --wide-bg: #080a0e;
  --btn-fg: #c3ccd9; --toggle-off: #2c3442; --status-bg: #12352b; --status-fg: #4fd3a0; --check-on-bg: #1a2542; --check-on-line: #3d5fb8; --check-on-fg: #8fb0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--navy); font-family: "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
/* iOS Safari zooms into any focused field under 16px and stays zoomed. */
input, select, textarea { font-size: 16px; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); } .warn { color: var(--warn); }

/* ---------- shell ---------- */
#app { min-height: 100dvh; }
.shell { max-width: 430px; min-height: 100dvh; margin: 0 auto; background: var(--bg); position: relative; }
@media (min-width: 560px) {
  body { background: var(--wide-bg); }
  .shell { box-shadow: 0 24px 70px rgba(38, 60, 96, .18); }
}
.page { padding: calc(17px + var(--safe-top)) 18px calc(92px + var(--safe-bottom)); }
.page.no-tabs { padding-bottom: calc(32px + var(--safe-bottom)); }
.page.with-dock { padding-bottom: calc(160px + var(--safe-bottom)); }
.boot { min-height: 50vh; display: grid; place-items: center; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { max-width: 360px; margin: 20vh auto; padding: 24px; text-align: center; }
.fatal button { margin-top: 12px; border: 0; border-radius: 14px; padding: 12px 18px; background: var(--blue); color: #fff; font-weight: 700; }

/* ---------- bars ---------- */
.appbar, .navbar { display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin-bottom: 16px; gap: 8px; }
.appbar h2 { font-size: 24px; letter-spacing: -.035em; margin: 0; }
.navbar > b { flex: 1; text-align: center; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 13px; background: var(--surface); color: var(--icon); box-shadow: var(--btn-shadow); display: grid; place-items: center; flex: none; }
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn.on { color: #f0a01e; } .icon-btn.on .icon { fill: currentColor; }
.icon-spacer { display: block; width: 38px; }
.back { border: 0; background: none; padding: 0; width: 38px; height: 38px; display: grid; place-items: center start; color: var(--navy); }
.back .icon { width: 24px; height: 24px; }
/* wordmark (js/brand.mjs): height = cap height, so font-size sets it like text */
.brand { display: block; height: .737em; width: auto; font-size: 20px; overflow: visible; }
.sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px;
  display: grid; grid-template-columns: repeat(5, 1fr); padding: 8px 5px calc(8px + var(--safe-bottom));
  background: var(--surface); background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.bottom-nav a { display: grid; justify-items: center; gap: 2px; color: #8a96a9; font-size: 10px; padding: 4px 0; }
.bottom-nav .icon { width: 21px; height: 21px; }
.bottom-nav a.active { color: var(--blue); font-weight: 750; }

/* ---------- hero ---------- */
.hero { padding: 19px; border-radius: 23px; color: #fff; background: var(--hero); box-shadow: 0 17px 35px rgba(26, 67, 145, .22); }
.hero small { display: block; color: #cbd8fa; font-size: 13px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hero-top small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-day { flex: none; font-size: 12px; color: #cbd8fa; background: rgba(255, 255, 255, .14); padding: 4px 9px; border-radius: 999px; }
.hero .value { font-size: 31px; font-weight: 800; letter-spacing: -.04em; margin: 7px 0; line-height: 1.2; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hero-head .rank { font-size: 12px; padding: 5px 9px; }
.hero .rank { font-size: 13px; background: rgba(255, 255, 255, .14); padding: 7px 9px; border-radius: 9px; white-space: nowrap; }
.hero .up { color: var(--hero-up); } .hero .down { color: var(--hero-down); } .hero .flat { color: #cbd8fa; }
.hero-note { margin-top: 8px; font-size: 12px; color: #cbd8fa; }
.hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

/* ---------- sections & cards ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 11px; }
.section-head h3 { font-size: 16px; margin: 0; }
/* 收益排名 … ⟳ 更新于 14:23 │ 比赛详情 — the right side is one 12px line, centred, so the row is as tall as the others */
.section-side { display: flex; align-items: center; gap: 10px; }
.section-side .sep { width: 1px; height: 11px; background: var(--line); }
.refresh-btn { display: inline-flex; align-items: center; gap: 4px; margin: -6px -4px; padding: 6px 4px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1; font-variant-numeric: tabular-nums; cursor: pointer; }
.refresh-btn svg { width: 13px; height: 13px; }
.refresh-btn.spinning svg { animation: spin .8s linear infinite; }
.link { border: 0; background: none; padding: 0; color: var(--blue); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; }
.link .icon { width: 13px; height: 13px; }
.card { background: var(--surface); border-radius: 19px; padding: 4px 16px; box-shadow: var(--card-shadow); }
.card.flat { box-shadow: none; padding: 0; }
.card + .card { margin-top: 12px; }
.rank-row, .stock-row, .holding-row, .event { display: grid; align-items: center; gap: 9px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.card > :last-child, .card > :last-child > .holding-row, .card > .holding-item:last-child .holding-row { border-bottom: 0; }
.rank-row { grid-template-columns: 30px 1fr auto 72px; }
.rank-row > span:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.rank-row.rank-head { padding: 10px 0 8px; font-size: 11px; color: var(--muted); }
.rank-row.rank-head > span:nth-child(2) { display: block; }
.rank-row > span:nth-child(2) { display: flex; align-items: center; }
.stock-row { grid-template-columns: 1fr auto auto; }
.holding-row { grid-template-columns: 1fr auto; width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; }
.holding-row .right { text-align: right; }
.holding-head { display: flex; justify-content: space-between; padding: 10px 0 6px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); }
.quote-head { display: grid; grid-template-columns: 1fr auto 64px; gap: 9px; }
.quote-head span:not(:first-child) { text-align: right; }
.holding-pnl { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.holding-pnl small { font-size: 11.5px; }
.invite-code { text-align: center; margin: 14px 0 4px; }
.invite-code code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 1px; }
.invite-code code { font-size: 28px; font-weight: 800; color: var(--blue); letter-spacing: 3px; }
.wl-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.card > .wl-row:last-child { border-bottom: 0; }
.wl-row input { width: 20px; height: 20px; flex: none; }
.wl-row > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wl-row b { font-size: 14px; word-break: break-all; }
.admin-send { margin-top: 12px; }
.gen-card { padding-bottom: 14px; }
.generated { margin-top: 12px; background: var(--summary); border-radius: 12px; padding: 10px 14px; }
.generated code { white-space: pre; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 15px; line-height: 1.7; }
.review { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--summary); font-size: 13px; line-height: 1.6; }
.review b { display: block; font-size: 12px; color: var(--blue); margin-bottom: 2px; }
.review p { color: var(--navy); }
.card > .review:first-child { margin-top: 12px; }
.card > .review:last-child { margin-bottom: 12px; }
.review-card { margin-top: 12px; padding-top: 12px; padding-bottom: 4px; }
/* 今日 / 周 总结 in 最近动态: the AI's words on the summary tint, set apart from the one-line trades around it */
.event.review-event { display: block; margin: 10px 0; padding: 11px 12px; border-bottom: 0; border-radius: 12px; background: var(--summary); }
.review-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.review-top b { display: inline; }
.review-event p { margin: 6px 0; font-size: 13px; line-height: 1.6; color: var(--navy); }
.fb-kinds { margin-bottom: 12px; }
.sheet-form textarea, .nps-card textarea { width: 100%; border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--navy); resize: vertical; }
.fb-reply { text-align: left; margin: -4px 0 8px; }
.fb-item { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.6; }
.card > .fb-item:last-child { border-bottom: 0; }
.fb-item.done { opacity: .6; }
.fb-head { display: flex; justify-content: space-between; gap: 8px; }
.fb-device { font-size: 11px; word-break: break-all; }
.nps-card { margin-top: 14px; padding: 14px 16px; }
.nps-card > b { display: block; font-size: 14px; margin-bottom: 10px; }
.nps-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.nps-scale button { border: 0; border-radius: 8px; padding: 8px 0; background: var(--chip); color: var(--navy); font-weight: 700; font-size: 13px; }
.nps-scale button.active { background: var(--blue); color: #fff; }
.nps-ends { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin: 6px 0 4px; }
.nps-card [data-nps-more] { margin-top: 10px; display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 1fr auto 52px; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.funnel-row.src { grid-template-columns: 1.6fr repeat(4, 1fr); text-align: right; }
.funnel-row.src span:first-child { text-align: left; word-break: break-all; }
.funnel-row.head { font-size: 11px; color: var(--muted); }
.card > .funnel-row:last-child { border-bottom: 0; }
.funnel-row .meta { text-align: right; }
.report-preview { display: block; width: auto; max-width: 100%; max-height: 52dvh; margin: 0 auto; border-radius: 16px; box-shadow: 0 10px 30px rgba(20, 33, 58, .18); }
.report-name { margin-top: 12px; }
.report-actions { display: grid; gap: 10px; margin-top: 16px; }
.share-report { margin-top: 14px; gap: 8px; }
.share-report .icon { width: 18px; height: 18px; }
.price-note { padding: 10px 0 12px; font-size: 11px; color: var(--muted); text-align: center; }
.holding-row b, .event b { display: block; font-size: 14px; }
.ai-tag { display: inline-block; margin-left: 6px; padding: 3px 5px; border-radius: 5px; background: var(--ai-bg); color: var(--ai-fg); font-size: 10px; font-weight: 800; line-height: 1; letter-spacing: .02em; vertical-align: 2px; }
.symbol { font-weight: 800; font-size: 14px; }
.name, .meta { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.meta.up { color: var(--up); } .meta.down { color: var(--down); }
.price-cell { font-weight: 700; text-align: right; }
.list-empty { padding: 20px 0; text-align: center; color: var(--muted); font-size: 12px; }
.row-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 0 12px; }
.row-actions[hidden] { display: none; }
.row-actions .btn { padding: 9px 0; font-size: 13px; }
.order-actions { display: flex; gap: 14px; }
.center-meta { text-align: center; margin-top: 12px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 14px; padding: 13px 15px; font-weight: 750; font-size: 15px; background: var(--chip); color: var(--btn-fg); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.buy { background: var(--up); color: #fff; }
.btn.sell { background: var(--down); color: #fff; }
.btn.ghost { background: var(--ghost-bg); color: var(--ghost-fg); }
.btn.danger { background: var(--rise); color: #fff; }
.hero .btn.ghost { background: rgba(255, 255, 255, .16); color: #fff; }
.search { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: var(--field); border-radius: 14px; padding: 12px 14px; color: var(--muted); font-size: 15px; text-align: left; }
.search .icon { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--navy); padding: 0; }
.chips { display: flex; gap: 7px; overflow-x: auto; margin: 12px 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button, .chip { white-space: nowrap; border: 0; border-radius: 10px; background: var(--chip); color: var(--chip-fg); padding: 7px 11px; font-size: 11px; }
.chips .active { background: var(--chip-on-bg); color: var(--chip-on-fg); font-weight: 750; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--seg-bg); padding: 4px; border-radius: 13px; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; border-radius: 10px; padding: 9px; text-align: center; color: var(--seg-fg); cursor: pointer; }
.seg input:checked + span { background: var(--surface); color: var(--blue); font-weight: 750; box-shadow: 0 3px 10px rgba(39, 57, 85, .08); }
.field { margin: 15px 0; }
.field > label, .field > span.label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 7px; }
.field input, .field select { width: 100%; border: 1px solid var(--field-line); border-radius: 13px; background: var(--surface); padding: 13px; outline: none; color: var(--navy); }
.field input[readonly] { background: var(--soft); color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.summary { margin-top: 15px; background: var(--summary); border-radius: 15px; padding: 5px 14px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 12px; border-bottom: 1px solid var(--summary-line); }
.summary div:last-child { border: 0; }
.notice { font-size: 11px; color: #697991; background: var(--notice); border-radius: 12px; padding: 10px 12px; line-height: 1.55; margin-top: 12px; }
.notice:empty { display: none; }
.form-error { min-height: 18px; margin: 8px 0; color: var(--rise); font-size: 12px; }
.form-title { font-size: 27px; margin: 5px 0 7px; letter-spacing: -.04em; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.checks label { position: relative; }
.checks input { position: absolute; opacity: 0; }
.checks span { display: block; border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 14px; padding: 12px; font-weight: 750; cursor: pointer; }
.checks input:checked + span { border-color: var(--check-on-line); background: var(--check-on-bg); color: var(--check-on-fg); }
.checks input:checked + span::before { content: "✓ "; }
.status { font-size: 10px; color: var(--status-fg); background: var(--status-bg); padding: 5px 7px; border-radius: 7px; white-space: nowrap; }
.status.idle { color: #697991; background: var(--notice); }
.reason { font-size: 12px; line-height: 1.6; color: var(--reason-fg); background: var(--soft); padding: 11px; border-radius: 11px; margin-top: 10px; }
.reason b { color: var(--reason-fg); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { background: var(--surface); padding: 13px 11px; border-radius: 15px; }
.metric small { display: block; font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.metric strong { font-size: 15px; }
.empty { text-align: center; padding: 76px 18px; }
.empty-mark { width: 70px; height: 70px; margin: auto; display: grid; place-items: center; border-radius: 24px; background: var(--avatar-bg); color: var(--blue); font-size: 24px; font-weight: 850; }
.empty h2 { font-size: 22px; margin: 18px 0 8px; }
.empty p { font-size: 13px; color: var(--muted); line-height: 1.65; margin-bottom: 16px; }
.steps { list-style: none; padding: 0; margin: 34px auto 0; max-width: 300px; text-align: left; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: 13px; color: var(--muted); line-height: 1.55; }
.steps b { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--avatar-bg); color: var(--blue); font-size: 12px; }
.notice.tip { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.notice.tip span { flex: 1; }
.tip-close { border: 0; background: none; padding: 2px; color: var(--muted); display: grid; place-items: center; }
.tip-close .icon { width: 15px; height: 15px; }
.more { margin-top: 10px; }
.more > summary { display: flex; align-items: center; gap: 4px; list-style: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 6px 2px; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary .icon { width: 14px; height: 14px; transition: transform .2s; }
.more[open] > summary .icon { transform: rotate(180deg); }

/* ---------- AI ---------- */
.ai-card { margin-bottom: 12px; padding: 16px; display: block; }
.ai-card + .ai-card { margin-top: 0; }
.ai-top { display: flex; justify-content: space-between; align-items: center; }
.ai-top > span { display: flex; align-items: center; }
.ai-top b { font-size: 16px; }
.ai-card .metric-grid { margin-top: 14px; }
.ai-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.ai-foot .link { font-size: 13px; }
.ai-card .metric { padding: 13px 11px 0; }

/* ---------- stock ---------- */
.quote { display: flex; justify-content: space-between; align-items: flex-end; margin: 5px 0 15px; }
.quote strong { font-size: 30px; letter-spacing: -.04em; }
.quote .change { font-size: 16px; font-weight: 600; margin-left: 4px; }
.stat-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; font-size: 12px; }
.stat-line small { display: block; color: var(--muted); font-size: 10px; }
.chart { background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--card-shadow); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; min-height: 26px; padding: 6px 12px 0; font-size: 10px; color: var(--muted); }
.chart-box { height: 250px; position: relative; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.chart-fallback { width: 100%; height: 230px; display: block; }
.chart-fallback .grid { stroke: var(--line); } .chart-fallback .axis { fill: var(--muted); font-size: 11px; }
.chart-fallback .base { stroke: var(--muted); stroke-dasharray: 4 4; } .chart-fallback .price { fill: none; stroke: var(--blue); stroke-width: 1.6; }
.chart-note { text-align: center; font-size: 11px; color: var(--muted); }
.trade-dock { position: fixed; z-index: 19; bottom: calc(59px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 18px;
  background: var(--surface); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }

/* ---------- trade ticket (腾讯自选股 structure in the 设计稿 visual language) ---------- */
.ticket { margin-top: 12px; padding: 4px 16px 16px; }
.ticket-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 42px; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ticket-row .label { font-size: 14px; font-weight: 700; }
.ticket-note { margin: 6px 0 0 50px; font-size: 12px; color: var(--muted); }
.stepper { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; height: 42px; }
.stepper button, .tool { height: 42px; border: 0; border-radius: 12px; background: var(--chip); color: var(--btn-fg); display: grid; place-items: center; }
.stepper input { min-width: 0; height: 42px; border: 0; outline: 0; background: none; text-align: center; font-weight: 700; font-size: 17px; color: var(--navy); }
.stepper input::placeholder { font-weight: 400; font-size: 15px; color: #a3adbd; }
.stepper input:disabled { color: #a3adbd; }
.ticket .summary { margin-top: 14px; }
.ticket .summary .buy-tone { color: var(--up); } .ticket .summary .sell-tone { color: var(--down); }
.ticket-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.ticket-actions .btn.block { grid-column: 1 / -1; }
.ticket-hint { min-height: 18px; margin-top: 8px; text-align: center; font-size: 12px; color: var(--warn); }
.ts-symbol { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; color: var(--navy); }
.ts-symbol b { font-size: 15px; }
.ts-symbol small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ts-quote { display: flex; gap: 6px; align-items: baseline; font-weight: 700; }
.ts-placeholder { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portion-group + .portion-group { margin-top: 16px; }
.portion-group p { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.portion-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.portion-row .btn { padding: 10px 0; font-size: 13px; }
.pick-label { margin: 12px 0 8px; font-size: 12px; color: var(--muted); }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: center; gap: 12px; width: 100%; min-height: 46px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; padding: 0; }
.pick-row span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- search page ---------- */
.search-page .search { margin-bottom: 12px; }
.search-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); }
.search-row:last-child { border: 0; }
.search-row a { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 9px; padding: 12px 0; min-width: 0; font-size: 13px; }
.search-row a span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.search-row .icon-btn { box-shadow: none; background: none; width: 34px; height: 34px; }
.hot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hot-grid a { padding: 10px 12px; border-radius: 15px; background: var(--surface); box-shadow: var(--card-shadow); }
.hot-grid b { display: block; font-size: 14px; }

/* ---------- settings ---------- */
.settings-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 13px; }
.card > .settings-row:last-child { border-bottom: 0; }
.settings-row b { display: block; font-size: 14px; }
.settings-row .chev { color: var(--navy); width: 16px; height: 16px; }
.settings-row.static { cursor: default; }
.settings-row.static .meta { font-size: 13px; }
.profile-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; width: 100%; padding: 16px; border: 0; text-align: left; margin-bottom: 12px; }
.profile-card b { display: block; font-size: 17px; }
.profile-card .chev { color: var(--navy); width: 16px; height: 16px; }
.profile-mark { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: var(--avatar-bg); color: var(--blue); font-size: 18px; font-weight: 850; }
.settings-links { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.settings-links .link { color: var(--muted); font-weight: 600; }
.settings-logout { margin-top: 16px; background: var(--surface); color: var(--rise); box-shadow: var(--card-shadow); }
.settings-row input[type="checkbox"] { width: 44px; height: 26px; -webkit-appearance: none; appearance: none; border-radius: 999px; background: var(--toggle-off); position: relative; transition: background .2s; margin: 0; }
.settings-row input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.settings-row input[type="checkbox"]:checked { background: var(--blue); }
.settings-row input[type="checkbox"]:checked::after { transform: translateX(18px); }
.rules-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.option-list { display: grid; gap: 8px; }

/* ---------- auth ---------- */
.auth { position: relative; padding: calc(48px + var(--safe-top)) 18px 24px; }
.lang-switch { position: absolute; top: calc(14px + var(--safe-top)); right: 16px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; }
.auth .brand { font-size: 26px; }
.auth .sub { margin: 6px 0 28px; }
.auth .card { padding: 20px 16px; }
.auth h1 { font-size: 22px; margin-bottom: 4px; }
.auth .link { display: block; margin: 14px auto 0; font-size: 13px; }
.auth .waitlist-link { display: inline; margin: 0; font-size: inherit; }
.intro .waitlist-link { display: block; margin: 14px auto 0; font-size: 13px; }
.auth .link.forgot { margin-top: 12px; color: var(--muted); font-weight: 600; }
.sheet .link.resend { display: block; margin: 12px auto 0; font-size: 13px; }
.link:disabled { color: var(--muted); }
.auth-back { margin: -10px 0 10px -6px; }
.field-hint { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.password { position: relative; }
.password input { padding-right: 46px; }
.reveal { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; }
.terms { margin-top: 10px; text-align: center; font-size: 11px; color: var(--muted); }
.auth .terms .link { display: inline; margin: 0; font-size: 11px; }
/* 首次打开：介绍页。插图沿用设计稿的深蓝资产卡片与排名行 */
.intro .brand { font-size: 20px; }
.intro-art { margin: 26px 0 24px; padding: 17px 17px 8px; }
.intro-art-head { display: flex; justify-content: space-between; align-items: center; }
.intro-art-head small { display: inline; }
.intro-art .rank { font-size: 11px; padding: 4px 8px; }
.intro-race { display: block; width: 100%; height: 72px; margin: 12px 0 6px; }
.intro-row { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 9px; padding: 8px 0; font-size: 13px; border-top: 1px solid rgba(255, 255, 255, .12); }
.intro-row > span:nth-child(2) { display: flex; align-items: center; }
.hero .ai-tag { background: rgba(205, 188, 255, .22); color: #e2d8ff; }
.intro-title { font-size: 27px; letter-spacing: -.04em; margin-bottom: 6px; }
.intro-text { font-size: 14px; line-height: 1.7; color: var(--muted); }
.intro-actions { display: grid; gap: 10px; margin: 26px 0 10px; }
.intro-actions.pair { grid-template-columns: 1fr 1fr; }
.intro-fine { margin-top: 18px; text-align: center; font-size: 11px; color: var(--text-3); }
.intro-closed { text-align: center; font-size: 12px; color: var(--muted); }
.notice.warn-notice { color: var(--warn); }
.notice.pause-notice { color: var(--navy); line-height: 1.6; }
.notice.pause-notice b { color: var(--blue); }

/* ---------- sheet & toast ---------- */
/* iOS Safari: the layer follows the visual viewport (JS sets top/height), so the sheet sits above the keyboard, and the
   open sheet has no transform — a transformed fixed panel with the keyboard up gets taps at the wrong place. Grip and
   title stay put; only the body scrolls. */
.sheet-layer { position: fixed; left: 0; right: 0; top: 0; height: 100%; z-index: 100; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 20, .45); opacity: 0; transition: opacity .18s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 430px; max-height: 86%;
  display: flex; flex-direction: column; overflow: hidden; transform: translateY(100%);
  padding: 8px 0 0; border-radius: 23px 23px 0 0; background: var(--bg); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: none; }
.sheet-grip { flex: none; width: 36px; height: 4px; border-radius: 2px; background: #d3dae5; margin: 0 auto 10px; }
.sheet-head { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 0 18px 10px; }
.sheet-body, .sheet-actions { padding-left: 18px; padding-right: 18px; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(18px + var(--safe-bottom)); }
.sheet-body:has(+ .sheet-actions) { padding-bottom: 0; }
.sheet-actions { flex: none; padding-bottom: calc(18px + var(--safe-bottom)); }
.sheet-head h2 { font-size: 17px; }
.sheet-head .icon-button { border: 0; border-radius: 12px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--chip); color: var(--navy); }
.sheet-head .icon-button .icon { width: 18px; height: 18px; }
.sheet-cancel { margin-top: 10px; }
.sheet-text { color: var(--muted); line-height: 1.6; font-size: 14px; }
.sheet-form .sheet-text { margin-bottom: 12px; }
/* 设置 → 运营数据（管理员） */
.stats-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
.stats-table th { color: var(--muted); font-weight: 600; text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.stats-table td { text-align: right; padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.stats-table th:first-child, .stats-table td:first-child { text-align: left; }
.stats-table th, .stats-table td:first-child { white-space: nowrap; }
.stats-table td small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.stats-table tr.off td { color: var(--muted); }
.sheet-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 16px; }
.sheet-actions .btn:only-child { grid-column: 1 / -1; }
.sheet .card + .btn { margin-top: 12px; }
.confirm-list { margin: 0; background: var(--surface); border-radius: 15px; padding: 4px 14px; }
.confirm-list div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.confirm-list div:last-child { border: 0; }
.confirm-list dt { color: var(--muted); } .confirm-list dd { margin: 0; font-weight: 700; }
.confirm-warn { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.toast { position: fixed; z-index: 120; left: 50%; top: calc(56px + var(--safe-top)); transform: translate(-50%, -8px); max-width: min(400px, 90vw);
  padding: 10px 16px; border-radius: 12px; background: rgba(20, 33, 58, .94); color: #fff; font-size: 14px; line-height: 1.5; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-tone="error"] { background: rgba(190, 40, 55, .95); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
a.holding-row { color: inherit; }
.ticker-name { margin-left: 5px; font-size: 11px; font-weight: 500; color: var(--muted); display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.symbol-link { color: inherit; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
/* 设置里的表单弹窗（修改密码、重置用户密码） */
.sheet-form .field:first-child { margin-top: 0; }
.sheet-hint { margin-top: 10px; text-align: center; font-size: 11px; color: var(--muted); }
.temp-password { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 4px; padding: 14px; border-radius: 13px; background: var(--summary); }
.temp-password code { font: 700 20px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .06em; }
.temp-password .link { font-size: 13px; }
/* AI 风格：创建比赛时的滑块面板，AI 卡片上的风格说明 */
.style-card { padding: 0; }
.style-head { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 14px 16px; text-align: left; color: var(--navy); }
.style-head b { font-size: 14px; flex: none; }
.style-summary { flex: 1; min-width: 0; text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.style-caret { display: grid; color: var(--muted); transition: transform .2s; }
.style-caret .icon { width: 16px; height: 16px; }
.style-caret.open { transform: rotate(180deg); }
.style-body { padding: 0 16px 16px; }
.style-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--seg-bg); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.style-tabs button { border: 0; background: none; border-radius: 9px; padding: 8px; font-size: 13px; color: var(--seg-fg); }
.style-tabs .on { background: var(--surface); color: var(--blue); font-weight: 750; box-shadow: 0 3px 10px rgba(39, 57, 85, .08); }
.style-presets { margin: 0 0 16px; }
.style-presets button { flex: 1; font-size: 12px; padding: 8px 0; }
.style-slider { margin-bottom: 18px; }
.style-slider-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.style-slider-head b { font-size: 14px; }
.style-value { font-size: 12px; font-weight: 750; color: var(--blue); }
.hard-tag { margin-left: 6px; padding: 2px 5px; border-radius: 5px; background: var(--notice); color: var(--muted); font-size: 10px; font-weight: 750; vertical-align: 1px; }
.field .style-slider input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; }
.style-slider input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px;
  background: linear-gradient(var(--blue), var(--blue)) 0 / var(--fill, 0%) 100% no-repeat, var(--line); }
.style-slider input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
.style-slider input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--blue); }
.style-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(20, 33, 58, .25); }
.style-slider input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(20, 33, 58, .25); }
.style-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.style-desc { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--soft); color: var(--reason-fg); font-size: 12px; line-height: 1.5; }
.style-lock { text-align: center; font-size: 11px; color: var(--muted); }
.ai-style { margin-top: 6px; font-size: 12px; color: var(--muted); }
.page-style { margin: -6px 2px 12px; }
/* 持仓明细：券商式四列表格（股票/市值 · 最新/成本 · 持有/仓位 · 盈亏） */
.hold-summary { display: flex; justify-content: space-between; padding: 12px 0 4px; font-size: 12px; color: var(--muted); }
.hold-summary b { color: var(--navy); font-size: 13px; }
.hold-head, .hold-row { display: grid; grid-template-columns: 1.35fr 1fr .85fr 1fr; gap: 8px; align-items: center; }
.hold-head { padding: 8px 0; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); }
.hold-head span:not(:first-child), .hold-toggle { text-align: right; }
.hold-toggle { justify-self: end; border: 0; border-radius: 8px; background: var(--chip-on-bg); color: var(--chip-on-fg); padding: 3px 7px; font: inherit; font-size: 12px; font-weight: 750; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.hold-toggle .icon { width: 13px; height: 13px; }
.hold-row { width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.holding-item:last-child .hold-row { border-bottom: 0; }
.hold-total { padding: 12px 0 10px; border-bottom: 0; cursor: default; }
.hold-total > .hold-cell:first-child b { color: var(--muted); font-weight: 600; }
.hold-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hold-cell.num { text-align: right; align-items: flex-end; }
.hold-cell b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hold-cell small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hold-cell.up b, .hold-cell.up small { color: var(--up); }
.hold-cell.down b, .hold-cell.down small { color: var(--down); }
.hold-cell .ticker-name { display: block; margin: 1px 0 0; max-width: 100%; font-size: 10.5px; }
.hold-note { display: block; font-size: 10.5px; color: var(--warn); }
