/* Primary actions use white labels in both themes; backgrounds are unchanged. */
html[data-theme="dark"] body :is(.button.primary,button.primary,a.primary) { color: white; }
/* Approved iOS-inspired light system. Shared dark rules below remain unchanged. */
html[data-theme="light"] {
  color-scheme: light;
  --theme-canvas: #f5f5f5;
  --theme-surface: #ffffff;
  --theme-inset: #ffffff;
  --theme-raised: #eeeeee;
  --theme-ink: #1d1d1f;
  --theme-muted: #656569;
  --theme-subtle: #68686c;
  --theme-border: #d8d8dc;
  --theme-border-strong: #909095;
  --theme-accent: #0071e3;
  --theme-accent-hover: #0062c4;
  --theme-accent-soft: #edf4fc;
  --theme-link: #0066cc;
  --theme-positive: #247241;
  --theme-positive-soft: #eaf6ee;
  --theme-negative: #c53328;
  --theme-negative-soft: #fff0ed;
  --theme-warning: #885715;
  --theme-warning-soft: #fff4dc;
  --theme-info: #0066cc;
  --theme-info-soft: #f1f6fc;
  --theme-shadow: rgba(0, 0, 0, .055);
  --theme-backdrop: rgba(30, 30, 32, .28);
  --theme-selection: #d2e6ff;
  --theme-focus: #0066cc;
  --site-motion-ease: cubic-bezier(.22,1,.36,1);
  /* Existing semantic names remain compatible with cached/native components. */
  --canvas: var(--theme-canvas); --bg: var(--theme-canvas);
  --surface: var(--theme-surface); --panel: var(--theme-surface);
  --sidebar: var(--theme-inset); --side: var(--theme-inset);
  --raised: var(--theme-raised); --border: var(--theme-border); --line: var(--theme-border);
  --text: var(--theme-ink); --muted: var(--theme-muted); --link: var(--theme-link);
  --accent: var(--theme-accent); --accent-deep: var(--theme-accent-hover);
  --accent-hover: var(--theme-accent-hover); --accent-soft: var(--theme-accent-soft);
  --success: var(--theme-positive); --good: var(--theme-positive);
  --warning: var(--theme-warning); --danger: var(--theme-negative); --error: var(--theme-negative);
  --info: var(--theme-info); --focus: var(--theme-focus);
}
html[data-theme] .theme-switch {
  position: relative; display: inline-grid; grid-template-columns: repeat(2,44px);
  flex: 0 0 auto; width: max-content; min-width: 0; height: 50px;
  box-sizing: border-box; margin: 0; padding: 2px; gap: 0;
  border: 1px solid var(--theme-border, #2a3850); border-radius: 16px;
  background: var(--theme-inset, #0b1526); color: var(--theme-muted, #9aa8bd);
  font: 13px/1.4 "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  white-space: nowrap; isolation: isolate;
}
html[data-theme] .theme-switch::before {
  content: ""; position: absolute; z-index: -1; top: 2px; left: 2px;
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--theme-surface, #25334a); box-shadow: 0 2px 5px rgba(10,20,36,.12);
  transform: translateX(calc(var(--theme-choice-index,0) * 44px));
  transition: transform 220ms cubic-bezier(.16,1,.3,1);
}
html[data-theme-preference="dark"] .theme-switch { --theme-choice-index: 0; }
html[data-theme-preference="light"] .theme-switch { --theme-choice-index: 1; }
html[data-theme] .theme-switch :is(legend,.theme-choice-input,.theme-choice-text) {
  position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0;
  margin: -1px; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
html[data-theme] .theme-switch .theme-choice {
  display: grid; place-items: center; width: 44px; height: 44px;
  min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 12px;
  color: inherit; background: transparent; cursor: pointer;
  transition: color 160ms ease-out;
}
html[data-theme] .theme-switch .theme-choice:hover { color: var(--theme-ink, #f7f4f6); }
html[data-theme] .theme-choice-input:checked+.theme-choice { color: var(--theme-accent, #ff8aae); }
html[data-theme] .theme-choice-input:focus-visible+.theme-choice { outline: 2px solid var(--theme-focus, #ff8aae); outline-offset: 2px; }
html[data-theme] .theme-switch svg { display: block; width: 19px; height: 19px; stroke: currentColor; pointer-events: none; }
html[data-theme] :is(.brandbar,.top-actions,.guide-header nav,.sc-header nav) { flex-wrap: wrap; }
html[data-theme] .site-distribution .side>.brand { flex-wrap: wrap; }
html[data-theme] .site-distribution .side>.brand .theme-switch { margin-top: 6px; }
html[data-theme] .site-auth .wrap>.brand { flex-wrap: wrap; }
html[data-theme] .site-auth .brandbar .theme-switch { margin-left: 6px; }
html[data-theme] .site-registration .shell>.brand { flex-wrap: wrap; }
html[data-theme="light"] body {
  color-scheme: light; color: var(--theme-ink); background: var(--theme-canvas);
  font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei UI",sans-serif;
  -webkit-font-smoothing: antialiased; scrollbar-color: #ababaf var(--theme-canvas);
}
html[data-theme="light"] body :is(h1,h2,h3,strong,b) { letter-spacing: -.02em; }
html[data-theme="light"] ::selection { color: var(--theme-ink); background: var(--theme-selection); }
html[data-theme="light"] :is(input,textarea) { caret-color: var(--theme-focus); }
html[data-theme="light"] body :is(.button.primary,button.primary,a.primary,.sc-primary,.guide-primary,.register-guide-cta,.workspace-entry,.dialog-close,.success-finish,.skip:focus) {
  color: #ffffff;
}
/* The legacy guide button color is important; keep this exception local. */
html[data-theme="light"] .guide-button.guide-primary { color: #ffffff !important; }
html[data-theme="light"] .site-admin-login button[type="submit"] { color: #ffffff; }
html[data-theme="light"] .site-auth .track :is(.active,.done) b { color: #ffffff; }
html[data-theme="light"] :is(.button.primary,.primary.button,.sc-primary,.guide-primary,.workspace-entry,.dialog-close,.success-finish) { background: var(--theme-accent); border-color: transparent; border-radius: 12px; box-shadow: none; }
html[data-theme="light"] :is(.button.primary,.sc-primary,.guide-primary):hover { background: var(--theme-accent-hover); }
html[data-theme="light"] :is(.material-logo-stamp,.sc-roster-pattern span) { background-color: #6d6d73; }
/* Retain the original brand asset; keep the light reading area quiet. */
html[data-theme="light"] :is(.site-material,.site-artist.page-releases) .material-logo-pattern { opacity: .035; }
html[data-theme="light"] :is(.site-material,.site-artist.page-releases) .material-logo-stamp { background-color: #6d6d73; }
html[data-theme="light"] :is(.site-material,.site-artist.page-releases) .material-atmosphere {
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #0008 10%, transparent 24%, transparent 76%, #0008 90%, #000 100%);
  mask-image: linear-gradient(90deg, #000 0%, #0008 10%, transparent 24%, transparent 76%, #0008 90%, #000 100%);
}
html[data-theme="light"] :is(dialog,.workspace-dialog,.admin-dialog,.sc-modal)::backdrop { background: var(--theme-backdrop); }
html[data-theme="light"] :is(.sign-box,.ob-signature) canvas { color-scheme: light; background: white; }
html[data-theme="light"] .interactive-chart text { fill: var(--theme-muted); }
html[data-theme="light"] .interactive-chart line { stroke: var(--theme-border); }
html[data-theme="light"] .site-material .field-note a { color: var(--theme-link); text-underline-offset: 3px; }
/* Shared light controls across artist, admin, distribution and public pages. */
html[data-theme="light"] body :is(input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),select,textarea) {
  color: var(--theme-ink); background: var(--theme-inset); border-color: var(--theme-border-strong); border-radius: 11px; box-shadow: none;
}
html[data-theme="light"] body :is(input,select,textarea):focus { border-color: var(--theme-focus); }
html[data-theme="light"] body :is(input,select,textarea):focus-visible { outline: 2px solid var(--theme-focus); outline-offset: 2px; }
html[data-theme="light"] body :is(input,textarea)::placeholder { color: var(--theme-muted); opacity: 1; }
html[data-theme="light"] body input[readonly] { color: var(--theme-muted); background: #f7f7f7; }
html[data-theme="light"] body :is(input[type="radio"],input[type="checkbox"]) { accent-color: var(--theme-accent); }
html[data-theme="light"] body input[type="file"]::file-selector-button {
  color: var(--theme-link); background: #eaf2fd; font-weight: 600; border-radius: 7px;
}
html[data-theme="light"] body :is(.button,.secondary,.guide-button):not(.primary):not(.danger):not(.guide-primary):not(.active) {
  color: var(--theme-link); border-color: transparent; background: #efefef; border-radius: 11px;
}
html[data-theme="light"] body :is(.theme-switch,button.logout) {
  color: var(--theme-muted); border-color: transparent; background: #e8e8e8;
}
html[data-theme="light"] .theme-switch::before { background: #ffffff; box-shadow: 0 2px 5px rgba(0,0,0,.11); }
html[data-theme="light"] :is(.site-admin,.site-distribution) :is(.side,.sidebar) { background: #efefef; border-color: var(--theme-border); }
html[data-theme="light"] :is(.site-admin,.site-distribution) :is(.topbar,.top) { background: #fafafa; border-color: var(--theme-border); }
html[data-theme="light"] :is(.site-admin,.site-distribution) .nav a.active {
  color: var(--theme-link); background: #ffffff; box-shadow: 0 2px 8px var(--theme-shadow); border-radius: 11px;
}
html[data-theme="light"] :is(.view-tabs,.release-filters) {
  width: fit-content; max-width: 100%; gap: 4px; padding: 4px; border: 0; border-radius: 12px; background: #e8e8e8;
}
html[data-theme="light"] :is(.view-tabs,.release-filters) a.active {
  color: var(--theme-ink); border-color: transparent; border-radius: 9px; background: #ffffff; box-shadow: 0 2px 5px rgba(0,0,0,.10);
}
html[data-theme="light"] :is(.site-admin,.site-distribution,.site-artist) :is(.track,.track-item,.artist,.artist-card) {
  background: #f5f5f5;
}
html[data-theme="light"] :is(.site-admin,.site-distribution,.site-artist) :is(.panel,.overview-strip,.table-wrap) { border-color: transparent; border-radius: 16px; background: var(--theme-surface); }
html[data-theme="light"] .site-material .content { border: 0; background: transparent; box-shadow: none; }
html[data-theme="light"] .site-material .brandbar { border-color: var(--theme-border); }
html[data-theme="light"] .site-material .quick-nav a { color: var(--theme-muted); border: 1px solid transparent; border-radius: 11px; background: transparent; font-weight: 500; }
html[data-theme="light"] .site-material .quick-nav a[href="/"] {
  color: var(--theme-link); border: 1px solid transparent; border-radius: 11px; background: #ffffff; box-shadow: 0 2px 8px var(--theme-shadow);
}
html[data-theme="light"] .site-artist .brandbar .nav a.active {
  color: var(--theme-link); border: 1px solid transparent; border-radius: 11px; background: #ffffff; box-shadow: 0 2px 8px var(--theme-shadow);
}
html[data-theme="light"] .site-material .signed { border: 0; border-radius: 14px; color: var(--theme-muted); background: #ededed; }
html[data-theme="light"] .site-material .announcements { border: 0; border-radius: 16px; background: var(--theme-surface); }
html[data-theme="light"] .site-material .announcements>header { background: #ededed; }
html[data-theme="light"] .site-material .submission-type-section { padding: 26px 28px; border: 0; border-radius: 16px; background: #ffffff; margin-bottom: 18px; }
html[data-theme="light"] .site-material .submission-type-options { gap: 4px; padding: 5px; border-radius: 14px; background: #eaeaea; }
html[data-theme="light"] .site-material .submission-type-choice { color: var(--theme-ink); background: transparent; border-color: transparent; border-radius: 10px; }
html[data-theme="light"] .site-material .submission-type-choice:has(input:checked) {
  background: #ffffff; border-color: transparent; box-shadow: 0 2px 7px rgba(30,30,40,.12);
}
html[data-theme="light"] .site-material .submission-type-choice:has(input:checked) b { color: var(--theme-ink); }
html[data-theme="light"] .site-material .selected-mode { color: var(--theme-muted); background: transparent; border: 0; padding: 0 4px 12px; }
html[data-theme="light"] .site-material #material-details>.section { background: #ffffff; border: 0; border-radius: 16px; margin-bottom: 18px; }
html[data-theme="light"] .site-material :is(.track-card,.artist-card) { border: 0; border-radius: 14px; background: #f5f5f5; }
html[data-theme="light"] body.site-material :is(.section-number,.track-number) { color: #454549; background: #ededed; }
html[data-theme="light"] .site-material .core-progress { color: var(--theme-muted); border: 0; background: #f1f1f1; }
html[data-theme="light"] .site-material .core-badge { color: var(--theme-negative); }
html[data-theme="light"] .site-material .hero h1 { font-weight: 700; letter-spacing: -.035em; }
html[data-theme="light"] .site-material :is(.section-head h2,.submission-type-section h2) { font-weight: 650; }
html[data-theme="light"] .site-admin .overview-item.pending strong { color: var(--theme-accent); }
html[data-theme="light"] .site-admin .rank-number { color: var(--theme-muted); background: #eeeeee; }
html[data-theme="light"] body dialog {
  border: 0; border-radius: 20px; color: var(--theme-ink); background: #ffffff; box-shadow: 0 24px 70px rgba(0,0,0,.18);
}
html[data-theme="light"] body dialog::backdrop { background: var(--theme-backdrop); }
html[data-theme="light"] :is(.lyrics-example,.trend-numbers) summary::marker { color: var(--theme-link); }
@media(hover:hover) and (pointer:fine) {
  html[data-theme="light"] .site-material .quick-nav a:hover,
  html[data-theme="light"] .site-material .announcement:hover { color: var(--theme-link); background: #f6f6f6; }
}
@media(max-width:640px) {
  html[data-theme="light"] .site-material .submission-type-section { padding: 22px 18px; }
  html[data-theme="light"] .site-material .submission-type-choice { padding: 14px; }
  html[data-theme="light"] body dialog { border-radius: 22px; }
}
@media(max-width:700px) {
  html[data-theme] .site-material .quick-nav>.theme-switch { grid-column: 1/-1; justify-self: end; }
  html[data-theme] .site-artist .brandbar .nav { flex-wrap: wrap; }
  html[data-theme] .site-artist .brandbar .nav .theme-switch { margin-left: auto; }
  html[data-theme] .site-auth .brandbar .theme-switch { margin-left: auto; }
  html[data-theme] .ob-brand nav { flex-wrap: wrap; }
}
@media(prefers-reduced-motion:reduce) {
  html[data-theme] .theme-switch::before,html[data-theme] .theme-switch .theme-choice { transition: none; }
}
@media(forced-colors:active) {
  html[data-theme] .theme-choice-input:checked+.theme-choice { outline: 2px solid Highlight; outline-offset: -4px; }
}
@media(max-width:540px) {
  html[data-theme] .site-artist .brandbar .nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: center; }
  html[data-theme] .site-artist .brandbar .nav>a { text-align: center; }
  html[data-theme] .site-artist .brandbar .nav>.theme-switch { justify-self: end; margin-left: 0; }
  html[data-theme] .guide-header nav { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); width: 100%; gap: 8px; }
  html[data-theme] .guide-header nav>.guide-button { padding-inline: 8px; }
  html[data-theme] .guide-header nav>.theme-switch { grid-column: 1/-1; justify-self: end; }
}
