/* Gsignalx Velocity docs — shared theme tokens + mobile utilities (v2.01) */
:root, [data-theme="dark"] {
  --bg: #0A121E;
  --bg-mid: #0D2D48;
  --bg-elev: #0D2D48;
  --bg-card: #144064;
  --bg-soft: #103A5C;
  --edge: #2D6EA0;
  --edge-soft: #1E4F78;
  --text: #F2F7FC;
  --muted: #A8C4DB;
  --heading-sub: #E8ECF5;
  --gold: #FBA927;
  --gold-dim: #D99212;
  --brand-blue: #469AD4;
  --bull: #16A34A;
  --bear: #DC2626;
  --link: #7EBFE8;
  --header-bg: rgba(10, 18, 30, 0.94);
  --header-edge: rgba(70, 154, 212, 0.35);
  --rail-bg: rgba(18, 22, 30, 0.55);
  --radius: 10px;
  --font: "Segoe UI", "Candara", system-ui, sans-serif;
  --mono: Consolas, "Cascadia Mono", monospace;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #F4F8FC;
  --bg-mid: #E8F0F8;
  --bg-elev: #FFFFFF;
  --bg-card: #EEF4FA;
  --bg-soft: #E4EDF6;
  --edge: #8BB4D4;
  --edge-soft: #C5D8E8;
  --text: #0A1F33;
  --muted: #3D5A72;
  --heading-sub: #16324A;
  --gold: #D99212;
  --gold-dim: #B87A0E;
  --brand-blue: #2E7BB0;
  --bull: #15803D;
  --bear: #B91C1C;
  --link: #1E6FA8;
  --header-bg: rgba(244, 248, 252, 0.92);
  --header-edge: rgba(46, 123, 176, 0.28);
  --rail-bg: rgba(255, 255, 255, 0.72);
  color-scheme: light;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0;
}
.table-scroll table { min-width: 0; }

.mobile-chapter-wrap {
  display: none;
  width: 100%;
  padding: 0 12px 8px;
}
.mobile-chapter-wrap label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.mobile-chapter-wrap select {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  padding: 8px 12px;
}

@media (max-width: 900px) {
  .mobile-chapter-wrap { display: block; }
  .brand-text-keep { display: inline !important; font-size: 13px; }
  .header-cta-label { display: none; }
  .header-actions .header-cta { min-width: 44px; min-height: 44px; padding: 8px; }
}
@media (max-width: 480px) {
  .header-actions { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .callout.gold code { display: inline-block; max-width: 100%; word-break: break-word; }
  .flow { flex-direction: column; align-items: stretch; }
  .flow .flow-node { width: 100%; }
}
/* Desk community (Telegram channel + group) */
:root, [data-theme="dark"] {
  --cta-community-bg: rgba(70, 154, 212, 0.12);
  --cta-community-hover: rgba(70, 154, 212, 0.22);
  --community-strip-bg: rgba(13, 45, 72, 0.92);
}
[data-theme="light"] {
  --cta-community-bg: rgba(46, 123, 176, 0.10);
  --cta-community-hover: rgba(46, 123, 176, 0.18);
  --community-strip-bg: rgba(232, 240, 248, 0.96);
}

.header-cta.community {
  border-color: rgba(70, 154, 212, 0.55);
  color: var(--brand-blue);
  background: var(--cta-community-bg);
}
.header-cta.community:hover {
  background: var(--cta-community-hover);
  color: var(--link);
  text-decoration: none;
}
.header-cta.community .cm-short { display: none; }

/* Compact Links menu (replaces stacked CTAs) */
.header-links {
  position: relative;
}
.header-links > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.header-links > summary::-webkit-details-marker { display: none; }
.header-cta.links-toggle {
  border-color: var(--edge);
  color: var(--text);
  background: var(--bg-card);
}
.header-cta.links-toggle:hover {
  border-color: var(--brand-blue);
  color: var(--link);
  background: var(--cta-community-bg);
  text-decoration: none;
}
.header-links .links-short { display: none; }
.header-links-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: min(320px, calc(100vw - 24px));
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--bg-elev);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.header-link-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}
.header-link-item:hover {
  background: color-mix(in srgb, var(--brand-blue) 14%, transparent);
  text-decoration: none;
}
.header-link-item strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.header-link-item span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.header-link-item.premium {
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  margin-bottom: 4px;
}
.header-link-item.premium strong { color: var(--gold); }
.header-link-item.premium:hover {
  background: color-mix(in srgb, var(--gold) 18%, transparent);
}

.gsx-community-strip {
  position: sticky;
  top: var(--header-h, 56px);
  z-index: 40;
  background: var(--community-strip-bg);
  border-bottom: 1px solid var(--header-edge);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.gsx-community-strip[hidden] { display: none !important; }
.gsx-community-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 16px;
}
.gsx-community-strip-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.gsx-community-dual {
  margin: 1rem 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--brand-blue) 40%, transparent);
  background: color-mix(in srgb, var(--bg-card) 85%, transparent);
}
.gsx-community-lead {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}
.gsx-community-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.gsx-community-actions.compact { gap: 6px; }
.gsx-community-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gsx-community-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.gsx-community-btn.channel {
  color: var(--brand-blue);
  border-color: rgba(70, 154, 212, 0.55);
  background: var(--cta-community-bg);
}
.gsx-community-btn.channel:hover {
  background: var(--cta-community-hover);
  color: var(--link);
  text-decoration: none;
}
.gsx-community-btn.channel.primary {
  border-color: var(--gold-dim);
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold) 25%, transparent);
  font-size: 13px;
}
.gsx-community-btn.channel.primary:hover {
  background: color-mix(in srgb, var(--gold) 22%, transparent);
  color: var(--gold);
  text-decoration: none;
}
.gsx-community-btn.group {
  color: var(--muted);
  border-color: var(--edge-soft);
  background: transparent;
}
.gsx-community-btn.group:hover {
  color: var(--text);
  border-color: var(--edge);
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  text-decoration: none;
}
.gsx-community-btn.group.secondary {
  opacity: 0.92;
}
.gsx-community-btn.whatsapp {
  color: #1f8f5f;
  border-color: rgba(37, 211, 102, 0.55);
  background: color-mix(in srgb, #25d366 12%, transparent);
}
.gsx-community-btn.whatsapp:hover {
  color: #157a4f;
  border-color: rgba(37, 211, 102, 0.8);
  background: color-mix(in srgb, #25d366 20%, transparent);
  text-decoration: none;
}
.gsx-community-btn.tv {
  color: #2962ff;
  border-color: rgba(41, 98, 255, 0.55);
  background: color-mix(in srgb, #2962ff 12%, transparent);
}
.gsx-community-btn.tv:hover {
  color: #1e4fd6;
  border-color: rgba(41, 98, 255, 0.8);
  background: color-mix(in srgb, #2962ff 20%, transparent);
  text-decoration: none;
}
.gsx-community-dual.channel-primary .gsx-community-lead {
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}
.gsx-community-btn.more {
  color: var(--muted);
  border-color: var(--edge-soft);
  background: transparent;
  flex-direction: row;
  align-items: center;
}
.gsx-community-btn.more:hover {
  color: var(--text);
  border-color: var(--edge);
  text-decoration: none;
}
.gsx-community-hint {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}
.gsx-community-actions.compact .gsx-community-btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 11.5px;
  flex-direction: row;
}

@media (max-width: 900px) {
  .header-cta.community .cm-full { display: none; }
  .header-cta.community .cm-short { display: inline; }
  .header-links .links-full { display: none; }
  .header-links .links-short { display: inline; }
  .gsx-community-strip-inner { padding: 8px 12px; }
}
@media (max-width: 480px) {
  .gsx-community-btn { flex: 1 1 calc(50% - 4px); }
  .gsx-community-btn.more { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Managed Premium upgrade rail (keep URLs in sync with BrandLinks.mqh / gsx-premium.js) */
:root, [data-theme="dark"] {
  --cta-premium-bg: rgba(251, 169, 39, 0.12);
  --cta-premium-hover: rgba(251, 169, 39, 0.22);
  --premium-rail-bg: rgba(10, 18, 30, 0.96);
}
[data-theme="light"] {
  --cta-premium-bg: rgba(217, 146, 18, 0.12);
  --cta-premium-hover: rgba(217, 146, 18, 0.2);
  --premium-rail-bg: rgba(255, 255, 255, 0.97);
}

.header-cta.premium {
  border-color: color-mix(in srgb, var(--gold) 55%, transparent);
  color: var(--gold);
  background: var(--cta-premium-bg);
}
.header-cta.premium:hover {
  background: var(--cta-premium-hover);
  color: var(--gold);
  text-decoration: none;
}
.header-cta.premium .prm-short { display: none; }

.gsx-premium-rail {
  position: sticky;
  bottom: 0;
  z-index: 45;
  background: var(--premium-rail-bg);
  border-top: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}
body:has(.gsx-premium-rail.is-visible:not([hidden])) {
  padding-bottom: 88px;
}
.gsx-premium-rail[hidden] { display: none !important; }
.gsx-premium-rail-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom, 0px));
}
.gsx-premium-rail-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: min(100%, 220px);
}
.gsx-premium-rail-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.gsx-premium-rail-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.gsx-premium-rail-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.gsx-premium-dual {
  margin: 1rem 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--gold) 10%, transparent),
      color-mix(in srgb, var(--bg-card) 90%, transparent));
}
.gsx-premium-lead {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}
.gsx-premium-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.gsx-premium-actions.compact { gap: 6px; }
.gsx-premium-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gsx-premium-btn:focus-visible {
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
}
.gsx-premium-btn.book.primary {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
}
.gsx-premium-btn.book.primary:hover {
  background: color-mix(in srgb, var(--gold) 26%, transparent);
  color: var(--gold);
  text-decoration: none;
}
.gsx-premium-btn.manual {
  color: var(--brand-blue);
  border-color: rgba(70, 154, 212, 0.55);
  background: var(--cta-community-bg);
}
.gsx-premium-btn.manual:hover {
  background: var(--cta-community-hover);
  color: var(--link);
  text-decoration: none;
}
.gsx-premium-btn.mentor {
  color: var(--muted);
  border-color: var(--edge-soft);
  background: transparent;
}
.gsx-premium-btn.mentor:hover {
  color: var(--text);
  border-color: var(--edge);
  background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
  text-decoration: none;
}
.gsx-premium-btn.dismiss {
  flex-direction: row;
  align-items: center;
  color: var(--muted);
  border-color: var(--edge-soft);
  background: transparent;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 11.5px;
}
.gsx-premium-btn.dismiss:hover {
  color: var(--text);
  border-color: var(--edge);
}
.gsx-premium-hint {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
  text-transform: none;
}
.gsx-premium-fine {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.gsx-premium-fine a { color: var(--link); font-weight: 600; }
.gsx-premium-actions.compact .gsx-premium-btn {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 11.5px;
  flex-direction: row;
}

.footer-note {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--edge-soft);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.footer-note a { color: var(--link); font-weight: 600; }

@media (max-width: 900px) {
  .header-cta.premium .prm-full { display: none; }
  .header-cta.premium .prm-short { display: inline; }
  .gsx-premium-rail-inner { padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 480px) {
  .gsx-premium-btn { flex: 1 1 calc(50% - 4px); }
  .gsx-premium-btn.dismiss { flex: 1 1 100%; }
}
@media print {
  .gsx-premium-rail { display: none !important; }
}

/* Adaptive risk guidance (shared) */
.risk-block {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 1em 0;
  border: 1px solid rgba(70, 154, 212, 0.45);
  background: linear-gradient(135deg, rgba(70, 154, 212, 0.10), var(--bg-card));
  font-size: 0.95rem;
}
.risk-block .rb-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-blue);
  border: 1px solid rgba(70, 154, 212, 0.4);
  border-radius: 4px;
  padding: 2px 8px;
  margin-bottom: 8px;
}
.risk-block.warn {
  border-color: rgba(251, 169, 39, 0.55);
  background: linear-gradient(135deg, rgba(251, 169, 39, 0.10), var(--bg-card));
}
.risk-block.warn .rb-tag { color: var(--gold); border-color: rgba(251, 169, 39, 0.45); }
.risk-block.bear {
  border-color: rgba(220, 38, 38, 0.45);
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.08), var(--bg-card));
}
.risk-block.bear .rb-tag { color: var(--bear); border-color: rgba(220, 38, 38, 0.4); }
.decision-tree {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  background: var(--bg-soft);
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  white-space: pre;
}

/* Language control — shared by the manual and the splash */
html[data-i18n-pending] .site-header,
html[data-i18n-pending] .shell,
html[data-i18n-pending] .kbd-hint,
html[data-i18n-pending] .splash {
  visibility: hidden;
}
html[data-i18n-font="ar"] {
  --font: "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}
html[data-i18n-font="zh"] {
  --font: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}
.lang-switch { position: relative; flex-shrink: 0; }
.lang-toggle {
  appearance: none;
  position: relative;
  height: 44px;
  min-width: 44px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  border: 1px solid var(--edge-soft);
  background: var(--bg-card);
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.35s, transform 0.35s;
}
.lang-toggle:hover { background: var(--bg-soft); border-color: var(--edge); }
.lang-toggle:focus-visible,
.lang-option:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.lang-toggle .lang-globe { width: 16px; height: 16px; flex-shrink: 0; }
.lang-toggle .lang-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-top-color: var(--gold);
  flex-shrink: 0;
  animation: gsx-lang-spin 0.7s linear infinite;
}
.lang-switch.is-busy .lang-toggle .lang-globe { display: none; }
.lang-switch.is-busy .lang-toggle .lang-spinner { display: inline-block; }
.lang-switch.is-busy .lang-toggle { cursor: wait; opacity: 0.92; }
.lang-switch.is-hint .lang-toggle {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 45%, transparent);
  animation: gsx-lang-pulse 1.1s ease-in-out 3;
}
.lang-panel {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 80;
  width: min(280px, calc(100vw - 24px));
  max-height: min(70vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--edge);
  background: var(--bg-elev);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}
.lang-panel.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.lang-panel[hidden] { display: none; }
.lang-option {
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  text-align: start;
}
.lang-option:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand-blue) 14%, transparent);
}
.lang-option:disabled {
  opacity: 0.55;
  cursor: wait;
}
.lang-option.is-active {
  border-color: rgba(251, 169, 39, 0.55);
  background: color-mix(in srgb, var(--gold) 16%, transparent);
}
.lang-option-name { font-weight: 700; font-size: 13.5px; }
.lang-option-code {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}
.lang-option.is-active .lang-option-code { color: var(--gold); }
.lang-live {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.splash .lang-switch {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 0px));
  inset-inline-end: max(12px, env(safe-area-inset-right, 0px));
  z-index: 20;
}
@keyframes gsx-lang-spin {
  to { transform: rotate(360deg); }
}
@keyframes gsx-lang-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}
[dir="rtl"] .header-actions { margin-left: 0; margin-right: auto; }
[dir="rtl"] .header-links-panel { right: auto; left: 0; }
[dir="rtl"] .rail-btn,
[dir="rtl"] th,
[dir="rtl"] td,
[dir="rtl"] .chapter-nav button { text-align: right; }
[dir="rtl"] .chapter-nav #nextChapter { text-align: left; }
[dir="rtl"] .checklist li { padding: 8px 36px 8px 10px; }
[dir="rtl"] .checklist li::before { left: auto; right: 8px; }
@media (max-width: 480px) {
  .lang-toggle { padding: 0 8px; }
  .lang-panel {
    width: min(280px, calc(100vw - 16px));
    inset-inline-end: -4px;
  }
}
@media print {
  .lang-switch, .lang-live { display: none !important; }
}
