:root[data-theme="dark"] {
  color-scheme: dark;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255,255,255,.035);
  color: var(--text);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255,255,255,.07);
}
.theme-toggle [data-theme-icon] {
  display: block;
  line-height: 1;
  font-size: 1rem;
  transform-origin: center;
  transition: transform .2s ease;
}
.theme-toggle:hover [data-theme-icon] { transform: rotate(10deg); }

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f2;
  --bg-elevated: #eef1e8;
  --panel: #ffffff;
  --panel-2: #f2f4ed;
  --panel-3: #e7ebe1;
  --text: #161a13;
  --muted: #5d6556;
  --muted-2: #7b8374;
  --line: rgba(22, 26, 19, .12);
  --line-strong: rgba(22, 26, 19, .24);
  --accent: #668500;
  --accent-soft: rgba(102, 133, 0, .13);
  --danger: #a53f3f;
  --shadow: 0 24px 70px rgba(45, 55, 36, .12);
}

:root[data-theme="light"] body.skill-page {
  --accent: color-mix(in srgb, var(--skill-accent, #668500) 66%, #202914);
  --accent-soft: color-mix(in srgb, var(--skill-accent, #668500) 14%, transparent);
}

:root[data-theme="light"] ::selection {
  background: var(--accent);
  color: #ffffff;
}

:root[data-theme="light"] body::before {
  background:
    linear-gradient(rgba(22,26,19,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(22,26,19,.035) 1px, transparent 1px);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.72), transparent 78%);
}
:root[data-theme="light"] body::after {
  background: radial-gradient(circle, rgba(132, 170, 17, .13) 0, rgba(132, 170, 17, .045) 38%, transparent 70%);
}
:root[data-theme="light"] .topbar::before {
  background: rgba(246, 247, 242, .82);
}
:root[data-theme="light"] .language-switch,
:root[data-theme="light"] .status-badge,
:root[data-theme="light"] .quiet-badge,
:root[data-theme="light"] .panel-version,
:root[data-theme="light"] .policy-badge,
:root[data-theme="light"] .product-chip,
:root[data-theme="light"] .pill {
  background: rgba(22,26,19,.035);
}
:root[data-theme="light"] .theme-toggle {
  background: rgba(255,255,255,.72);
}
:root[data-theme="light"] .theme-toggle:hover {
  background: #ffffff;
}
:root[data-theme="light"] .button {
  background: rgba(22,26,19,.035);
}
:root[data-theme="light"] .button:hover {
  background: rgba(22,26,19,.065);
}
:root[data-theme="light"] .button-primary,
:root[data-theme="light"] .button-primary:hover,
:root[data-theme="light"] .language-switch .button.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}
:root[data-theme="light"] .lede,
:root[data-theme="light"] .detail-description {
  color: var(--muted);
}
:root[data-theme="light"] .hero-panel {
  background: linear-gradient(180deg, #ffffff, rgba(250,251,247,.84));
}
:root[data-theme="light"] .source-flow span {
  background: rgba(22,26,19,.045);
}
:root[data-theme="light"] .search input {
  background: rgba(255,255,255,.86);
}
:root[data-theme="light"] .search input:focus {
  background: #ffffff;
  border-color: color-mix(in srgb, var(--accent) 56%, transparent);
}
:root[data-theme="light"] .search-clear {
  background: rgba(22,26,19,.055);
}
:root[data-theme="light"] .search-clear:hover {
  background: rgba(22,26,19,.1);
}
:root[data-theme="light"] .skill-card {
  background: linear-gradient(180deg, #ffffff, rgba(249,250,246,.86));
}
:root[data-theme="light"] .skill-card:hover {
  background: linear-gradient(180deg, #ffffff, #f4f6ef);
  box-shadow: 0 18px 44px rgba(45,55,36,.12);
}
:root[data-theme="light"] .policy-badge {
  color: var(--muted);
}
:root[data-theme="light"] .usage-steps article {
  background: rgba(255,255,255,.56);
}
:root[data-theme="light"] .repo-cta {
  background: linear-gradient(135deg, rgba(102,133,0,.1), rgba(255,255,255,.88) 56%);
}
:root[data-theme="light"] .action-card {
  background: linear-gradient(180deg, #ffffff, rgba(249,250,246,.86));
}
:root[data-theme="light"] .command pre,
:root[data-theme="light"] .markdown pre {
  background: #eef1e9;
  color: #22271e;
}
:root[data-theme="light"] .copy-button {
  background: var(--panel-2);
}
:root[data-theme="light"] .markdown code {
  background: rgba(22,26,19,.07);
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle,
  .theme-toggle [data-theme-icon] {
    transition: none;
  }
}
