:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --canvas: #101113;
  --surface: #18191c;
  --surface-raised: #202125;
  --surface-soft: #25262a;
  --line: #323338;
  --line-soft: #292a2f;
  --text: #ededee;
  --muted: #a2a2a7;
  --quiet: #777980;
  --accent: #f4f4f5;
  --green: #61cf7a;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 340px; height: 100%; margin: 0; background: #111214; }
body { color: var(--text); font-size: 12px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #aab4ff; outline-offset: 2px; }
.demo-shell { display: flex; flex-direction: column; width: 100%; height: 100dvh; min-height: 640px; overflow: hidden; background: var(--canvas); border: 1px solid #393a3f; }
.app-menubar { display: flex; flex: 0 0 36px; align-items: center; gap: 10px; padding: 0 12px; background: #202125; border-bottom: 1px solid #34353a; font-family: var(--mono); font-size: 11px; }
.brand-mark { display: grid; width: 17px; height: 17px; place-items: center; border: 1px solid #78808c; border-radius: 4px; background: linear-gradient(140deg, #dadde2 0 45%, #303b58 46%); color: #15161a; font-size: 7px; font-weight: 700; }
.app-title { color: #ededee; letter-spacing: .01em; white-space: nowrap; }
.app-title span { color: #93949a; }
.top-menu { display: flex; align-items: center; gap: 3px; margin-left: 13px; }
.top-menu button, .icon-button { border: 0; background: transparent; color: #b8b8bc; }
.top-menu button { padding: 4px 8px; }
.top-menu button:hover, .icon-button:hover { color: #fff; background: #303136; }
.menubar-spacer, .title-spacer { flex: 1; }
.app-version { color: #8d8e94; font-size: 9px; letter-spacing: .1em; }
.app-version span { margin-left: 7px; color: #dadadd; letter-spacing: 0; }
.workspace { display: grid; flex: 1 1 auto; min-height: 0; grid-template-columns: minmax(340px, 40.5%) minmax(550px, 59.5%); gap: 5px; padding: 5px; }
.preview-column, .config-column { display: flex; min-width: 0; min-height: 0; flex-direction: column; background: #151619; border: 1px solid #303136; }
.panel-title { display: flex; flex: 0 0 30px; align-items: center; gap: 8px; padding: 0 9px; background: #222327; border-bottom: 1px solid #37383d; color: #dedee0; font-family: var(--mono); font-size: 11px; letter-spacing: .015em; }
.preview-title { flex-basis: 28px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #77cb8c; box-shadow: 0 0 7px #67cc7d66; }
.icon-button { display: grid; width: 23px; height: 23px; place-items: center; padding: 0; border-radius: 3px; font-family: var(--mono); font-size: 14px; }
.preview-stage-wrap { display: flex; align-items: flex-start; justify-content: center; padding: 30px 8px 8px; }
.preview-stage { position: relative; width: 100%; max-width: 1920px; overflow: hidden; aspect-ratio: 16 / 9; container-type: size; background: #08090b; border: 1px solid #2a2b30; box-shadow: 0 7px 25px #0005; }
.output-surface { display: flex; width: 100%; height: 100%; flex-direction: column; overflow: hidden; }
.output-segment { position: relative; flex: 1 1 0; min-height: 0; overflow: hidden; border-bottom: 1px solid #a9a9ad; background: #050607; }
.output-segment:last-child { border-bottom: 0; }
.empty-output { display: grid; width: 100%; height: 100%; place-items: center; color: #73757a; background: linear-gradient(135deg, #111214, #1e1f22); font: 11px var(--mono); }
.output-image, .output-segment > .svg-preview, .fallback-svg { position: absolute; top: var(--slice-top); left: 0; display: block; width: 100%; height: var(--full-height); }
.output-image { object-fit: fill; }
.fallback-svg .svg-preview { width: 100%; height: 100%; }
.segment-label { position: absolute; right: 6px; bottom: 5px; left: 6px; overflow: hidden; color: #fff; font: 9px var(--mono); text-align: center; text-overflow: ellipsis; text-shadow: 0 1px 3px #000; white-space: nowrap; opacity: .78; }
.video-overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.sync-frame-flash { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.timecode-overlay { position: absolute; z-index: 5; padding: 3px 5px; border-radius: 2px; background: #07090bd9; color: #f7f7f7; font: clamp(9px, 1vw, 15px) var(--mono); letter-spacing: .06em; white-space: nowrap; }
.text-overlay { position: absolute; z-index: 4; max-width: 70%; font-weight: 600; line-height: 1.05; text-shadow: 0 2px 5px #000; white-space: pre-wrap; }
.frame-marker { position: absolute; z-index: 6; top: 3%; left: 3%; width: 6px; height: 6px; border-radius: 50%; background: #ff3c2f; box-shadow: 0 0 7px #f33; }
.qr-placeholder { position: absolute; z-index: 5; top: 3%; display: grid; width: clamp(26px, 8%, 68px); aspect-ratio: 1; place-items: center; border: 3px solid white; background: repeating-conic-gradient(#111 0 25%, white 0 50%) 0 0 / 8px 8px; color: #fff; font: 6px var(--mono); text-shadow: 0 1px 2px #000; }
.ball { position: absolute; z-index: 3; aspect-ratio: 1; border-radius: 50%; animation: bounce 3.2s ease-in-out infinite alternate; }
@keyframes bounce { to { left: var(--end-x); top: var(--end-y); } }
.preview-hud { position: absolute; right: 5px; bottom: 5px; left: 5px; z-index: 8; display: flex; justify-content: space-between; color: #fff9; font: 8px var(--mono); opacity: 0; transition: opacity .18s; pointer-events: none; }
.preview-stage:hover .preview-hud { opacity: 1; }
.preview-footer { display: flex; align-items: center; gap: 12px; padding: 7px 12px; color: #888a90; font: 9px var(--mono); }
.live-indicator { display: inline-flex; align-items: center; gap: 5px; color: #c5c5c8; letter-spacing: .08em; }
.live-indicator i { width: 5px; height: 5px; border-radius: 50%; background: #66ce7e; }
.lower-dock { flex: 1 1 auto; min-height: 225px; margin-top: 4px; padding: clamp(18px, 3vh, 28px) clamp(18px, 2.4vw, 30px); overflow-y: auto; border-top: 1px solid #34363c; background: radial-gradient(circle at 100% 100%, #2a384044, transparent 65%), #202125; }
.demo-intro { color: #b9bac0; }
.demo-intro-kicker { display: flex; align-items: center; gap: 8px; color: #9ad5ac; font: 10px var(--mono); letter-spacing: .1em; }
.demo-intro-indicator { width: 6px; height: 6px; border-radius: 50%; background: #79cf92; box-shadow: 0 0 8px #79cf9270; }
.demo-intro h2 { margin: 11px 0 10px; color: #f0f1f2; font-size: clamp(17px, 1.8vw, 22px); font-weight: 600; letter-spacing: -.025em; line-height: 1.2; }
.demo-intro p { max-width: 53ch; margin: 0 0 9px; font-size: 11px; line-height: 1.5; }
.demo-intro-footer { margin-top: 15px; padding-top: 13px; border-top: 1px solid #3a3d43; }
.demo-intro-footer > span { color: #dedfe2; font-size: 11px; font-weight: 600; }
.demo-intro-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.demo-intro-links a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid #51545a; border-radius: 3px; color: #e8e9eb; font: 10px var(--mono); text-decoration: none; }
.demo-intro-links a:hover { border-color: #91c9a2; background: #313d38; }
.demo-intro-links a:focus-visible { outline: 2px solid #aab4ff; outline-offset: 2px; }
.demo-intro-links a span { color: #8ecda0; }
.tab-bar { display: flex; flex: 0 0 35px; align-items: flex-end; gap: 2px; padding: 0 7px; background: #1b1c20; border-bottom: 1px solid #36373c; }
.tab-button { height: 29px; padding: 0 13px; border: 1px solid transparent; border-bottom: 0; border-radius: 4px 4px 0 0; background: transparent; color: #aaaab0; font-family: var(--mono); font-size: 11px; }
.tab-button:hover { color: #fff; background: #27282c; }
.tab-button.active { border-color: #404147; background: #2a2b30; color: #f5f5f6; }
.tab-page { flex: 1 1 auto; min-height: 0; }
.video-page.active { display: grid; grid-template-columns: minmax(225px, 34%) minmax(300px, 66%); gap: 9px; padding: 9px; }
.video-settings-column { display: flex; min-width: 0; min-height: 0; flex-direction: column; gap: 8px; }
.panel-card { min-width: 0; background: #1b1c20; border: 1px solid #303136; }
.current-panel { flex: 0 0 auto; padding: 0 9px 6px; border-radius: 0 0 3px 3px; }
.section-heading { display: flex; min-height: 27px; align-items: center; justify-content: space-between; gap: 8px; color: #dcdcdf; font: 10px var(--mono); }
.current-panel > .section-heading { margin: 0 -9px 1px; padding: 0 10px; background: #28292d; border-bottom: 1px solid #34353a; }
.slot-count, .catalog-count { color: #8c8e95; font-size: 9px; }
.current-patterns { display: flex; flex-direction: column; gap: 2px; min-height: 84px; max-height: 126px; margin: 0; padding: 3px 0 0; overflow: auto; list-style: none; }
.current-pattern { display: flex; min-height: 35px; align-items: center; gap: 7px; padding: 4px 5px; border: 1px solid transparent; border-radius: 2px; color: #e0e0e2; font: 10px var(--mono); }
.current-pattern:hover { border-color: #45464c; background: #25262b; }
.current-pattern.drag-over { border-color: #d7d7dc; background: #313238; }
.current-thumb { flex: 0 0 38px; width: 38px; height: 22px; overflow: hidden; background: #090a0c; }
.current-thumb .svg-preview, .current-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.current-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.current-handle { color: #686a71; cursor: grab; }
.remove-pattern { display: grid; width: 22px; height: 22px; place-items: center; border: 0; border-radius: 2px; background: transparent; color: #85868d; }
.remove-pattern:hover { background: #4a292b; color: #ffb8b8; }
.drop-hint { min-height: 21px; padding: 4px 3px 0; color: #74767c; font: 9px var(--mono); }
.current-panel.is-drop-target { outline: 1px solid #bac5ff; outline-offset: -2px; background: #25262b; }
.settings-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 1px 2px 10px; scrollbar-color: #4b4c51 #1b1c20; scrollbar-width: thin; }
.settings-group { padding: 5px 4px 7px; border-bottom: 1px solid #303136; }
.settings-group h3 { margin: 0 0 5px; color: #e3e3e5; font: 10px var(--mono); }
.check-row { display: flex; align-items: center; gap: 7px; min-width: 0; color: #c1c1c5; font: 10px var(--mono); }
input[type="checkbox"], input[type="radio"] { width: 14px; height: 14px; margin: 0; accent-color: #d1d2d7; }
.field-label { flex: 0 0 60px; color: #a1a2a8; font: 9px var(--mono); }
.inline-fields { display: flex; align-items: center; gap: 4px; margin: 4px 0; }
.inline-fields > .compact-input { min-width: 0; width: 58px; }
.compact-input, .field-stack input[type="text"], .field-stack input[type="number"], .field-stack select, .search-control input, .mock-form-grid input, .mock-form-grid select, .unit-input { min-height: 23px; padding: 3px 6px; border: 1px solid #393a40; border-radius: 2px; background: #242529; color: #e1e1e4; font: 9px var(--mono); }
.field-stack { display: flex; align-items: center; gap: 8px; min-width: 0; margin: 4px 0; }
.field-stack > span { flex: 0 0 62px; color: #a2a3a9; font: 9px var(--mono); }
.field-stack input[type="text"], .field-stack input[type="number"], .field-stack select { flex: 1; min-width: 0; }
.field-stack input[type="color"] { width: 25px; height: 21px; padding: 1px; border: 1px solid #42434a; background: #25262b; }
.format-group .field-stack > span { flex-basis: 62px; }
input[type="range"] { flex: 1; min-width: 42px; height: 14px; accent-color: #ceced3; }
.file-button { display: grid; min-height: 22px; flex: 1; place-items: center; border: 1px solid #3a3b40; border-radius: 2px; background: #27282c; color: #bfc0c5; font: 9px var(--mono); cursor: pointer; }
.file-button:hover { background: #33343a; }
.browser-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; padding: 0 9px 5px; }
.browser-heading { flex: 0 0 28px; margin: 0 -9px; padding: 0 10px; background: #28292d; border-bottom: 1px solid #34353a; }
.browser-tools { display: flex; flex: 0 0 35px; align-items: center; gap: 10px; }
.search-control { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; color: #c7c7ca; font: 10px var(--mono); }
.search-control input { flex: 1; width: 30px; }
.hdr-check { white-space: nowrap; }
.pattern-catalog { display: block; flex: 1 1 auto; min-height: 0; overflow: auto; padding: 0 1px 8px; scrollbar-color: #505157 #1b1c20; scrollbar-width: thin; }
.pattern-group { margin: 3px 0 8px; }
.group-heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; height: 20px; margin: 2px 0 4px; background: #1b1c20; color: #aeb0b5; font: 10px var(--mono); }
.group-heading::after { height: 1px; flex: 1; background: #45464b; content: ""; }
.pattern-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px 8px; }
.pattern-card { min-width: 0; padding: 0; border: 1px solid transparent; border-radius: 2px; background: transparent; text-align: left; cursor: grab; }
.pattern-card:hover, .pattern-card:focus-visible { border-color: #575960; background: #27282d; }
.pattern-card:active { cursor: grabbing; }
.pattern-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; overflow: hidden; background: #747578; }
.pattern-thumb svg, .pattern-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pattern-name { display: block; overflow: hidden; padding: 3px 2px 1px; color: #92949a; font: 9px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.pattern-card:hover .pattern-name { color: #e2e2e4; }
.motion-tag { margin-left: 4px; color: #83c8ff; }
.browser-footnote { display: flex; flex: 0 0 26px; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #303136; color: #81838a; font: 8px var(--mono); }
.browser-footnote button { padding: 3px 7px; border: 1px solid #414248; border-radius: 2px; background: #25262a; color: #c5c6ca; font: 9px var(--mono); }
.browser-footnote button:hover { background: #34353a; }
.tab-page.static-page { overflow: auto; padding: 14px; }
.audio-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(180px, .7fr); gap: 12px; max-width: 920px; }
.audio-panel, .audio-side, .visual-config { border-radius: 3px; padding: 0 13px 13px; }
.audio-panel > .section-heading, .audio-side > .section-heading, .visual-config > .section-heading { min-height: 34px; border-bottom: 1px solid #33343a; }
.signal-status { color: #96989f; }
.audio-signal-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 12px 0; }
.signal-choice { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 7px; border: 1px solid #34353a; border-radius: 3px; background: #202125; color: #bfc0c4; font: 10px var(--mono); cursor: pointer; }
.signal-choice:hover, .signal-choice.selected { border-color: #65666c; background: #2a2b30; color: #f1f1f2; }
.signal-choice input { position: absolute; opacity: 0; pointer-events: none; }
.signal-icon { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid #45464c; border-radius: 3px; color: #dae5ff; font-size: 18px; }
.noise-icon { color: #a8c5ad; }
.audio-controls { padding-top: 8px; border-top: 1px solid #33343a; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.control-grid .field-stack { display: block; margin: 0; }
.control-grid .field-stack > span { display: flex; justify-content: space-between; margin-bottom: 5px; }
.control-grid .field-stack input[type="number"], .control-grid .field-stack select { width: 100%; }
.unit-input { display: flex; align-items: center; }
.unit-input input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text); outline: none; }
.unit-input span { color: #85878e; }
.audio-increment { align-self: end; min-height: 27px; }
.audio-actions { display: flex; align-items: center; gap: 9px; margin-top: 15px; padding-top: 12px; border-top: 1px solid #33343a; }
.audio-actions button, .primary-button { min-height: 30px; padding: 0 12px; border: 1px solid #45464c; border-radius: 3px; background: #2b2c31; color: #dbdbde; font: 10px var(--mono); }
.audio-actions .primary-button { border-color: #d9d9df; background: #dedee1; color: #17181b; font-weight: 600; }
.audio-actions button:disabled { opacity: .45; cursor: default; }
.audio-actions button:hover:not(:disabled) { filter: brightness(1.12); }
.audio-actions > span { margin-left: auto; color: #7d7f85; font: 9px var(--mono); }
.audio-side { align-self: start; min-height: 176px; }
.waveform { display: flex; height: 69px; align-items: center; justify-content: space-between; gap: 2px; margin: 13px 0; padding: 0 5px; border-radius: 3px; background: #131417; }
.waveform i { width: 3px; height: 20%; border-radius: 3px; background: #858b9c; }
.waveform i:nth-child(4n) { height: 70%; }.waveform i:nth-child(3n) { height: 38%; }.waveform i:nth-child(5n) { height: 92%; }.waveform i:nth-child(7n) { height: 52%; }
.audio-playing .waveform i { animation: meter .42s ease-in-out infinite alternate; }
.audio-playing .waveform i:nth-child(2n) { animation-delay: -.22s; }.audio-playing .waveform i:nth-child(3n) { animation-delay: -.13s; }
@keyframes meter { to { transform: scaleY(.25); opacity: .65; } }
.audio-side p, .panel-description { color: #92949a; font: 10px/1.6 var(--mono); }
.visual-config { max-width: 720px; }
.visual-only { padding: 3px 5px; border: 1px solid #45464a; border-radius: 2px; color: #94969c; font: 8px var(--mono); letter-spacing: .07em; }
.panel-description { margin: 12px 0 18px; }
.mock-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; max-width: 600px; }
.mock-form-grid > label { display: grid; gap: 6px; color: #aaaab0; font: 9px var(--mono); }
.mock-form-grid input, .mock-form-grid select { width: 100%; min-height: 28px; opacity: .68; }
.mock-check { display: flex !important; align-items: center; gap: 8px !important; padding-top: 21px; }
.mock-input-button { display: flex; gap: 6px; }
.mock-input-button button { padding: 0 8px; border: 1px solid #3b3c41; background: #292a2e; color: #9b9ca2; font: 9px var(--mono); }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 30; padding: 9px 12px; border: 1px solid #484950; border-radius: 3px; background: #24252a; color: #e4e4e7; font: 10px var(--mono); opacity: 0; transform: translateY(6px); transition: opacity .16s, transform .16s; pointer-events: none; }
.toast.visible { opacity: 1; transform: translateY(0); }
.menu-popover { position: fixed; top: 36px; left: 76px; z-index: 40; min-width: 170px; padding: 5px; border: 1px solid #45464c; background: #25262a; box-shadow: 0 10px 25px #0008; }
.menu-popover button { display: block; width: 100%; padding: 7px 9px; border: 0; background: transparent; color: #d6d6da; text-align: left; font: 10px var(--mono); }
.menu-popover button:hover { background: #3a3b41; }
.menu-popover[hidden], [hidden] { display: none !important; }

@media (max-width: 1050px) {
  .demo-shell { height: auto; min-height: 100dvh; overflow: visible; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .preview-column { min-height: 430px; }
  .config-column { min-height: 660px; }
  .lower-dock { min-height: 100px; }
}
@media (max-width: 660px) {
  .app-title span, .app-version, .top-menu button:nth-child(2) { display: none; }
  .top-menu { margin-left: auto; }
  .workspace { gap: 7px; padding: 4px; }
  .preview-column { min-height: 340px; }
  .preview-stage-wrap { padding: 22px 7px 4px; }
  .config-column { min-height: 700px; }
  .video-page.active { grid-template-columns: 1fr; grid-template-rows: minmax(250px, 40%) minmax(390px, 60%); }
  .video-settings-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .settings-scroll { max-height: 250px; }
  .browser-panel { min-height: 390px; }
  .audio-layout { grid-template-columns: 1fr; }
  .audio-side { display: none; }
  .mock-form-grid { grid-template-columns: 1fr; }
  .tab-button { padding: 0 10px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
