.ts-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border, rgba(0, 0, 0, 0.12));
  background: rgba(255, 255, 255, 0.72);
  color: var(--text, rgba(0, 0, 0, 0.9));
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ts-theme-toggle:focus,
.ts-theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.7), 0 0 0 4px rgba(56, 189, 248, 0.18), 0 0 22px rgba(59, 130, 246, 0.22);
}

.ts-theme-toggle__icon,
.theme-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 16px;
  line-height: 1;
}

html[data-theme="dark"] {
  --bg: #0b1220;
  --bg-soft: rgba(255, 255, 255, 0.06);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.14);
  --primary: #7c5cff;
  --primary-2: #35d6ff;
  --focus: rgba(124, 92, 255, 0.5);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] body {
  background: var(--bg);
}

html[data-theme="dark"] body::before {
  background: radial-gradient(1200px 680px at 12% 4%, rgba(124, 92, 255, 0.24), transparent 58%),
    radial-gradient(980px 640px at 88% 14%, rgba(53, 214, 255, 0.2), transparent 62%),
    radial-gradient(1200px 900px at 50% 120%, rgba(86, 243, 166, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(11, 18, 32, 1) 0%, rgba(11, 18, 32, 1) 70%, rgba(11, 18, 32, 1) 100%);
}

html[data-theme="dark"] header.site-header {
  background: rgba(11, 18, 32, 0.78);
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .logo {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 18px rgba(124, 92, 255, 0.22);
}

html[data-theme="dark"] .navlinks a {
  color: var(--muted);
}
html[data-theme="dark"] .navlinks a:hover {
  color: var(--text);
}

html[data-theme="dark"] .btn,
html[data-theme="dark"] .iconbtn,
html[data-theme="dark"] .pill {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="dark"] .iconbtn {
  border-color: rgba(147, 197, 253, 0.22);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.16), 0 0 18px rgba(56, 189, 248, 0.16);
}
html[data-theme="dark"] .iconbtn:hover {
  border-color: rgba(147, 197, 253, 0.32);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.22), 0 0 26px rgba(56, 189, 248, 0.22);
}
html[data-theme="dark"] .iconbtn:active {
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18), 0 0 18px rgba(56, 189, 248, 0.16);
}
html[data-theme="dark"] .iconbtn:focus,
html[data-theme="dark"] .iconbtn:focus-visible {
  outline: none;
  border-color: rgba(147, 197, 253, 0.42);
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.46), 0 0 0 4px rgba(56, 189, 248, 0.2), 0 0 26px rgba(56, 189, 248, 0.24);
}

html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn-primary {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.95), rgba(53, 214, 255, 0.75));
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

html[data-theme="dark"] .pill[aria-pressed="true"] {
  border-color: rgba(124, 92, 255, 0.45);
  background: rgba(124, 92, 255, 0.18);
  color: var(--text);
}

html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .tool-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .result,
html[data-theme="dark"] details {
  background: rgba(15, 23, 42, 0.72);
  border-color: var(--border);
}
html[data-theme="dark"] .tool-card:hover {
  border-color: rgba(147, 197, 253, 0.28);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.16), 0 0 26px rgba(56, 189, 248, 0.18), var(--shadow);
}
html[data-theme="dark"] .tool-card:focus {
  outline: none;
}
html[data-theme="dark"] .tool-card:focus-visible {
  border-color: rgba(147, 197, 253, 0.38);
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.44), 0 0 0 4px rgba(56, 189, 248, 0.2), 0 0 28px rgba(56, 189, 248, 0.22), var(--shadow);
}

html[data-theme="dark"] .kv {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--border);
}

html[data-theme="dark"] .ad-slot {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--muted);
}

html[data-theme="dark"] .modal {
  background: linear-gradient(180deg, rgba(37, 43, 66, 0.96), rgba(37, 43, 66, 0.9));
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 36px rgba(255, 200, 150, 0.14), 0 0 90px rgba(255, 140, 60, 0.18), 0 18px 55px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] .modal-head {
  background: linear-gradient(to bottom, rgba(11, 18, 32, 0.92), rgba(11, 18, 32, 0.65));
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .modal-backdrop {
  background: rgba(10, 15, 30, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

html[data-theme="dark"] .help-drawer {
  background: linear-gradient(180deg, rgba(37, 43, 66, 0.96), rgba(37, 43, 66, 0.92));
  border-left-color: rgba(255, 255, 255, 0.12);
  box-shadow: -16px 0 55px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .help-head {
  background: linear-gradient(to bottom, rgba(11, 18, 32, 0.92), rgba(11, 18, 32, 0.65));
  border-bottom-color: var(--border);
}
html[data-theme="dark"] .help-section {
  background: rgba(15, 23, 42, 0.72);
  border-color: var(--border);
}
html[data-theme="dark"] .help-faq details {
  background: rgba(0, 0, 0, 0.16);
  border-color: var(--border);
}
html[data-theme="dark"] .help-actions a {
  background: rgba(0, 0, 0, 0.16);
  border-color: var(--border);
  color: rgba(255, 255, 255, 0.86);
}
html[data-theme="dark"] .guide-card,
html[data-theme="dark"] .guide-box,
html[data-theme="dark"] .guide-faq .faq-items details {
  background: rgba(15, 23, 42, 0.72);
  border-color: var(--border);
}
html[data-theme="dark"] .guide-link,
html[data-theme="dark"] .guide-help {
  background: rgba(0, 0, 0, 0.18);
  border-color: var(--border);
  color: rgba(255, 255, 255, 0.9);
}
html[data-theme="dark"] .guide-mark {
  background: rgba(124, 92, 255, 0.18);
  border-color: rgba(124, 92, 255, 0.25);
}

html[data-theme="dark"] .input {
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  border-color: var(--border);
}

html[data-theme="dark"] footer.site-footer {
  background: transparent;
  border-top-color: var(--border);
}
