/* ============================================================================
   TSBCrypto (TSB) — global.css
   Single source of truth for the design system: palette, spacing, radius,
   motion, scrollbar, focus states and shared micro-animations.
   Every page loads this BEFORE the Tailwind CDN utilities so the custom
   properties are available to inline Tailwind config + component classes.
   (Palette unchanged in the TSBCrypto rebrand — naming only.)
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Surfaces (deep charcoal / navy) */
  --bg-base:        #0B0E14;   /* page background            */
  --bg-raised:      #11141B;   /* raised plane / header      */
  --bg-panel:       #151A23;   /* cards & panels             */
  --bg-panel-hover: #1A2029;   /* card hover                 */
  --bg-inset:       #0D1017;   /* inputs, wells, table heads */

  /* Hairlines & borders */
  --edge:           rgba(255, 255, 255, 0.06);
  --edge-strong:    rgba(255, 255, 255, 0.12);

  /* Accent — electric cyan/teal */
  --accent:         #22D3EE;
  --accent-strong:  #67E8F9;
  --accent-dim:     #0E7490;
  --accent-soft:    rgba(34, 211, 238, 0.12);
  --accent-ring:    rgba(34, 211, 238, 0.45);

  /* Semantic — market direction (always paired with a sign/arrow, never
     color-alone, so CVD users still read direction from the glyph) */
  --gain:           #16C784;
  --gain-soft:      rgba(22, 199, 132, 0.12);
  --loss:           #EA3943;
  --loss-soft:      rgba(234, 57, 67, 0.14);
  --warn:           #F0B90B;
  --warn-soft:      rgba(240, 185, 11, 0.12);

  /* Ink */
  --text-primary:   #EDF0F4;
  --text-secondary: #98A1B3;
  --text-muted:     #5C6675;

  /* Chart chrome */
  --grid-line:      rgba(255, 255, 255, 0.05);
  --axis-line:      rgba(255, 255, 255, 0.14);

  /* Radius scale */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Spacing scale (used where Tailwind utilities don't reach, e.g. injected DOM) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-fast: 150ms;
  --dur-med:  250ms;
  --dur-slow: 400ms;

  /* Shadows */
  --shadow-card:  0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-pop:   0 12px 40px rgba(0, 0, 0, 0.55);
}

/* ----------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* Subtle radial glow behind the page — premium fintech backdrop */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 80% -10%, rgba(34, 211, 238, 0.07), transparent 60%),
    radial-gradient(700px 420px at 8% 110%, rgba(22, 199, 132, 0.05), transparent 60%);
  pointer-events: none;
}

::selection { background: var(--accent-soft); color: var(--accent-strong); }

/* ----------------------------------------------------------------------------
   3. Custom scrollbar — thin, accent thumb, transparent track
   -------------------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ----------------------------------------------------------------------------
   4. Accessibility — focus-visible ring (never strip outlines silently)
   -------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: #06252B;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { left: 8px; }

/* Visually hidden but readable by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Critical visibility utility, defined here so hidden overlays/modals stay
   hidden even if the Tailwind CDN is blocked (ad-blockers) or slow. Without
   this, .hidden full-screen modal overlays render and veil the page —
   the "text only visible when selected" bug. !important so it beats
   component display rules (.tsb-modal-overlay { display:flex }) regardless
   of source order; when the CDN loads, the duplicate rule is harmless. */
.hidden { display: none !important; }

/* ----------------------------------------------------------------------------
   5. Shared components
   -------------------------------------------------------------------------- */

/* Card / panel */
.tsb-card {
  background: var(--bg-panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              background-color var(--dur-med) var(--ease-out);
}
.tsb-card--lift:hover {
  transform: translateY(-3px);
  border-color: var(--edge-strong);
  background: var(--bg-panel-hover);
}

/* Buttons */
.tsb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.tsb-btn:active { transform: scale(0.97); }
.tsb-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.tsb-btn--primary {
  background: var(--accent);
  color: #06252B;
}
.tsb-btn--primary:hover:not(:disabled) {
  background: var(--accent-strong);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}

.tsb-btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--edge-strong);
}
.tsb-btn--ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.tsb-btn--buy  { background: var(--gain); color: #052E1F; }
.tsb-btn--buy:hover:not(:disabled)  { filter: brightness(1.12); }
.tsb-btn--sell { background: var(--loss); color: #FDECEC; }
.tsb-btn--sell:hover:not(:disabled) { filter: brightness(1.12); }

/* Inputs */
.tsb-input {
  width: 100%;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 12px;
  font: inherit;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.tsb-input:hover { border-color: var(--edge-strong); }
.tsb-input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tsb-input::placeholder { color: var(--text-muted); }
.tsb-input[aria-invalid="true"] { border-color: var(--loss); }

/* Remove number-input spinners for a cleaner terminal look */
.tsb-input::-webkit-outer-spin-button,
.tsb-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tsb-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* Badges */
.tsb-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--edge-strong);
  color: var(--text-secondary);
  white-space: nowrap;
}
.tsb-badge--accent { color: var(--accent); border-color: rgba(34, 211, 238, 0.35); background: var(--accent-soft); }
.tsb-badge--gain   { color: var(--gain);   border-color: rgba(22, 199, 132, 0.35); background: var(--gain-soft); }
.tsb-badge--loss   { color: var(--loss);   border-color: rgba(234, 57, 67, 0.4);   background: var(--loss-soft); }
.tsb-badge--warn   { color: var(--warn);   border-color: rgba(240, 185, 11, 0.35); background: var(--warn-soft); }

/* Live pulse dot */
.tsb-pulse {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gain);
  animation: tsbPulse 2s var(--ease-out) infinite;
}
@keyframes tsbPulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 199, 132, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(22, 199, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 199, 132, 0); }
}

/* ----------------------------------------------------------------------------
   6. Price flash — toggled by JS on ticker change (background flash + fade)
   -------------------------------------------------------------------------- */
.flash-up, .flash-down { animation: none; }
.flash-up    { animation: tsbFlashUp   600ms var(--ease-out); }
.flash-down  { animation: tsbFlashDown 600ms var(--ease-out); }

@keyframes tsbFlashUp {
  0%   { background-color: var(--gain-soft); color: var(--gain); }
  100% { background-color: transparent; }
}
@keyframes tsbFlashDown {
  0%   { background-color: var(--loss-soft); color: var(--loss); }
  100% { background-color: transparent; }
}

/* ----------------------------------------------------------------------------
   7. Skeleton shimmer (ticker loading state)
   -------------------------------------------------------------------------- */
.tsb-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}
.tsb-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: tsbShimmer 1.4s infinite;
}
@keyframes tsbShimmer { 100% { transform: translateX(100%); } }

/* ----------------------------------------------------------------------------
   8. Reveal-on-load (staggered fade-up for hero/cards)
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(14px); animation: tsbReveal var(--dur-slow) var(--ease-out) forwards; }
.reveal-1 { animation-delay: 60ms; }
.reveal-2 { animation-delay: 140ms; }
.reveal-3 { animation-delay: 220ms; }
.reveal-4 { animation-delay: 300ms; }
@keyframes tsbReveal { to { opacity: 1; transform: translateY(0); } }

/* ----------------------------------------------------------------------------
   9. Toasts (injected by shared-header.js)
   -------------------------------------------------------------------------- */
#tsb-toast-region {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.tsb-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--edge-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  padding: 12px 14px;
  animation: tsbToastIn var(--dur-med) var(--ease-out);
}
.tsb-toast--success { border-left-color: var(--gain); }
.tsb-toast--error   { border-left-color: var(--loss); }
.tsb-toast--info    { border-left-color: var(--accent); }
.tsb-toast.is-leaving { animation: tsbToastOut var(--dur-med) var(--ease-out) forwards; }
@keyframes tsbToastIn  { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes tsbToastOut { to   { opacity: 0; transform: translateX(24px); } }

/* ----------------------------------------------------------------------------
   10. Modal (reset confirmation etc.)
   -------------------------------------------------------------------------- */
.tsb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: tsbFadeIn var(--dur-fast) var(--ease-out);
}
.tsb-modal {
  background: var(--bg-panel);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 440px;
  padding: 24px;
  animation: tsbPopIn var(--dur-med) var(--ease-out);
}
@keyframes tsbFadeIn { from { opacity: 0; } }
@keyframes tsbPopIn  { from { opacity: 0; transform: scale(0.95) translateY(8px); } }

/* ----------------------------------------------------------------------------
   11. Tables (holdings / history)
   -------------------------------------------------------------------------- */
.tsb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tsb-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--bg-inset);
  white-space: nowrap;
}
.tsb-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums; /* aligned digit columns */
  white-space: nowrap;
}
.tsb-table tbody tr { transition: background-color var(--dur-fast) var(--ease-out); }
.tsb-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.tsb-table tr:last-child td { border-bottom: none; }

/* ----------------------------------------------------------------------------
   12. Confidence meter (analytics signals) — fill carries state, track is a
       darker step of the same ramp so the whole bar reads as one control
   -------------------------------------------------------------------------- */
.tsb-meter {
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}
.tsb-meter > span {
  display: block;
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--dur-slow) var(--ease-out);
}

/* ----------------------------------------------------------------------------
   13. Roadmap timeline (home)
   -------------------------------------------------------------------------- */
.tsb-timeline { position: relative; padding-left: 28px; }
.tsb-timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--edge-strong));
}
.tsb-timeline-dot {
  position: absolute;
  left: -28px; top: 4px;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-panel);
  border: 2px solid var(--accent);
}
.tsb-timeline-item--upcoming .tsb-timeline-dot { border-color: var(--text-muted); border-style: dashed; }

/* ----------------------------------------------------------------------------
   14. Chart tooltip (analytics canvas chart)
   -------------------------------------------------------------------------- */
.tsb-chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--bg-raised);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  white-space: nowrap;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 12px));
}

/* ----------------------------------------------------------------------------
   15. Mobile nav drawer
   -------------------------------------------------------------------------- */
#tsb-mobile-menu {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(300px, 84vw);
  z-index: 70;
  background: var(--bg-raised);
  border-left: 1px solid var(--edge-strong);
  box-shadow: var(--shadow-pop);
  transform: translateX(100%);
  transition: transform var(--dur-med) var(--ease-out);
  display: flex;
  flex-direction: column;
  padding: 20px;
}
#tsb-mobile-menu.is-open { transform: translateX(0); }
#tsb-mobile-backdrop {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(5, 7, 11, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out);
}
#tsb-mobile-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ----------------------------------------------------------------------------
   16. Fluid typography — page headings scale with the viewport instead of
       clipping (fix for headings cut off at laptop widths).
   -------------------------------------------------------------------------- */
.tsb-page-title   { font-size: clamp(1.15rem, 1rem + 1.2vw, 1.5rem); }
.tsb-hero-title   { font-size: clamp(2rem, 1.2rem + 4vw, 3.75rem); }
.tsb-section-title{ font-size: clamp(1.35rem, 1.1rem + 1.4vw, 1.875rem); }

/* ----------------------------------------------------------------------------
   17. HEADER — layout contract (fixes the clipping/overflow bug).
       The row is a flex container where every child may shrink (min-width:0);
       nothing is allowed to push past the viewport edge at 320–2560px.
   -------------------------------------------------------------------------- */
#tsb-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--edge);
  max-width: 100vw;
  overflow-x: clip;           /* belt-and-braces: header can never scroll the page sideways */
}
.tsb-header-row {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 60px;
  min-width: 0;               /* every flex child below may shrink */
}
.tsb-header-spacer { flex: 1 1 0; min-width: 8px; }

/* Brand: mark + wordmark + badge; wordmark/badge drop out at tiny widths */
.tsb-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}
.tsb-brand-mark {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-dim));
  color: #06252B;
}
.tsb-brand-word {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Nav links */
.tsb-desktop-nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tsb-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.tsb-nav-link:hover:not(.is-active):not(.is-disabled) { color: var(--text-primary); }
.tsb-nav-link.is-active { color: var(--accent); font-weight: 600; background: var(--accent-soft); }
.tsb-nav-link.is-disabled { color: var(--text-muted); cursor: not-allowed; }

/* Header BTC/ETH pills */
.tsb-desktop-tickers { display: flex; align-items: center; gap: 8px; flex-shrink: 1; min-width: 0; }
.tsb-hticker {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--edge);
  border-radius: var(--radius-md);
  background: var(--bg-inset);
  white-space: nowrap;
}
.tsb-hticker-sym { font-size: 11px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.03em; }
.tsb-hticker [data-role="price"] {
  display: inline-block;
  min-width: 64px;             /* CLS: reserve numeric slot before data */
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  border-radius: 4px; padding: 0 3px; text-align: right;
}
.tsb-hticker [data-role="change"] {
  display: inline-block;
  min-width: 48px;             /* CLS: 24h-change slot reserved */
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* Wallet button: always visible & tappable; collapses gracefully */
.tsb-wallet-wrap { position: relative; flex-shrink: 0; }
.tsb-wallet-btn { padding: 8px 13px; font-size: 13px; max-width: 180px; }
.tsb-wallet-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tsb-wallet-btn.is-connected { border-color: rgba(22, 199, 132, 0.45); color: var(--gain); }
.tsb-wallet-tip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(250px, calc(100vw - 32px)); /* never wider than the viewport */
  background: var(--bg-raised);
  border: 1px solid var(--edge-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
  z-index: 75;
}
.tsb-wallet-wrap:hover .tsb-wallet-tip,
.tsb-wallet-wrap:focus-within .tsb-wallet-tip { opacity: 1; }

.tsb-menu-btn { display: none; padding: 8px 10px; flex-shrink: 0; }

/* --- Header breakpoints (tested at 375 / 768 / 1024 / 1440) --------------- */
/* <1280px: hide the BTC/ETH pills — the tape below carries all prices */
@media (max-width: 1279px) {
  .tsb-desktop-tickers { display: none; }
}
/* <1024px: nav collapses into the hamburger drawer */
@media (max-width: 1023px) {
  .tsb-desktop-nav { display: none; }
  .tsb-menu-btn { display: inline-flex; }
}
/* <640px: wallet shrinks to icon (+ short address when connected) */
@media (max-width: 639px) {
  .tsb-wallet-btn { padding: 8px 10px; max-width: 120px; }
  .tsb-wallet-btn:not(.is-connected) .tsb-wallet-label { display: none; } /* icon-only until connected */
  .tsb-header-row { padding: 0 12px; gap: 8px; }
}
/* ≤400px: drop the wordmark text, keep the mark + badge */
@media (max-width: 400px) {
  .tsb-brand-word { display: none; }
}

/* ----------------------------------------------------------------------------
   18. TICKER TAPE — auto-scrolling strip under the header with all coins.
       Two copies of the cells + translateX(-50%) = seamless infinite loop.
       Paused on hover/focus (JS) and under prefers-reduced-motion (below).
       CLS: the tape row and each numeric slot have FIXED dimensions so live
       prices popping in never shift layout (Core Web Vitals: CLS < 0.1).
   -------------------------------------------------------------------------- */
.tsb-tape {
  height: 32px;                /* reserved before any data arrives */
  border-top: 1px solid var(--edge);
  overflow: hidden;
  background: var(--bg-raised);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.tsb-tape-track {
  display: inline-flex;
  align-items: center;
  height: 100%;
  white-space: nowrap;
  width: max-content;
  animation: tsbTape 60s linear infinite;
  will-change: transform;      /* keep the marquee off the layout path */
}
@keyframes tsbTape { to { transform: translateX(-50%); } }

.tsb-tape-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px;
  text-decoration: none;
  border-right: 1px solid var(--edge);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.tsb-tape-cell:hover { background: rgba(255, 255, 255, 0.03); }
.tsb-tape-sym { font-size: 11px; font-weight: 700; color: var(--text-secondary); letter-spacing: 0.04em; }
.tsb-tape-cell [data-role="price"] {
  display: inline-block;
  min-width: 58px;             /* CLS: slot width fixed before price arrives */
  font-size: 12.5px; font-weight: 600; color: var(--text-primary);
  font-variant-numeric: tabular-nums; border-radius: 4px; padding: 0 3px;
  text-align: right;
}
.tsb-tape-cell [data-role="change"] {
  display: inline-block;
  min-width: 52px;             /* CLS: 24h-change slot reserved too */
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tsb-tape-delayed {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--warn); border: 1px solid rgba(240, 185, 11, 0.35);
  border-radius: var(--radius-full); padding: 0 5px;
}

/* ----------------------------------------------------------------------------
   19. PRICING — plan cards, trial banner, premium lock overlay.
   -------------------------------------------------------------------------- */
.tsb-plan-card { position: relative; display: flex; flex-direction: column; }
.tsb-plan-card--popular { border-color: rgba(34, 211, 238, 0.45); box-shadow: 0 0 32px rgba(34, 211, 238, 0.12); }
.tsb-plan-flag {
  position: absolute;
  top: -11px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #06252B;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.tsb-plan-price { font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.4rem); font-weight: 800; }

/* Premium lock: veils gated content, invites upgrade — content stays in the
   DOM but inert (aria-hidden + pointer-events) so nothing "flashes" unlocked */
.tsb-locked { position: relative; }
.tsb-locked > .tsb-lock-veil {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 20px;
  background: rgba(11, 14, 20, 0.55);
  backdrop-filter: blur(7px);
  border-radius: inherit;
}

/* ----------------------------------------------------------------------------
   19b. AD SLOTS (free tier only — ads.js removes these for premium).
        Fixed reserved height comes from ads.js per format (CLS-safe).
   -------------------------------------------------------------------------- */
.tsb-ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--edge-strong);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  position: relative;
}
.tsb-ad-slot::before {
  content: 'Advertisement';
  position: absolute;
  top: 4px; left: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.tsb-ad-placeholder {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
  line-height: 1.5;
}

/* ----------------------------------------------------------------------------
   19c. LIVE TRADING — visual separation from the simulator: amber framing
        so real-funds surfaces can never be mistaken for paper trading.
   -------------------------------------------------------------------------- */
.tsb-live-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--warn-soft);
  border: 1px solid rgba(240, 185, 11, 0.45);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--warn);
  font-size: 13px;
  font-weight: 600;
}
.tsb-live-frame {
  border: 2px solid rgba(240, 185, 11, 0.5);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-panel);
  min-height: 560px;         /* reserved before the widget iframe loads (CLS) */
  position: relative;
}
.tsb-live-frame iframe {
  display: block;
  width: 100%;
  height: 560px;
  border: 0;
}

/* ----------------------------------------------------------------------------
   20. Reduced motion — kill non-essential animation, keep state changes.
       (Also stops the ticker tape marquee; prices still update in place.)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .tsb-tape-track { animation: none; }   /* tape sits still; prices still refresh */
}
