:root {
  --site-toggle-bg: rgba(255, 255, 255, 0.9);
  --site-toggle-text: #17202a;
  --site-toggle-border: rgba(220, 227, 232, 0.95);
  --site-toggle-hover: #eef4f6;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --site-toggle-bg: rgba(18, 27, 34, 0.88);
  --site-toggle-text: #eef4f8;
  --site-toggle-border: rgba(70, 85, 96, 0.72);
  --site-toggle-hover: rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-soft: #eef4f6;
  --line: #dce3e8;
  --text: #17202a;
  --muted: #64707d;
  --cyan: #0f766e;
  --green: #0f766e;
  --amber: #b45309;
  --rose: #be123c;
  --shadow: 0 18px 48px rgba(23, 32, 42, 0.1);
  --color-link: #334155;
  --color-link-hover: #0f766e;
  --color-enter: #17202a;
  --color-title: #17202a;
  --color-content: #eef4f6;
}

body {
  position: relative;
  z-index: 0;
  isolation: isolate;
}

body,
.topbar,
.profile-panel,
.composer-panel,
.post-card,
.quick-panel,
.manage-login,
.manage-header,
.manage-card,
.manage-stats .stat,
.empty-state,
input,
textarea,
select,
.comment,
.hot-post,
.project-details,
.site-theme-toggle {
  transition:
    background-color 260ms ease,
    color 260ms ease,
    border-color 260ms ease,
    box-shadow 260ms ease;
}

.site-theme-transition,
.theme-transition-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background: #05070a;
  clip-path: circle(0 at 0 0);
  will-change: clip-path, opacity;
  transition:
    clip-path 680ms cubic-bezier(0.72, 0, 0.22, 1),
    opacity 180ms ease;
}

.site-theme-transition.is-active,
.theme-transition-overlay.is-active {
  opacity: 1;
  clip-path: circle(150vmax at 0 0);
}

.site-theme-transition.is-fading,
.theme-transition-overlay.is-fading {
  opacity: 0;
  transition: opacity 260ms ease;
}

.site-theme-toggle,
.theme-toggle {
  min-width: 78px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  flex: 0 0 auto;
  border: 1px solid var(--site-toggle-border);
  border-radius: 8px;
  background: var(--site-toggle-bg);
  color: var(--site-toggle-text);
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.08);
  font: inherit;
  line-height: 1;
}

.site-theme-toggle {
  cursor: pointer;
}

.site-theme-toggle:hover,
.site-theme-toggle:focus-visible,
.theme-toggle:hover,
.theme-toggle:focus-visible {
  background: var(--site-toggle-hover);
  outline: none;
}

.site-theme-toggle-floating {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 220;
}

.nav-links .site-theme-toggle,
.nav-actions .site-theme-toggle {
  margin-left: 0.35rem;
}

.topbar > .site-theme-toggle {
  margin-left: auto;
}

.site-theme-icon,
.site-theme-toggle .moon-icon,
.site-theme-toggle .sun-icon,
.theme-toggle .moon-icon,
.theme-toggle .sun-icon {
  font-size: 18px;
}

.site-theme-toggle-text,
.theme-toggle .theme-toggle-text {
  font-size: 13px;
  font-weight: 800;
}

.site-theme-sun,
.site-theme-toggle .sun-icon,
.theme-toggle .sun-icon {
  display: none;
}

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

html[data-theme="dark"] .site-theme-sun,
html[data-theme="dark"] .site-theme-toggle .sun-icon,
html[data-theme="dark"] .theme-toggle .sun-icon {
  display: inline;
}

html.theme-is-switching .site-theme-toggle,
html.theme-is-switching .theme-toggle {
  cursor: progress;
}

html[data-theme="light"] body {
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 118, 110, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--text);
}

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

html[data-theme="light"] .brand-mark {
  background: var(--text);
  color: #fff;
}

html[data-theme="light"] .nav-links a {
  color: var(--muted);
}

html[data-theme="light"] .nav-links a:hover {
  color: var(--text);
}

html[data-theme="light"] .profile-panel,
html[data-theme="light"] .composer-panel,
html[data-theme="light"] .post-card,
html[data-theme="light"] .quick-panel,
html[data-theme="light"] .manage-login,
html[data-theme="light"] .manage-header,
html[data-theme="light"] .manage-card,
html[data-theme="light"] .manage-stats .stat,
html[data-theme="light"] .empty-state {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .markdown-preview,
html[data-theme="light"] .format-preview span,
html[data-theme="light"] .manage-post,
html[data-theme="light"] .comment-form,
html[data-theme="light"] .comment,
html[data-theme="light"] .comment-card,
html[data-theme="light"] .hot-post,
html[data-theme="light"] .project-details,
html[data-theme="light"] .markdown-body pre,
html[data-theme="light"] .markdown-body code,
html[data-theme="light"] .markdown-body img {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line);
}

html[data-theme="light"] .profile-name-display h1,
html[data-theme="light"] .markdown-body h2,
html[data-theme="light"] .markdown-body h3,
html[data-theme="light"] .markdown-body h4,
html[data-theme="light"] .markdown-body a,
html[data-theme="light"] .post-body,
html[data-theme="light"] .comment-body,
html[data-theme="light"] .manage-post p {
  color: var(--text);
}

html[data-theme="light"] .tag,
html[data-theme="light"] .download-link {
  background: #ecfdf5;
  color: var(--green);
  border-color: rgba(15, 118, 110, 0.22);
}

html[data-theme="light"] .hot-rank {
  background: #fff7ed;
  color: var(--amber);
}

html[data-theme="light"] .avatar-badge {
  background: #ecfdf5;
  color: var(--green);
}

html[data-theme="light"] .primary-btn {
  background: var(--cyan);
  color: #fff;
}

html[data-theme="light"] .primary-btn:hover {
  background: #0c4f4a;
}

html[data-theme="light"] .ghost-btn,
html[data-theme="light"] .tab-btn,
html[data-theme="light"] .action-btn,
html[data-theme="light"] .avatar-upload {
  background: var(--panel-soft);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="light"] .content,
html[data-theme="light"] .content-main {
  background: radial-gradient(#ffffff, #dce8ef);
}

html[data-theme="light"] .content-intro .content-inner {
  background: var(--color-content);
}

html[data-theme="light"] .shape {
  fill: var(--color-content);
}

html[data-theme="light"] #background {
  opacity: 0.2;
}

html[data-theme="light"] .content-title,
html[data-theme="light"] .content-subtitle,
html[data-theme="light"] #card .card-inner header h1,
html[data-theme="light"] #card .card-inner header h2,
html[data-theme="light"] #card .card-inner ul li a {
  color: var(--text);
  text-shadow: none;
}

html[data-theme="light"] #card .card-inner header,
html[data-theme="light"] #card .card-inner ul,
html[data-theme="light"] #card .card-inner ul li {
  border-color: rgba(23, 32, 42, 0.12);
}

html[data-theme="dark"] #container_head,
html[data-theme="dark"] #div_tail {
  background: #121b22;
  border-color: #2c3a44;
  color: #eef4f8;
}

html[data-theme="dark"] #div_body {
  background: #0b1117;
  color: #eef4f8;
}

html[data-theme="dark"] #div_leftmenu,
html[data-theme="dark"] #div_body_mid,
html[data-theme="dark"] #div_profile,
html[data-theme="dark"] #div_visitors,
html[data-theme="dark"] #div_message,
html[data-theme="dark"] #div_favorites {
  background: #121b22;
  border-color: #2c3a44;
}

html[data-theme="dark"] #input_search,
html[data-theme="dark"] #input_write {
  background: #0f172a;
  color: #eef4f8;
  border-color: #2c3a44;
}

html[data-theme="dark"] .li_leftmenu.li_deepcolor {
  background: #1b2932;
}

html[data-theme="dark"] #div_tail p,
html[data-theme="dark"] .span_comment_time,
html[data-theme="dark"] #div_visitors span,
html[data-theme="dark"] #div_favorites span {
  color: #9fb0be;
}

@media (max-width: 560px) {
  .site-theme-toggle-floating {
    top: 10px;
    right: 10px;
  }

  .site-theme-toggle,
  .theme-toggle {
    min-width: 72px;
    height: 40px;
    padding: 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-theme-transition,
  .theme-transition-overlay {
    transition: none !important;
  }
}
