:root {
  /* bloomberg.com Design System tokens (light editorial finance) */
  --bg-main: #ffffff;
  --bg-surface: #f7f7f7;
  --bg-pill: #000000;
  --border-line: #e0e0e0;
  --border-subtle: #f2f2f2;

  /* 文字系统 */
  --text-main: #000000;
  --text-muted: #6b6b6b;
  --text-body: #333333;
  --text-inverse: #ffffff;

  /* 金融信号色 */
  --color-up: #338736;
  --color-down: #e51503;
  --color-tag: #fb8b1e;
  --color-accent: #fb8b1e;

  /* 兼容旧变量名 */
  --bg: var(--bg-main);
  --panel: var(--bg-surface);
  --line: var(--border-line);
  --grid: var(--border-subtle);
  --neon: var(--color-up);
  --red: var(--color-down);
  --warn: #ffb800;
  --cyan: var(--color-accent);
  --text: var(--text-main);
  --muted: var(--text-muted);
  --radius: 4px;
  --font: "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "BWHaasMono", "JetBrains Mono", "Roboto Mono", "SF Mono", Consolas, monospace;

  /* Global stacking: cards < sticky/ticker/nav < modal */
  --z-base: 1;
  --z-card: 1;
  --z-ticker: 100;
  --z-nav: 100;
  --z-sticky: 110;
  --z-hint: 200;
  --z-modal: 2000;
  --z-drawer: 2100;
}

/* Sticky header+ticker stack: chrome is the only sticky unit */
.site-sticky-chrome {
  position: sticky;
  top: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: var(--bg-main, #ffffff);
}
body.has-bb-util .site-sticky-chrome {
  top: 28px;
}
.site-sticky-chrome .topbar {
  position: relative !important;
  top: auto !important;
  z-index: 2;
  flex-shrink: 0;
  overflow: hidden;
}
.site-sticky-chrome .ticker-bar {
  position: relative !important;
  top: auto !important;
  z-index: 2;
  flex-shrink: 0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  min-height: 100%;
  min-height: 100dvh;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}
body {
  display: flex;
  flex-direction: column;
}
/* Legacy drawer mask — disabled; mobile menu uses .topbar > #navDrawerBackdrop */
body::before,
body.nav-drawer-open::before {
  content: none !important;
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  background: none !important;
}
.wrap {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  display: block; /* block avoids sticky topbar overlapping following siblings in a flex column */
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  padding: 16px 16px 88px;
}
.wrap.wide { max-width: 80rem; }
.editorial-light .wrap.wide { max-width: 100%; padding-left: 16px; padding-right: 16px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  background: var(--bg-main);
  border: 0;
  border-bottom: 1px solid var(--border-line);
  border-radius: 4px;
  position: relative; top: auto; z-index: 120;
  min-height: 56px;
  height: auto !important;
  max-height: none !important;
  line-height: normal !important;
  overflow: visible !important;
}
.nav-toggle { order: 1; }
.brand { order: 2; display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; max-width: min(320px, 44vw); overflow: hidden; }
.nav-actions {
  order: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin-left: 0;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #333333;
  min-height: 36px;
  height: auto !important;
  max-height: none !important;
  line-height: normal !important;
  overflow: visible !important;
  position: relative;
  z-index: 2;
  min-width: 0;
}
.nav-actions .lang-pills { margin-left: auto; }
.nav-end {
  order: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}
.logo {
  width: 22px; height: 22px; border-radius: 50%;
  background: #000000 url("./favicon.svg") center / 100% 100% no-repeat;
  box-shadow: 0 0 0 1px #ffffff; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 0; min-width: 0; overflow: hidden; max-width: 100%; }
.brand h1 {
  font-size: 24px; letter-spacing: 0.08em; color: var(--text-main);
  font-weight: 900; line-height: 1; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand span { display: block; font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; margin-top: 2px; }
.site-slogan {
  margin: 0;
  text-align: left;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 400;
}
.auth-dock { display: flex; align-items: center; min-width: 0; }
.auth-btn {
  font-family: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px;
  color: #000000; background: #ffffff;
  border: 1px solid #000000; border-radius: 4px;
  padding: 6px 10px 6px 12px;
  box-shadow: none;
  transition: transform 0.05s ease, filter 0.05s ease, border-color 0.15s ease;
}
.lang-switch { display: flex; border: 1px solid var(--border-line); }
.lang-switch button {
  font-family: inherit; font-size: 11px; color: var(--text-muted);
  background: 0; border: 0; padding: 8px 10px; cursor: pointer;
}
.lang-switch button.active { color: var(--text-inverse); background: var(--bg-pill); }

.nav-link {
  font-family: inherit;
  font-size: 12px !important;
  color: var(--text-main);
  background: 0;
  border: 0;
  text-decoration: none;
  cursor: pointer;
  padding: 8px 6px;
  font-weight: 600;
  line-height: 1.35 !important;
  min-height: 32px;
  height: auto !important;
  max-height: none !important;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  overflow: visible !important;
  opacity: 1 !important;
  visibility: visible !important;
}
.nav-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.micro-tag {
  font-size: 10px; color: var(--color-tag); border: 1px solid var(--color-tag);
  border-radius: 4px; padding: 3px 8px;
}
.btn, .btn-cta, .action-btn {
  font-family: inherit; cursor: pointer; font-size: 12px; letter-spacing: 0.04em;
  padding: 10px 14px; border: 1px solid var(--border-line); color: var(--text-main);
  background: var(--bg-main);
  border-radius: var(--radius);
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, filter 0.05s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.btn-cta.pulse { animation: none; }
.btn-cta.lg, .btn.lg { padding: 14px 18px; font-size: 14px; }
@keyframes ctaPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}
.btn:hover { background: var(--bg-surface); }
button:active, .action-btn:active, .btn:active, .btn-cta:active, .ai-chip:active,
.term-tab:active, .seg-btn:active, .auth-btn:active, .nav-toggle:active, .btn-back-list:active,
.lang-pills button:active, .strat-tab:active, a.btn-cta:active, a.btn:active {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.9);
  transition: transform 0.05s ease;
}
.btn.cyan { color: var(--text-main); border-color: var(--border-line); }
.btn.amber { color: var(--warn); border-color: var(--warn); }
.btn.ghost { background: transparent; color: var(--text-muted); }
.btn-cta, .btn-cta {
  color: var(--text-inverse); background: var(--bg-pill); border-color: var(--bg-pill);
  box-shadow: none;
}
.btn-cta:hover, .btn-cta:hover { background: #000; }
.btn-cta.compact, .btn-cta.compact { padding: 12px 14px; }

.desk {
  margin-top: 16px;
  background: transparent;
  border: 0;
  padding: 8px 0;
}
.desk-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.kicker {
  color: var(--text-main); font-size: 10px; letter-spacing: 0.28em;
  font-weight: 800; text-transform: uppercase;
}
.kicker.kicker-plain,
.kicker[data-i18n] { text-transform: none; letter-spacing: 0.14em; }
.h2 { font-size: 22px; font-weight: 800; margin: 6px 0 8px; letter-spacing: -0.02em; }
.muted { color: var(--text-muted); font-size: 12px; line-height: 1.65; }
.desk-ctrls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.seg, .strat-tabs { display: flex; flex-wrap: wrap; border: 1px solid var(--border-line); }
.seg-btn, .strat-tab {
  font-family: inherit; font-size: 11px; color: var(--text-muted);
  background: 0; border: 0; padding: 8px 12px; cursor: pointer; font-weight: 700;
}
.seg-btn.active, .strat-tab.active { color: var(--text-inverse); background: var(--bg-pill); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.metrics.four { grid-template-columns: repeat(4, 1fr); }
.strat-tab.locked { opacity: 0.42; cursor: pointer; color: var(--text-muted); }
.nav-pages { display: flex; gap: 6px; }
.metric { border: 1px solid var(--border-line); background: var(--bg-surface); padding: 12px 14px; }
.metric span { font-size: 10px; color: var(--text-muted); letter-spacing: 0.14em; }
.metric b { display: block; margin-top: 6px; font-size: 22px; color: var(--text-main); font-variant-numeric: tabular-nums; }
.metric b.up { color: var(--color-up); }
@media (max-width: 900px) {
  .metrics, .metrics.four { grid-template-columns: 1fr 1fr; }
  .desk-ctrls { align-items: stretch; }
}
@media (max-width: 520px) { .metrics, .metrics.four { grid-template-columns: 1fr; } }

.chart-shell {
  position: relative; height: 440px; border: 1px solid var(--border-line); background: var(--bg-main);
}
.chart-shell.live { height: 62vh; min-height: 480px; }
.tv-chart { width: 100%; height: 100%; }
.feed-status {
  font-size: 12px; letter-spacing: 0.04em; font-weight: 700;
  border-radius: 4px; padding: 4px 10px; border: 1px solid var(--bg-pill);
  background: var(--bg-pill); color: var(--text-inverse);
}
.feed-status.wait { color: var(--text-muted); background: var(--bg-surface); border-color: var(--border-subtle); }
.feed-status.live { color: var(--text-inverse); background: var(--color-up); border-color: var(--color-up); }
.feed-status.warn { color: var(--text-inverse); background: var(--warn); border-color: var(--warn); }
.feed-status.err { color: var(--text-inverse); background: var(--color-down); border-color: var(--color-down); }
.lab-top {
  margin-top: 16px; height: 60vh; min-height: 420px;
  display: flex; flex-direction: column;
  border: 0; background: transparent; padding: 4px 0;
}
.lab-top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.lab-canvas { flex: 1; min-height: 320px; border: 1px solid var(--border-line); background: var(--bg-main); }
.lab-panel { margin-top: 16px; border: 0; background: transparent; padding: 8px 0; }
.lab-actions { display: flex; flex-wrap: wrap; gap: 10px; }
#kline { width: 100%; height: 100%; display: block; }
.engine-box { margin-top: 16px; display: grid; gap: 10px; }
.engine-box select {
  width: 100%; background: var(--bg-main); border: 1px solid var(--border-line);
  color: var(--text-main); padding: 10px; font-family: inherit; font-size: 13px;
}
.pine-box { border: 1px solid var(--border-line); background: var(--bg-surface); padding: 10px 12px; }
.pine-box summary { cursor: pointer; color: var(--text-main); font-size: 12px; letter-spacing: 0.08em; font-weight: 700; }
.pine-pre {
  margin-top: 10px; max-height: 280px; overflow: auto; white-space: pre;
  color: var(--text-main); font-size: 12px; line-height: 1.55;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.m-card, .strategy-card {
  position: relative;
  border: 1px solid #e2e8f0;
  background: var(--bg-main);
  padding: 16px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 4px;
  width: 100%;
  min-height: 236px;
  height: auto;
  overflow: visible;
  box-shadow: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.m-card h3 { font-size: 15px; font-weight: 800; color: var(--text-main); line-height: 1.4; min-height: 42px; }
.m-card.master { border-width: 2px; border-color: var(--border-line); background: var(--bg-surface); }
.m-card.master h3 { color: var(--text-main); padding-right: 96px; }
.m-card .muted { font-size: 11px; }
.vip-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; letter-spacing: 0.04em;
  color: #b8860b; border: 1px solid #c9a227;
  background: #fffdf5;
  border-radius: 4px; padding: 3px 8px; white-space: nowrap;
  font-weight: 700;
}
.m-card.master { border-color: #c9a227; }
.card-principle {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: #94a3b8;
  font-weight: 400;
}
.zone-head { margin: 28px 0 12px; }
.zone-head h3 { margin: 0 0 6px; font-size: 15px; letter-spacing: 0.14em; color: var(--text-main); }
.zone-head.master h3 { color: var(--text-main); }
.zone-title { margin-top: 28px; color: var(--text-main); font-size: 14px; letter-spacing: 0.08em; }
.card-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; position: static; }
.card-actions .btn-cta { width: 100%; text-align: center; position: static; }
.ghost-link {
  display: block; text-align: center; font-size: 11px; color: var(--text-muted);
  text-decoration: none; padding: 2px 0; font-weight: 700;
}
.ghost-link:hover { color: var(--text-main); text-decoration: underline; }
.code-lock { margin: 0; font-size: 11px; color: var(--text-muted); }
.stat-caps {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.stat-cap {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: 4px;
  padding: 8px 10px;
  min-height: 52px;
}
.stat-cap span { display: block; font-size: 10px; color: var(--text-muted); letter-spacing: 0.08em; }
.stat-cap b {
  display: block; margin-top: 6px; font-size: 13px; color: var(--color-up);
  font-variant-numeric: tabular-nums; line-height: 1.35; min-height: 1.35em;
}
.stat-cap b.soft { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.term-tabs {
  display: flex; gap: 8px; overflow-x: auto; white-space: nowrap;
  -webkit-overflow-scrolling: touch; margin: 16px 0 14px; padding-bottom: 4px;
  scrollbar-width: thin;
}
.term-tab {
  font-family: inherit; font-size: 12px; cursor: pointer; flex: 0 0 auto;
  color: var(--text-main); background: var(--bg-main);
  border: 1px solid var(--border-line); border-radius: 4px; padding: 8px 14px;
  font-weight: 700;
}
.term-tab.active { color: var(--text-inverse); background: var(--bg-pill); border-color: var(--bg-pill); }
.disc-foot {
  margin: 22px 0 0; text-align: center; font-size: 10px; color: var(--text-muted); line-height: 1.6;
}
.m-card.is-hidden { display: none; }
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#console select, #gate input, #console input, #console textarea {
  width: 100%; margin-top: 8px; background: var(--bg-main); color: var(--text-main);
  border: 1px solid var(--border-line); padding: 10px; font-family: inherit;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 10px; color: var(--color-tag); border: 1px solid var(--color-tag);
  padding: 3px 7px; background: var(--bg-main); font-weight: 700;
}
.chart-meta {
  position: absolute; top: 10px; left: 12px;
  font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em;
}
.home-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; justify-content: center; }
footer.site-foot {
  margin-top: auto;
  flex-shrink: 0;
  border: 1px solid var(--border-line);
  border-radius: 4px;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.7;
}
.foot-cta {
  padding: 18px 16px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-line);
  text-align: left;
}
.foot-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  border: 1px solid #000000;
  border-radius: 4px;
  background: #000000;
  color: #ffffff;
  cursor: pointer;
  margin-bottom: 10px;
}
.foot-cta-btn:hover { background: #333333; }
.foot-brand {
  padding: 18px 16px;
  background: #000000;
  color: #ffffff;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.foot-logo-mark {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #ffffff;
  margin-bottom: 12px;
}
.foot-risk-banner {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-line);
  background: var(--bg-surface);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
}
.foot-link {
  font-family: inherit;
  font-size: 11px;
  color: var(--text-main);
  background: 0;
  border: 0;
  padding: 8px 4px;
  min-height: 36px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.foot-official {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
}
.foot-official a { color: var(--text-main); text-decoration: underline; }
.foot-official .sep { display: none; }
.legal-body { white-space: pre-wrap; font-size: 12px; line-height: 1.7; margin: 12px 0 16px; max-height: 50vh; overflow: auto; }
.dash-block { border: 0; padding: 4px 0 16px; margin-bottom: 8px; background: transparent; border-bottom: 1px solid var(--border-line); }
.m-card .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 0; }
.bt-meta.stats-row, .lab-panel .stats-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 12px; }
.stat { border: 1px solid var(--border-line); padding: 8px; background: var(--bg-surface); }
.stat span { display: block; font-size: 10px; color: var(--text-muted); }
.stat b { display: block; margin-top: 4px; font-size: 13px; color: var(--text-main); }
@media (max-width: 700px) {
  .bt-meta.stats-row, .lab-panel .stats-row { grid-template-columns: 1fr; }
  .stat-caps { grid-template-columns: 1fr 1fr; }
  .market-grid { grid-template-columns: 1fr; }
  .m-card { min-height: 0; }
  .m-card h3 { min-height: 0; }
}

.lang-pills {
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border-radius: 4px;
  border: 1px solid var(--border-line);
  background: var(--bg-main);
  overflow: hidden;
  flex: 0 0 auto;
}
.lang-pills button {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  padding: 0 12px;
  min-width: 36px;
  height: 100%;
  cursor: pointer;
  outline: none;
  box-shadow: none;
  font-weight: 700;
}
.lang-pills button + button { border-left: 1px solid var(--border-line); }
.lang-pills button:hover { color: var(--text-main); }
.lang-pills button.active { color: var(--text-inverse); background: var(--bg-pill); }
.lang-pills button:focus,
.lang-pills button:focus-visible {
  outline: none;
  box-shadow: none;
}

.modal-bg {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: none; align-items: center; justify-content: center;
  z-index: var(--z-modal, 2000); padding: 20px;
}
#aiStratModal.modal-bg {
  z-index: 2100;
}
.modal-bg.show { display: flex; }
.modal {
  position: relative;
  width: min(480px, 100%); background: var(--bg-main); border: 1px solid var(--border-line); padding: 20px;
  max-height: 92vh; overflow: auto; border-radius: var(--radius);
}
.modal-x {
  position: sticky; top: 0; float: right;
  z-index: 210;
  width: 36px; height: 36px; margin: -8px -8px 8px 8px;
  border: 1px solid var(--border-line); background: var(--bg-main); color: var(--text-main);
  font-size: 22px; line-height: 32px; cursor: pointer; border-radius: var(--radius);
}
.modal.wide { width: min(560px, 100%); }
.modal.login-modal {
  padding: 20px;
  background: var(--bg-main);
  border: 2px solid var(--border-line);
  box-shadow: none;
  animation: none;
}
@keyframes loginGlow {
  0%, 100% { border-color: var(--border-line); }
  50% { border-color: var(--border-line); }
}
.login-step { margin-top: 14px; }
.login-step label {
  display: block; font-size: 11px; letter-spacing: 0.16em;
  color: var(--text-main); margin-bottom: 6px; font-weight: 800;
}
.btn-tg {
  display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px;
  background: #229ED9; color: #fff; border: 0; padding: 14px 16px;
  font-family: inherit; font-size: 13px; text-decoration: none; cursor: pointer;
  box-shadow: none; font-weight: 700;
}
#loginCode { letter-spacing: 0.28em; font-size: 18px; text-align: center; }
#loginCode:focus {
  outline: none;
  border: 2px solid #000000;
  box-shadow: none;
}
.status.err { color: var(--color-down); font-weight: 700; }
.btn-cancel {
  width: 100%; margin-top: 8px; background: transparent; border: 0;
  color: var(--text-muted); font-family: inherit; font-size: 12px; cursor: pointer;
}
.pnl.up { color: var(--color-up); }
.pnl.down { color: var(--color-down); }
.modal h3 { color: var(--text-main); margin-bottom: 8px; font-size: 16px; font-weight: 800; }
.modal h4 { margin: 16px 0 8px; font-size: 13px; color: var(--text-main); }
input, textarea, select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  background: var(--bg-main);
  border: 1px solid var(--border-line);
  color: var(--text-main);
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  caret-color: #000000;
  box-shadow: none;
  outline: none;
  transition: border-color 0.05s ease, border-width 0.05s ease;
}
input:focus, textarea:focus, select:focus,
input:focus-visible, textarea:focus-visible, select:focus-visible,
input.is-focused, textarea.is-focused, select.is-focused {
  outline: none;
  border: 2px solid #000000;
  box-shadow: none;
}
.dash-status {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--border-line); padding: 12px; margin: 12px 0; background: var(--bg-surface);
}
.dash-status .dot {
  width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--color-up);
  box-shadow: none;
}
.qr { display: block; width: 180px; height: 180px; margin: 12px auto; background: #fff; padding: 8px; border: 1px solid var(--border-line); }
.addr { word-break: break-all; font-size: 12px; color: var(--text-main); border: 1px dashed var(--border-line); padding: 10px; margin: 8px 0; }
.amount { text-align: center; font-size: 28px; color: var(--text-main); margin: 10px 0; font-weight: 800; }
.status { font-size: 12px; color: var(--text-muted); margin: 10px 0; min-height: 16px; }
.toast {
  position: fixed; right: 16px; bottom: 16px; display: none;
  border: 1px solid var(--color-up); color: var(--color-up); background: var(--bg-main); padding: 10px 14px; z-index: 80;
  border-radius: var(--radius); font-weight: 700;
}
.toast.show { display: block; }
.toast.warn { border-color: var(--warn); color: var(--warn); background: var(--bg-main); }
.toast.err { border-color: var(--color-down); color: var(--color-down); background: var(--bg-main); }

@media (max-width: 900px) {
  .nav-actions { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart-shell { height: 400px; }
}

.page-grid { display: grid; gap: 16px; margin-top: 16px; }
.panel {
  background: transparent; border: 0; padding: 8px 0 20px;
  border-bottom: 1px solid var(--border-line);
}
.panel h2 { font-size: 18px; font-weight: 800; margin: 6px 0 10px; }
.rules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rule-card { border: 1px solid var(--border-line); background: var(--bg-surface); padding: 12px; }
.rule-card b { color: var(--color-up); font-size: 18px; display: block; margin-top: 6px; }
.tree-wrap { overflow: auto; border: 1px solid var(--border-line); background: var(--bg-surface); padding: 12px; }
.tree-wrap svg { min-width: 720px; width: 100%; }
.fission-container, .table-wrapper {
  max-width: 100vw;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th, .data-table td {
  border-bottom: 1px solid var(--border-line); text-align: left; padding: 10px 8px; color: var(--text-main);
}
.data-table th { color: var(--text-muted); font-weight: 700; letter-spacing: 0.08em; font-size: 10px; }
.strat-list { display: grid; gap: 8px; }
.strat-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  border: 1px solid var(--border-line); background: var(--bg-main); padding: 10px 12px; cursor: pointer;
  font-family: inherit; color: var(--text-main); width: 100%; text-align: left;
}
.strat-item.active { border-width: 2px; color: var(--text-main); font-weight: 800; }
.lc-chart { height: 280px; border: 1px solid var(--border-line); background: var(--bg-main); margin-bottom: 12px; }
#equity { width: 100%; height: 280px; display: block; background: var(--bg-main); border: 1px solid var(--border-line); }
.bt-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.bt-meta.five { grid-template-columns: repeat(5, 1fr); }
.gate { border: 1px dashed var(--border-line); padding: 24px; text-align: center; }
.nav-toggle {
  display: none;
  font-family: inherit; font-size: 18px; color: #ffffff;
  background: #000000; border: 1px solid #555555; padding: 8px 12px; cursor: pointer;
}
.nav-kpis {
  display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
  margin: 8px 0 12px; font-size: 13px; line-height: 1.5; color: var(--text-main);
  background: var(--bg-pill); color: var(--text-inverse); padding: 8px 12px;
}
.nav-kpis span { color: inherit; }
.nav-sep { color: #94a3b8; }
.nav-chip { color: #cbd5e1; }
.nav-chip.up { color: #4ade80; }
.nav-chip.down { color: #f87171; }
#candleChart, #candleChart, #equityChart, #equityChart, #tvChart, .lab-canvas, .chart-container, .lc-chart {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: block;
  overflow: hidden;
  position: relative;
}

.chart-container,
#tv_chart_container,
.tradingview-widget-container,
#candleChart,
#equityChart,
#tvChart,
.lab-canvas,
.lc-chart {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  position: relative !important;
}

.lab-flow,
.lab-chart-block,
.lab-chart-frame,
#viewBacktest,
#viewBacktest .lab-flow,
.editorial-main,
.editorial-main section {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.lab-chart-frame {
  overflow: hidden;
}
.pine-toolbar {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-surface); padding: 8px 0; margin-top: 6px;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.data-table { min-width: 520px; font-size: 12px; }

@media (max-width: 768px) {
  * { box-sizing: border-box; }
  html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }
  body, .wrap, .main-container { padding-bottom: 80px; }
  .wrap, .wrap.wide {
    padding: 12px 16px 80px;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    min-width: 0;
  }
  .market-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    width: 100%;
  }
  .market-grid > * { min-width: 0; max-width: 100%; }
  .price-grid { grid-template-columns: 1fr; }
  .trust-bar, .about-pillars { grid-template-columns: 1fr; }
  .status-pill { display: none; }
  .status-pill-desk { display: none !important; }
  .term-home-link {
    display: inline-flex;
    align-items: center;
    border: 1px solid #555555;
    background: #000000;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    white-space: nowrap;
    text-decoration: none;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .term-home-link:active { background: #333333; }
  .nav-end { min-width: 0; max-width: 100%; }
  .editorial-grid { width: 100%; min-width: 0; }
  .ticker-bar { max-width: 100%; }
  .bb-marquee { width: 100%; max-width: 100%; }
  input, textarea, select, .addr { max-width: 100%; }
  .stats-row { grid-template-columns: 1fr !important; }
  .bt-meta, .bt-meta.five { grid-template-columns: 1fr 1fr; }
  .topbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    position: relative !important;
    top: auto !important;
    padding: 8px 0;
    background: var(--bg-main);
    border: 0;
    border-bottom: 2px solid var(--border-line);
    border-radius: 4px;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    height: 36px;
    width: 36px;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    line-height: 1;
    order: 1;
  }
  .brand {
    order: 2;
    min-width: 0;
    max-width: 100% !important;
    overflow: hidden;
    flex: 1 1 auto;
  }
  .brand-text { overflow: hidden; }
  .nav-end {
    order: 3;
    gap: 8px;
    min-height: 36px;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
  }
  .auth-dock { min-height: 36px; align-items: center; }
  .brand h1 {
    font-size: clamp(17px, 6vw, 22px);
    letter-spacing: 0.08em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand span { display: none; }
  .site-slogan {
    display: none;
    font-size: 8px;
    letter-spacing: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    height: 36px;
    box-sizing: border-box;
    font-size: 11px;
    padding: 0 10px;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
  }
  .auth-btn::after { margin-left: 6px; flex-shrink: 0; }
  .id-pill { font-size: 10px; padding: 6px 8px; max-width: 40vw; }
  .hero-cta { flex-direction: row; align-items: flex-start; justify-content: flex-start; }
  .hero-cta .btn-cta,
  .hero-cta .btn,
  .btn-cta.lg,
  .btn.lg {
    width: auto;
    text-align: left;
    display: inline-flex;
    line-height: 1.45;
  }
  footer.site-foot,
  .foot-legal,
  .foot-official {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 8px;
  }
  .foot-brand { text-align: left; word-break: break-word; }
  .foot-official .sep { display: none; }
  .modal-bg {
    align-items: flex-start;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .modal {
    max-height: calc(100dvh - 16px);
    width: 100%;
  }
  .modal-x { position: sticky; top: 0; z-index: 210; }
  .modal [data-close]:not(.modal-x) {
    position: sticky;
    bottom: 0;
    z-index: 210;
    background: var(--bg-main);
    min-height: 44px;
  }
  .nav-toggle { display: inline-flex; }
  .nav-actions {
    display: none !important;
    order: 4;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    margin-left: 0;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .topbar.nav-open .nav-actions { display: flex !important; }
  .nav-actions .btn, .nav-actions .btn-cta, .nav-actions > button {
    width: 100%; text-align: center;
  }
  .nav-actions .lang-pills {
    width: auto;
    height: 44px;
    margin: 10px auto 4px;
    align-self: center;
    margin-left: auto;
    margin-right: auto;
  }
  .nav-actions .lang-pills button {
    width: auto;
    min-width: 48px;
    min-height: 44px;
    padding: 0 12px;
  }
  .seg { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .seg-btn { flex: 0 0 auto; }
  .chart-shell, .chart-shell.live {
    height: 250px; min-height: 250px; max-height: 250px;
  }
  .lab-top {
    height: auto; min-height: 0; max-height: none;
    margin: 6px 0;
  }
  #candleChart, #candleChart, .lab-canvas {
    width: 100% !important;
    height: 380px !important;
    min-height: 380px !important;
    max-height: 400px !important;
    display: block !important;
    flex: none !important;
    margin-bottom: 0 !important;
  }
  .lab-chart-frame,
  .lab-chart-block,
  .chart-container,
  .tradingview-widget-container {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
    margin-bottom: 12px !important;
  }
  .lab-chart-frame {
    height: 380px !important;
    max-height: 400px !important;
    margin-bottom: 12px !important;
  }
  .lab-chart-frame #candleChart {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  #equityChart, #equityChart {
    width: 100% !important;
    height: 180px !important;
    min-height: 180px !important;
    display: block !important;
    flex: none !important;
  }
  #ddChart, .dd-chart {
    width: 100% !important;
    height: 140px !important;
    min-height: 140px !important;
    display: block !important;
  }
  .lc-chart.chart-container {
    margin-bottom: 6px;
  }
  .h2 { font-size: 18px; }
  .engine-box select,
  .lab-actions .btn,
  .lab-actions .btn-cta,
  .pine-toolbar .btn {
    width: 100%; min-height: 44px;
  }
  .lab-actions { flex-direction: column; }
  .bt-meta { grid-template-columns: 1fr 1fr; }
  .stats-row { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .nav-actions .nav-link {
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    box-sizing: border-box;
  }
  .micro-tag { align-self: center; }
  .hero-h1 { font-size: 20px; overflow-wrap: anywhere; }
  .hero-h2, .open-src, .muted { overflow-wrap: anywhere; }
  .kpi-row { grid-template-columns: 1fr; }
  .chart-meta { font-size: 10px; max-width: 70%; }
  .tg-fab {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    padding: 12px 16px;
  }
  .toast { left: 12px; right: 12px; }
}

.hero { margin-top: 18px; }
.hero-h1 { font-size: 28px; font-weight: 800; line-height: 1.25; max-width: 920px; letter-spacing: -0.03em; }
.hero-h2 { color: var(--text-muted); font-size: 14px; margin: 10px 0 16px; max-width: 760px; line-height: 1.6; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.lab-chart-frame, .chart-shell { position: relative; }
.lab-chart-frame {
  min-height: 0;
  height: auto;
  overflow: hidden;
}
@media (min-width: 769px) {
  .lab-chart-frame {
    min-height: 480px;
  }
  #candleChart, #candleChart.lab-canvas {
    width: 100% !important;
    height: 480px !important;
    min-height: 480px !important;
    display: block !important;
  }
  #equityChart, #equityChart.lc-chart {
    width: 100% !important;
    height: 220px !important;
    min-height: 220px !important;
    display: block !important;
  }
  #tvChart, #tvChart.tv-chart {
    min-height: 480px;
  }
}
.tv-chart-badge {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  text-decoration: none; color: var(--text-muted);
  background: transparent; border: 0;
  padding: 0; font-size: 10px; letter-spacing: 0.04em; opacity: 0.75;
}
.hook-title {
  font-size: 13px; font-weight: 700; color: var(--text-main);
  margin: 16px 0 4px; letter-spacing: 0.06em;
}
.hook-steps {
  list-style: none; margin: 8px 0 16px; padding: 0; display: grid; gap: 0;
  counter-reset: hook;
}
.hook-steps li {
  counter-increment: hook;
  display: flex; align-items: baseline; gap: 10px;
  border: 0; background: transparent;
  border-bottom: 1px solid var(--border-line);
  border-radius: 4px; padding: 10px 0;
  font-size: 13px; color: var(--text-muted);
}
.hook-steps li::before {
  content: counter(hook) ".";
  color: var(--text-main); font-variant-numeric: tabular-nums; min-width: 1.4em; font-weight: 800;
}
.tv-guide { margin: 12px 0 20px; }
.desk-status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.open-src { margin-top: 12px; color: var(--text-main); font-size: 12px; font-weight: 700; }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.kpi { border: 0; background: transparent; padding: 10px 0 12px; border-radius: 4px; border-bottom: 2px solid var(--border-line); }
.kpi span { font-size: 11px; color: var(--text-muted); font-weight: 700; letter-spacing: 0.08em; }
.kpi b { display: block; margin-top: 8px; font-size: 26px; font-variant-numeric: tabular-nums; color: var(--color-up); }
.kpi-note { margin-top: 8px; }
.ticker, .ticker-bar {
  margin-top: 0;
  min-height: 40px;
  height: 40px;
  max-height: 40px;
  line-height: 40px;
  overflow: hidden;
  white-space: nowrap;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  color: #000000;
  font-size: 12px;
  padding: 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  flex-shrink: 0;
}
.ticker { padding: 0; overflow: hidden; text-overflow: ellipsis; max-width: 100%; box-sizing: border-box; }
.ticker-track {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  min-height: 40px;
  height: 40px;
  line-height: 40px;
  min-width: max-content;
  transform: none;
  will-change: transform;
  animation: qaTickerMarquee 60s linear infinite;
}
.ticker-bar.is-paused .ticker-track,
.ticker.is-paused .ticker-track { animation-play-state: paused; }
@keyframes qaTickerMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ticker-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  line-height: 28px;
  overflow: visible;
  border: 1px solid #e2e8f0;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
  white-space: nowrap;
}
.ticker-pill .tp-sym,
.ticker-pill .tp-px,
.ticker-pill .tp-chg {
  text-align: center;
  min-width: 0;
  display: inline-block;
}
.ticker-pill .tp-chg.up, .rail-quote em.up { color: var(--color-up); }
.ticker-pill .tp-chg.down, .rail-quote em.down { color: var(--color-down); }
/* Flash marquee: owned by css/marquee-ticker.css — keep only non-conflicting stubs */
.bb-marquee,
.news-ticker-container,
#bloomberg-marquee-bar {
  /* structure + sizing in marquee-ticker.css */
}
.bb-tag {
  position: static;
}
.bb-track-wrap {
  flex: 1 1 0%;
  min-width: 0;
  overflow: hidden;
}
.bb-track {
  display: inline-flex;
  white-space: nowrap;
}
.bb-gap { display: none; }
@keyframes bbMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.ohlc { margin-top: 4px; color: var(--text-main); }
.risk-banner {
  margin-top: 16px; border: 1px solid var(--warn); color: var(--warn);
  background: #fff7ed; padding: 12px 14px; font-size: 12px; line-height: 1.6;
  border-radius: var(--radius);
}
.login-guide { margin: 10px 0 0 18px; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.otp { display: flex; gap: 8px; justify-content: center; margin: 10px 0; }
.otp-cell {
  width: 52px; height: 56px; text-align: center; font-size: 22px; letter-spacing: 0;
  margin-top: 0; border-radius: var(--radius);
}

/* Member sign-in card: single column, desktop + mobile */
.member-login {
  display: flex;
  justify-content: center;
}
.member-login-card {
  width: 100%;
  max-width: 440px;
  margin: 24px auto 40px;
  border: 1px solid #000;
  background: #fff;
  padding: 28px 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}
.member-login-card .kicker {
  margin: 0;
  text-align: left;
}
.member-login-card .h2 {
  margin: 0;
  text-align: left;
}
.member-login-lead {
  margin: 0;
  text-align: left;
}
.member-login-card .login-guide {
  margin: 0;
  padding: 0 0 0 1.25rem;
  list-style: decimal;
  text-align: left;
}
.member-login-card .login-guide li {
  margin: 0 0 4px;
  line-height: 1.55;
}
.member-login-card .btn-tg {
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}
.login-otp-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.login-otp-block label {
  display: block;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.16em;
  font-weight: 800;
  color: var(--text-main);
}
.member-login-card .otp {
  margin: 4px 0;
  justify-content: center;
  flex-wrap: nowrap;
}
.member-login-card .otp-cell {
  flex: 0 0 52px;
  width: 52px;
  height: 56px;
}
.member-login-card .muted {
  text-align: center;
  margin: 0;
}
.member-login-submit {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.member-login-card .status {
  margin: 0;
  min-height: 1.2em;
  text-align: center;
}
@media (max-width: 768px) {
  .member-login-card {
    margin: 12px 0 28px;
    padding: 20px 16px;
    max-width: 100%;
  }
  .member-login-card .otp-cell {
    flex: 1 1 0;
    width: auto;
    min-width: 44px;
    max-width: 56px;
    height: 52px;
  }
}
.progress { height: 8px; background: var(--bg-surface); border: 1px solid var(--border-line); border-radius: 4px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--color-up); }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.price-card { border: 1px solid var(--border-line); padding: 12px; border-radius: var(--radius); background: var(--bg-surface); }
.price-card.on { border-width: 2px; background: var(--bg-main); }
.trc-warn {
  background: #fef2f2; color: var(--color-down); padding: 10px 12px; font-size: 12px; margin: 12px 0;
  border: 1px solid var(--color-down); border-radius: var(--radius);
}
.pay-help { display: block; margin-top: 12px; color: var(--text-main); font-size: 12px; }
.tg-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 70;
  background: #229ED9; color: #fff; text-decoration: none;
  padding: 12px 14px; border-radius: 4px; font-size: 12px;
  box-shadow: none; font-weight: 700;
}
.fab-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--color-down);
  margin-right: 6px; animation: ctaPulse 1.4s ease-in-out infinite;
}
.demo-card { border: 1px dashed var(--border-line); padding: 16px; border-radius: var(--radius); background: var(--bg-surface); }
.demo-card input[type="range"] { width: 100%; margin: 12px 0; }
.est { font-size: 28px; color: var(--color-up); font-variant-numeric: tabular-nums; font-weight: 800; }
.panel, .desk, .lab-panel, .rule-card, input, select, .btn, .stat, .pine-box {
  border-radius: var(--radius);
}
@media (max-width: 360px) {
  .hero-h1 { font-size: 18px; }
  .otp-cell { width: 44px; height: 48px; }
}
.onboard {
  margin-top: 14px; padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--border-line); background: var(--bg-surface);
}
.onboard p { margin: 6px 0; line-height: 1.55; }
.newbie { margin: 12px 0; }
.newbie b { font-size: 22px; color: var(--warn); font-variant-numeric: tabular-nums; }
.id-pill {
  font-family: inherit; font-size: 11px; cursor: pointer; white-space: nowrap;
  border-radius: 4px; padding: 7px 12px; border: 1px solid var(--border-line);
  background: var(--bg-pill); color: var(--text-inverse); max-width: 42vw;
  overflow: hidden; text-overflow: ellipsis;
}
.id-pill::before {
  content: "";
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-up); margin-right: 8px; vertical-align: middle;
  box-shadow: none;
}
.id-pill.free { color: var(--text-inverse); opacity: 0.85; }
.id-pill.pro { color: var(--text-inverse); border-color: var(--color-up); }
.id-pill.vip { color: var(--text-inverse); border: 1px solid var(--bg-pill); box-shadow: none; }
.ai-lab {
  position: relative;
  margin-top: 18px;
  padding: 28px 20px 22px;
  border: 1px solid var(--border-line);
  background: var(--bg-surface);
  border-radius: 4px;
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}
.ai-lab-glow { display: none; }
.ai-disc {
  position: absolute; top: 12px; right: 12px; z-index: 2;
}
.ai-disc summary {
  list-style: none; cursor: pointer; font-size: 11px; color: var(--text-muted);
  border: 1px solid var(--border-line); border-radius: 4px; padding: 4px 10px;
  background: var(--bg-main);
}
.ai-disc summary::-webkit-details-marker { display: none; }
.ai-disc[open] summary { color: var(--text-main); border-color: var(--border-line); }
.ai-disc p {
  position: absolute; right: 0; top: 32px; width: min(280px, 78vw);
  font-size: 11px; line-height: 1.55; color: var(--text-muted);
  background: var(--bg-main); border: 1px solid var(--border-line); border-radius: 4px;
  padding: 10px 12px; box-shadow: none;
}
.ai-lab-h1 {
  position: relative;
  font-size: clamp(20px, 3.4vw, 32px);
  line-height: 1.35;
  color: var(--text-main);
  margin: 8px 72px 28px 0;
  text-shadow: none;
  font-weight: 800; letter-spacing: -0.03em;
}
.ai-lab textarea {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 110px;
  resize: vertical;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  background: var(--bg-main);
  border: 1px solid var(--border-line);
  color: var(--text-main);
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  border-radius: 4px;
  caret-color: #000000;
  box-shadow: none;
  margin-top: 0;
}
.ai-lab textarea:focus,
.ai-lab textarea:focus-visible,
.ai-lab textarea.is-focused,
.param-card textarea:focus,
.param-card input:focus,
.param-card select:focus,
.engine-box select:focus,
.engine-box select.is-focused {
  outline: none;
  border: 2px solid #000000;
  box-shadow: none;
}
.ai-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ai-chip {
  font-family: inherit; font-size: 11px; cursor: pointer;
  color: var(--color-tag); background: var(--bg-main);
  border: 1px solid var(--color-tag); border-radius: 4px;
  padding: 6px 12px; font-weight: 700;
}
.ai-chip:hover { background: var(--bg-pill); color: var(--text-inverse); }
.ai-lab .ai-go {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  animation: none;
  box-shadow: none;
  background: #000000;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  border: 1px solid #000000;
  border-radius: 4px;
  padding: 14px 20px;
}
.ai-lab .ai-go:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #ffffff;
}
.ai-lab .ai-go:active {
  transform: translateY(1px);
  filter: none;
}
#aiHint { display: none !important; }
.nav-chip.nav-dur, #navDur {
  color: #00873c !important;
  font-weight: 700;
}
.btn-back-list {
  margin-top: 12px;
  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--border-line);
  padding: 10px 14px;
  cursor: pointer;
  border-radius: var(--radius);
  box-shadow: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  box-sizing: border-box;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn-back-list:hover { background: var(--bg-surface); }
.ai-bt-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  margin: 8px 0 4px;
}
.ai-bt-head .btn-back-list { margin-top: 0; flex: 0 1 auto; min-width: 0; }
.ai-bt-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-line);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gm-toolbar { margin-top: 8px; }
.gm-btn, .btn-cta.gm-btn {
  background: #000000;
  color: #ffffff;
  border: 1px solid #000000;
}
.dd-chart { height: 180px; }
.param-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 12px;
  margin: 16px 0;
}
.param-card {
  border: 1px solid #000000;
  background: var(--bg-surface);
  padding: 14px;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.param-card h3 {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
  font-weight: 800;
}
.param-card textarea,
.param-card input,
.param-card select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  padding: 10px;
  font-family: inherit;
}
.code-pane {
  position: relative;
  border: 1px solid #000000;
  background: var(--bg-surface);
  margin: 12px 0 20px;
}
.code-pane-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #000000;
  background: #000000;
  color: #ffffff;
}
.code-pane-bar h3 { margin: 0; font-size: 13px; color: #ffffff; letter-spacing: 0.08em; }
.copy-float { flex-shrink: 0; }
.code-hl {
  margin: 0;
  padding: 14px;
  max-height: 320px;
  background: #ffffff;
  color: #000000;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
}
.exec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 20px;
}
.exec-card {
  border: 1px solid #000000;
  padding: 14px;
  background: #ffffff;
  min-height: 92px;
}
.exec-card span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  font-weight: 700;
}
.exec-card b {
  display: block;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.4;
  color: #00873C;
  font-variant-numeric: tabular-nums;
}
.matrix-table { min-width: 720px; border: 1px solid #000000; }
.matrix-table th, .matrix-table td {
  border: 1px solid #000000;
  padding: 8px 10px;
  font-variant-numeric: tabular-nums;
}
.matrix-table tbody tr:nth-child(even) { background: #f8fafc; }
.matrix-table tbody tr:nth-child(odd) { background: #ffffff; }
@media (max-width: 768px) {
  .param-grid, .exec-grid { grid-template-columns: 1fr; }
  .dd-chart { height: 280px; }
  .code-pane-bar { flex-direction: column; align-items: stretch; }
}

/* Bloomberg editorial grid + tactile system */
.editorial-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 16px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.editorial-main { min-width: 0; max-width: 100%; overflow: hidden; }
#viewList, #viewBacktest { min-width: 0; max-width: 100%; }
.editorial-rail {
  min-width: 0;
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.rail-block {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  padding: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.rail-h {
  font-size: 14px;
  font-weight: 800;
  margin: 4px 0 10px;
  letter-spacing: -0.02em;
}
.lb-period-note {
  font-size: 11px;
  margin: -6px 0 8px;
  color: #64748b;
}
.flash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 360px;
  overflow: auto;
  scrollbar-width: thin;
}
.flash-list li { border-bottom: 1px solid #e2e8f0; }
.flash-src {
  display: block;
  grid-column: 2;
  font-size: 10px;
  font-style: normal;
  color: #94a3b8;
  letter-spacing: 0.04em;
}
.week-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.week-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: #000;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.week-row b { font-variant-numeric: tabular-nums; color: #64748b; }
.week-row span { font-size: 12px; line-height: 1.35; }
.week-row em { font-style: normal; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 12px; }
.week-row em.up { color: #00873c; }
.week-row em.down { color: #d0021b; }
.week-board-mobile { display: none; margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid #000; }
.flash-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 8px;
  padding: 8px 0;
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.45;
}
.flash-row time {
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #000;
  white-space: nowrap;
}
.flash-row span { color: var(--text-muted); }
.flash-row:hover span { color: #000; text-decoration: underline; }
.rail-quotes { display: grid; gap: 0; }
.rail-quote {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
}
.rail-quote span, .rail-quote b, .rail-quote em {
  text-align: center;
  font-style: normal;
}
.rail-note { margin-top: 10px; font-size: 11px; }

@media (hover: hover) and (pointer: fine) {
  .strategy-card:hover, .m-card:hover, .exec-card:hover, .rule-card:hover,
  .param-card:hover, .price-card:hover, .rail-block:hover {
    border-color: #000000;
    transform: translateY(-2px);
    box-shadow: none;
  }
}

@keyframes greenFlash {
  0% { filter: brightness(2.4); }
  100% { filter: none; }
}
@keyframes redFlash {
  0% { filter: brightness(2.4); }
  100% { filter: none; }
}
.ticker-pill.data-updated-up,
.ticker-pill.data-updated-down,
.rail-quote.data-updated-up,
.rail-quote.data-updated-down {
  animation: none;
  background: #1a1a1a;
  outline: none;
}
.ticker-pill .tp-chg.data-updated-up,
.rail-quote em.data-updated-up {
  animation: greenFlash 0.45s ease-out;
}
.ticker-pill .tp-chg.data-updated-down,
.rail-quote em.data-updated-down {
  animation: redFlash 0.45s ease-out;
}
.data-updated-up { animation: none; }
.data-updated-down { animation: none; }
.ticker-pill [data-px],
.rail-quote b[data-px] {
  transition: none;
}

.ai-chip, .term-tab, .seg-btn, .nav-toggle, .btn-back-list, .lang-pills button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.05s ease, filter 0.05s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.exec-card, .rule-card, .param-card, .price-card, .stat, .stat-cap {
  transition: border-color 0.15s ease, transform 0.15s ease;
}

@media (max-width: 900px) {
  .editorial-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    width: calc(100%);
  }
  .editorial-rail { position: static; }
  .editorial-main .ai-lab,
  .editorial-main .desk,
  .editorial-main .lab-top,
  .editorial-main .lab-panel { margin-top: 16px; }
  .wrap, .wrap.wide, .editorial-light .wrap.wide {
    padding-left: 16px;
    padding-right: 16px;
  }
}

.lab-flow { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.bt-sheet-portal {
  display: none;
  flex-shrink: 0;
}
body.desk-open .bt-sheet-portal {
  display: block;
}
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 610;
}
.sheet-scrim[hidden] { display: none !important; }
body.sheet-open { overflow: hidden; }

@media (min-width: 769px) {
  body.desk-open .bt-sheet-portal .result-sheet.bb-sheet {
    position: static;
    transform: none;
    visibility: visible;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    margin-top: 16px;
    box-shadow: none;
    border: 2px solid #000000;
  }
  body.desk-open .bt-sheet-portal .sheet-scrim {
    display: none !important;
  }
}
.lab-chart-block { margin: 0; }
.lab-chart-block .feed-status { margin-bottom: 6px; }
.lab-chart-block.bt-chart-collapsed {
  display: none;
  margin-top: 14px;
}
.lab-chart-block.bt-chart-collapsed.is-open {
  display: block !important;
  animation: btChartReveal 0.28s ease;
}
.lab-chart-block.bt-chart-collapsed.is-open .lab-chart-frame.bt-chart-frame-reserved {
  min-height: 480px;
  position: relative;
}
.bt-chart-skeleton {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px dashed #94a3b8;
}
.bt-chart-skeleton.is-visible {
  display: flex;
}
.bt-skeleton-pulse {
  width: 72%;
  height: 58%;
  border-radius: 4px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: btSkeletonPulse 1.2s ease-in-out infinite;
}
.bt-chart-skeleton p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.04em;
}
#candleChart.bt-chart-hidden {
  visibility: hidden;
  pointer-events: none;
}
@keyframes btSkeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes btChartReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
.tf-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0;
  padding: 2px 0;
}
.tf-bar::-webkit-scrollbar { display: none; }
.tf-bar .seg-btn {
  flex: 0 0 auto;
  border-radius: 4px;
  border: 1px solid #000000;
  background: #ffffff;
  color: #000000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 10px;
  min-height: 32px;
  min-width: 40px;
}
.tf-bar .seg-btn.active {
  background: #000000;
  color: #ffffff;
  border-color: #000000;
}
.exec-bar {
  display: grid;
  gap: 8px;
  margin: 0;
}
.engine-chip {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f7941d;
}
.bt-results.in-page {
  margin-top: 12px;
}
.bt-param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 10px;
}
.bt-param {
  display: grid;
  gap: 6px;
  margin: 0;
}
.bt-param select {
  width: 100%;
  margin: 0;
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
}
.bt-param select.bt-lookback-native {
  /* Kept in the DOM (JS reads .value directly) but replaced visually by
     the quick period pills below — no more long calendar-style dropdown. */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.period-pill {
  flex: 1 1 auto;
  white-space: nowrap;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #000000;
  background: #ffffff;
  border: 1px solid #000000;
  cursor: pointer;
  touch-action: manipulation;
}
.period-pill:hover { background: #f1f5f9; }
.period-pill.is-active {
  background: #000000;
  color: #ffffff;
}
@media (max-width: 480px) {
  .period-pill { flex: 1 1 30%; font-size: 11px; padding: 8px 6px; }
}
.exec-label { margin: 0; font-size: 11px; letter-spacing: 0.08em; font-weight: 700; }
.exec-bar select {
  width: 100%;
  margin: 0;
  background: #ffffff;
  border: 1px solid #000000;
  color: #000000;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
}
.exec-run, .exec-bar .gm-btn {
  width: 100%;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.source-module { margin-top: 8px; }
.sample-hint { margin: 0; font-size: 11px; }
.perf-block, .trades-block { margin: 0; }

@media (max-width: 768px) {
  .lab-flow { gap: 6px; margin-top: 6px; }
  .lab-flow > * { margin: 4px 0; }
  .lab-flow .lab-chart-block { margin-bottom: 0; }
  .lab-flow .tf-bar { margin-top: 0; }
  .btn-back-list {
    margin: 6px 0;
    padding: 10px 12px;
    width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
  }
  .ai-bt-head {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin: 4px 0 8px;
  }
  .ai-bt-head .btn-back-list { width: 100%; }
  .ai-bt-badge {
    width: 100%;
    letter-spacing: 0.02em;
    font-size: 12px;
    padding: 8px 10px;
  }
  .ticker { display: none !important; }
  .zone-title { margin-top: 8px; margin-bottom: 4px; font-size: 13px; }
  .nav-kpis { margin: 6px 0; padding: 6px 8px; font-size: 11px; gap: 4px 6px; }
  .bt-meta { margin: 6px 0; gap: 6px; }
  .stat { padding: 6px 8px; }
  .engine-box, .lab-panel { margin: 6px 0; padding: 0; }
  .editorial-main .lab-top,
  .editorial-main .lab-panel { margin-top: 6px; }
  .editorial-grid { display: flex; flex-direction: column; }
  .editorial-rail,
  .editorial-rail,
  .flash-desk,
  .flash-desk,
  .flash-list,
  .flash-list {
    display: none !important;
  }
  .week-board-desk, .week-board-desk { display: none !important; }
  body.desk-open .editorial-rail,
  body.desk-open .editorial-rail { display: none !important; }
  body.desk-open .week-board-mobile,
  body.desk-open .week-board-mobile { display: block; }
  .ticker-bar,
  .ticker-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    min-height: 40px !important;
    height: 40px !important;
    max-height: 40px !important;
    line-height: 40px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    border-bottom: 1px solid #e2e8f0;
  }
  #bloomberg-marquee-bar,
  .bb-marquee,
  .news-ticker-container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }
  .ticker-bar .ticker-track {
    height: auto !important;
    min-height: 28px !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    max-width: none;
    animation-duration: 42s !important;
  }
  .bb-track-wrap {
    overflow: hidden !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .desk-only, .desk-only { display: none !important; }
  .ticker-pill,
  .ticker-item {
    flex-shrink: 0 !important;
    margin-right: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    font-size: 11px !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
  }
  .disc-mini { display: block; margin: 16px 0 8px; font-size: 11px; color: #94a3b8; text-align: center; }
  .ai-lab-h1 { font-size: 22px; line-height: 1.25; margin: 4px 0 6px; }
  .ai-lab-sub { margin: 0 0 10px; font-size: 13px; color: #475569; }
  .ai-lab {
    padding: 14px 12px;
    margin-top: 10px;
  }
  .ai-lab textarea {
    font-size: 16px;
    padding: 10px;
    min-height: 96px;
  }
  .ai-lab .ai-go {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .ai-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 4px;
    margin-top: 8px;
  }
  .ai-chip { flex: 0 0 auto; white-space: nowrap; font-size: 12px; padding: 8px 12px; }
  .exec-bar { margin-bottom: 8px; }
  .bt-param-grid { grid-template-columns: 1fr; }
  body.desk-open .thumb-dock {
    display: none !important;
  }
  body.desk-open,
  body.desk-open .wrap,
  body.desk-open .wrap.wide,
  body.desk-open .main-container {
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  body.desk-open footer.site-foot {
    display: block;
    margin-top: 20px;
  }
  #candleChart, #candleChart { height: 380px !important; min-height: 380px !important; max-height: 400px !important; }
  #equityChart, #equityChart { height: 150px !important; min-height: 150px !important; }
  .lab-chart-frame {
    height: 380px !important;
    min-height: 0 !important;
    max-height: 400px !important;
    margin-bottom: 12px !important;
  }
  .bt-sheet-portal {
    display: none;
    height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
  }
  body.desk-open .bt-sheet-portal {
    display: block;
    height: 0;
  }
  .lab-flow .result-sheet { margin: 0; }
  .thumb-dock { display: flex; }
  body, .wrap, .wrap.wide, .main-container { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .term-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .m-card, .m-card, .strategy-card, .strategy-card {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible;
    padding: 12px;
    gap: 8px;
  }
  .m-card h3, .m-card h3 {
    font-size: 14px;
    min-height: 0;
    flex: 0 0 auto;
    width: 100%;
    padding-right: 0;
    margin: 0;
    position: static;
  }
  .m-card .card-principle, .m-card .tags, .m-card .muted, .m-card .stat-caps,
  .m-card .card-principle, .m-card .tags, .m-card .muted, .m-card .stat-caps { display: none; }
  body.plaza-page .m-card.plaza-card .card-principle,
  body.plaza-page .m-card.plaza-card .card-meta,
  body.plaza-page .m-card.plaza-card .muted { display: block !important; }
  body.plaza-page .m-card.plaza-card .stat-caps.plaza-metrics { display: grid !important; }
  body.plaza-page .m-card.plaza-card .tags { display: none !important; }
  .m-card .vip-badge, .m-card .vip-badge { position: static; font-size: 10px; align-self: flex-start; }
  .m-card .card-hit, .m-card .card-hit {
    display: block;
    width: 100%;
    font-size: 12px;
    font-weight: 700;
    color: #000000;
    margin: 0;
    position: static;
    flex: 0 0 auto;
  }
  .m-card .card-actions, .m-card .card-actions {
    position: static !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
    flex: 0 0 auto;
  }
  .m-card .card-actions .btn-cta, .m-card .card-actions .btn-cta {
    position: static !important;
    bottom: auto !important;
    width: 100%;
    min-height: 40px;
    font-size: 13px;
  }
  .m-card.is-paged { display: none !important; }
  .sheet-head,
  .sheet-foot,
  .sheet-hint {
    display: block;
  }
  .result-sheet.bb-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    height: min(72vh, 620px);
    max-height: min(72vh, 620px);
    background: #ffffff;
    border-top: 2px solid #000000;
    border-radius: 4px;
    z-index: 620;
    transform: translateY(110%);
    transition: transform 0.22s ease;
    display: none;
    flex-direction: column;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    visibility: hidden;
  }
  .result-sheet.bb-sheet.open {
    display: flex;
    transform: translateY(0);
    pointer-events: auto;
    visibility: visible;
  }
  .sheet-head {
    flex: 0 0 auto;
    padding: 0;
    border-bottom: 2px solid #000000;
    background: #000000;
    color: #ffffff;
  }
  .sheet-grab {
    display: block;
    width: 44px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 4px;
    background: #64748b;
  }
  .sheet-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px 0;
  }
  .sheet-title {
    margin: 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffffff;
  }
  .sheet-x {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border: 1px solid #ffffff;
    background: transparent;
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
  }
  .sheet-hint {
    margin: 0;
    padding: 8px 14px 10px;
    font-size: 10px;
    line-height: 1.45;
    color: #94a3b8;
    text-align: center;
    background: #000000;
    letter-spacing: 0.04em;
  }
  .sheet-body {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px;
    min-height: 0;
    background: #ffffff;
  }
  .sheet-foot {
    flex: 0 0 auto;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    border-top: 2px solid #000000;
    background: #ffffff;
  }
  .sheet-done {
    width: 100%;
    min-height: 44px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    border-radius: 4px;
  }
  .bb-sheet .bbg-terminal-card {
    margin-bottom: 10px;
  }
  .bb-sheet .funnel-card { display: none !important; }
  .bb-sheet .zone-title {
    font-size: 11px;
    margin: 8px 0 6px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 800;
  }
  .bb-sheet #equityChart {
    height: 150px !important;
    min-height: 150px !important;
    margin-bottom: 8px;
    border: 1px solid #374151;
  }
  .bb-sheet .sheet-extra { display: none !important; }
}

.disc-mini { display: none; }
.ai-lab-sub { margin: 0 0 12px; font-size: 14px; color: #475569; }
.thumb-dock { display: none; }
.sheet-head, .sheet-foot, .sheet-hint { display: none; }
.bt-results.in-page .bbg-terminal-card { margin: 0 0 12px; }
.funnel-card { display: none !important; }
.raw-log { margin-top: 8px; }
.raw-log summary { cursor: pointer; font-size: 12px; font-weight: 700; }
.card-hit { display: none; }
@media (max-width: 768px) {
  .m-card .card-hit, .m-card .card-hit { display: block !important; }
}
.grid-more { width: 100%; margin: 8px 0 16px; }
.hint { cursor: help; font-size: 11px; }
.thumb-dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 2px solid #000;
  z-index: 50;
  align-items: stretch;
  gap: 8px;
}
.dock-field {
  display: flex; flex-direction: column; justify-content: center;
  min-width: 72px; font-size: 10px; color: #64748b; font-weight: 700;
}
.dock-field select {
  border: 1px solid #000; background: #fff; font: inherit; font-size: 13px; font-weight: 700;
  height: 36px; padding: 0 6px;
}
.dock-run {
  flex: 1; min-height: 44px; font-size: 14px; font-weight: 800;
}
.share-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal, 999); background: rgba(0,0,0,0.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px;
}
.share-overlay[hidden] { display: none; }
.share-poster {
  width: min(320px, 90vw); background: #0b0b0b; color: #fff; padding: 28px 20px;
  text-align: center; border: 2px solid #c9a227;
}
.share-brand { letter-spacing: 0.2em; font-size: 11px; color: #c9a227; margin: 0 0 16px; }
.share-line { font-size: 26px; font-weight: 800; margin: 0 0 8px; }
.share-sub { margin: 0 0 16px; color: #86efac; }
.share-qr { margin: 0; font-size: 12px; color: #94a3b8; }

.status-pill-desk {
  display: inline-flex;
}
.term-home-link { display: none; }
@media (min-width: 769px) {
  .term-home-link { display: none; }
}
.bt-loading {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  margin: 12px 0;
  padding: 24px 16px;
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  text-align: center;
}
.bt-loading.show { display: flex; }
.bt-loading p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 0.04em;
}
body.desk-open #btLoading.show ~ .lab-flow .lab-chart-block,
body.desk-open #btLoading.show ~ .lab-flow .lab-chart-block .lab-chart-frame {
  min-height: 120px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #000;
  background: #fff;
  color: #000;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00873c;
  flex-shrink: 0;
  animation: statusPulse 1.5s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.trust-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}
.trust-card {
  border: 1px solid #000;
  background: #fff;
  padding: 14px 12px;
}
.trust-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #000;
}
.trust-card p {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: #334155;
}
.foot-disc {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  max-width: 72rem;
  text-align: left;
}
.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-items: center;
  justify-content: flex-start;
  margin: 0;
  font-family: var(--font);
  font-size: 12px;
}
.foot-links a { color: #ffffff; text-decoration: none; font-weight: 700; }
.foot-links a:hover { text-decoration: underline; }
.foot-sep { color: #555555; padding: 0 4px; user-select: none; }
@media (max-width: 700px) {
  .foot-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 8px;
    justify-items: start;
    max-width: 100%;
  }
  .foot-sep { display: none; }
  .foot-disc {
    text-align: left;
    padding: 0;
  }
}
.about-hero { padding: 36px 0 28px; border-bottom: 1px solid #000; }
.about-kicker {
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 800;
  color: #000;
  margin: 0 0 12px;
}
.about-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: #000;
  max-width: 18em;
  margin: 0 0 16px;
}
.about-lead {
  font-size: 16px;
  line-height: 1.65;
  color: #000;
  max-width: 46rem;
  margin: 0;
}
.about-pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 28px 0;
  border-bottom: 1px solid #e2e8f0;
}
.about-pillar {
  border: 1px solid #000;
  background: #fff;
  padding: 18px 16px;
}
.about-pillar h2 {
  font-size: 16px;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}
.about-pillar p { margin: 0; font-size: 13px; line-height: 1.6; color: #334155; }
.about-tech {
  padding: 24px 0 40px;
}
.about-tech h2 {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.about-tech p {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.7;
  color: #475569;
  margin: 0 0 16px;
  max-width: 52rem;
}
@media (max-width: 900px) {
  .trust-bar, .about-pillars { grid-template-columns: 1fr; }
  .status-pill span[data-i18n] { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; }
}

/* =========================================================================
 * Mobile UX recovery: segmented Strategies / Leaderboard / News switcher,
 * AI Lab single-line collapse, and chart touch-shield toggle. Shared by
 * terminal.html and live.html so both pages get the same mobile controls.
 * ======================================================================= */
.mobile-view-tabs { display: none; }
.mv-panel-strategies { display: contents; }
body.live-page .mv-panel-strategies {
  display: block;
  width: 100%;
  min-width: 0;
}

@media (max-width: 768px) {
  .mv-panel-leaderboard,
  .mv-panel-news { display: none; }

  .mobile-view-tabs {
    display: flex;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 4px 0 8px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .mobile-view-tabs::-webkit-scrollbar { display: none; }
  body.desk-open .mobile-view-tabs { display: none; }
  .mv-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid #000;
    background: #fff;
    color: #000;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
    cursor: pointer;
  }
  .mv-tab.is-active { background: #000; color: #fff; }

  body[data-mv-view="leaderboard"] .mv-panel-strategies,
  body[data-mv-view="news"] .mv-panel-strategies,
  body[data-mv-view="leaderboard"] #viewList,
  body[data-mv-view="news"] #viewList {
    display: none !important;
  }
  body:not([data-mv-view="leaderboard"]) .mv-panel-leaderboard,
  body:not([data-mv-view="news"]) .mv-panel-news {
    display: none !important;
  }
  body[data-mv-view="leaderboard"] .mv-panel-leaderboard,
  body[data-mv-view="news"] .mv-panel-news {
    display: block !important;
    margin: 4px 0 20px;
    padding-top: 10px;
    border-top: 1px solid #000;
  }
  /* terminal.html reuses the desktop rail markup for these panels — it's
     normally suppressed entirely on mobile, so re-enable just the active one.
     (Scoped away from live.html's .vps-exec-rail bottom-sheet, which has its
     own show/hide driven by the tape-sheet-open class, not display.) */
  body[data-mv-view="leaderboard"] .editorial-rail:not(.vps-exec-rail),
  body[data-mv-view="news"] .editorial-rail:not(.vps-exec-rail) {
    display: block !important;
  }
  body[data-mv-view="leaderboard"] .flash-desk { display: none !important; }
  body[data-mv-view="news"] .week-board-desk,
  body[data-mv-view="news"] .rail-mkt { display: none !important; }
}

/* ---- AI Strategy Lab: collapse to a single-line trigger on mobile ---- */
.ai-lab-collapsed-trigger { display: none; }
@media (max-width: 768px) {
  .ai-lab-collapsed-trigger {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid #000;
    background: #fff;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  .ai-lab.is-collapsed .kicker.desk-only,
  .ai-lab.is-collapsed .ai-lab-h1,
  .ai-lab.is-collapsed .ai-lab-sub,
  .ai-lab.is-collapsed textarea,
  .ai-lab.is-collapsed .ai-chips,
  .ai-lab.is-collapsed .ai-go {
    display: none !important;
  }
  .ai-lab.is-collapsed { padding-bottom: 12px; }
}

/* ---- Chart touch-shield: pan-y by default so vertical swipes scroll the
   page through the chart; toggle (or long-press) opens full interaction. ---- */
.chart-frame-rel { position: relative; }
.chart-touch-toggle { display: none; }
@media (max-width: 768px) {
  .chart-container { touch-action: pan-y; }
  .chart-container.touch-interactive { touch-action: none; }
  .chart-touch-toggle {
    display: inline-flex;
    align-items: center;
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 6;
    padding: 5px 9px;
    border: 1px solid rgba(0, 0, 0, 0.65);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #000;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
  }
  .chart-touch-toggle.is-active {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
  }
  .chart-touch-toggle-left { right: auto; left: 8px; }
}

/* ---- Generic text-overflow safety net for metric/leaderboard labels ---- */
.hb-model, .hb-num, .bbg-metric-title, .bbg-badge-label, .selected-matrix-label,
.stat b, .stat span, .kpi p, .exec-label {
  min-width: 0;
}
@media (max-width: 768px) {
  .hb-model, .hb-num, .bbg-metric-title, .bbg-badge-label {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hb-model-en { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .home-kpi, .nav-kpis { flex-wrap: wrap; }
  .kpi, .stat { flex-wrap: wrap; min-width: 0; }
}





/* Research whitepaper block (single-DOM compliance) */
.lab-paper {
  margin: 28px 0 12px;
  padding: 20px 16px;
  border-top: 2px solid #000;
  background: #f8fafc;
}
.lab-paper .paper-block { margin: 16px 0; }
.lab-paper .paper-math {
  font-family: "Roboto Mono", "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
}
.lab-paper .paper-list { margin: 8px 0 0 18px; line-height: 1.6; }

/* ========== Layout defensive layer (post-compliance copy) ========== */
.wrap,
.wrap.wide,
.site-sticky-chrome,
.home-boards-section,
.home-boards-grid,
.hb-card,
.hb-head,
.hb-scroll,
.market-grid,
.m-card,
.strategy-card,
.plaza-card,
.coin-grid,
.coin-card,
.radar-board,
.lab-paper,
.paper-block,
.hero-copy,
.kpi,
.stat-cap {
  min-width: 0;
  box-sizing: border-box;
}

.home-boards-grid,
.coin-grid,
.market-grid,
.lab-paper,
.radar-board {
  width: 100%;
  max-width: 100%;
}

/* Long academic titles / formulas must wrap, never blow the row */
.hb-title,
.hb-kicker,
.hero-h1,
.hero-h2,
.h2,
.site-slogan,
.radar-title,
.coin-pair,
.card-principle,
.muted,
.kpi span,
.stat-cap span,
.stat-tip,
.lab-paper h2,
.lab-paper h3,
.lab-paper p,
.bbg-metric-title,
.paper-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.hb-title {
  line-height: 1.35;
  font-size: clamp(13px, 1.35vw, 16px);
}

.hb-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.hb-period {
  max-width: 40%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-hero .hero-cta {
  flex-wrap: wrap;
  white-space: normal;
  max-width: 100%;
}

.home-hero .hero-cta .btn-cta {
  white-space: normal;
  text-align: left;
  line-height: 1.3;
  max-width: 100%;
}

.site-sticky-chrome {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.site-sticky-chrome .topbar {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.site-sticky-chrome .brand,
.site-sticky-chrome .brand-text,
.site-sticky-chrome .site-slogan {
  min-width: 0;
  max-width: 100%;
}

.site-sticky-chrome .nav-actions {
  min-width: 0;
  justify-content: flex-end;
  margin-left: auto;
}

.site-sticky-chrome .nav-end {
  flex-shrink: 0;
}

.lab-paper {
  overflow: hidden;
  max-width: 100%;
}

.lab-paper .paper-math {
  max-width: 100%;
  overflow-x: auto;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 768px) {
  .home-boards-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-kpi {
    grid-template-columns: minmax(0, 1fr);
  }
  .hb-period {
    max-width: 100%;
  }
}
