:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --ink: #141a22;
  --muted: #66707e;
  --line: #e2e6ec;
  --accent: #d97a1e;
  --accent-2: #f2b84b;
  --up: #0f9d6b;
  --down: #e0394f;
  --chip: #eef1f5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
/* Dark colours: when the system is dark (unless 白天 is forced), or when 黑夜 is forced. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #161d28;
    --ink: #e8edf3;
    --muted: #8590a0;
    --line: #222b38;
    --accent: #f0a24b;
    --accent-2: #ffd27a;
    --up: #2ebd85;
    --down: #f6465d;
    --chip: #1b2330;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0b0f14;
    --surface: #121821;
    --surface-2: #161d28;
    --ink: #e8edf3;
    --muted: #8590a0;
    --line: #222b38;
    --accent: #f0a24b;
    --accent-2: #ffd27a;
    --up: #2ebd85;
    --down: #f6465d;
    --chip: #1b2330;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; justify-content: space-between; align-items: center; height: 52px; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: 0.04em; display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; }
.brand-mark { width: 12px; height: 12px; background: var(--accent); transform: rotate(45deg); }
.clock { display: flex; gap: 8px; align-items: center; font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--chip); font-family: inherit; }
.pill:empty { display: none; }
.pill.up { color: var(--up); }
.pill.down { color: var(--down); }
.up { color: var(--up); }
.down { color: var(--down); }

main { padding-top: 16px; padding-bottom: 48px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.notice { padding: 14px 16px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 16px; color: var(--muted); }
h2 { font-size: 17px; margin: 0 0 12px; }
.prose h2:not(:first-child) { margin-top: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 13px; }

.summary-row { display: flex; flex-wrap: wrap; gap: 16px 40px; align-items: flex-end; }
.big { font: 700 40px/1.1 var(--mono); }
.kpis { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.kpis dt { color: var(--muted); font-size: 12px; }
.kpis dd { margin: 0; font: 600 20px/1.3 var(--mono); }
.equity { height: 220px; margin-top: 12px; }
.monthly { height: 140px; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; }
.lv-rows { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; font-size: 13px; margin-top: 4px; }
.lv-rows span { color: var(--muted); }
.lv-rows b { font: 500 13px var(--mono); text-align: right; }
.impact-High { color: var(--down); font-weight: 600; }
.past { opacity: 0.5; }
.report-h { font-size: 15px; margin: 16px 0 6px; }
.fold { border-top: 1px solid var(--line); padding: 8px 0; }
.fold summary { cursor: pointer; font-weight: 600; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 12px; margin-bottom: 12px; }
.form label { font-size: 12px; color: var(--muted); display: grid; gap: 2px; }
.form input { font: 14px var(--mono); padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); min-width: 0; }
a { color: var(--accent); }
#report .two-col { margin-top: 4px; }
.flag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--chip); margin-right: 4px; }

.tabs, .tfs { display: flex; flex-wrap: wrap; gap: 6px; }
.tabs { margin-bottom: 12px; }
.tabs button, .tfs button, .btn {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--chip);
  border: 1px solid transparent; border-radius: 6px; padding: 4px 12px; cursor: pointer;
}
.tabs button[aria-selected="true"], .tfs button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn { margin-top: 12px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; margin-bottom: 20px; }
.tile { text-align: left; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.tile[aria-current="true"] { border-color: var(--accent); }
.tile .t-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-id { font-size: 11px; color: var(--muted); }
.tile .t-price { font: 600 14px var(--mono); }
.tile .t-chg { font: 12px var(--mono); }
.tile .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: 4px; vertical-align: middle; }

.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; }
.c-name { font-size: 18px; font-weight: 700; margin-right: 6px; }
.c-price { font: 700 20px var(--mono); }
.chart-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 10px 0 6px; align-items: center; }
.check { font-size: 13px; display: flex; gap: 4px; align-items: center; }
.ohlc { min-height: 20px; font-family: var(--mono); }
.chart { height: 400px; }

.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sig { text-align: left; font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.sig[aria-current="true"] { border-color: var(--accent); }
.sig-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sig-name { font-weight: 600; }
.sig-status { font-size: 12px; color: var(--muted); }
.sig-tp { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sig-tp b { color: var(--up); font-weight: 600; }
.sig-usd { font: 600 16px var(--mono); }
.sig-time { font: 12px var(--mono); color: var(--muted); }

.detail { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail h3 { margin: 0 0 4px; font-size: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; margin-top: 12px; }
.facts { margin: 0; padding-left: 18px; }
.facts li { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, .levels td { font-family: var(--mono); }

.closed-list { display: grid; gap: 8px; }
.closed { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.closed-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; }
.closed-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 4px 12px; margin-top: 6px; font-size: 13px; }
.closed-levels span { color: var(--muted); font-size: 12px; display: block; }
.closed-levels b { font: 500 13px var(--mono); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
code { font-family: var(--mono); font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 4px; }
.prose ul { padding-left: 20px; margin: 8px 0; }

/* ---- navigation -------------------------------------------------------------- */
.top-row { gap: 16px; }
.nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; display: flex; align-items: center; gap: 6px;
}
.nav a:hover { color: var(--ink); background: var(--chip); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--chip); }
.nav-k { font: 11px var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; line-height: 16px; }
.tabbar { display: none; }
.view[hidden] { display: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- header tools: connection light, sound, theme ------------------------------------ */
.top-tools { display: flex; align-items: center; gap: 10px; }
.conn { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.conn-ok .conn-dot { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 25%, transparent); }
.conn-slow .conn-dot { background: #d9a400; }
.conn-bad .conn-dot { background: var(--down); }
.conn-bad .conn-text { color: var(--down); }
.icon-btn {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--chip); border: 1px solid transparent;
  border-radius: 8px; height: 32px; min-width: 32px; padding: 0 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
}
.icon-btn:hover { border-color: var(--line); }
.icon-btn .mute-line { display: none; }
.icon-btn[aria-pressed="false"] { color: var(--muted); }
.icon-btn[aria-pressed="false"] .mute-line { display: inline; }
.theme-icon { font-size: 15px; line-height: 1; }

/* ---- new-signal popup -------------------------------------------------------------------- */
.alert-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; }
.btn-small { margin-top: 0; padding: 2px 10px; font-size: 12px; }
.alert-dialog {
  width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.alert-dialog::backdrop { background: rgba(20, 18, 14, 0.45); }
.alert-dialog[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .alert-dialog[open] { animation: none; } }
.alert-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.alert-head h2 { margin: 0; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.alert-sig { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.alert-sig .lv-rows { max-width: 220px; margin-top: 6px; }
.alert-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.alert-actions .btn { margin-top: 0; padding: 6px 14px; }

/* ---- 今日: status strip ----------------------------------------------------------- */
.status { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; padding: 16px 20px; }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat span { color: var(--muted); font-size: 12px; }
.stat b { font: 600 18px/1.3 var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#st-open { white-space: normal; }
.stat-link { color: inherit; text-decoration: none; border-left: 1px solid var(--line); padding-left: 16px; }
.stat-link:hover span { color: var(--accent); }
.two-col-wide { display: contents; }
.detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.detail-head .btn { margin-top: 0; }
.btn-primary { background: var(--accent); color: var(--surface); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }

/* ---- 今日: personal risk, countdown, alerts --------------------------------------- */
.status-tools {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px;
  border-top: 1px solid var(--line); padding-top: 12px;
}
.risk-input { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.risk-input input {
  width: 96px; font: 600 14px var(--mono); padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--bg); color: var(--ink);
}
.position { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px; }
.position-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.position-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 16px; }
.position-grid span { display: block; color: var(--muted); font-size: 12px; }
.position-grid b { font: 600 16px var(--mono); }
.copy-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.copy {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--chip); border: 1px solid transparent;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; display: flex; gap: 6px; align-items: center;
}
.copy b { font: 600 13px var(--mono); }
.copy span { color: var(--muted); }
.copy:hover { border-color: var(--line); }
.copy.copied { border-color: var(--up); }
.copy.copied span::after { content: ' 已複製'; color: var(--up); font-size: 12px; }

/* ---- 工具: suggested risk per signal ----------------------------------------------- */
.sizing-result { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px; }
.sizing-result span { display: block; color: var(--muted); font-size: 12px; }
.sizing-result b { font: 700 26px/1.2 var(--mono); }
.sizing-result .btn { margin-top: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- futures mode ---------------------------------------------------------------- */
[hidden] { display: none !important; }
.mode-row { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.futures { margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; }
.futures-bad { border: 1px solid var(--down); }
#margin-out p { margin: 8px 0; }
#sizing-out td:first-child, #sizing-out th:first-child, #margin-out th { white-space: normal; }
#sizing-out td:first-child { min-width: 9em; }

/* ---- 今日: distance to the next signal ------------------------------------------- */
.next-summary { margin: 0 0 10px; }
.c-note { margin: 4px 0 6px; color: var(--muted); }
td.dist { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.dist-bar { display: inline-block; width: 60px; height: 6px; border-radius: 3px; background: var(--chip); position: relative; overflow: hidden; }
.dist-bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); border-radius: 3px; }

/* ---- 盤中預警 toast ------------------------------------------------------------------ */
.toast {
  position: fixed; right: 16px; bottom: 16px; z-index: 20; width: min(360px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); border: 1px solid var(--accent); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.toast p { margin: 6px 0; font-size: 14px; }
.toast-head { display: flex; justify-content: space-between; align-items: center; color: var(--accent); }
.toast-x { font: inherit; font-size: 18px; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 4px; }
@media (max-width: 760px) { .toast { bottom: calc(64px + env(safe-area-inset-bottom)); } }

/* ---- 規則健康 --------------------------------------------------------------------------- */
.health-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.health-row:first-child { border-top: 0; padding-top: 4px; }
.health-row p { margin: 4px 0 0; font-size: 14px; }
.health-title { display: flex; align-items: center; gap: 8px; }
.light { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: var(--muted); flex: none; }
.light-ok { background: var(--up); }
.light-warn { background: #d9a400; }
.light-bad { background: var(--down); }
.light-wait { background: transparent; border: 2px solid var(--muted); }
.health-notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 14px;
}
.health-notice .light { margin-top: 0; }
.nav a.has-alert::after, .tabbar a.has-alert::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--down); margin-left: 4px; display: inline-block; }

/* ---- 看盤: watchlist beside the chart ---------------------------------------------- */
.market { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: stretch; }
/* The watchlist is exactly as tall as the chart card beside it and scrolls inside
   (contain: size keeps its long list from stretching the row); the research report
   spans the full width underneath. */
.watch { contain: size; overflow-y: auto; padding: 16px; margin-bottom: 0; display: flex; flex-direction: column; }
.watch h2 { flex: none; }
.market-main > .card { margin-bottom: 0; }
.market-report { grid-column: 1 / -1; }
html[data-page="chart"] main.wrap, html[data-page="chart"] .top > .wrap { max-width: 1480px; }
@media (min-width: 761px) {
  .market { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
  html[data-page="chart"] .chart { height: clamp(440px, calc(100vh - 350px), 760px); }
}
.watch .tabs { gap: 4px; }
.watch .tabs button { padding: 3px 9px; font-size: 12px; }
.watch .tiles { grid-template-columns: minmax(0, 1fr); gap: 2px; margin-bottom: 0; }
.watch .tile {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name price" "id chg";
  column-gap: 8px; border-color: transparent; padding: 6px 8px;
}
.watch .tile:hover { background: var(--chip); }
.watch .tile[aria-current="true"] { border-color: var(--accent); background: var(--chip); }
.watch .t-name { grid-area: name; }
.watch .t-id { grid-area: id; }
.watch .t-price { grid-area: price; text-align: right; }
.watch .t-chg { grid-area: chg; text-align: right; }
.chart { height: 460px; }

/* ---- 日曆: released events hidden until asked for ------------------------------------ */
#t-calendar:not(.show-past) tr.past { display: none; }

@media (max-width: 760px) {
  .two-col, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .big { font-size: 32px; }
  .chart { height: 320px; }
  .card { padding: 16px; }

  /* bottom tab bar instead of the header links */
  .nav { display: none; }
  .clock > .muted, .clock > .pill, .theme-label, .conn-text { display: none; }
  .top-tools { gap: 8px; }
  main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a {
    text-align: center; padding: 12px 0; font-size: 13px; font-weight: 600;
    color: var(--muted); text-decoration: none; border-top: 2px solid transparent;
  }
  .tabbar a[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }

  .status { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-link { border-left: 0; padding-left: 0; }

  /* watchlist becomes a swipeable strip above the chart */
  .market { grid-template-columns: minmax(0, 1fr); }
  .watch { contain: none; display: block; position: static; max-height: none; overflow: visible; }
  .watch .tabs, .tfs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .watch .tabs button, .tfs button { flex: none; white-space: nowrap; }
  .watch .tiles { grid-auto-flow: column; grid-auto-columns: minmax(150px, 46%); grid-template-columns: none; overflow-x: auto; gap: 6px; scroll-snap-type: x proximity; }
  .watch .tile {
    border-color: var(--line); scroll-snap-align: start;
    /* name and change on top, the price on its own full line below */
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name chg" "price price";
  }
  .watch .t-id { display: none; }
  .watch .t-price { text-align: left; }
}
.lab-flag { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 600; }
#t-lab td:nth-child(2), #t-lab td:nth-child(3), #t-lab td:nth-child(4), #t-lab td:nth-child(8), #t-lab th:nth-child(2), #t-lab th:nth-child(3), #t-lab th:nth-child(4), #t-lab th:nth-child(8) { text-align: left; }
.row-core td { background: color-mix(in srgb, var(--up, #16a34a) 7%, transparent); }
.chart-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; }
.zoom { display: flex; gap: 4px; }
.zoom .btn { min-width: 32px; }
.off-levels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0; }
.off-chip { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 999px; cursor: pointer; background: transparent; color: var(--ink);
  border: 1px solid var(--c, var(--line)); }
.off-chip b { font-family: var(--mono); font-weight: 600; }
.chart { touch-action: pan-y; cursor: crosshair; }
@media (max-width: 640px) {
  .off-levels { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .off-levels::-webkit-scrollbar { display: none; }
  .off-chip { white-space: nowrap; flex: none; }
  .off-levels > .muted { white-space: nowrap; flex: none; }
  .c-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
  .c-note.open { display: block; }
}
/* Production: secondary notes stay in the DOM for the scripts but are not shown. */
#radar-note, #c-source, #sum-note, #pattern-note, #recent-note, #sum-span { display: none !important; }

/* ==== Visual design (production) ======================================================= */
body {
  font-family: "Inter", -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
  background:
    radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(900px 400px at -10% 0%, color-mix(in srgb, var(--up) 7%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
:root { --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace; }
.top { background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); }
.brand { font-size: 18px; letter-spacing: .06em; }
.brand-mark { width: 14px; height: 14px; border-radius: 3px; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent); }

.card { border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow); border-color: var(--line); position: relative; }
h2 { font-size: 15px; font-weight: 650; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card > h2::before, .card > .card-head > h2::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent-2), var(--accent)); flex: none; }
.muted.small { font-size: 12px; }

/* tables */
table { font-size: 13.5px; }
thead th { text-transform: none; letter-spacing: .03em; font-size: 11.5px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; }
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
th, td { padding: 8px 12px; }
td.num { font-variant-numeric: tabular-nums; }
.table-wrap { border-radius: 10px; }
.row-core td { background: color-mix(in srgb, var(--up) 8%, transparent); }
.row-core td:first-child { box-shadow: inset 3px 0 0 var(--up); }

/* buttons and chips */
.tabs button, .tfs button, .btn { border-radius: 8px; padding: 5px 12px; transition: background .15s, border-color .15s, color .15s, transform .05s; }
.tabs button:hover, .tfs button:hover, .btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.btn:active, .tfs button:active { transform: translateY(1px); }
.tabs button[aria-selected="true"], .tfs button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.btn-primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #1a1205; border: 0; font-weight: 600; }
.pill { font-weight: 600; letter-spacing: .02em; }
.pill.up { background: color-mix(in srgb, var(--up) 15%, transparent); }
.pill.down { background: color-mix(in srgb, var(--down) 15%, transparent); }
.flag { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.light { box-shadow: 0 0 8px currentColor; }

/* tiles, signal cards */
.tile, .sig { border-radius: 10px; background: var(--surface-2); transition: border-color .15s, transform .15s, box-shadow .15s; }
.tile:hover, .sig:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.tile[aria-current="true"], .sig[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sig-usd, .tile .t-price, .c-price, .big, .kpis dd { font-variant-numeric: tabular-nums; }
.c-price { font-size: 24px; }
.c-name { font-size: 20px; }

/* chart frame */
.chart { border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.off-chip { background: color-mix(in srgb, var(--c) 10%, transparent); }

/* status strip numbers */
.stat b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.next-summary { font-size: 14px; }


/* ==== Market brief tabs ==== */
.b-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.b-tabs::-webkit-scrollbar { display: none; }
.b-tabs button { flex: 1 0 auto; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.b-tabs button:hover { color: var(--ink); }
.b-tabs button[aria-selected="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .18), inset 0 -2px 0 var(--accent); }
.b-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.b-kpi { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; position: relative; }
.b-kpi span { font-size: 11.5px; color: var(--muted); }
.b-kpi b { font: 700 18px/1.2 var(--mono); font-variant-numeric: tabular-nums; }
.b-kpi small { font: 12px var(--mono); }
.b-gauge { display: block; height: 5px; border-radius: 3px; margin-top: 6px; position: relative; background: linear-gradient(90deg, var(--down), var(--accent-2) 50%, var(--up)); }
.b-gauge i { position: absolute; top: -3px; width: 3px; height: 11px; border-radius: 2px; background: var(--ink); transform: translateX(-50%); }
.b-heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 12px; }
.b-cell { font: inherit; text-align: left; cursor: pointer; border: 1px solid color-mix(in srgb, var(--c) calc(var(--a) * 60%), var(--line)); border-radius: 8px; padding: 8px 10px; color: var(--ink);
  background: color-mix(in srgb, var(--c) calc(var(--a) * 35%), var(--surface-2)); display: grid; gap: 2px; transition: transform .12s; }
.b-cell:hover { transform: translateY(-1px); }
.b-cell span { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-cell b { font: 600 13px var(--mono); }
.b-lines { margin: 0 0 12px; padding-left: 18px; font-size: 13.5px; }
.b-news { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.b-news li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); font-size: 13.5px; }
.b-news a { color: var(--ink); text-decoration: none; font-weight: 500; }
.b-news a:hover { color: var(--accent); }
.b-news .muted { margin-left: 6px; }
.b-news .flag { margin-left: 4px; }
td.warn, .warn { color: var(--accent); }
#brief td.txt, #brief th.txt { text-align: left; }
#brief td.num, #brief th.num { text-align: right; }
/* Brand: 北辰 Polaris — a four-point star */
.brand-mark { width: 18px; height: 18px; border-radius: 0; transform: none; box-shadow: none;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 60%, transparent)); }
.brand-en { font: 600 10px/1 var(--mono); letter-spacing: .22em; color: var(--muted); margin-left: 2px; align-self: center; }
@media (max-width: 640px) { .brand-en { display: none; } }
.stat small { display: block; font-size: 11.5px; margin-top: 2px; }
.st-rule { grid-column: 1 / -1; margin: 6px 0 0; padding: 8px 12px; border-radius: 8px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); }

/* ==== 今日 category cards ==== */
.groups { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.group { font: inherit; color: var(--ink); text-align: left; cursor: pointer; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  position: relative; overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; min-width: 0; }
.group:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.g-icon { width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); transition: background .15s, color .15s; }
.g-icon svg { width: 20px; height: 20px; }
.g-text { display: grid; gap: 2px; min-width: 0; }
.g-text b { font-size: 15px; font-weight: 650; white-space: nowrap; }
.g-text small { font-size: 12.5px; line-height: 1.35; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.group[aria-pressed="true"] { border-color: color-mix(in srgb, var(--up) 55%, var(--line));
  background: linear-gradient(160deg, color-mix(in srgb, var(--up) 10%, var(--surface)), var(--surface) 70%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--up) 25%, transparent), 0 10px 30px color-mix(in srgb, var(--up) 12%, transparent); }
.group[aria-pressed="true"] .g-icon { color: #0b0f14; border-color: transparent; background: linear-gradient(135deg, var(--up), #8b7cf6); }
.group[aria-pressed="true"] .g-text small { color: var(--up); }
.group[aria-pressed="true"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--up), #8b7cf6); }
@media (max-width: 1280px) { .groups { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .groups { display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; padding: 2px 0 6px; }
  .groups::-webkit-scrollbar { display: none; }
  .group { flex: 0 0 auto; width: 168px; padding: 12px; scroll-snap-align: start; }
  .g-icon { width: 36px; height: 36px; }
}
@media (min-width: 1101px) {
  .group { padding: 10px; gap: 8px; }
  .g-icon { width: 34px; height: 34px; border-radius: 9px; }
  .g-icon svg { width: 17px; height: 17px; }
  .g-text b { font-size: 14px; }
  .g-text small { font-size: 11.5px; }
  .group[aria-pressed="true"]::after { left: 10px; right: 10px; }
}

/* ==== Research log ==== */
.rl-intro { margin: 0 0 10px; }
.flag.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.flag.down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
/* Site footer: brand, five link columns, copyright and risk line. */
.site-foot { margin: 32px 0 24px; padding: 36px 4px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot-top { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.foot-brand { max-width: 420px; }
.foot-brand .foot-logo { font-size: 17px; margin-bottom: 12px; }
.foot-brand p { margin: 0; line-height: 1.75; }
.foot-cols { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px; padding: 28px 0; }
.foot-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.foot-col h4 { margin: 0 0 4px; font-size: 14px; font-weight: 650; color: var(--ink); }
.foot-col a { color: var(--muted); text-decoration: none; width: fit-content; }
.foot-col a:hover { color: var(--accent); }
.foot-bottom { display: grid; gap: 6px; padding: 18px 0 0; border-top: 1px solid var(--line); font-size: 12px; }
.foot-bottom span:first-child { color: var(--ink); font-weight: 600; }
@media (max-width: 860px) { .foot-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; } }
@media (max-width: 520px) { .foot-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Legal pages (免責聲明・隱私政策・服務條款) */
.legal { max-width: 820px; margin: 0 auto; line-height: 1.8; }
.legal h1 { font-size: 22px; margin: 4px 0 6px; }
.legal h3 { margin: 22px 0 6px; font-size: 15px; }
.legal p, .legal li { color: var(--ink); }
.legal li + li { margin-top: 6px; }
.legal .legal-links { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
@media (max-width: 640px) { .site-foot { margin-bottom: 80px; } }

/* Long first-column text wraps instead of forcing a wide sideways scroll on phones. */
#research-log td:first-child, #t-score td:first-child, #lab-board td:first-child { white-space: normal; min-width: 7em; }
.sig-plan { opacity: .85; }
table.levels tr.plan-head th { font-size: 12px; font-weight: 500; color: var(--muted); padding-top: 10px; border-top: 1px dashed var(--line, rgba(127,127,127,.3)); text-align: left; }
table.levels tr.plan-row th { font-weight: 500; }
tr.row-plan td:first-child b { font-weight: 500; color: var(--muted); }

/* ---- member accounts ---- */
.acct-btn { display: inline-flex; align-items: center; gap: 6px; width: auto; padding: 0 10px; font-size: 13px; }
.acct-btn .acct-label { max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-btn.signed-in { color: var(--accent); }
@media (max-width: 640px) { .acct-btn .acct-label { display: none; } .acct-btn { padding: 0; width: 34px; justify-content: center; } }
.acct-dialog { width: min(400px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.acct-dialog::backdrop { background: rgba(20, 18, 14, 0.45); }
.acct-dialog h2 { margin: 0 0 16px; font-size: 20px; }
.acct-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.acct-field { display: block; margin-bottom: 12px; }
.acct-fixed { margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 13.5px; line-height: 1.6; }
.acct-field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.acct-field input, .acct-field textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; }
.acct-field input:focus, .acct-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.acct-dialog form .btn { margin-top: 4px; }
.acct-submit { width: 100%; padding: 10px; }
.acct-google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box; padding: 10px; margin: 0; text-decoration: none; color: var(--ink); }
.acct-or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12px; }
.acct-or::before, .acct-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.acct-switch { margin: 14px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.linklike { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0 2px; }
.acct-note { padding: 8px 12px; border-radius: 10px; font-size: 13px; margin: 0 0 14px; }
.acct-ok { background: color-mix(in srgb, var(--up) 12%, transparent); color: var(--up); }
.acct-bad { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.acct-info { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 14px; }
.acct-info dt { color: var(--muted); }
.acct-info dd { margin: 0; overflow-wrap: anywhere; }
.acct-more { margin-top: 12px; font-size: 14px; }
.acct-more summary { cursor: pointer; color: var(--accent); }
.acct-more form { margin-top: 10px; }
.acct-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.acct-dialog a.btn-primary { display: inline-block; text-decoration: none; margin-right: 8px; }
.acct-code { font: 600 24px var(--mono); letter-spacing: .4em; text-align: center; }

/* ---- language switch (i18n.js) ---- */
html.i18n-wait body { visibility: hidden; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; height: 30px; }
.lang-switch button { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--mono, inherit); padding: 0 9px; cursor: pointer; }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #1a1205; }
html[lang="en"] .brand-en { display: none; }

/* ---- header and tiles with longer (English) labels ---- */
.top-row { min-width: 0; }
.nav { min-width: 0; }
.nav a { white-space: nowrap; }
.top-tools > * { flex-shrink: 0; }
.clock .pill { white-space: nowrap; }
.acct-btn .acct-label { max-width: 12em; }
.lang-switch button { min-width: 28px; }
/* English words are wider than Chinese characters: drop the key hints and tighten first. */
@media (max-width: 1440px) { html[lang="en"] .nav-k { display: none; } html[lang="en"] .nav a { padding: 6px 10px; } }
@media (max-width: 1240px) { html[lang="en"] .conn-text, html[lang="en"] .theme-label { display: none; } html[lang="en"] .top-tools { gap: 8px; } }
@media (max-width: 1100px) { html[lang="en"] .clock > .muted { display: none; } }
html[lang="en"] .g-text b { font-size: 14.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
html[lang="en"] body { letter-spacing: 0; }
.pill { white-space: nowrap; }
html[lang="en"] .g-text b { white-space: normal; line-height: 1.2; }
@media (max-width: 760px) {
  .tabbar { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tabbar a { white-space: nowrap; overflow: hidden; text-overflow: clip; }
  html[lang="en"] .tabbar a { font-size: 11.5px; letter-spacing: -0.01em; }
  /* Tiles on phones: let the second line wrap instead of cutting it off. */
  .g-text small { white-space: normal; line-height: 1.25; }
}
/* Phones: the top bar must fit 360-px screens (logo, language, icons). The clock is
   hidden there; the next-check countdown on the page still shows the time left. */
@media (max-width: 480px) {
  .top-row { gap: 8px; }
  .top-tools { gap: 6px; }
  .top-tools .clock { display: none; }
  .lang-switch { height: 28px; }
  .lang-switch button { min-width: 0; padding: 0 7px; font-size: 11px; }
  .icon-btn { width: 32px; height: 32px; }
  .brand { font-size: 17px; }
}

/* ---- market state card (market.js) ---- */
.mk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-head h2 { margin: 0; }
.mk-state { font-size: 14px; padding: 3px 12px; }
.mk-line { margin: 8px 0 10px; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mk-chip { display: inline-flex; gap: 6px; align-items: baseline; font-size: 13px; padding: 5px 10px; border-radius: 10px; background: var(--chip); color: var(--ink); }
.mk-chip b { font-weight: 600; color: var(--muted); }
.mk-chip.mk-bull { background: color-mix(in srgb, var(--up) 12%, transparent); }
.mk-chip.mk-bear { background: color-mix(in srgb, var(--down) 12%, transparent); }
.mk-sub { font-size: 14px; margin: 4px 0 8px; }
.mk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mk-table th, .mk-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.mk-table th { color: var(--muted); font-weight: 500; }
.mk-table .num { font-variant-numeric: tabular-nums; }

/* ---- language menu (i18n.js) ---- */
.lang-select { height: 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--chip); color: var(--ink); font: 600 12.5px inherit; padding: 0 6px; cursor: pointer; }
@media (max-width: 480px) { .lang-select { height: 30px; font-size: 12px; padding: 0 4px; max-width: 86px; } }

/* ---- 北辰交易理論 ---- */
.theory-lead { font-size: 15px; line-height: 1.75; margin: 0 0 16px; }
.theory-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.theory-item { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.theory-item b { display: block; font-size: 15px; margin-bottom: 6px; color: var(--accent); }
.theory-item p { margin: 0; font-size: 14px; line-height: 1.7; }
.theory h3 { font-size: 15px; margin: 4px 0 8px; }
.theory-proof { margin: 0; padding-left: 20px; line-height: 1.8; font-size: 14px; }

/* 形態訊號 */
.pat-card { cursor: pointer; }
.pat-card:hover { border-color: var(--accent); }
.pat-aligned { color: var(--accent); }
.pat-prog { height: 4px; background: var(--chip); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.pat-prog i { display: block; height: 100%; background: var(--accent); }

/* 帳戶：三步註冊、邀請、自動交易 */
.acct-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow-y: auto; }
.acct-steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 16px; counter-reset: st; }
.acct-steps li { flex: 1; font-size: 12px; color: var(--muted); padding-top: 6px; border-top: 3px solid var(--line); counter-increment: st; }
.acct-steps li::before { content: counter(st) ". "; }
.acct-steps li.done { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.acct-steps li.now { border-color: var(--accent); color: var(--ink); font-weight: 600; }
.acct-sec { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.acct-sec h3 { margin: 0 0 8px; font-size: 15px; }
.acct-copyrow { display: flex; gap: 8px; }
.acct-link { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: 13px var(--mono); }
.acct-mono { font-family: var(--mono); }
.acct-list { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13px; }
.acct-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.acct-field select { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; }
.acct-check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 4px 0 12px; }
.acct-check input { margin-top: 3px; flex: none; }
.acct-btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.acct-invite[readonly] { opacity: .8; }

/* 我的帳戶：獨立頁 (#account) */
.acct-page { max-width: 1080px; margin: 0 auto; }
.acct-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.acct-avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 24px var(--sans, inherit); color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.acct-avatar { overflow: hidden; position: relative; }
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-avatar-edit { cursor: pointer; overflow: visible; }
.acct-avatar-edit img { border-radius: 50%; }
.acct-avatar-cam { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.acct-avatar-edit:hover .acct-avatar-cam, .acct-avatar-edit:focus-within .acct-avatar-cam { color: var(--accent); }
.acct-avatar-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.acct-avatar-row .acct-btnrow { margin: 0 0 4px; }
.acct-avatar-row label.btn { cursor: pointer; }
.acct-btn-img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; }
.acct-hero-text { flex: 1; min-width: 200px; }
.acct-hero-text h1 { margin: 0 0 4px; font-size: 22px; }
.acct-hero-text p { margin: 0; overflow-wrap: anywhere; }
.acct-hero-act { margin: 0; }
.acct-hero-act a.btn { text-decoration: none; }
.acct-cards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.acct-cards .card { margin-bottom: 0; }
.acct-wide { grid-column: 1 / -1; }
/* member page: wallet is one column (balances, sub-tabs, one card); settings is two columns */
.acct-cards-wallet, .acct-cards-level, .acct-cards-trade, .acct-cards-invite { grid-template-columns: minmax(0, 1fr); }
.acct-inv { display: flex; gap: 28px; align-items: center; }
.acct-inv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.acct-inv-main h2 { margin-bottom: 0; font-size: 18px; }
.acct-inv-main h2::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent-2), var(--accent)); flex: none; }
.acct-inv-main .acct-copyrow .acct-link { font-size: 14px; padding: 10px 12px; }
.acct-inv-code { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.acct-inv-code b { font-size: 22px; letter-spacing: .12em; }
.acct-inv-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; }
.acct-bal-item b small { font-size: 15px; color: var(--muted); font-weight: 500; }
@media (max-width: 640px) { .acct-inv { flex-direction: column; align-items: stretch; } .acct-inv-qr { align-self: center; } }
.acct-banner { grid-column: 1 / -1; margin: 0; padding: 12px 16px; border-radius: 12px; font-size: 14px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); color: var(--ink); }
.acct-banner-bad { background: color-mix(in srgb, var(--down) 8%, var(--surface)); border-color: color-mix(in srgb, var(--down) 35%, var(--line)); color: var(--down); }
.acct-bal { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; }
.acct-bal-item { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.acct-bal-item + .acct-bal-item { padding-left: 32px; border-left: 1px solid var(--line); }
.acct-bal-item span { font-size: 13px; color: var(--muted); }
.acct-bal-item b { font-size: 28px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.acct-bal-item em { font-style: normal; font-size: 12px; color: var(--muted); }
.acct-bal-act { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.acct-seg { display: inline-flex; justify-self: start; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.acct-seg button { white-space: nowrap; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 7px 18px; border-radius: 9px; cursor: pointer; }
.acct-seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.acct-dep { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.acct-dep-qr { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.acct-dep-qr .bill-nets { margin: 0; }
.acct-dep-info > div { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.acct-addrbox { width: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.acct-tips { margin: 16px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); display: grid; gap: 4px; }
.acct-tips b { color: var(--ink); }
.acct-table th { color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); }
.acct-table td { border-bottom: 1px dashed var(--line); }
.acct-empty { text-align: center; padding: 20px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.acct-empty b { display: block; font-size: 16px; margin-bottom: 4px; }
.acct-bound { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; }
.acct-bound > div { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.acct-bound b { font-size: 15px; overflow-wrap: anywhere; }
.acct-narrow { max-width: 460px; }
.acct-inline { display: flex !important; gap: 8px; margin: 0 !important; color: inherit !important; font-size: inherit !important; }
.acct-inline input { flex: 1; min-width: 0; }
.acct-inline .btn { flex: none; white-space: nowrap; }
.acct-help { margin: -6px 0 12px; }
.acct-cards-settings { align-items: stretch; }
.acct-cards-settings .acct-wide .acct-form { max-width: 720px; }
.acct-profile { display: flex; gap: 28px; align-items: flex-start; }
.acct-profile-pic { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 150px; flex: none; text-align: center; }
.acct-profile-pic .acct-btnrow { justify-content: center; margin: 0; }
.acct-profile-pic p { margin: 0; }
.acct-profile-pic label.btn { cursor: pointer; }
.acct-avatar-lg { width: 84px; height: 84px; font-size: 34px; }
.acct-profile-form { flex: 1; min-width: 0; }
.acct-sec { display: flex; flex-direction: column; }
.acct-sec h2 { display: flex; align-items: center; gap: 8px; }
.acct-sec h2 .pill { font-size: 11.5px; font-weight: 600; }
.acct-sec > p { margin-top: 0; }
.acct-sec .acct-form { flex: 1; display: flex; flex-direction: column; }
.acct-sec .acct-form > .btn:last-child { margin-top: auto; align-self: flex-start; }
.acct-sec .acct-form > p.small:empty { display: none; }
.acct-bal-pend { flex-basis: 100%; margin: 0; }
@media (max-width: 640px) { .acct-profile { flex-direction: column; align-items: stretch; } .acct-profile-pic { width: auto; flex-direction: row; text-align: left; flex-wrap: wrap; } }
@media (max-width: 640px) {
  .acct-dep { grid-template-columns: minmax(0, 1fr); }
  .acct-bal-item + .acct-bal-item { padding-left: 0; border-left: 0; }
  .acct-bal { gap: 14px 16px; }
  .acct-bal .acct-bal-item { min-width: 0; flex: 1 1 calc(50% - 8px); } /* balances in two columns */
  .acct-bal .acct-bal-item > :nth-child(2) { font-size: 22px; }
  .acct-bal-act { margin-left: 0; width: 100%; }
  .acct-bal-act .btn { flex: 1 1 0; white-space: nowrap; }
  .acct-bal-act [data-act="pay-activate"] { flex-basis: 100%; } /* the long one gets its own row */
  .acct-seg { display: flex; width: 100%; box-sizing: border-box; }
  .acct-seg button { flex: 1; padding: 7px 6px; white-space: nowrap; }
}
.acct-card h2 { margin-top: 0; }
.acct-h3 { font-size: 15px; margin: 18px 0 8px; }
.bill-step { margin: 14px 0; }
.bill-step-h { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 4px; }
.bill-bar { height: 6px; border-radius: 3px; background: var(--line, rgba(127,127,127,.2)); overflow: hidden; }
.bill-bar i { display: block; height: 100%; background: var(--accent, #c9a227); }
.bill-wrap { overflow-x: auto; }
.bill-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.bill-table td, .bill-table th { padding: 6px 8px; white-space: nowrap; text-align: left; }
.acct-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 10px 0; }
.acct-kv span { color: var(--muted); font-size: 13px; }
.acct-big { font-size: 22px; letter-spacing: .08em; }
.acct-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.acct-form .btn { margin-top: 4px; }
.acct-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.acct-stats > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.acct-stats > div > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.acct-stats b { font-size: 14px; overflow-wrap: anywhere; }
.acct-guide { list-style: none; counter-reset: g; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.acct-guide li { counter-increment: g; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--surface-2); font-size: 13px; }
.acct-guide li::before { content: counter(g); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.acct-guide li b { display: block; margin-bottom: 4px; }
.acct-guide li span { color: var(--muted); }
.acct-guide li span b { display: inline; color: var(--ink); margin: 0; }
.acct-signin { max-width: 520px; margin: 40px auto; text-align: center; }
.acct-signin .acct-btnrow { justify-content: center; }
@media (max-width: 760px) {
  .acct-cards, .acct-grid2 { grid-template-columns: minmax(0, 1fr); }
  .acct-hero-act { width: 100%; }
}

/* Six category tiles in one row (desktop): icon on top, title and status underneath,
   each on one line, so nothing is cut off or wrapped. */
@media (min-width: 1281px) {
  .groups .group { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 14px 16px; }
  .groups .g-icon { width: 34px; height: 34px; border-radius: 10px; }
  .groups .g-icon svg { width: 17px; height: 17px; }
  .groups .g-text { width: 100%; }
  .groups .g-text b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
  .groups .g-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
}

/* 我的交易紀錄 (trade-history.js) */
.th-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 4px; }
.th-stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: linear-gradient(160deg, var(--surface-2), var(--surface)); }
.th-stat span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.th-stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.th-stat em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.th-h { font-size: 15px; margin: 22px 0 8px; display: flex; align-items: center; gap: 8px; }
.th-h::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent-2), var(--accent)); }
.th-table { font-size: 13px; }
.th-table td, .th-table th { white-space: nowrap; }
.th-table td.num, .th-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.th-table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.th-coin { display: inline-flex; align-items: center; gap: 6px; }
.th-dir { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--chip); }
.th-dir.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.th-dir.down { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.th-tag { font-size: 10.5px; padding: 0 5px; border-radius: 5px; background: var(--chip); color: var(--muted); }
.th-foot { margin-top: 12px; }

/* ==== 今日 hero (2026-11-21): brand line, call to action, headline numbers.
   Colours follow the theme: a warm light panel by day, deep navy by night. ==== */
:root {
  --h-bg: radial-gradient(640px 320px at 90% -20%, rgba(242, 184, 75, .30), transparent 62%),
    radial-gradient(520px 320px at -5% 115%, rgba(139, 124, 246, .16), transparent 60%),
    linear-gradient(140deg, #fffdf8 0%, #fbf6ec 50%, #f4f1fb 100%);
  --h-line: #ece3d2; --h-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 36px rgba(120, 90, 30, .08);
  --h-ink: #141a22; --h-title: linear-gradient(180deg, #141a22 40%, #3b4660); --h-lead: #4d5767; --h-muted: #707a8a;
  --h-eyebrow: #b7650f; --h-card: rgba(255, 255, 255, .72); --h-card-line: #ebe4d6;
  --h-main: linear-gradient(135deg, rgba(242, 184, 75, .22), rgba(255, 255, 255, .8)); --h-main-line: rgba(217, 122, 30, .35); --h-main-ink: #b4610c;
  --h-ghost: rgba(20, 26, 34, .04); --h-ghost-line: rgba(20, 26, 34, .16); --h-stars: 0;
  --h-up: #0f9d6b; --h-down: #e0394f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --h-bg: radial-gradient(600px 300px at 88% -10%, rgba(242, 184, 75, .20), transparent 60%),
      radial-gradient(500px 300px at 0% 110%, rgba(110, 99, 246, .16), transparent 60%),
      linear-gradient(140deg, #111826 0%, #141c2c 55%, #171f33 100%);
    --h-line: #243045; --h-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 36px rgba(0, 0, 0, .35);
    --h-ink: #eef2f8; --h-title: linear-gradient(180deg, #ffffff 30%, #c9d3e6); --h-lead: #b7c2d6; --h-muted: #9aa7bd;
    --h-eyebrow: #f2c56b; --h-card: rgba(255, 255, 255, .045); --h-card-line: rgba(255, 255, 255, .09);
    --h-main: linear-gradient(135deg, rgba(242, 184, 75, .14), rgba(255, 255, 255, .03)); --h-main-line: rgba(242, 184, 75, .32); --h-main-ink: #ffd27a;
    --h-ghost: rgba(255, 255, 255, .04); --h-ghost-line: rgba(255, 255, 255, .2); --h-stars: .45;
    --h-up: #3ddc97; --h-down: #ff6b81;
  }
}
:root[data-theme="dark"] {
  --h-bg: radial-gradient(600px 300px at 88% -10%, rgba(242, 184, 75, .20), transparent 60%),
    radial-gradient(500px 300px at 0% 110%, rgba(110, 99, 246, .16), transparent 60%),
    linear-gradient(140deg, #111826 0%, #141c2c 55%, #171f33 100%);
  --h-line: #243045; --h-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 12px 36px rgba(0, 0, 0, .35);
  --h-ink: #eef2f8; --h-title: linear-gradient(180deg, #ffffff 30%, #c9d3e6); --h-lead: #b7c2d6; --h-muted: #9aa7bd;
  --h-eyebrow: #f2c56b; --h-card: rgba(255, 255, 255, .045); --h-card-line: rgba(255, 255, 255, .09);
  --h-main: linear-gradient(135deg, rgba(242, 184, 75, .14), rgba(255, 255, 255, .03)); --h-main-line: rgba(242, 184, 75, .32); --h-main-ink: #ffd27a;
  --h-ghost: rgba(255, 255, 255, .04); --h-ghost-line: rgba(255, 255, 255, .2); --h-stars: .45;
  --h-up: #3ddc97; --h-down: #ff6b81;
}
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 28px; padding: 36px 36px 30px; margin-bottom: 18px; border-radius: 20px; color: var(--h-ink);
  background: var(--h-bg); border: 1px solid var(--h-line); box-shadow: var(--h-shadow); isolation: isolate;
}
.hero::before { /* faint star field, night only */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: var(--h-stars); pointer-events: none;
  background-image: radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 42% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 72% 32%, #ffe3a3 50%, transparent 51%), radial-gradient(1px 1px at 86% 72%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 78%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 58% 88%, #fff 50%, transparent 51%);
}
.hero-eyebrow { margin: 0 0 14px; font-size: 13px; letter-spacing: .08em; color: var(--h-eyebrow); display: flex; align-items: center; gap: 8px; font-weight: 600; }
.hero-star { font-size: 15px; filter: drop-shadow(0 0 6px rgba(242, 184, 75, .7)); }
.hero-title { margin: 0 0 14px; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.22; font-weight: 800; letter-spacing: -.01em;
  background: var(--h-title); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-lead { margin: 0 0 22px; font-size: 15.5px; line-height: 1.75; color: var(--h-lead); max-width: 560px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.cta { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 12px;
  font-weight: 700; font-size: 15px; text-decoration: none; transition: transform .15s, box-shadow .15s, background .15s; }
.cta:hover { transform: translateY(-1px); }
.cta-primary { color: #1a1204; background: linear-gradient(135deg, #ffd27a, #f0a24b); box-shadow: 0 8px 22px rgba(240, 162, 75, .32); }
.cta-primary:hover { box-shadow: 0 10px 28px rgba(240, 162, 75, .46); }
.cta-ghost { color: var(--h-ink); border: 1px solid var(--h-ghost-line); background: var(--h-ghost); }
.cta-ghost:hover { background: color-mix(in srgb, var(--h-ghost) 100%, var(--h-ghost-line)); }
.hero-mkt { margin: 18px 0 0; font-size: 13.5px; color: var(--h-lead); display: flex; align-items: center; gap: 8px; }
.hero-mkt:empty { display: none; }
.hero-mkt b { margin: 0 2px; }
.hero .up { color: var(--h-up); } .hero .down { color: var(--h-down); }
.dot-live { width: 8px; height: 8px; border-radius: 50%; flex: none; animation: live 2s ease-in-out infinite; }
.up-bg { background: var(--h-up); box-shadow: 0 0 0 4px color-mix(in srgb, var(--h-up) 18%, transparent); }
.down-bg { background: var(--h-down); box-shadow: 0 0 0 4px color-mix(in srgb, var(--h-down) 18%, transparent); }
@keyframes live { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } .cta, .cta:hover { transform: none; } }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: center; }
.hs { display: grid; gap: 4px; padding: 16px 18px; border-radius: 14px; color: inherit; text-decoration: none; min-width: 0;
  background: var(--h-card); border: 1px solid var(--h-card-line); backdrop-filter: blur(6px); }
.hs span { font-size: 12.5px; color: var(--h-muted); }
.hs b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--h-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs small { font-size: 12px; color: var(--h-muted); font-variant-numeric: tabular-nums; }
.hs-main { grid-column: 1 / -1; background: var(--h-main); border-color: var(--h-main-line); transition: border-color .15s; }
.hs-main:hover { border-color: var(--h-eyebrow); }
.hs-main b { font-size: 34px; color: var(--h-main-ink); }
.hs:nth-child(2) { grid-column: 1 / -1; }
.hs-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 11.5px; color: var(--h-muted); }
@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding: 26px 20px 22px; gap: 22px; border-radius: 16px; }
  .hs-main b { font-size: 28px; }
  .hs b { font-size: 20px; }
  .hs { padding: 12px 14px; }
  .cta { flex: 1 1 auto; }
}
@media (max-width: 520px) {
  .hero-stats { gap: 8px; }
  .hs { padding: 10px; }
  .hs b { font-size: 15.5px; }
  .hs span, .hs small { font-size: 11px; }
  .hero-title { font-size: 26px; }
  .hs:nth-child(2) b { font-size: 19px; }
}

/* next daily signal line and the folded settings under the category cards */
.st-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 12px; padding: 10px 14px; border-radius: 12px;
  font-size: 13.5px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.st-rule:empty { display: none; }
.st-rule-k { font-size: 12px; font-weight: 700; color: var(--accent); padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.prefs { margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; }
.prefs summary { cursor: pointer; font-weight: 600; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.prefs .status-tools { border-top: 1px solid var(--line); margin-top: 10px; }

/* overall polish: softer cards, clearer headings */
.card { border-radius: 16px; box-shadow: var(--shadow); padding: 22px 24px; }
.card > h2:first-child, .mk-head h2 { font-size: 18px; letter-spacing: .01em; }
@media (max-width: 640px) { .card { padding: 18px 16px; border-radius: 14px; } }
.btn-more { display: block; width: 100%; margin-top: 10px; padding: 8px; border-radius: 10px; font-weight: 600; }

.fold-top { border-top: 0; padding: 0; }
.fold-top > summary { font-size: 16px; }

.c-pattern { margin: 4px 0 8px; line-height: 1.7; }
.c-pattern .pill { margin-right: 4px; }

/* Header fits in every language (2026-11-22): drop the extras step by step as it narrows. */
@media (max-width: 1440px) { .nav-k { display: none; } .nav a { padding: 6px 10px; } }
@media (max-width: 1240px) { .conn-text, .theme-label { display: none; } .top-tools { gap: 8px; } }
@media (max-width: 1100px) { .clock > .muted { display: none; } }
@media (max-width: 960px) { .clock { display: none; } }

/* Home extras (home.js): price strip, today's key signal, results ledger. */
.ticker { margin: 0 0 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.tk-track { display: flex; width: max-content; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14px; animation: tk-run var(--tk-dur, 50s) linear infinite; }
.ticker:hover .tk-track { animation-play-state: paused; }
@keyframes tk-run { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tk { display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px; border-right: 1px solid var(--line); }
.tk-ic { width: 22px; height: 22px; border-radius: 7px; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--c); }
.tk-logo { background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); border-radius: 50%; }
.tk-logo img { display: block; } .tk-logo .tk-night { display: none; }
:root[data-theme="dark"] .tk-logo { background: #1b2336; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
:root[data-theme="dark"] .tk-logo .tk-day { display: none; } :root[data-theme="dark"] .tk-logo .tk-night { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tk-logo { background: #1b2336; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
  :root:not([data-theme="light"]) .tk-logo .tk-day { display: none; } :root:not([data-theme="light"]) .tk-logo .tk-night { display: block; }
}
.tk b { font-weight: 600; }
.tk em { font-style: normal; }
@media (prefers-reduced-motion: reduce) { .tk-track { animation: none; } .ticker { overflow-x: auto; } }
.home-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; margin: 0 0 16px; }
.home-row .card { margin: 0; }
.fs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.fs-head h2 { margin: 0; }
.fs-title { margin: 10px 0 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fs-title > b { font-size: 18px; }
.fs-state { margin-left: auto; font-size: 13px; color: var(--muted); }
.fs-levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fs-lv { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--surface-2); min-width: 0; }
.fs-lv span { display: block; font-size: 12px; color: var(--muted); }
.fs-lv b { font-variant-numeric: tabular-nums; font-size: 15px; overflow: hidden; text-overflow: ellipsis; display: block; }
.fs-lv.up b { color: var(--up); } .fs-lv.down b { color: var(--down); }
.fs-how { margin: 10px 0 6px; }
.lg-stats { display: flex; gap: 24px; margin: 6px 0 10px; }
.lg-stats b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.lg-stats span { font-size: 12px; color: var(--muted); }
.lg-chart { height: 90px; display: flex; align-items: center; gap: 3px; position: relative; }
.lg-chart::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--line); }
.lg-bar { flex: 1; height: calc(var(--h) / 2); border-radius: 2px; align-self: flex-end; margin-bottom: 45px; cursor: default; }
.lg-bar.up { background: var(--up); }
.lg-bar.down { background: var(--down); align-self: flex-start; margin-bottom: 0; margin-top: 45px; }
.lg-bar:hover { opacity: .7; }
.lg-axis { display: flex; justify-content: space-between; margin-top: 4px; }
.lg-rules { margin: 10px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.7; }
.lg-rules b { color: var(--ink); }
@media (max-width: 860px) { .home-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .fs-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fs-state { margin-left: 0; width: 100%; } }

/* Hero pulse (pulse.js), 2026-11-22: the whole hero is a night sky drawn on one canvas, in both
   themes; the 3D ring sits in the right column (#pulse-wrap only marks its place). */
.hero { --pu-ink: #141a30; --pu-muted: rgba(70,78,110,.8); --pu-card: rgba(255,255,255,.88); --pu-line: rgba(20,150,120,.45); --pu-acc: #0f8f72; --h-line: rgba(80,90,140,.12); }
:root[data-theme="dark"] .hero { --pu-ink: #fff; --pu-muted: rgba(190,200,235,.75); --pu-card: rgba(10,16,32,.82); --pu-line: rgba(90,210,190,.55); --pu-acc: #5fd7bd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { --pu-ink: #fff; --pu-muted: rgba(190,200,235,.75); --pu-card: rgba(10,16,32,.82); --pu-line: rgba(90,210,190,.55); --pu-acc: #5fd7bd; } }
.hero > #pulse { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.hero > .hero-main { position: relative; z-index: 1; }
.hero-pulse { position: relative; z-index: 1; min-height: 480px; aspect-ratio: 1 / 1; max-height: 560px; width: 100%; }
.pulse-center { display: none; }
.pulse-cap { position: absolute; left: 0; right: 0; bottom: -4px; text-align: center; font-size: 12px; letter-spacing: .14em; color: var(--pu-muted); pointer-events: none; }
.pulse-cap::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #2fd3a0; margin-right: 8px; box-shadow: 0 0 0 3px rgba(47,211,160,.2); vertical-align: 1px; }
#pulse-cards { position: absolute; inset: 0; pointer-events: none; }
.pc { position: absolute; min-width: 170px; max-width: 220px; padding: 8px 11px; border-radius: 12px; background: var(--pu-card); border: 1px solid var(--pu-line);
  backdrop-filter: blur(8px); box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: 12.5px; color: var(--pu-ink); }
.pc { opacity: 0; } .pc.pc-hover { opacity: 1; z-index: 2; }
.pc-rule { color: var(--pu-acc); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }
.pc-name { margin: 1px 0 3px; display: flex; align-items: center; gap: 8px; } .pc-name b { font-size: 15px; color: var(--pu-ink); }
.pc-dir, .pc-chg { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; }
.pc-chg.up { color: var(--up); } .pc-chg.down { color: var(--down); }
.pc-dir.down { color: #ff6b7d; background: rgba(255,90,110,.16); } .pc-dir.up { color: #3ee0a8; background: rgba(60,220,160,.16); }
.pc-px { font-variant-numeric: tabular-nums; font-weight: 600; }
.pc-st { font-size: 11.5px; margin-top: 3px; } .pc-st.up { color: var(--up); } .pc-st.down { color: var(--down); }
@keyframes pc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.hero-stats-row { grid-template-columns: 1.4fr 1fr 1fr 1fr; margin: 0 0 16px; }
.hero-stats-row .hs-main, .hero-stats-row .hs:nth-child(2) { grid-column: auto; }
.hero-stats-row .hs-main b { font-size: 28px; }
.hero-stats-row .hs-note { grid-column: 1 / -1; }
@media (max-width: 860px) {
  .hero-pulse { min-height: 340px; max-height: 480px; aspect-ratio: 1 / 1.2; }
  .pulse-cap { bottom: -16px; }
  .hero-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats-row .hs-main { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .pc { min-width: 150px; font-size: 11px; } }
@media (prefers-reduced-motion: reduce) { .pc { animation: none; } }

.pulse-tip { position: absolute; z-index: 3; pointer-events: none; min-width: 150px; max-width: 220px; padding: 8px 11px; border-radius: 10px; font-size: 12.5px;
  background: var(--pu-card); color: var(--pu-ink); border: 1px solid var(--pu-line); box-shadow: 0 10px 24px rgba(0,0,0,.2); backdrop-filter: blur(8px); }
.pulse-tip b { font-size: 15px; margin-right: 6px; } .pulse-tip small { display: block; color: var(--pu-muted); font-size: 11px; }
.pulse-tip .up { color: var(--up); } .pulse-tip .down { color: var(--down); }
.pt-sig { margin-top: 4px; font-size: 11.5px; } .pt-go { margin-top: 4px; font-size: 11.5px; color: var(--pu-acc); font-weight: 600; }

.notice.notice-float { position: fixed; left: 16px; bottom: 16px; z-index: 40; margin: 0; max-width: min(420px, calc(100vw - 32px)); font-size: 12.5px;
  background: var(--surface); box-shadow: 0 10px 28px rgba(0,0,0,.18); border-style: solid; }
@media (max-width: 760px) { .notice.notice-float { bottom: calc(72px + env(safe-area-inset-bottom)); } }
.bill-pay { margin-top: 18px; gap: 24px; align-items: start; }
.bill-addr { margin: 8px 0 10px; }
.bill-addr .acct-copyrow { margin-top: 4px; }
.acct-tabs { display: flex; gap: 6px; margin: 16px 0 14px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.acct-tabs::-webkit-scrollbar { display: none; }
.acct-tab { flex: 0 0 auto; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; margin-bottom: -1px; }
.acct-tab.on { color: var(--text, inherit); border-bottom-color: var(--accent); font-weight: 600; }
.bill-bal > div > b { font-size: 22px; }
.bill-nets { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; }
.bill-net { background: none; border: 0; border-radius: 7px; padding: 6px 14px; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; }
.bill-net.on { background: var(--accent); color: #fff; }
.bill-dep { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bill-qr { border-radius: 8px; background: #fff; padding: 4px; image-rendering: pixelated; }
.bill-dep-info { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 200px; align-items: flex-start; }
.bill-addr-txt { word-break: break-all; font-size: 14px; }
.bill-code { align-items: end; }
.bill-code .btn { margin-bottom: 12px; }

/* API Secret: masked text, not a password field, so browsers never save it as a login */
.acct-secret { -webkit-text-security: disc; text-security: disc; font-family: var(--mono); }

/* 北辰廣場 (#plaza) */
.plaza-page { max-width: 680px; margin: 0 auto; }
.pz-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pz-head h1 { margin: 0 0 4px; font-size: 22px; }
.pz-head p { margin: 0; font-size: 13px; }
.pz-sort { display: flex; gap: 6px; }
/* Tabs on the left, Messages on the far right of the same row (2026-11-23, user). */
.pz-sortbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pz-head-btns { display: inline-flex; gap: 8px; margin-left: auto; flex: none; }
.pz-head-btns .pz-dm-btn { margin: 0; position: relative; }
/* Friends page (#plaza/friends): invite-code search, requests, friend list. */
.pz-friends { display: flex; flex-direction: column; gap: 10px; }
.pz-find { display: flex; gap: 8px; }
.pz-find input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
.pz-friend { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line, rgba(255,255,255,.08)); }
.pz-friend:first-child { border-top: 0; }
.pz-friend .acct-btnrow { margin: 0; }
.pz-compose { margin-bottom: 14px; }
.pz-guest { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pz-guest p { margin: 0; }
.pz-guest .acct-btnrow { margin: 0; }
.pz-compose-row { display: flex; gap: 12px; align-items: flex-start; }
.pz-compose textarea { flex: 1; min-width: 0; resize: vertical; min-height: 72px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; color: var(--ink); background: var(--surface-2); }
.pz-compose textarea:focus { outline: none; border-color: var(--accent); }
.pz-compose-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-left: 52px; }
.pz-count { margin-left: auto; }
.pz-iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--accent); cursor: pointer; }
.pz-iconbtn:hover { background: var(--chip); }
.pz-iconbtn.off { opacity: .4; cursor: not-allowed; }
.pz-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 0 52px; }
.pz-thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.pz-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pz-thumb-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; cursor: pointer; }
.pz-av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.pz-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pz-av.sm { width: 30px; height: 30px; font-size: 13px; }
.pz-feed { display: flex; flex-direction: column; gap: 12px; }
.pz-feed .card { margin-bottom: 0; }
.pz-post { padding-bottom: 6px; }
.pz-meta { display: flex; align-items: center; gap: 10px; }
.pz-who { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1; }
.pz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16em; }
.pz-badge { font-size: 11px; padding: 1px 6px; border-radius: 999px; color: #fff; background: var(--accent); }
.pz-text { margin: 10px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.pz-imgs { display: grid; gap: 4px; margin-top: 10px; border-radius: 12px; overflow: hidden; }
.pz-imgs-1 { grid-template-columns: 1fr; }
.pz-imgs-2, .pz-imgs-4 { grid-template-columns: 1fr 1fr; }
.pz-imgs-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.pz-imgs-3 .pz-img:first-child { grid-row: 1 / 3; }
.pz-img { padding: 0; border: 0; background: var(--chip); cursor: zoom-in; display: block; aspect-ratio: 1; overflow: hidden; }
.pz-imgs-1 .pz-img { aspect-ratio: auto; max-height: 520px; }
.pz-imgs-3 .pz-img:first-child { aspect-ratio: auto; }
.pz-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pz-imgs-1 .pz-img img { object-fit: contain; max-height: 520px; background: var(--chip); }
.pz-acts { display: flex; gap: 18px; margin-top: 6px; }
.pz-act { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); padding: 6px 8px; margin-left: -8px; border-radius: 999px; cursor: pointer; font: inherit; font-size: 13px; }
.pz-act:hover { background: var(--chip); color: var(--ink); }
.pz-act.on { color: var(--down); }
.pz-act.on-c { color: var(--accent); }
.pz-link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.pz-del { color: var(--muted); }
.pz-del:hover { color: var(--down); }
.pz-cmts { border-top: 1px solid var(--line); margin-top: 6px; padding: 10px 0 6px; display: flex; flex-direction: column; gap: 10px; }
.pz-cmt { display: flex; gap: 10px; }
.pz-cmt-body { flex: 1; min-width: 0; }
.pz-cmt-body .pz-meta { gap: 8px; flex-wrap: wrap; }
.pz-cmt-body .pz-text { margin-top: 2px; font-size: 14px; }
.pz-cmt-form { display: flex; gap: 8px; }
.pz-cmt-form input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; color: var(--ink); background: var(--surface-2); }
.pz-cmt-form input:focus { outline: none; border-color: var(--accent); }
.pz-more { text-align: center; margin: 16px 0; }
.pz-empty { text-align: center; }
.pz-zoom { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh; }
.pz-zoom::backdrop { background: rgba(0,0,0,.85); }
.pz-zoom img { max-width: 96vw; max-height: 92vh; display: block; border-radius: 8px; }
.pz-zoom-x { position: fixed; top: 14px; right: 18px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; cursor: pointer; }
@media (max-width: 640px) {
  .pz-compose-bar, .pz-thumbs { padding-left: 0; margin-left: 0; }
  .pz-compose-row .pz-av, .pz-compose-row .pz-av-link { display: none; }
}

/* Six top tabs (北辰廣場, 2026-11-23). The header is capped at the page width (1120 px), so
   screen-width steps alone can't make room: the key hints and the "live" / theme words are
   always off (their icons stay); below 1100 px the logo's English and the account name go;
   below 900 px the tabs move to the bottom bar, as on phones. */
.brand { flex-shrink: 0; }
.nav-k, .conn-text, .theme-label { display: none; }
.nav a { padding: 6px 10px; }
.top-tools { gap: 8px; }
@media (max-width: 1100px) {
  .brand-en, .acct-btn .acct-label { display: none; }
  .acct-btn { padding: 0; width: 34px; justify-content: center; }
  .nav a { padding: 6px 8px; }
}
@media (max-width: 900px) {
  .nav { display: none; }
  main { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar a { text-align: center; padding: 12px 0; font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; border-top: 2px solid transparent; white-space: nowrap; overflow: hidden; }
  .tabbar a[aria-current="page"] { color: var(--accent); border-top-color: var(--accent); }
  .site-foot { margin-bottom: 80px; }
}
@media (max-width: 760px) { .tabbar { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* 北辰廣場: replies and notifications */
.pz-reply-to { color: var(--muted); font-size: 13px; }
.pz-reply-to b { color: var(--accent); font-weight: 600; }
.pz-replying { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: -2px; }
.pz-replying b { color: var(--accent); }
.pz-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--down); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 1px; }
.pz-back { margin: 0 0 10px; }
.pz-back .pz-link { font-size: 14px; }
.pz-notifs { padding: 6px 0; margin-bottom: 14px; }
.pz-notif { display: flex; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 12px 18px; font: inherit; color: var(--ink); cursor: pointer; border-bottom: 1px solid var(--line); }
.pz-notif:last-child { border-bottom: 0; }
.pz-notif:hover { background: var(--chip); }
.pz-notif.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pz-notif-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pz-notif-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.pz-notif-cmt { overflow-wrap: anywhere; }
.pz-notif-post { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 2px solid var(--line); padding-left: 8px; }

/* Header bell: notification centre (notify.js) */
.bell-btn { position: relative; }
.bell-badge { position: absolute; top: -4px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--down); color: #fff; font: 700 10.5px/17px var(--sans, inherit); text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.nc-panel { position: fixed; z-index: 30; width: min(400px, calc(100vw - 16px)); max-height: min(560px, calc(100vh - 80px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.25); overflow: hidden; }
.nc-panel[hidden] { display: none; }
.nc-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 6px; }
.nc-head b { font-size: 15px; }
.nc-tabs { display: flex; gap: 4px; padding: 4px 10px 8px; border-bottom: 1px solid var(--line); }
.nc-tabs button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; }
.nc-tabs button.on { background: var(--chip); color: var(--ink); font-weight: 600; }
.nc-list { overflow-y: auto; flex: 1; }
.nc-item { display: flex; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 10px 16px; font: inherit; color: var(--ink); cursor: pointer; border-bottom: 1px solid var(--line); }
.nc-item:hover { background: var(--chip); }
.nc-item.unread { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.nc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 13.5px; }
.nc-line { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.nc-line .muted { margin-left: auto; }
.nc-quote { overflow-wrap: anywhere; }
.nc-post { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-ico { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; color: #fff; }
.nc-ico.up { background: var(--up); }
.nc-ico.down { background: var(--down); }
.nc-empty { padding: 24px 16px; text-align: center; margin: 0; }
.nc-empty p { margin: 0 0 10px; }
.nc-all { display: block; text-align: center; padding: 10px; font-size: 13px; color: var(--accent); }
.nc-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* 廣場: member pages, private messages */
.pz-av-link { display: inline-flex; flex: none; text-decoration: none; }
a.pz-name { color: inherit; font-weight: 700; text-decoration: none; }
a.pz-name:hover { text-decoration: underline; }
.pz-time { text-decoration: none; }
.pz-time:hover { text-decoration: underline; }
.pz-av.lg { width: 76px; height: 76px; font-size: 30px; }
.pz-dm-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.pz-profile-acts .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.pz-profile { margin-bottom: 16px; }
.pz-profile-top { display: flex; align-items: center; gap: 16px; }
.pz-profile-name h1 { margin: 0 0 6px; font-size: 22px; display: flex; align-items: center; gap: 8px; }
.pz-profile-name .pill { margin-right: 6px; }
.pz-stats { display: flex; gap: 18px; margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.pz-stats b { color: var(--ink); margin-right: 3px; }
.pz-stat { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.pz-stat:hover { color: var(--accent); }
.pz-menu-wrap { position: relative; }
.pz-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 120px; }
.pz-menu button { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 8px 12px; font: inherit; color: var(--down); cursor: pointer; border-radius: 6px; }
.pz-menu button:hover { background: var(--chip); }
.pz-people { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.pz-people-head { display: flex; justify-content: space-between; align-items: center; }
.pz-person { display: flex; align-items: center; gap: 10px; padding: 4px 0; color: inherit; text-decoration: none; }
.pz-person:hover span { text-decoration: underline; }
.pz-sub { font-size: 15px; margin: 4px 0 10px; }
.pz-inbox { padding: 4px 0; }
.pz-conv { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.pz-conv:last-child { border-bottom: 0; }
.pz-conv:hover { background: var(--chip); }
.pz-conv.unread { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pz-conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pz-conv-top { display: flex; align-items: center; gap: 8px; }
.pz-conv-top .muted { margin-left: auto; }
.pz-conv-last { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.pz-empty-in { padding: 20px; text-align: center; }
.pz-thread { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pz-thread-head { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.pz-thread-who { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.pz-thread-who:hover b { text-decoration: underline; }
.pz-safe { margin: 0; padding: 8px 18px; font-size: 12.5px; color: var(--muted); background: color-mix(in srgb, var(--accent) 7%, transparent); border-bottom: 1px solid var(--line); }
.pz-msgs { height: min(56vh, 520px); overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.pz-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; max-width: 78%; }
.pz-msg.mine { align-self: flex-end; align-items: flex-end; }
.pz-bubble { padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--chip); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.pz-msg.mine .pz-bubble { border-radius: 16px 16px 4px 16px; background: var(--accent); color: #1a1205; }
.pz-day { align-self: center; margin: 6px 0; }
.pz-dm-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px; border-top: 1px solid var(--line); }
.pz-dm-form textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 18px; padding: 9px 14px; font: inherit; color: var(--ink); background: var(--surface-2); max-height: 140px; }
.pz-dm-form textarea:focus { outline: none; border-color: var(--accent); }
.pz-dm-form .btn { margin: 0; }
.pz-thread > .acct-note, .pz-thread > p.muted { margin: 8px 18px; }
/* Footer links jump to sections; keep them clear of the sticky header. */
#groups, #f-research, #f-news, #f-signals, #f-follow, #f-scoring, #f-academy, #sizing, #calc, #sessions { scroll-margin-top: 72px; }

/* Chat dock (chat.js): private messages in the bottom-right corner */
.chat-dock { position: fixed; right: 20px; bottom: 20px; z-index: 25; display: flex; align-items: flex-end; gap: 12px; flex-direction: row-reverse; pointer-events: none; }
.chat-dock[hidden] { display: none; }
.chat-dock > * { pointer-events: auto; }
.chat-launch { position: relative; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #1a1205; background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 6px 20px rgba(0,0,0,.28); flex: none; }
.chat-launch:hover { filter: brightness(1.05); }
.chat-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--down); color: #fff; font: 700 11px/20px var(--sans, inherit); text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.chat-badge[hidden] { display: none; }
.chat-list { position: absolute; right: 0; bottom: 66px; width: 340px; max-height: min(480px, calc(100vh - 140px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden; }
.chat-list[hidden] { display: none; }
.chat-list-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-list-head b { font-size: 16px; }
.chat-list-body { overflow-y: auto; }
.chat-conv { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.chat-conv:hover { background: var(--chip); }
.chat-conv.unread .chat-conv-top b, .chat-conv.unread .chat-conv-last { font-weight: 700; color: var(--ink); }
.chat-conv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-conv-top { display: flex; align-items: center; gap: 8px; }
.chat-conv-top .muted { margin-left: auto; }
.chat-conv-last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-empty { padding: 18px 16px; text-align: center; margin: 0; }
.chat-wins { display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 12px; }
.chat-win { width: 330px; height: 440px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 10px 10px; box-shadow: 0 12px 40px rgba(0,0,0,.28); overflow: hidden; }
.chat-win.min { height: auto; width: 240px; }
.chat-win.min .chat-win-main { display: none; }
.chat-win-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; background: var(--surface-2); }
.chat-win.min .chat-win-head { border-bottom: 0; }
.chat-who { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.chat-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-who:hover b { text-decoration: underline; }
/* Group chats (chat.js) */
button.chat-who { border: 0; background: none; padding: 0; font: inherit; cursor: pointer; text-align: left; }
.chat-list-acts { display: flex; align-items: center; gap: 12px; }
.chat-list-acts .pz-link { display: inline-flex; align-items: center; gap: 4px; }
.pz-av.pz-av-group { background: linear-gradient(135deg, #5b7cfa, #3aa0c8); }
.pz-av.pz-av-group svg { width: 55%; height: 55%; }
.pz-sys { align-self: center; text-align: center; max-width: 90%; padding: 3px 10px; border-radius: 10px; background: var(--chip); font-size: 12px; }
.pz-msg-from { color: var(--muted); padding-left: 4px; }
.chat-create { display: flex; flex-direction: column; min-height: 0; }
.chat-create-body { padding: 12px 16px; }
.chat-pick { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; margin: 4px 0 10px; }
.chat-pick-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.chat-pick-row:hover { background: var(--chip); }
.chat-pick-row input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.chat-members .chat-rename { margin-bottom: 10px; }
.chat-mlist { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.chat-mrow { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.chat-mname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-win-tools { margin-left: auto; display: flex; gap: 2px; flex: none; }
.chat-tool { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.chat-tool:hover { background: var(--chip); color: var(--ink); }
.chat-tool.chat-tool-ask { width: auto; padding: 0 9px; border-radius: 14px; font-size: 12px; color: #fff; background: var(--down); white-space: nowrap; }
.pz-thread-head .pz-clear { margin-left: auto; }
.chat-win-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-safe { margin: 0; padding: 6px 12px; font-size: 11.5px; line-height: 1.45; color: var(--muted); background: color-mix(in srgb, var(--accent) 7%, transparent); border-bottom: 1px solid var(--line); }
.chat-safe[hidden] { display: none; }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-msgs .pz-msg { max-width: 85%; }
.chat-msgs .pz-bubble { font-size: 14px; padding: 7px 11px; }
.chat-note { margin: 0; padding: 4px 12px; font-size: 12.5px; color: var(--down); }
.chat-note[hidden] { display: none; }
.chat-note.ok { color: var(--muted); }
.chat-form { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: 18px; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2); max-height: 110px; }
.chat-form textarea:focus { outline: none; border-color: var(--accent); }
.chat-send { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--accent); cursor: pointer; }
.chat-send:hover { background: var(--chip); }
.chat-foot-note { margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-paybtn { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: none; color: var(--muted); cursor: pointer; }
.chat-paybtn:hover { background: var(--chip); color: var(--accent); }
/* Pictures in private messages (chat.js / plaza.js): a thumbnail that opens full size. */
.chat-imgbtn { width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.chat-imgbtn:hover { background: var(--chip); color: var(--accent); }
.pz-imgbtn { width: 40px; height: 40px; }
.pz-bubble.pz-bubble-img { padding: 0; border: 0; background: none; line-height: 0; overflow: hidden; border-radius: 14px; cursor: zoom-in; display: block; }
.pz-msg.mine .pz-bubble.pz-bubble-img { background: none; border-radius: 14px; }
.chat-msgs .pz-bubble.pz-bubble-img { padding: 0; }
.pz-bubble-img img { display: block; width: 240px; max-width: 62vw; height: auto; max-height: 320px; object-fit: cover; background: var(--chip); border-radius: 14px; }
.chat-msgs .pz-bubble-img img { width: 200px; max-height: 260px; }
.pz-msg-sending .pz-bubble-img { cursor: default; }
.pz-msg-sending img { opacity: .55; }
.chat-pay { border-top: 1px solid var(--line); padding: 10px 12px; max-height: 62%; overflow-y: auto; }
.chat-pay[hidden] { display: none; }
.chat-pay p { margin: 6px 0; }
.chat-pay-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.chat-pay-wallets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.chat-pay-w { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 12.5px; }
.chat-pay-w input { position: absolute; opacity: 0; pointer-events: none; }
.chat-pay-w b { font-size: 14px; font-variant-numeric: tabular-nums; }
.chat-pay-w.on { border-color: var(--accent); background: var(--chip); }
.chat-pay-w:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-pay-row { display: flex; flex-direction: column; gap: 3px; margin-bottom: 7px; font-size: 12.5px; color: var(--muted); }
.chat-pay-row input { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; min-width: 0; }
.chat-pay-row input:focus { outline: none; border-color: var(--accent); }
.chat-pay-inline { display: flex; gap: 6px; }
.chat-pay-inline input { flex: 1; }
.chat-pay-err { color: var(--down); }
.chat-pay-acts { display: flex; justify-content: flex-end; gap: 6px; }
.pz-bubble.pz-xfer { display: flex; flex-direction: column; gap: 1px; min-width: 150px; border: 1px solid var(--accent); background: var(--surface-2); color: var(--ink); white-space: normal; }
.pz-msg.mine .pz-bubble.pz-xfer { background: var(--surface-2); color: var(--ink); }
.pz-xfer-top, .pz-xfer-w { font-size: 12px; color: var(--muted); }
.pz-xfer b { font-size: 18px; color: var(--accent); font-variant-numeric: tabular-nums; }
.pz-xfer-note { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.pz-xfer-st { margin-top: 6px; font-size: 12px; color: var(--muted); }
.pz-xfer-st.up { color: var(--up); }
.pz-xfer-acts { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }
.pz-xfer-returned b, .pz-xfer-expired b { color: var(--muted); text-decoration: line-through; }
.btn.pz-danger { color: var(--down); border-color: var(--down); }
/* Below 900 px the tab bar sits at the bottom: keep the dock above it. On phones a chat fills the screen. */
@media (max-width: 900px) { .chat-dock { bottom: calc(76px + env(safe-area-inset-bottom)); right: 14px; } }
@media (max-width: 640px) {
  .chat-launch { width: 50px; height: 50px; }
  .chat-list { position: fixed; left: 8px; right: 8px; width: auto; bottom: calc(140px + env(safe-area-inset-bottom)); }
  /* The huge shadow paints the chat's own background all round it, so whatever the keyboard leaves
     uncovered (iPhone's see-through bar above the keyboard, a gap while it slides) shows the chat, not the page behind. */
  .chat-win:not(.min) { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; z-index: 40; box-shadow: 0 0 0 100vmax var(--surface); }
  .chat-win.min { width: 200px; }
  html.chat-full, html.chat-full body { overflow: hidden; overscroll-behavior: none; background: var(--surface); }
  /* iPhone draws the page itself in the strip around the keyboard, where no fixed layer reaches:
     hide the page (it keeps its place) so only the plain background can show there. */
  /* …but not the picture viewer, which opens over the chat (a dialog appended to body). */
  html.chat-full body > *:not(#chat-dock):not(dialog[open]) { visibility: hidden; }
  html.chat-full .chat-backdrop { display: block; position: fixed; left: 0; right: 0; top: -100vh; bottom: -100vh; background: var(--surface); z-index: 39; pointer-events: auto; touch-action: none; }
}
.chat-backdrop { display: none; }
.foot-contact { margin-top: 10px !important; display: flex; gap: 10px; flex-wrap: wrap; }
.foot-contact a, .legal-contact a { color: var(--accent); text-decoration: none; }
.foot-contact a:hover, .legal-contact a:hover { text-decoration: underline; }
.legal .legal-contact { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.nc-foot { flex-wrap: wrap; }
.nc-try { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.nc-try .pz-link { font-size: 12px; }
.nc-push-tip { flex-basis: 100%; line-height: 1.5; }

/* ---- 北辰廣場 layout (2026-11-23): feed + side column; member page with a cover ---- */
.plaza-page[data-mode="feed"] { max-width: 1040px; }
.plaza-page { --pz-cover: linear-gradient(120deg, #1b2440 0%, #2a2350 55%, color-mix(in srgb, var(--accent) 45%, #2a2350) 100%); }
.pz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.pz-main { min-width: 0; }
.pz-side { position: sticky; top: 126px; display: flex; flex-direction: column; gap: 12px; } /* below the header and the sticky tab bar */
.pz-side .card { margin: 0; }
@media (max-width: 900px) {
  .pz-layout { grid-template-columns: minmax(0, 1fr); }
  .pz-side { position: static; }
  .pz-side-me { display: none !important; }
}
.pz-head { display: block; margin: 6px 0 16px; }
.pz-head h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: .02em; }
.pz-head p { margin: 0; font-size: 14px; }
.pz-sortbar { margin: 0 -10px 16px; padding: 6px 10px 0; border-bottom: 1px solid var(--line);
  /* like X: the tab bar stays under the site header while the posts scroll */
  position: sticky; top: 53px; z-index: 4;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); }
.pz-sort { gap: 4px; }
.pz-sortbar .pz-dm-btn { padding: 6px 12px; }

/* posts */
.pz-feed { gap: 12px; }
.pz-post { padding: 16px 20px 6px; }
.pz-post > .pz-meta .pz-who { flex-direction: column; align-items: flex-start; gap: 0; }
.pz-post > .pz-meta .pz-time { font-size: 12px; }
.pz-post .pz-text { margin-top: 10px; font-size: 15px; line-height: 1.7; }
.pz-post .pz-imgs { margin-top: 12px; max-width: 520px; }
/* one picture: shown whole at its own shape, never cropped */
.pz-imgs-1 { display: block; overflow: visible; border-radius: 0; }
.pz-imgs-1 .pz-img { max-height: none; background: none; width: 100%; }
.pz-imgs-1 .pz-img img { width: auto; height: auto; max-width: 100%; max-height: 440px; object-fit: contain; background: none; border-radius: 12px; }
.pz-acts { gap: 4px; margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.pz-act { margin-left: 0; padding: 6px 10px; }
.pz-act:first-child { margin-left: -10px; }

/* side column */
.pz-side-me { padding: 16px 18px 6px; }
.pz-side-id { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.pz-side-id > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pz-side-id b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pz-side-id:hover b { text-decoration: underline; }
.pz-av.md { width: 48px; height: 48px; font-size: 19px; }
.pz-side-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; border-top: 1px solid var(--line); }
.pz-side-stats a { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 10px 0 8px; color: var(--muted); font-size: 12px; text-decoration: none; }
.pz-side-stats a + a { border-left: 1px solid var(--line); }
.pz-side-stats b { color: var(--ink); font-size: 17px; }
.pz-side-stats a:hover span { color: var(--accent); }
.pz-side-rules { padding: 16px 18px; }
.pz-side-rules h2 { font-size: 14px; margin-bottom: 12px; }
.pz-side-rules ol { margin: 0; padding: 0; list-style: none; counter-reset: rule; display: grid; gap: 10px; }
.pz-side-rules li { counter-increment: rule; display: flex; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.pz-side-rules li::before { content: counter(rule); flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); margin-top: 1px; }

/* member page */
.pz-profile { padding: 0; margin-bottom: 18px; }
.pz-cover { height: 110px; border-radius: 14px 14px 0 0; background: var(--pz-cover); position: relative; }
/* Member's own banner (1500x300 picture); edit buttons sit in its top-right corner. */
.pz-cover.has-img { background-size: cover; background-position: center; height: 150px; }
.pz-cover-acts { position: absolute; top: 10px; right: 12px; display: flex; gap: 6px; }
.pz-cover-btn { display: inline-flex; align-items: center; gap: 5px; margin: 0; background: rgba(10, 12, 20, .55); color: #fff; border-color: rgba(255, 255, 255, .25); backdrop-filter: blur(6px); cursor: pointer; }
.pz-cover-btn:hover { background: rgba(10, 12, 20, .75); }
.pz-crop { width: min(680px, 94vw); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); padding: 18px; }
.pz-crop::backdrop { background: rgba(0, 0, 0, .6); }
.pz-crop h3 { margin: 0 0 4px; }
.pz-crop-frame { position: relative; width: 100%; aspect-ratio: 5 / 1; overflow: hidden; border-radius: 10px; background: #111; cursor: grab; touch-action: none; margin: 12px 0; }
.pz-crop-frame:active { cursor: grabbing; }
.pz-crop-frame img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; pointer-events: none; }
.pz-crop-zoom { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pz-crop-zoom input { flex: 1; }
.pz-crop-acts { justify-content: flex-end; margin-top: 14px; }
.pz-profile-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 22px; margin-top: -40px; }
.pz-av.xl { width: 88px; height: 88px; font-size: 34px; box-shadow: 0 0 0 4px var(--surface); }
.pz-profile-acts { margin: 0; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pz-profile-name { padding: 12px 22px 0; }
.pz-profile .pz-av { position: relative; z-index: 1; } /* the cover is positioned, so lift the avatar above it */
.pz-bio { margin: 10px 0 0; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; font-size: 14.5px; }
.pz-bio-empty a { color: var(--muted); font-size: 13px; text-decoration: none; }
.pz-bio-empty a:hover { color: var(--accent); }
.acct-bio { grid-column: 1 / -1; margin-top: 4px; }
.acct-bio textarea { width: 100%; resize: vertical; min-height: 72px; font: inherit; }
.pz-profile-name h1 { margin: 0; font-size: 22px; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.pz-profile-tags { display: flex; gap: 6px; margin-top: 6px; }
.pz-profile-tags:empty { display: none; }
.pz-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 16px 22px 0; padding: 0 0 16px; border-top: 1px solid var(--line); }
.pz-stats .pz-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 0 0; border: 0; background: none; font: inherit; color: var(--muted); font-size: 13px; }
.pz-stats .pz-stat + .pz-stat { border-left: 1px solid var(--line); }
.pz-stats .pz-stat b { color: var(--ink); font-size: 19px; font-weight: 700; margin: 0; }
.pz-stats button.pz-stat { cursor: pointer; }
.pz-stats button.pz-stat:hover span, .pz-stats .pz-stat.on span { color: var(--accent); }
.pz-profile > .muted.small, .pz-profile > .acct-note { margin: 0 22px 16px; }
.pz-profile .pz-people { margin: 0 22px; padding: 12px 0 16px; }
.pz-sub { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 12px; }
.pz-sub-n { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
@media (max-width: 560px) {
  .pz-cover { height: 90px; }
  .pz-cover.has-img { height: 110px; }
  /* phones: avatar, name, then the buttons in their own row */
  .pz-profile { display: flex; flex-direction: column; }
  .pz-profile-top { display: contents; }
  .pz-profile > .pz-cover { order: 0; }
  .pz-profile-top > .pz-av { order: 1; margin: -34px 0 0 16px; }
  .pz-profile > .pz-profile-name { order: 2; }
  .pz-profile-top > .pz-profile-acts { order: 3; justify-content: flex-start; padding: 12px 16px 0; }
  .pz-profile > :not(.pz-cover):not(.pz-profile-top):not(.pz-profile-name) { order: 4; }
  .pz-av.xl { width: 72px; height: 72px; font-size: 28px; }
  .pz-profile-acts .btn { padding: 6px 12px; }
  .pz-profile-name { padding: 10px 16px 0; }
  .pz-stats { margin: 14px 16px 0; }
  .pz-profile > .muted.small, .pz-profile > .acct-note, .pz-profile .pz-people { margin-left: 16px; margin-right: 16px; }
}

/* ---- 北辰學院 -------------------------------------------------------------------------- */
.ac-hero p { margin-bottom: 10px; }
.ac-progress { display: flex; align-items: center; gap: 12px; }
.ac-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ac-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.ac-part { margin: 18px 0 4px; font-size: 13px; letter-spacing: .04em; color: var(--muted); }
.ac-part:first-child { margin-top: 0; }
.lesson > summary { padding: 4px 0; }
.lesson.is-done > summary::after { content: ' ✓'; color: var(--up); }
.lesson .ac-done { margin: 6px 0 8px; }
.ac-tip { border-left: 3px solid var(--accent); padding-left: 10px; }
.ac-table td, .ac-table th, .moves-table td, .moves-table th { white-space: nowrap; }
.move-x.hot { color: var(--down); font-weight: 600; }
.move-cell span { display: inline-block; margin-left: 8px; }
.move-cell span:first-child { margin-left: 0; }
.quiz-q { border-top: 1px solid var(--line); padding: 10px 0; }
.quiz-q p { margin: 0 0 8px; }
.quiz-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.quiz-opt.quiz-right { border-color: var(--up); color: var(--up); }
.quiz-opt.quiz-wrong { border-color: var(--down); color: var(--down); }
.quiz-opt:disabled { cursor: default; opacity: 1; }
.quiz-why { margin-top: 8px !important; color: var(--muted); }
.quiz-score { font-weight: 600; border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 900px) { .tabbar { grid-template-columns: repeat(7, minmax(0, 1fr)) !important; } }
/* seven tabs on phones: the English "Performance" is too wide for its column */
@media (max-width: 900px) {
  html[lang="en"] .tabbar a { font-size: 11px; letter-spacing: -0.02em; }
  html[lang="en"] .tabbar a[data-nav="performance"] { font-size: 0; }
  html[lang="en"] .tabbar a[data-nav="performance"]::after { content: 'Results'; font-size: 11px; }
}
@media (max-width: 900px) { html[lang="ja"] .tabbar a { font-size: 10px; letter-spacing: -0.04em; } }

/* ---- research figures (figures.js) ------------------------------------------------------ */
.fig-grid { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 8px; max-width: 900px; }
@media (max-width: 900px) { .fig-grid { grid-template-columns: 1fr; } }
.fig { width: 100%; height: auto; display: block; }
.fig-t { font-size: 11px; font-family: var(--mono, ui-monospace, monospace); }
.fig-name { font-family: inherit; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.fig-tag { font-size: 10.5px; font-weight: 600; font-family: var(--mono, ui-monospace, monospace); }
.fig-legend { margin-top: 4px; }
.fig-sketch { max-width: 360px; }
.fig-sketches { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0; }
.fig-sketches figure { margin: 0; }
.fig-sketches figcaption { font-size: 13px; color: var(--muted); text-align: center; }
.ac-fig { margin: 10px 0; max-width: 760px; }
.ac-fig .fig-sketch { background: var(--surface-2); border-radius: 8px; }

/* Exchange picker in the auto-trading form (2026-11-26) */
.acct-ex { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.acct-ex-opt { position: relative; margin-top: 0; cursor: pointer; }
.acct-ex-opt input { position: absolute; opacity: 0; pointer-events: none; }
.acct-ex-opt:has(input:checked) { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #1a1205; border-color: transparent; font-weight: 600; }
.acct-ex-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.bill-table tr.acct-row-cur td { background: color-mix(in srgb, var(--accent, #e8a33d) 10%, transparent); }

/* iPhone Safari zooms the whole page in when a text box, text area or menu with text under 16px
   gets focus (the chat then looks cut off on both sides). On touch screens every field is 16px. */
@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select { font-size: 16px !important; }
  .lang-select { max-width: 108px !important; padding: 0 2px 0 6px !important; }
}

/* Tables fit a phone without sideways scrolling where they can (after the .bill-table rules). */
@media (max-width: 640px) {
  .bill-table { font-size: 12px; }
  .bill-table td, .bill-table th { padding: 6px 5px; }
  .bill-table th { white-space: normal; vertical-align: bottom; }
}
/* Voice calls (public/call.js): the panel at the top of the screen, and call records in a chat. */
.call-box { position: fixed; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); margin: 0; z-index: 60; width: min(360px, calc(100vw - 24px)); padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.call-who { display: flex; align-items: center; gap: 12px; }
.call-who > div { display: flex; flex-direction: column; min-width: 0; }
.call-who b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-st { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.call-av { width: 44px; height: 44px; font-size: 18px; flex: none; }
.call-acts { display: flex; justify-content: center; gap: 28px; margin-top: 14px; }
.call-acts:empty { display: none; }
.call-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; color: var(--ink); font-size: 12px; cursor: pointer; padding: 0; }
.call-btn svg { box-sizing: content-box; padding: 13px; border-radius: 50%; background: var(--chip); }
.call-btn.call-red svg { background: #e5484d; color: #fff; }
.call-btn.call-green svg { background: #30a46c; color: #fff; }
.call-btn.call-on svg { background: var(--ink); color: var(--surface); }
.pz-bubble.pz-call { display: inline-flex; align-items: center; gap: 6px; }
.pz-bubble.pz-call-missed { color: #e5484d; }
.pz-msg.mine .pz-bubble.pz-call-missed { color: inherit; }
.pz-thread-head .pz-call-btn { margin-left: auto; }
.pz-thread-head .pz-call-btn + .pz-clear { margin-left: 8px; }

.foot-ver { color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* 自動交易申請：交易方案卡片 (account.js tradeForm) */
.acct-ip-note { margin: -4px 0 14px; }
.acct-plans { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 6px; }
.acct-plan { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; }
.acct-plan:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.acct-plan input { position: absolute; opacity: 0; pointer-events: none; }
.acct-plan:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.acct-plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.acct-plan-name { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.acct-plan-name::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); box-sizing: border-box; flex: none; }
.acct-plan:has(input:checked) .acct-plan-name::before { border: 5px solid var(--accent); }
.acct-plan-facts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.acct-plan-facts li { display: flex; flex-direction: column; gap: 2px; }
.acct-plan-facts span { font-size: 12px; color: var(--muted); }
.acct-plan-facts b { font-size: 15px; font-variant-numeric: tabular-nums; }
.acct-plan-note { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.acct-plan-warn { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--down); }
.acct-plan-common { list-style: none; margin: 12px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); display: grid; gap: 6px; font-size: 13.5px; line-height: 1.6; }
.acct-plan-common b { display: inline-block; min-width: 5.5em; margin-right: 8px; color: var(--muted); font-weight: 500; }
@media (max-width: 640px) { .acct-plans { grid-template-columns: minmax(0, 1fr); } }

/* 下載北辰 App：頂欄按鈕與頁尾 QR（2026-11-28） */
.dl-top { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); white-space: nowrap; }
.dl-top:hover { filter: brightness(1.05); }
@media (max-width: 900px) { .dl-top span { display: none; } .dl-top { padding: 7px; } }
.foot-app { display: inline-flex; align-items: center; gap: 12px; margin: 6px 0 12px; padding: 10px 14px 10px 10px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: inherit; background: var(--surface); }
.foot-app img { background: #fff; border-radius: 8px; padding: 4px; }
.foot-app span { display: flex; flex-direction: column; gap: 3px; }
.foot-app small { color: var(--muted); font-size: 12px; }

/* Header fit (2026-11-28): the logo is "Polaris" in every language; the menu never spills over it
   (it scrolls sideways as a last resort). The download button is icon-only in the bar, and the
   session tag, the "UTC+8" label and the account name give way first when space runs short. */
.brand-name { letter-spacing: .02em; }
.nav { justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 10px; }
.top-tools { gap: 8px; }
.top .dl-top span { display: none; }
.top .dl-top { padding: 7px; }
.top-tools #session, .top-tools .clock > .muted { display: none; }
@media (max-width: 1100px) { .acct-btn .acct-label { display: none; } .acct-btn { padding: 0; width: 34px; justify-content: center; } }
@media (max-width: 1000px) { .top-tools .clock { display: none; } }
