:root[data-studio-theme] {
  --studio-bg: #ffffff;
  --studio-surface: #f5f6fc;
  --studio-fg: #20233e;
  --studio-muted: #62677e;
  --studio-border: #dfe2ef;
  --studio-accent: #4b46cf;
  --studio-hover: #3933b0;
  --studio-on-accent: #ffffff;
  --studio-tint: #eeedff;
  --studio-error: #a52a3d;
  --fg: var(--studio-fg);
  --muted: var(--studio-muted);
  --border: var(--studio-border);
  --accent: var(--studio-accent);
  --tint: var(--studio-surface);
  color-scheme: light;
  background: var(--studio-bg);
  color: var(--studio-fg);
}
:root[data-studio-theme="dark"] {
  --studio-bg: #151624;
  --studio-surface: #202236;
  --studio-fg: #e9eaf5;
  --studio-muted: #aeb2cb;
  --studio-border: #383b55;
  --studio-accent: #b0aaff;
  --studio-hover: #cac6ff;
  --studio-on-accent: #201b54;
  --studio-tint: #2b2850;
  --studio-error: #ffacbb;
  color-scheme: dark;
}
body[data-studio-app] { background: var(--studio-bg); color: var(--studio-fg); }
#studio-header { flex: none; width: 100%; margin: 0; border-bottom: 1px solid var(--studio-border); background: var(--studio-bg); color: var(--studio-fg); font: 500 14px/1.4 "Segoe UI", system-ui, sans-serif; }
#studio-header .studio-shell { display: flex; align-items: center; justify-content: space-between; gap: 24px; max-width: 1160px; margin: 0 auto; padding: 19px 28px; }
#studio-header a { color: inherit; text-decoration: none; }
#studio-header a:hover { color: var(--studio-accent); }
#studio-header .studio-brand { display: inline-flex; align-items: center; gap: 11px; flex-shrink: 0; font-weight: 700; letter-spacing: -.025em; font-size: 16px; }
#studio-header .studio-mark { display: grid; place-items: center; width: 31px; height: 31px; background: var(--studio-accent); color: var(--studio-on-accent); border-radius: 8px 8px 8px 2px; font-size: 16px; letter-spacing: -.08em; padding-right: 2px; }
#studio-header .studio-nav { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px 24px; padding: 0; margin: 0; color: var(--studio-muted); font-size: 13px; }
#studio-header .studio-account-state { font-size: 13px; }
#studio-header .studio-theme { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; margin: 0; padding: 7px 11px; background: var(--studio-surface); border: 1px solid var(--studio-border); border-radius: 7px; box-shadow: none; color: var(--studio-fg); cursor: pointer; font: inherit; }
#studio-header .studio-theme::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; border-radius: 50%; background: linear-gradient(90deg, currentColor 50%, transparent 50%); }
#studio-header .studio-theme[aria-pressed="true"] { border-color: var(--studio-accent); }
#studio-header :is(a, button):focus-visible, .studio-profile :is(a, button):focus-visible, .home-wrap a:focus-visible, .home-footer a:focus-visible { outline: 3px solid var(--studio-accent); outline-offset: 4px; }
.studio-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 11px 18px; border: 1px solid var(--studio-accent); border-radius: 7px; background: var(--studio-accent); color: var(--studio-on-accent); font: 600 14px/1.4 "Segoe UI", system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.studio-button:hover { background: var(--studio-hover); border-color: var(--studio-hover); }
.studio-button:disabled { opacity: .6; cursor: wait; }
.studio-button-secondary { background: transparent; color: var(--studio-accent); border-color: var(--studio-border); }
.studio-button-secondary:hover { background: var(--studio-tint); border-color: var(--studio-accent); }
.studio-profile { max-width: 790px; margin: 0 auto; padding: 50px 24px 70px; width: 100%; }
.studio-back { color: var(--studio-accent); font-size: .9rem; text-underline-offset: 4px; }
.studio-profile h1 { margin: 30px 0 12px; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -.045em; }
.studio-intro { color: var(--studio-muted); margin-bottom: 36px; }
.studio-profile-panel { border: 1px solid var(--studio-border); border-radius: 12px; padding: 28px; margin: 20px 0; background: var(--studio-bg); }
.studio-profile-panel h2 { margin: 0 0 16px; font-size: 1.25rem; letter-spacing: -.02em; }
.studio-profile-panel p { max-width: 60ch; }
.studio-profile-panel .studio-button { margin: 8px 10px 8px 0; }
.studio-account-details { margin: 20px 0; }
.studio-account-details > div { display: grid; grid-template-columns: 75px minmax(0, 1fr); gap: 20px; padding: 10px 0; border-bottom: 1px solid var(--studio-border); }
.studio-account-details dt { color: var(--studio-muted); }
.studio-account-details dd { margin: 0; overflow-wrap: anywhere; }
.studio-profile-note, .studio-small { font-size: .875rem; color: var(--studio-muted); }
.studio-status { color: var(--studio-accent); font-weight: 650; }
.studio-error { color: var(--studio-error); overflow-wrap: anywhere; }
body[data-studio-app="engine"] a { color: var(--studio-accent); }
body[data-studio-app="engine"] :is(.btn, button, .buy) { background: var(--studio-accent); color: var(--studio-on-accent); }
body[data-studio-app="engine"] :is(.btn, button, .buy):hover { background: var(--studio-hover); }
body[data-studio-app="engine"] :is(button:disabled, .buy[disabled]) { background: var(--studio-border); color: var(--studio-muted); }
body[data-studio-app="engine"] :is(.top, .bar b) { color: var(--studio-muted); }
body[data-studio-app="engine"] :is(.tile, .card, .bar) { background: var(--studio-bg); color: var(--studio-fg); border-color: var(--studio-border); }
body[data-studio-app="engine"] .tile { box-shadow: 0 2px 10px #0002, inset 0 0 0 1px var(--studio-border); }
body[data-studio-app="engine"] .tile:is(:hover, :focus) { border-color: var(--studio-accent); }
body[data-studio-app="engine"] #panel { background: #0009; }
body[data-studio-app="asset-library"] :is(.filters input, .filters select, .play) { background: var(--studio-bg); }
body[data-studio-app="asset-library"] .play[aria-pressed="true"] { background: var(--studio-accent); color: var(--studio-on-accent); }
body[data-studio-app="blog"] article pre, body[data-studio-app="graft"] pre { background: var(--studio-surface); }
body[data-studio-app="blog"] article a { color: var(--studio-accent); }
body[data-studio-app="graft"] .btn { color: var(--studio-on-accent); }
body[data-studio-app="graft"] .btn:hover { background: var(--studio-hover); }
body[data-studio-app="open-anarchy"] :is(.tip, .wiki-main th, code, .cmd) { background: var(--studio-surface); }
body[data-studio-app="open-anarchy"] :is(.button, .wiki-nav a[aria-current="page"]) { color: var(--studio-on-accent); }
:root[data-studio-theme="light"]:has(body[data-studio-app="WorkoutRPG"]) { --gym: #ffffff; --chalk: #203e43; --steel: #506c72; --brass: #81601f; --rubber: #edf2f3; --line: #cad6d8; }
:root[data-studio-theme="dark"]:has(body[data-studio-app="WorkoutRPG"]) { --gym: #173c43; --chalk: #e9e4d5; --steel: #adc1c5; --brass: #e4b86c; --rubber: #20292f; --line: #46636a; }
body[data-studio-app="WorkoutRPG"] { background: var(--gym); color: var(--chalk); }
body[data-studio-app="WorkoutRPG"] .button { background: var(--brass); color: var(--gym); }
body[data-studio-app="WorkoutRPG"] .button:hover { background: var(--chalk); border-color: var(--chalk); }
body[data-studio-app="WorkoutRPG"] .download { background: var(--rubber); color: var(--chalk); }
body[data-studio-app="WorkoutRPG"] .download a:not(.button) { color: var(--brass); }
body[data-studio-app="WorkoutRPG"] kbd { background: var(--rubber); color: var(--chalk); }
@media (max-width: 760px) {
  #studio-header .studio-shell { align-items: flex-start; flex-direction: column; gap: 14px; padding: 16px 20px; }
  #studio-header .studio-nav { width: 100%; justify-content: flex-start; gap: 10px 18px; }
  #studio-header .studio-theme { margin-left: auto; }
}
@media (max-width: 400px) {
  #studio-header .studio-nav { gap: 10px 13px; }
  #studio-header .studio-theme { margin-left: 0; }
  .studio-profile-panel { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  body[data-studio-app="engine"] .tile { transition: none; }
  body[data-studio-app="engine"] .tile:is(:hover, :focus) { transform: none; }
}
