:root {
  --theme-toggle-bg: rgba(255, 255, 255, 0.025);
  --theme-toggle-bg-hover: rgba(255, 255, 255, 0.055);
  --theme-toggle-border: rgba(174, 195, 232, 0.22);
  --theme-toggle-border-hover: rgba(101, 151, 255, 0.48);
  --theme-toggle-ink: #d6dde9;
  --theme-toggle-ring: #6597ff;
}

html[data-theme="light"] {
  color-scheme: light;

  --c-canvas: #f6f8fc;
  --c-canvas-soft: #eef3f9;
  --c-surface: #ffffff;
  --c-surface-elevated: #ffffff;
  --c-surface-strong: #e7edf6;
  --c-line: rgba(35, 57, 88, 0.13);
  --c-line-soft: rgba(35, 57, 88, 0.085);
  --c-line-strong: rgba(35, 57, 88, 0.21);
  --c-edge: rgba(255, 255, 255, 0.84);
  --c-ink: #0b1728;
  --c-ink-soft: #24344d;
  --c-body: #4c5d73;
  --c-muted: #66758a;
  --c-faint: #8290a3;
  --c-primary: #2f6fed;
  --c-primary-hover: #1f5fce;
  --c-primary-active: #184daa;
  --c-primary-soft: rgba(47, 111, 237, 0.1);
  --c-cyan: #087f8c;
  --c-up: #0a8f69;
  --c-down: #c94b4b;

  --hc-canvas: #f6f8fc;
  --hc-canvas-soft: #eef3f9;
  --hc-surface: #ffffff;
  --hc-surface-elevated: #ffffff;
  --hc-surface-strong: #e7edf6;
  --hc-line: rgba(35, 57, 88, 0.13);
  --hc-line-soft: rgba(35, 57, 88, 0.085);
  --hc-line-strong: rgba(35, 57, 88, 0.21);
  --hc-edge: rgba(255, 255, 255, 0.84);
  --hc-ink: #0b1728;
  --hc-ink-soft: #24344d;
  --hc-body: #4c5d73;
  --hc-muted: #66758a;
  --hc-faint: #8290a3;
  --hc-primary: #2f6fed;
  --hc-primary-hover: #1f5fce;
  --hc-primary-active: #184daa;
  --hc-primary-soft: rgba(47, 111, 237, 0.1);
  --hc-cyan: #087f8c;
  --hc-cyan-soft: rgba(8, 127, 140, 0.1);
  --hc-teal: #0a8f69;
  --hc-teal-soft: rgba(10, 143, 105, 0.1);
  --hc-amber: #a96708;
  --hc-amber-soft: rgba(169, 103, 8, 0.1);
  --hc-red: #c94b4b;
  --hc-red-soft: rgba(201, 75, 75, 0.09);

  --canvas: #f6f8fc;
  --surface: #ffffff;
  --surface-strong: #eef3f9;
  --line: rgba(35, 57, 88, 0.13);
  --line-strong: rgba(35, 57, 88, 0.21);
  --ink: #0b1728;
  --body: #4c5d73;
  --muted: #66758a;
  --primary: #2f6fed;
  --primary-soft: rgba(47, 111, 237, 0.1);
  --green: #0a8f69;

  --bg: #f6f8fc;
  --surface-2: #ffffff;
  --surface-3: #e9eff7;
  --border: #dce4ef;
  --text: #0b1728;
  --text-muted: #66758a;
  --accent: #2f6fed;
  --accent-hover: #1f5fce;
  --accent-soft: rgba(47, 111, 237, 0.1);
  --pos: #087b61;
  --pos-soft: rgba(8, 123, 97, 0.1);
  --amber: #9a620d;
  --amber-soft: rgba(154, 98, 13, 0.1);
  --shadow-card: 0 1px 2px rgba(18, 40, 72, 0.04), 0 16px 44px rgba(18, 40, 72, 0.07);

  --theme-toggle-bg: rgba(255, 255, 255, 0.86);
  --theme-toggle-bg-hover: #ffffff;
  --theme-toggle-border: rgba(35, 57, 88, 0.17);
  --theme-toggle-border-hover: rgba(47, 111, 237, 0.5);
  --theme-toggle-ink: #33445d;
  --theme-toggle-ring: #2f6fed;
}

.theme-toggle {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--theme-toggle-border);
  border-radius: 12px;
  background: var(--theme-toggle-bg);
  color: var(--theme-toggle-ink);
  cursor: pointer;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms cubic-bezier(0.2, 0.72, 0.2, 1);
}

.theme-toggle:hover {
  border-color: var(--theme-toggle-border-hover);
  background: var(--theme-toggle-bg-hover);
  color: var(--theme-toggle-ring);
  box-shadow: 0 8px 22px rgba(22, 54, 104, 0.1);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--theme-toggle-ring);
  outline-offset: 3px;
}

.theme-toggle-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

html[data-theme="light"] .theme-toggle-sun,
html[data-theme="dark"] .theme-toggle-moon {
  display: none;
}

.theme-toggle-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Main website and download page */

html[data-theme="light"] .site-header {
  background: rgba(246, 248, 252, 0.76);
}

html[data-theme="light"] .site-header.is-scrolled {
  background: rgba(246, 248, 252, 0.92);
  box-shadow: 0 12px 34px rgba(20, 44, 78, 0.09);
}

html[data-theme="light"] .site-nav a:hover,
html[data-theme="light"] .header-link:hover,
html[data-theme="light"] .menu-toggle:hover {
  background: rgba(47, 111, 237, 0.07);
}

html[data-theme="light"] .menu-toggle {
  background: rgba(255, 255, 255, 0.76);
}

html[data-theme="light"] .hero::before {
  background:
    radial-gradient(ellipse at 20% 18%, rgba(49, 150, 185, 0.15), transparent 56%),
    radial-gradient(ellipse at 82% 28%, rgba(74, 105, 210, 0.12), transparent 58%),
    linear-gradient(180deg, #f9fbff 0%, var(--c-canvas) 82%);
}

html[data-theme="light"] .hero h1 span {
  background: linear-gradient(100deg, #0b1728 0%, #183a5b 50%, #087f8c 100%);
  background-clip: text;
  color: #0b1728;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-theme="light"] .hero-copy .hero-actions .button-secondary {
  border-color: rgba(35, 57, 88, 0.18);
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 12px 28px rgba(20, 44, 78, 0.09);
  color: var(--c-ink-soft);
}

html[data-theme="light"] .hero-copy .hero-actions .button-secondary:hover {
  border-color: rgba(47, 111, 237, 0.38);
  background: #ffffff;
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 16px 34px rgba(20, 44, 78, 0.12);
}

html[data-theme="light"] .hero-story-label {
  border-color: rgba(47, 111, 237, 0.2);
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 111, 237, 0.11), transparent 48%),
    rgba(255, 255, 255, 0.94);
  box-shadow:
    0 14px 34px rgba(20, 44, 78, 0.09),
    inset 0 1px 0 #ffffff;
}

html[data-theme="light"] .loop-steps li,
html[data-theme="light"] #mode-panel-check > .mode-copy,
html[data-theme="light"] #mode-panel-signal > .mode-copy,
html[data-theme="light"] #mode-panel-backtest > .mode-copy,
html[data-theme="light"] .feature-card,
html[data-theme="light"] .comparison-table-wrap,
html[data-theme="light"] .download-platform-card,
html[data-theme="light"] .download-platform-mac,
html[data-theme="light"] .download-release {
  border-color: var(--c-line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 254, 0.98)),
    var(--c-surface);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 18px 52px rgba(20, 44, 78, 0.08);
}

html[data-theme="light"] .loop-steps li::after {
  background: linear-gradient(180deg, rgba(47, 111, 237, 0.16), rgba(47, 111, 237, 0.03));
  background-clip: text;
  -webkit-background-clip: text;
}

html[data-theme="light"] .loop-step-icon {
  border-color: rgba(47, 111, 237, 0.2);
  background: rgba(47, 111, 237, 0.08);
  box-shadow: none;
  color: #2f6fed;
}

html[data-theme="light"] .loop-steps p {
  color: var(--c-muted);
}

html[data-theme="light"] .mode-panel,
html[data-theme="light"] .capability-panel {
  box-shadow: 0 24px 70px rgba(20, 44, 78, 0.1);
}

html[data-theme="light"] .feature-card-content {
  border-top-color: var(--c-line);
}

html[data-theme="light"] .feature-card-tag,
html[data-theme="light"] .feature-platform-icons,
html[data-theme="light"] .commerce-plan-badge-pro,
html[data-theme="light"] .download-release-latest,
html[data-theme="light"] .download-release-tag {
  color: #245fc7;
}

html[data-theme="light"] .comparison-feature-head,
html[data-theme="light"] .comparison-table tbody th {
  background: #f5f8fc;
}

html[data-theme="light"] .comparison-plan-head,
html[data-theme="light"] .comparison-table tbody td,
html[data-theme="light"] .comparison-table tfoot th,
html[data-theme="light"] .comparison-table tfoot td {
  background: #ffffff;
}

html[data-theme="light"] .comparison-plan-pro,
html[data-theme="light"] .comparison-table tbody td:last-child,
html[data-theme="light"] .comparison-table tfoot td:last-child {
  background:
    linear-gradient(90deg, rgba(47, 111, 237, 0.055), rgba(47, 111, 237, 0.1)),
    #f7faff;
}

html[data-theme="light"] .comparison-status.is-yes {
  color: #087b61;
}

html[data-theme="light"] .download-page {
  background:
    linear-gradient(180deg, rgba(225, 235, 248, 0.65), transparent 32%),
    var(--c-canvas-soft);
}

html[data-theme="light"] .download-platform-icon,
html[data-theme="light"] .download-release-latest {
  color: #2f6fed;
}

html[data-theme="light"] .download-platform-mac .download-platform-icon {
  color: #087f8c;
}

html[data-theme="light"] .support-card:hover {
  background: rgba(47, 111, 237, 0.045);
}

html[data-theme="light"] .site-footer {
  background: #eaf0f7;
}

/* Help center */

html[data-theme="light"] .hc-header {
  background: rgba(246, 248, 252, 0.92);
}

html[data-theme="light"] .hc-header-nav a:hover,
html[data-theme="light"] .hc-support-link:hover,
html[data-theme="light"] .hc-side-nav a:hover,
html[data-theme="light"] .hc-featured-article:hover,
html[data-theme="light"] .hc-home-category-row:hover,
html[data-theme="light"] a.hc-article-row:hover {
  background: rgba(47, 111, 237, 0.055);
}

html[data-theme="light"] .hc-menu-button,
html[data-theme="light"] .hc-button-secondary,
html[data-theme="light"] .hc-pill,
html[data-theme="light"] .hc-category-card-count,
html[data-theme="light"] .hc-feedback button {
  background: rgba(255, 255, 255, 0.8);
}

html[data-theme="light"] .hc-home-hero {
  background:
    radial-gradient(ellipse at 20% 12%, rgba(49, 150, 185, 0.14), transparent 56%),
    radial-gradient(ellipse at 82% 28%, rgba(74, 105, 210, 0.11), transparent 58%),
    linear-gradient(180deg, #f9fbff 0%, var(--hc-canvas) 88%);
}

html[data-theme="light"] .hc-search-field,
html[data-theme="light"] .hc-help-center .hc-home-hero .hc-search-field,
html[data-theme="light"] .hc-search-results,
html[data-theme="light"] .hc-search-dialog {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 22px 54px rgba(20, 44, 78, 0.11);
}

html[data-theme="light"] .hc-search-dialog::backdrop {
  background: rgba(26, 42, 66, 0.28);
}

html[data-theme="light"] .hc-home-category-tile {
  border-color: var(--hc-line);
  background:
    linear-gradient(145deg, rgba(47, 111, 237, 0.028), transparent 48%),
    var(--hc-surface);
  box-shadow: 0 10px 30px rgba(20, 44, 78, 0.04);
}

html[data-theme="light"] .hc-home-category-visual {
  border-color: rgba(47, 111, 237, 0.13);
  background: rgba(47, 111, 237, 0.075);
  color: var(--hc-primary);
}

html[data-theme="light"] .hc-home-category-tile:hover {
  border-color: var(--hc-line-strong);
  background-color: var(--hc-surface);
  box-shadow: 0 16px 38px rgba(20, 44, 78, 0.09);
}

html[data-theme="light"] .hc-home-category-tile:hover .hc-home-category-visual {
  border-color: rgba(47, 111, 237, 0.22);
  background: rgba(47, 111, 237, 0.12);
  color: var(--hc-primary-hover);
}

html[data-theme="light"] .hc-category-card {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(20, 44, 78, 0.055);
}

html[data-theme="light"] .hc-category-card[data-tone="cyan"] {
  --hc-card-ink: #087f8c;
}

html[data-theme="light"] .hc-category-card[data-tone="teal"] {
  --hc-card-ink: #087b61;
}

html[data-theme="light"] .hc-category-card[data-tone="amber"] {
  --hc-card-ink: #9a620d;
}

html[data-theme="light"] .hc-category-card[data-tone="indigo"] {
  --hc-card-ink: #5b55c7;
}

html[data-theme="light"] .hc-media-icon,
html[data-theme="light"] .hc-media-file,
html[data-theme="light"] .hc-media-badge {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .hc-help-center .hc-callout {
  background: rgba(47, 111, 237, 0.045);
}

html[data-theme="light"] .hc-footer {
  background: #eaf0f7;
}

/* Policy and support pages */

html[data-theme="light"] body:has(.legal-header) {
  background:
    radial-gradient(circle at 18% 2%, rgba(49, 150, 185, 0.1), transparent 32rem),
    radial-gradient(circle at 88% 10%, rgba(74, 105, 210, 0.08), transparent 36rem),
    var(--canvas);
}

html[data-theme="light"] body:has(.legal-header)::before {
  background-image:
    linear-gradient(rgba(44, 75, 113, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 75, 113, 0.035) 1px, transparent 1px);
}

html[data-theme="light"] .legal-header {
  background: rgba(246, 248, 252, 0.9);
}

html[data-theme="light"] .language-switch {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

html[data-theme="light"] .legal-document,
html[data-theme="light"] .support-panel {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 68px rgba(20, 44, 78, 0.08);
}

html[data-theme="light"] .legal-copy h3,
html[data-theme="light"] .legal-note {
  color: var(--ink);
}

html[data-theme="light"] .legal-copy a,
html[data-theme="light"] .support-panel-action,
html[data-theme="light"] .support-faq-item a {
  color: #1f5fce;
}

/* Changelog */

html[data-theme="light"] .changelog-body {
  background:
    linear-gradient(180deg, rgba(225, 235, 248, 0.68), transparent 30%),
    var(--c-canvas-soft);
}

html[data-theme="light"] .changelog-body .light-only {
  display: initial;
}

html[data-theme="light"] .changelog-body .dark-only {
  display: none;
}

html[data-theme="light"] .changelog-site-header {
  background: rgba(246, 248, 252, 0.78);
}

html[data-theme="light"] .changelog-site-header.is-scrolled {
  background: rgba(246, 248, 252, 0.94);
  box-shadow: 0 12px 34px rgba(20, 44, 78, 0.09);
}

html[data-theme="light"] .changelog-nav a:hover,
html[data-theme="light"] .changelog-language-toggle:hover,
html[data-theme="light"] .changelog-back:hover {
  background: rgba(47, 111, 237, 0.07);
}

html[data-theme="light"] .changelog-language-toggle,
html[data-theme="light"] .changelog-back {
  background: rgba(255, 255, 255, 0.82);
}

html[data-theme="light"] .changelog-body .release,
html[data-theme="light"] .changelog-body .release:first-child {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.99), rgba(247, 250, 254, 0.99)),
    var(--c-surface);
  box-shadow: 0 18px 52px rgba(20, 44, 78, 0.075);
}

html[data-theme="light"] .changelog-body .release-head .latest,
html[data-theme="light"] .changelog-body .tag {
  color: #245fc7;
}

html[data-theme="light"] .changelog-body .tag-improve {
  color: #95610e;
}

html[data-theme="light"] .changelog-body .tag-fix {
  color: #087b61;
}

@media (max-width: 800px) {
  .theme-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .hc-header-actions {
    display: flex;
  }

  html[data-theme="light"] .hc-header-nav {
    background: rgba(246, 248, 252, 0.99);
  }

  html[data-theme="light"] .site-nav {
    background: rgba(246, 248, 252, 0.99);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none;
  }
}
