:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#191a1b;
  --text:#eceeec;
  --muted:#a1a7a3;
  --line:#383b39;
  --accent:#8ac6af;
  --soft:#252827;
}

:root[data-theme="dark"] body {background:#191a1b; color:var(--text);}
:root[data-theme="dark"] .header-inner,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .article-list,
:root[data-theme="dark"] .paper-list,
:root[data-theme="dark"] .search-group,
:root[data-theme="dark"] .archive-timeline,
:root[data-theme="dark"] .reading-column,
:root[data-theme="dark"] .filter-bar,
:root[data-theme="dark"] .write-card,
:root[data-theme="dark"] .stat-number,
:root[data-theme="dark"] .stat-panel,
:root[data-theme="dark"] .workspace-drafts {background:#212324; border-color:#383b39; box-shadow:0 4px 24px #00000020;}
:root[data-theme="dark"] .month-track {background:#343b3a;}
:root[data-theme="dark"] .month-track>span {background:#8ac6af;}
:root[data-theme="dark"] .copy-code {background:#292c2d; border-color:#454948; color:var(--text);}
:root[data-theme="dark"] .filter-bar button,
:root[data-theme="dark"] .search-large button {background:#39745d; color:#fff;}
:root[data-theme="dark"] .header-inner {background:rgba(31,33,34,.97);}
:root[data-theme="dark"] .nav-search {background:#292c2d;}
:root[data-theme="dark"] .nav-search input {color:var(--text);}
:root[data-theme="dark"] .theme-toggle {color:var(--text); background:#292c2d; border-color:#454948;}
:root[data-theme="dark"] .theme-toggle:hover {background:#343839; border-color:#626a66;}
:root[data-theme="dark"] .skip-link {background:#222526; color:var(--text);}
:root[data-theme="dark"] .menu-toggle {background:#292c2d; color:var(--text); border-color:#454948;}
:root[data-theme="dark"] .content-card,
:root[data-theme="dark"] .note-row,
:root[data-theme="dark"] .paper-row,
:root[data-theme="dark"] .draft-row {border-color:#383b39;}
:root[data-theme="dark"] .pinned-notes,
:root[data-theme="dark"] .garden-note,
:root[data-theme="dark"] .filter-bar select,
:root[data-theme="dark"] .search-large input {background:#282b2c; border-color:#3b403e;}
:root[data-theme="dark"] .profile-avatar {border-color:#212324;}
:root[data-theme="dark"] .topic-cloud a,
:root[data-theme="dark"] .feed-tabs .selected,
:root[data-theme="dark"] .entry-kind,
:root[data-theme="dark"] .tag-list li,
:root[data-theme="dark"] .status-pill {background:#303638; color:#b6d6ca;}
:root[data-theme="dark"] .garden-note p {color:#bdcbc5;}
:root[data-theme="dark"] .garden-note>span,
:root[data-theme="dark"] .archive-month h2 {color:#9bcab5;}
:root[data-theme="dark"] .cover-placeholder {background:linear-gradient(135deg,#303638,#262a2d); color:#c3cbc6;}
:root[data-theme="dark"] .metadata,
:root[data-theme="dark"] .related-posts,
:root[data-theme="dark"] .contact-line,
:root[data-theme="dark"] .spoiler,
:root[data-theme="dark"] .edit-entry {border-color:#383b39;}
:root[data-theme="dark"] .spoiler[open] summary {border-color:#383b39;}
:root[data-theme="dark"] .prose blockquote {color:#b6c0bb; border-color:#5a776a; background:#222725;}
:root[data-theme="dark"] .prose th {background:#292d2b;}
:root[data-theme="dark"] .prose th,
:root[data-theme="dark"] .prose td {border-color:#454a47;}
:root[data-theme="dark"] .prose pre,
:root[data-theme="dark"] .prose code {background:#25292a;}
:root[data-theme="dark"] input:not([type="hidden"]),
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] select {color:var(--text); background-color:#282b2c; border-color:#454a47;}
:root[data-theme="dark"] ::selection {background:#345344; color:#fff;}

:root[data-theme="dark"] .library-page {
  --library-bg:#191a1b;
  background:var(--library-bg);
  --accent:#8ac6af;
  --text:#eceeec;
  --muted:#a1a7a3;
  --line:#383b39;
  --soft:#252827;
}
:root[data-theme="dark"] .library-page .header-inner {background:#212324; border-color:#383b39;}
:root[data-theme="dark"] .collection-total {color:#d1d9d3; background:#303735;}
:root[data-theme="dark"] .library-tabs {border-color:#383b39;}
:root[data-theme="dark"] .collection-controls,
:root[data-theme="dark"] .library-gallery .game-card {background:#252626; border-color:#3d4140;}
:root[data-theme="dark"] .collection-controls select {color:#eceeec; background:#2b2d2d; border-color:#484c4b;}
:root[data-theme="dark"] .game-card-footer {border-color:#3b3e3d;}
:root[data-theme="dark"] .game-review p {color:#d2d5d2;}
:root[data-theme="dark"] .game-review p.muted {color:#9ba19d;}
:root[data-theme="dark"] .game-rating-value {color:#eceeec;}
:root[data-theme="dark"] .game-rating-track {background:#454947;}
:root[data-theme="dark"] .game-state {color:#d1d8d3; background:#414744;}
:root[data-theme="dark"] .game-state.state-completed {color:#fff; background:#267b50;}
:root[data-theme="dark"] .game-state.state-in_progress {color:#d6eaff; background:#264764;}
:root[data-theme="dark"] .game-state.state-paused {color:#f0d8c7; background:#554234;}
:root[data-theme="dark"] .collection-apply {background:#39745d;}
:root[data-theme="dark"] .collection-filter-toggle:hover {background:#303534;}

.theme-toggle {
  display:inline-flex;
  flex:0 0 38px;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#f1f4f8;
  color:#45535d;
  font-size:21px;
  line-height:1;
  transition:background-color .15s,border-color .15s;
}
.theme-toggle:hover {background:#e8edf1; border-color:#d5dde2;}

@media(max-width:600px) {
  .header-inner {position:relative;}
  .theme-toggle {position:absolute; top:17px; right:84px; width:34px; height:34px; flex-basis:34px;}
}
@media(prefers-reduced-motion:reduce) {
  .theme-toggle {transition:none;}
}
