/* Screenio light/dark theme ------------------------------------------------- */
/* Theme changes should be visually atomic. Individual controls keep their
   normal transitions at every other time. */
html.theme-changing *,
html.theme-changing *::before,
html.theme-changing *::after {
  transition-duration: 0s !important;
  transition-delay: 0s !important;
}

.theme-toggle {
  width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 8px 22px rgba(24, 46, 89, 0.08);
  cursor: pointer;
  transition: color .16s ease, background .16s ease, border-color .16s ease,
              box-shadow .16s ease, transform .16s ease;
}

.theme-toggle:hover:not(:disabled) {
  color: var(--blue-dark);
  border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  background: var(--blue-soft);
  box-shadow: 0 8px 20px rgba(47, 115, 241, 0.12);
  transform: translateY(-1px);
}

.theme-toggle:active:not(:disabled) {
  transform: translateY(0);
}

.theme-toggle:focus-visible {
  outline: 3px solid rgba(47, 115, 241, 0.24);
  outline-offset: 3px;
}

.theme-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }

.site-header > .theme-toggle {
  position: absolute;
  z-index: 6;
  top: 18px;
  right: 8px;
}

.content-header .theme-toggle {
  margin-left: 4px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1020;
  --surface: #121a2a;
  --surface-soft: #182235;
  --border: #27354a;
  --border-strong: #354760;
  --text: #edf3ff;
  --muted: #a4b1c5;
  --blue: #6b9cff;
  --blue-dark: #94b7ff;
  --blue-soft: #1a2b4a;
  --green: #40d98b;
  --red: #ff7580;
  --amber: #f2b64e;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 88% 4%, rgba(72, 132, 255, 0.14), transparent 24rem),
    linear-gradient(180deg, #0e1525 0%, var(--page) 100%);
}

html[data-theme="dark"] .theme-toggle {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .visual-window {
  border-color: #334866;
  background: rgba(18, 26, 42, 0.88);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .visual-window-body {
  background: linear-gradient(145deg, #18243a, #142033);
}

html[data-theme="dark"] .floating-chip {
  border-color: rgba(18, 26, 42, 0.96);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .mode-card,
html[data-theme="dark"] .setup-panel > #webcamPanel .webcam-control-card,
html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-position-btn,
html[data-theme="dark"] .secondary-button {
  background: var(--surface);
}

html[data-theme="dark"] .mode-card:hover,
html[data-theme="dark"] .secondary-button:hover:not(:disabled),
html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-position-btn:hover:not(:disabled) {
  background: #162239;
  border-color: #5579b3;
}

html[data-theme="dark"] .mode-card:has(input:checked) {
  background: linear-gradient(180deg, #16233a, #121c2e);
}

html[data-theme="dark"] .mode-card:has(input:checked) .selection-indicator {
  box-shadow: inset 0 0 0 4px var(--surface);
}

html[data-theme="dark"] .secondary-button,
html[data-theme="dark"] .stats-list dt,
html[data-theme="dark"] .format-note p,
html[data-theme="dark"] .content-nav a,
html[data-theme="dark"] .download-icon,
html[data-theme="dark"] .feature-number {
  color: var(--muted);
}

html[data-theme="dark"] .stats-list dd {
  color: var(--text);
}

html[data-theme="dark"] .stats-list > div {
  border-bottom-color: var(--border);
}

html[data-theme="dark"] #downloadLink {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #355784;
}

html[data-theme="dark"] #downloadLink:hover {
  background: #20375b;
  border-color: #4b72aa;
}

html[data-theme="dark"] .download-panel {
  border-color: var(--border-strong);
}

html[data-theme="dark"] .faq-list details,
html[data-theme="dark"] .long-faq details {
  background: var(--surface-soft);
}

html[data-theme="dark"] .article-cta {
  border-color: #304562;
  background: linear-gradient(145deg, #17243b, #132039);
}

html[data-theme="dark"] .browser-compatibility-notice {
  border-color: #765c27;
  background: #2b2417;
  color: #e6cf99;
}

html[data-theme="dark"] .browser-notice-icon {
  background: #4a3a18;
  color: #f0c96c;
}

html[data-theme="dark"] .browser-compatibility-notice strong {
  color: #f5deb0;
}

html[data-theme="dark"] .mobile-unsupported-notice {
  border-color: #355784;
  background: #15243d;
  color: #b9cff5;
}

html[data-theme="dark"] .mobile-unsupported-icon {
  background: #1d3457;
  color: var(--blue-dark);
}

html[data-theme="dark"] .mobile-unsupported-notice strong {
  color: #dbe9ff;
}

html[data-theme="dark"] .preview-state-label {
  background: #202c3e;
  color: var(--muted);
}

html[data-theme="dark"] .preview-state-label[data-state="live"],
html[data-theme="dark"] .preview-state-label[data-state="ready"] {
  background: #153525;
  color: #72e4a8;
}

html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-position-btn {
  color: #a8b7cc;
}

html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-position-btn[data-active="true"] {
  background: #182d4e;
  color: var(--blue-dark);
}

html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-reset-btn {
  border-color: #355784;
  background: var(--blue-soft);
  color: var(--blue-dark);
}

html[data-theme="dark"] .setup-panel > #webcamPanel .overlay-reset-btn:hover:not(:disabled) {
  border-color: #5279b5;
  background: #20375b;
}

html[data-theme="dark"] .consent-banner {
  border-color: var(--border-strong);
  background: rgba(18, 26, 42, 0.98);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] .consent-reject,
html[data-theme="dark"] .consent-settings-button {
  border-color: var(--border-strong);
  background: rgba(18, 26, 42, 0.98);
  color: var(--text);
}

html[data-theme="dark"] .consent-settings-button {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] #recorderStatus #stopBtn:disabled {
  color: #77869d;
  border-color: var(--border);
  background: #1b2535;
}

@media (max-width: 760px) {
  .site-header > .theme-toggle {
    top: 14px;
    right: 10px;
  }

  .site-header .brand-block {
    padding-right: 48px;
  }

  .content-header {
    position: relative;
    padding-right: 52px;
  }

  .content-header .theme-toggle {
    position: absolute;
    top: 12px;
    right: 0;
    margin: 0;
  }
}


/* Dark-mode secondary text consistency
   Use the same muted text color as feature-card copy throughout the site. */
html[data-theme="dark"] .seo-intro > p:last-child,
html[data-theme="dark"] .legal-content p,
html[data-theme="dark"] .legal-content li,
html[data-theme="dark"] .article-lead,
html[data-theme="dark"] .article-content > p,
html[data-theme="dark"] .article-content > ol,
html[data-theme="dark"] .article-content > ul,
html[data-theme="dark"] #webcamPanel .overlay-position-label {
  color: var(--muted);
}

/* Dark-mode secondary copy: use one consistent readable muted color. */
html[data-theme="dark"] .article-lead,
html[data-theme="dark"] .article-content > p,
html[data-theme="dark"] .article-content > ol,
html[data-theme="dark"] .article-content > ul,
html[data-theme="dark"] .faq-intro p,
html[data-theme="dark"] .faq-list details p,
html[data-theme="dark"] .long-faq details p,
html[data-theme="dark"] .seo-intro > p:last-child,
html[data-theme="dark"] .how-section > div > p:last-child,
html[data-theme="dark"] .feature-card p,
html[data-theme="dark"] .legal-content p,
html[data-theme="dark"] .legal-content li {
  color: var(--muted) !important;
}
