:root {
  color-scheme: dark;
  --bg-primary: #08090b; --bg-elevated: #141519; --bg-card: #191b20;
  --border-subtle: rgba(255,255,255,.1); --text-primary: #f1f2f4; --text-secondary: #999da6;
  --accent-primary: #e4e7eb; --accent-cyan: #b7c7d8; --accent-emerald: #bdd1c7;
  --accent-amber: #d3c5ad; --accent-rose: #d8b8c2;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg-primary); color: var(--text-primary); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #d4dfeb; outline-offset: 4px; }
.top-nav {
  height: 64px; position: fixed; inset: 0 0 auto; z-index: 10;
  padding: 0 36px; display: flex; align-items: center; gap: 24px;
  background: rgba(18,19,22,.72); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand { font-size: 19px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.page-name { font-size: 13px; color: #c9cbd0; }
.credit { color: #777c87; margin-left: 5px; }
nav { margin-left: auto; display: flex; align-items: center; gap: 24px; font-size: 13px; white-space: nowrap; }
nav > button { border: 0; color: #c9cbd0; padding: 10px 0; background: transparent; }
nav > a { color: #c9cbd0; }
.glass-button, .transport-bar { background: linear-gradient(145deg,rgba(255,255,255,.13),rgba(255,255,255,.035)); border: 1px solid rgba(255,255,255,.16); box-shadow: inset 0 1px 0 #ffffff12, 0 8px 32px #0003; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
nav > .glass-button { padding: 8px 18px; border-radius: 999px; }
.workspace { padding-top: 64px; }
.stage { height: calc(100svh - 64px); min-height: 420px; display: grid; place-content: center; justify-items: center; padding: 20px 16px 100px; overflow: hidden; position: relative; }
.canvas-frame { display: flex; align-items: center; justify-content: center; background: #000; border-radius: 4px; overflow: hidden; }
#artCanvas { display: block; max-width: 100%; cursor: grab; }
#artCanvas:active { cursor: grabbing; }
.transport-bar { position: absolute; bottom: 28px; display: flex; gap: 4px; align-items: center; padding: 6px; border-radius: 999px; }
.btn { border: 1px solid transparent; color: #c1c5cd; background: transparent; font-size: 12px; padding: 9px 14px; border-radius: 999px; line-height: 1.4; }
.btn:hover { color: #fff; background: #ffffff0d; }
.btn.primary { color: #111317; background: #e7e9ed; min-width: 82px; }
.separator { width: 1px; height: 16px; background: #ffffff20; margin: 0 5px; }
.drawer-backdrop { position: fixed; inset: 64px 0 0; z-index: 19; border: 0; background: #0005; cursor: default; }
.inspector { position: fixed; inset: 76px 16px 16px auto; width: min(390px, calc(100% - 32px)); z-index: 20; overflow-y: auto; overscroll-behavior: contain; padding: 20px; border: 1px solid #ffffff1a; border-radius: 20px; background: #16181df5; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 24px 80px #0008; scrollbar-width: thin; }
.inspector-heading, .reference-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
h1, h2 { font-size: 16px; margin: 0; font-weight: 550; }
.icon-button { background: #ffffff09; color: #c8cbd1; border: 1px solid #ffffff12; border-radius: 50%; width: 32px; height: 32px; font-size: 22px; line-height: 1; }
.header-metrics { display: flex; flex-wrap: wrap; gap: 12px; font-size: 10px; margin: 16px 0 4px; color: var(--text-secondary); }
.header-metrics b { font-weight: 400; color: #c9cdd4; }
.panel-section { padding: 22px 0; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 15px; }
.panel-section:last-child { border-bottom: 0; padding-bottom: 4px; }
.section-title { color: #d3d5db; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.badge-new, .badge-emerald { color: #7c848e; font-size: 10px; font-weight: 400; }
.control-row { display: flex; flex-direction: column; gap: 10px; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 11px; line-height: 1.6; color: #b9bec7; }
.control-label strong { font-weight: 400; }
.control-val { font: 10px ui-monospace, SFMono-Regular, monospace; white-space: nowrap; color: #c9ced6; }
input[type=range] { width: 100%; accent-color: #c4ceda; cursor: pointer; margin: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.engine-switch, .mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-btn, .mode-btn { background: #ffffff04; color: #9da4b0; border: 1px solid #ffffff12; border-radius: 8px; padding: 9px 7px; font-size: 11px; line-height: 1.6; text-align: left; }
.preset-btn { text-align: center; font-size: 10px; }
.preset-btn.active, .mode-btn.active { background: #ffffff12; border-color: #ffffff3d; color: #ecedf0; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #9fa6b0; font-size: 11px; line-height: 1.7; }
.checkbox-row input { accent-color: #bdc9d7; flex: none; }
.frame-controls { display: flex; gap: 6px; flex-wrap: wrap; }
.frame-controls .btn { border: 1px solid #ffffff15; border-radius: 8px; font-size: 11px; padding: 7px 10px; }
.formula-box { padding: 12px; background: #0c0d10; border-radius: 8px; font: 10px/1.8 ui-monospace, SFMono-Regular, monospace; overflow-x: auto; white-space: nowrap; color: #a8adb6; }
.hl-emerald, .hl-amber { color: #79858c; }
.hl-cyan { color: #bfccd5; }
dialog { width: min(660px, calc(100% - 32px)); max-height: calc(100svh - 32px); border: 1px solid #ffffff21; border-radius: 18px; padding: 16px; background: #121316; color: #eee; }
dialog::backdrop { background: #000b; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.reference-heading { margin-bottom: 12px; }
video { display: block; width: 100%; max-height: calc(100svh - 120px); background: #000; border-radius: 6px; }
@media (max-width: 620px) {
  .top-nav { padding: 0 18px; gap: 12px; }
  .brand { font-size: 17px; }
  .page-name { display: none; }
  nav { gap: 17px; font-size: 12px; }
  nav > .glass-button { padding: 8px 15px; }
  .stage { padding-left: 12px; padding-right: 12px; }
  .inspector { inset: 76px 12px 12px; width: auto; padding: 18px; }
}
@media (max-height: 600px) and (min-width: 621px) { .stage { min-height: 280px; } .transport-bar { bottom: 12px; } }
