:root { color-scheme: dark; }
html[data-effective-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f9;
  --panel: #ffffff;
  --panel-2: #edf2f5;
  --panel-3: #e7edf1;
  --border: #cbd6dc;
  --border-strong: #aebdc5;
  --text: #17252d;
  --muted: #5b6c76;
  --accent: #2878c8;
  --accent-soft: rgba(40, 120, 200, .10);
  --accent-strong: #1f67ad;
}

.theme-switcher {
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--admin-line-strong, var(--preview-line-strong, var(--border-strong, rgba(194, 215, 225, .22))));
  border-radius: 8px;
  background: var(--ui-panel-soft, var(--preview-panel-soft, var(--panel-2, rgba(194, 215, 225, .05))));
  vertical-align: middle;
}
.theme-switcher button {
  min-height: 28px;
  border: 0;
  border-right: 1px solid var(--admin-line, var(--preview-line, var(--border, rgba(194, 215, 225, .12))));
  background: transparent;
  color: var(--admin-muted, var(--preview-muted, var(--muted, #8fa1ab)));
  padding: 3px 7px;
  cursor: pointer;
  font: 760 9px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.theme-switcher button:last-child { border-right: 0; }
.theme-switcher button[aria-pressed="true"] {
  background: var(--ui-hover, var(--accent-soft, rgba(104, 170, 248, .10)));
  color: var(--admin-text, var(--preview-text, var(--text, #e8f0f3)));
  box-shadow: inset 0 -2px 0 var(--tone-info, var(--preview-info, var(--accent, #68aaf8)));
}
.theme-switcher button:focus-visible { position: relative; z-index: 1; outline: 2px solid var(--tone-info, var(--accent, #68aaf8)); outline-offset: -2px; }

.nav > .testing-user-name {
  position: absolute;
  top: 50%;
  right: 24px;
  width: max-content;
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform: translateY(-50%);
}

.patreon-report-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(100% - 40px, 1320px);
  margin: 12px auto;
  border: 1px solid rgba(221, 214, 254, .92);
  border-radius: 12px;
  background: linear-gradient(105deg, #6d28d9 0%, #2563eb 56%, #07859a 100%);
  box-shadow: 0 18px 46px -25px rgba(37, 99, 235, .88), inset 0 1px 0 rgba(255, 255, 255, .18);
  color: #ffffff;
  padding: 13px 15px;
}
.patreon-report-banner > div { display: grid; gap: 2px; }
.patreon-report-banner strong { color: #ffffff; font-size: 13px; }
.patreon-report-banner span { color: rgba(255, 255, 255, .86); font-size: 11px; line-height: 1.45; }
.theme-banner-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(172, 140, 247, .46);
  border-radius: 8px;
  background: rgba(172, 140, 247, .13);
  color: var(--admin-text, var(--preview-text, var(--text)));
  padding: 6px 10px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}
.patreon-report-banner .theme-banner-action {
  border-color: rgba(255, 255, 255, .88);
  background: #ffffff;
  color: #4c1d95;
  box-shadow: 0 8px 22px -14px rgba(15, 23, 42, .78);
}
.patreon-report-banner .theme-banner-action:hover { background: #f5f3ff; transform: translateY(-1px); }

html[data-effective-theme="light"] body { background-color: var(--bg); color: var(--text); }
html[data-effective-theme="light"] .nav { background: rgba(248, 251, 252, .86); }
html[data-effective-theme="light"] .hero::before,
html[data-effective-theme="light"] .section-alt::before { opacity: .55; }
html[data-effective-theme="light"] .hero h1,
html[data-effective-theme="light"] .section h2,
html[data-effective-theme="light"] .subpage-hero h1 {
  background: none;
  color: var(--text);
  -webkit-background-clip: border-box;
          background-clip: border-box;
  -webkit-text-fill-color: currentColor;
}
html[data-effective-theme="light"] .version-row { background: rgba(255, 255, 255, .82); }
html[data-effective-theme="light"] .screenshots-grid a { background: rgba(255, 255, 255, .72); border-color: var(--border); }
html[data-effective-theme="light"] body.not-found-page {
  background: radial-gradient(ellipse 680px 360px at 18% 20%, rgba(40, 120, 200, .12), transparent 64%), radial-gradient(ellipse 520px 260px at 82% 78%, rgba(22, 131, 94, .08), transparent 62%), var(--bg);
}
html[data-effective-theme="light"] .not-found-visual { background: #e8edf0; border-color: var(--border); box-shadow: 0 36px 100px -54px rgba(35, 55, 65, .32); }

html[data-effective-theme="light"] body.submit-preview-page {
  --preview-bg: #f2f6f8;
  --preview-panel: #ffffff;
  --preview-panel-raised: #ffffff;
  --preview-panel-soft: #eaf0f3;
  --preview-line: rgba(31, 48, 58, .12);
  --preview-line-strong: rgba(31, 48, 58, .24);
  --preview-text: #17252d;
  --preview-muted: #5b6c76;
  --preview-info: #2878c8;
  --preview-bug: #087d91;
  --preview-feature: #7651c8;
  --preview-success: #16835e;
  --preview-attention: #9a6810;
  --preview-danger: #c53c57;
  background: radial-gradient(800px 430px at 2% -8%, rgba(40, 120, 200, .10), transparent 70%), radial-gradient(680px 420px at 100% 20%, rgba(118, 81, 200, .07), transparent 66%), var(--preview-bg);
}
html[data-effective-theme="light"] .submit-preview-topbar { background: rgba(247, 250, 251, .92); }
html[data-effective-theme="light"] .report-access-card h1,
html[data-effective-theme="light"] .submit-success-card h1 {
  background: none;
  color: #0b1114;
  -webkit-background-clip: border-box;
          background-clip: border-box;
  -webkit-text-fill-color: #0b1114;
}
html[data-effective-theme="light"] .account-strip,
html[data-effective-theme="light"] .account-login-card,
html[data-effective-theme="light"] .submit-form-card,
html[data-effective-theme="light"] .submit-success-card { background: rgba(255, 255, 255, .96); box-shadow: 0 22px 55px -48px rgba(35, 55, 65, .25); }
html[data-effective-theme="light"] .account-login-form input,
html[data-effective-theme="light"] .preview-field input,
html[data-effective-theme="light"] .preview-field textarea,
html[data-effective-theme="light"] .form-section { background: #ffffff; }
html[data-effective-theme="light"] .button-info { color: #1f67ac; }
html[data-effective-theme="light"] .button-account,
html[data-effective-theme="light"] .tone-account { color: #6242ad; }
html[data-effective-theme="light"] .button-neutral,
html[data-effective-theme="light"] .tone-neutral { color: #53656f; }
html[data-effective-theme="light"] .download-upload-tag {
  color: #116f50;
  background: rgba(22, 131, 94, .10);
  border-color: rgba(22, 131, 94, .36);
}
html[data-effective-theme="light"] .tone-success,
html[data-effective-theme="light"] .tone-success-text { color: #116f50; }
html[data-effective-theme="light"] .tone-attention { color: #80550c; }
html[data-effective-theme="light"] .tone-danger,
html[data-effective-theme="light"] .preview-client-errors { color: #a52e47; }

html[data-effective-theme="light"] body:not(.admin-new-page):not(.submit-preview-page) main:not(.not-found-main) {
  color: var(--text);
}
html[data-effective-theme="light"] body:not(.admin-new-page):not(.submit-preview-page) .metric,
html[data-effective-theme="light"] body:not(.admin-new-page):not(.submit-preview-page) section,
html[data-effective-theme="light"] body:not(.admin-new-page):not(.submit-preview-page) .panel {
  border-color: var(--border);
}

.utility-main { width: min(760px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 64px; }
.utility-main p { color: var(--muted, #9aacb7); line-height: 1.65; }

html[data-effective-theme="light"] body.supporter-page,
html[data-effective-theme="light"] body.stats-page,
html[data-effective-theme="light"] body.db-admin-page,
html[data-effective-theme="light"] body.account-page,
html[data-effective-theme="light"] body.legacy-report-page,
html[data-effective-theme="light"] body.legacy-admin-page,
html[data-effective-theme="light"] body.utility-page {
  background: radial-gradient(circle at 18% 8%, rgba(40, 120, 200, .11), transparent 31%), radial-gradient(circle at 86% 24%, rgba(22, 131, 94, .07), transparent 30%), var(--bg);
  color: var(--text);
}
html[data-effective-theme="light"] body.supporter-page main,
html[data-effective-theme="light"] body.db-admin-page .panel,
html[data-effective-theme="light"] body.account-page .panel,
html[data-effective-theme="light"] body.legacy-report-page .panel,
html[data-effective-theme="light"] body.legacy-admin-page .panel,
html[data-effective-theme="light"] body.legacy-admin-page .metric,
html[data-effective-theme="light"] body.legacy-admin-page .report,
html[data-effective-theme="light"] body.stats-page .metric,
html[data-effective-theme="light"] body.stats-page section {
  background: rgba(255, 255, 255, .95);
  border-color: var(--border);
  box-shadow: 0 22px 58px -48px rgba(35, 55, 65, .32);
}
html[data-effective-theme="light"] body.supporter-page .facts,
html[data-effective-theme="light"] body.stats-page table,
html[data-effective-theme="light"] body.legacy-report-page .metric,
html[data-effective-theme="light"] body.legacy-report-page .attachment,
html[data-effective-theme="light"] body.legacy-report-page .message-item {
  background: rgba(235, 241, 244, .72);
  border-color: var(--border);
}
html[data-effective-theme="light"] body.supporter-page input,
html[data-effective-theme="light"] body.db-admin-page input,
html[data-effective-theme="light"] body.account-page input,
html[data-effective-theme="light"] body.legacy-report-page textarea,
html[data-effective-theme="light"] body.legacy-admin-page input,
html[data-effective-theme="light"] body.legacy-admin-page textarea,
html[data-effective-theme="light"] body.legacy-admin-page pre {
  background: #ffffff;
  color: var(--text);
  border-color: var(--border);
}
html[data-effective-theme="light"] body.stats-page th,
html[data-effective-theme="light"] body.stats-page td { border-color: var(--border); }
html[data-effective-theme="light"] body.legacy-admin-page .desc,
html[data-effective-theme="light"] body.legacy-admin-page .thread-message,
html[data-effective-theme="light"] body.legacy-admin-page .user-note-item { background: rgba(235, 241, 244, .72); border-color: var(--border); color: var(--text); }

.theme-corner-control { position: fixed; top: 14px; right: 14px; z-index: 100; }
@media (max-width: 720px) {
  .patreon-report-banner { align-items: flex-start; flex-direction: column; width: min(100% - 24px, 1320px); }
  .theme-switcher button { padding-inline: 6px; }
  .theme-corner-control { position: static; display: flex; justify-content: flex-end; margin-bottom: 16px; }
}
@media (max-width: 1400px) {
  .nav > .testing-user-name { display: none; }
}

@media (prefers-color-scheme: light) {
  html:not([data-effective-theme]) { color-scheme: light; }
}
