@font-face {
    font-family: "Inter";
    src: url("../assets/fonts/Inter-VariableFont_opsz,wght.ttf") format("truetype");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}
:root {
    color-scheme: light;
    --scene-colour: #fff;
    --panel: rgba(245,245,246,.78);
    --panel-border: rgba(255,255,255,.85);
    --field: rgba(255,255,255,.75);
    --hover: rgba(255,255,255,.6);
    --dock: rgba(247,247,248,.66);
    --secondary: #68686f;
    --glyph: #7c7c84;
    --glyph-body: #e6e6e9;
    --track: #e1e1e4;
    --track-fill: #9a9aa0;
    --thumb: #fff;
    --control-border: #ddd;
    --selection: #b3b3b8;
    --ink: #303033;
    --muted: #858589;
    --line: rgba(28, 28, 32, 0.065);
    --surface: rgba(28, 28, 32, 0.035);
    --active: rgba(255, 255, 255, 0.95);
    --inspector-width: 336px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
:root[data-scene-theme="dark"] {
    color-scheme: dark;
    --ink: #efeff1;
    --muted: #b7b7bf;
    --secondary: #c5c5cd;
    --glyph: #c2c2cb;
    --glyph-body: #48484e;
    --line: rgba(255,255,255,.09);
    --surface: rgba(255,255,255,.045);
    --active: rgba(255,255,255,.12);
    --panel: rgba(34,34,37,.88);
    --panel-border: rgba(255,255,255,.08);
    --field: rgba(255,255,255,.075);
    --hover: rgba(255,255,255,.08);
    --dock: rgba(40,40,43,.78);
    --track: #505057;
    --track-fill: #a6a6b0;
    --thumb: #d5d5dc;
    --control-border: #64646d;
    --selection: #92929d;
}
*, *::before, *::after { box-sizing: border-box; }
html { font-family: "Inter", sans-serif; font-size: 16px; color: var(--ink); background: var(--scene-colour); -webkit-font-smoothing: antialiased; }
body { margin: 0; min-width: 320px; overflow: hidden; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; color: inherit; border: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #999; outline-offset: 3px; }
button:disabled { opacity: .28; cursor: default; }
[hidden] { display: none !important; }
.js .playground-shell { opacity: 0; transition: opacity .45s ease; }
.js.page-ready .playground-shell { opacity: 1; }
.js.page-leaving .playground-shell { opacity: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) var(--inspector-width); height: 100dvh; }
.stage { min-width: 0; min-height: 0; position: relative; overflow: hidden; background: var(--scene-colour); }
#dexCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#dexCanvas:active { cursor: grabbing; }
.stage-wash { display: none; }
.stage.is-transparent { background: repeating-conic-gradient(#fafafa 0% 25%, #fff 0% 50%) 0 0 / 20px 20px; }
.inspector {
    position: relative; z-index: 5; display: flex; flex-direction: column; min-width: 0; min-height: 0;
    margin: 12px 12px 12px 0; border: 1px solid var(--panel-border); border-radius: 8px;
    background: var(--panel); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
    box-shadow: 0 1px 3px rgba(0,0,0,.035), 0 8px 40px rgba(0,0,0,.025);
}
.sidebar-top { display: flex; align-items: center; gap: 8px; padding: 15px 12px 13px; flex: 0 0 auto; }
.app-title { display: flex; align-items: center; gap: 7px; margin-right: auto; font-size: 13px; font-weight: 600; }
.app-actions { display: flex; align-items: center; gap: 2px; }
.mini-dex { display: grid; place-items: center; width: 21px; height: 21px; }
.mini-dex-body { position: relative; width: 19px; height: 19px; border-radius: 6px; background: var(--glyph-body); }
.mini-dex-eye { position: absolute; top: 7px; width: 2px; height: 6px; background: var(--glyph); border-radius: 3px; animation: blink 4s infinite; }
.mini-dex-eye--left { left: 6px; } .mini-dex-eye--right { right: 6px; }
@keyframes blink { 0%,44%,49%,100% { transform: scaleY(1); } 46% { transform: scaleY(.1); } }
.ui-button, .icon-button, .play-button { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; border-radius: 7px; background: var(--surface); font-size: 11px; font-weight: 500; color: var(--secondary); transition: background .2s ease, transform .25s var(--ease), color .2s; }
.ui-button { padding: 0 10px; gap: 6px; }
.icon-button { width: 27px; min-height: 28px; padding: 0; background: transparent; }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.ui-button:hover, .icon-button:hover { background: var(--active); color: var(--ink); }
button:active:not(:disabled) { transform: scale(.95); }
.ui-button--record { min-width: 64px; }
.record-dot, .recording-indicator > span { width: 5px; height: 5px; border-radius: 50%; background: #c5786e; flex: 0 0 auto; }
.is-recording .record-dot { animation: record 1s infinite; }
@keyframes record { 50% { opacity: .3; } }
.record-time { font-variant-numeric: tabular-nums; }
.inspector-tabs { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); padding: 3px; margin: 0 12px 12px; gap: 2px; background: var(--surface); border-radius: 8px; flex: 0 0 auto; }
.inspector-tabs button { min-height: 31px; padding: 0 4px; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 500; transition: background .28s var(--ease), box-shadow .28s, color .2s; }
.inspector-tabs button.is-active { background: var(--active); box-shadow: 0 1px 4px rgba(0,0,0,.05); color: var(--ink); }
.inspector-tabs button:hover { color: var(--ink); }
.inspector-scroll { overflow-y: auto; overflow-x: hidden; min-height: 0; flex: 1; scrollbar-width: thin; scrollbar-color: var(--control-border) transparent; overscroll-behavior: contain; }
.inspector-panel { padding-bottom: 12px; animation: panel-in .35s var(--ease) both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.preset-grid, .expression-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 4px 12px 16px; }
.preset-tile, .expression-tile { min-width: 0; height: 67px; display: grid; place-items: center; border-radius: 8px; padding: 4px; background: transparent; position: relative; transition: background .25s, box-shadow .25s, transform .3s var(--ease); }
.preset-tile > span:last-child, .expression-tile > span:last-child { display: none; }
.preset-tile.is-active, .expression-tile.is-active { background: var(--active); box-shadow: 0 2px 6px rgba(0,0,0,.035); }
.preset-tile:hover, .expression-tile:hover { background: var(--hover); }
.form-icon { position: relative; width: 38px; height: 38px; border-radius: 11px; background: var(--glyph-body); transition: transform .38s var(--ease); }
.preset-tile:hover .form-icon { transform: translateY(-2px) rotate(-6deg); }
.form-icon i { position: absolute; top: 15px; width: 3px; height: 10px; border-radius: 9px; background: var(--glyph); }
.form-icon i:first-child { left: 12px; } .form-icon i:last-child { right: 12px; }
.form-icon--pillow { height: 32px; border-radius: 13px; }
.form-icon--pebble { width: 36px; height: 34px; border-radius: 46% 42% 48% 39%; }
.form-icon--wide { width: 44px; height: 28px; border-radius: 10px; }
.form-icon--wide i { top: 10px; }
.expression-tile { height: 55px; }
.face-icon { width: 40px; height: 34px; position: relative; transition: transform .28s var(--ease); }
.expression-tile:hover .face-icon { transform: scale(1.08) rotate(-4deg); }
.face-icon i { position: absolute; border-radius: 999px; background: var(--glyph); }
.control-section { display: grid; gap: 21px; padding: 20px 16px; border-top: 1px solid var(--line); }
.control-section--first { border-top: 0; padding-top: 4px; }
.range-control { display: grid; grid-template-columns: 78px minmax(0,1fr); align-items: center; gap: 12px; min-height: 16px; }
.range-heading, .section-heading, .colour-row, .toggle-row, .select-control, .dimension-grid label { font-size: 11px; color: var(--muted); font-weight: 500; }
.range-heading output { display: none; }
input[type="range"] { width: 100%; height: 16px; margin: 0; padding: 0; background: transparent; cursor: ew-resize; appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 5px; background: linear-gradient(to right,var(--track-fill) 0 var(--range-progress,50%),var(--track) var(--range-progress,50%) 100%); }
input[type="range"]::-webkit-slider-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--thumb); border: 1px solid var(--control-border); box-shadow: 0 1px 3px #0002; appearance: none; margin-top: -5px; }
input[type="range"]::-moz-range-track { height: 3px; background: var(--track); }
input[type="range"]::-moz-range-progress { height: 3px; background: var(--track-fill); }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--thumb); border: 1px solid var(--control-border); }
.colour-row, .toggle-row, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.swatch-control { display: flex; align-items: center; gap: 6px; }
.swatch-control button, .colour-picker { width: 24px; height: 24px; position: relative; border: 1px solid #00000009; border-radius: 50%; background: var(--swatch,#fff); transition: transform .3s var(--ease), box-shadow .2s; padding: 0; }
.swatch-control button:hover, .colour-picker:hover { transform: scale(1.12); }
.swatch-control button.is-active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--selection); }
.swatch-transparent { background: repeating-conic-gradient(#ddd 0% 25%, #fff 0% 50%) 0 0 / 8px 8px !important; }
.colour-picker { overflow: hidden; background: conic-gradient(#e8b4ad,#ead7a1,#bbd3b6,#aecbd7,#c4b6d0,#e8b4ad); cursor: pointer; }
.colour-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.colour-picker::after { content: "+"; position: absolute; inset: 0; display: grid; place-items: center; color: #62626b; pointer-events: none; font-size: 13px; }
.switch { position: relative; width: 28px; height: 17px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch > span { position: absolute; inset: 0; border-radius: 20px; background: var(--track); transition: background .2s; }
.switch > span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px #0002; transition: transform .28s var(--ease); }
.switch input:checked + span { background: var(--track-fill); } .switch input:checked + span::after { transform: translateX(11px); }
.switch input:focus-visible + span { outline: 2px solid #999; outline-offset: 2px; }
.text-action { background: transparent; padding: 0; font-size: 11px; color: var(--secondary); }
.empty-state { margin: 0; font-size: 11px; color: var(--muted); }
.saved-looks { display: grid; gap: 0; }
.saved-look { display: grid; grid-template-columns: minmax(0,1fr) 28px; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); padding: 5px 0; }
.saved-look:last-child { border-bottom: 0; }
.saved-look__load { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 38px; padding: 0 4px; border-radius: 6px; background: transparent; color: var(--secondary); font-size: 11px; text-align: left; transition: background .2s; }
.saved-look__load:hover { background: var(--hover); }
.saved-look__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.saved-look__preview { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; }
.saved-look__body { position: relative; display: block; box-shadow: inset 0 0 0 1px var(--line); }
.saved-look__body i { position: absolute; border-radius: 999px; }
.saved-look__remove { justify-self: end; }
.saved-look__remove .tool-icon { width: 14px; height: 14px; }
.axis-control { display: grid; grid-template-columns: 78px minmax(0,1fr); gap: 12px; align-items: center; font-size: 11px; font-weight: 500; color: var(--muted); }
.axis-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.axis-fields label { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 6px 7px; background: var(--field); border-radius: 6px; }
.axis-fields input { width: 100%; min-width: 0; border: 0; padding: 0; background: transparent; color: var(--secondary); font-size: 11px; }
.select-control { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.select-control select { width: 56%; }
select, .dimension-grid input { min-width: 0; border: 0; border-radius: 6px; padding: 8px; font-size: 11px; color: var(--secondary); background: var(--field); }
.dimension-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dimension-grid label { display: grid; gap: 8px; }
.dimension-grid input { width: 100%; }
.ratio-control, .sequence-presets { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 3px; }
.ratio-control button, .sequence-presets button { min-height: 30px; padding: 0 3px; font-size: 10px; font-weight: 500; background: transparent; color: var(--muted); border-radius: 6px; transition: background .2s; }
.ratio-control button.is-active, .sequence-presets button.is-active, .sequence-presets button:hover, .ratio-control button:hover { background: var(--active); color: var(--ink); }
.motion-toolbar { display: flex; justify-content: flex-end; padding: 2px 16px 8px; }
.play-button { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: var(--active); }
.play-button svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.play-button .pause-icon { display: none; fill: none; stroke: currentColor; stroke-width: 2; }
.play-button.is-playing .play-icon { display: none; } .play-button.is-playing .pause-icon { display: block; }
.sequence-presets { padding: 0 16px 12px; grid-template-columns: repeat(6,minmax(0,1fr)); }
.motion-toolbar { gap: 4px; }
.timeline-palette { grid-template-columns: repeat(6,minmax(0,1fr)); padding: 4px 16px 12px; gap: 2px; }
.timeline-palette .expression-tile { height: 42px; cursor: grab; user-select: none; }
.timeline-palette .face-icon { display: block !important; transform: scale(.85); }
.timeline-palette .expression-tile:active { cursor: grabbing; }
.timeline { position: relative; padding: 0 16px 18px; display: grid; gap: 9px; }
.timeline-track { display: flex; gap: 6px; min-height: 42px; padding: 3px 4px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--control-border) transparent; }
.timeline-step { position: relative; display: grid; place-items: center; min-width: 62px; height: 36px; padding: 5px 8px; border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 9px; transition: background .18s, box-shadow .18s; flex-shrink: 0; }
.timeline-step-label { font-size: 9px; line-height: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; }
.timeline-step[draggable="true"] { cursor: grab; }
.timeline-step[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--selection); background: var(--active); }
.timeline-step.is-dragging { opacity: .35; }
.timeline-drop-marker { position: absolute; width: 2px; border-radius: 0; background: var(--ink); pointer-events: none; z-index: 2; }
.timeline-empty { align-self: center; margin: auto; color: var(--muted); font-size: 11px; }
.step-editor { display: flex; align-items: center; gap: 3px; animation: panel-in .25s var(--ease); }
.step-editor select { flex: 1; width: 64px; padding: 7px 4px; }
.step-editor .icon-button { width: 24px; flex: 0 0 24px; }
.step-duration { display: flex; align-items: center; gap: 2px; width: 65px; font-size: 10px; color: var(--muted); }
.step-duration input { width: 52px; padding: 7px 3px; border: 0; background: var(--field); border-radius: 5px; color: var(--secondary); font-size: 11px; }
.timeline input.timeline-seek { height: 10px; }
.timeline-seek::-webkit-slider-runnable-track { height: 2px; }
.timeline-seek::-webkit-slider-thumb { width: 8px; height: 8px; margin-top: -3px; }
.timeline-step.is-current { background: var(--active); color: var(--ink); }
.timeline-progress { height: 2px; background: #ddd; border-radius: 2px; overflow: hidden; }
.timeline-progress span { display: block; height: 100%; background: #999; }
.timeline-time { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.export-list { padding: 0 12px; }
.export-list > button { display: flex; width: 100%; align-items: center; min-height: 60px; padding: 12px 6px; text-align: left; border-bottom: 1px solid var(--line); background: transparent; }
.export-list > button:hover { background: var(--hover); }
.export-list > button > span { display: grid; gap: 4px; }
.export-list strong { font-size: 12px; font-weight: 500; }
.export-list small { font-size: 10px; font-weight: 400; color: var(--muted); }
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.export-note { padding: 12px 16px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tool-icon { display: block; width: 17px; height: 17px; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; pointer-events: none; }
.camera-dock, .orbit-pad, .zoom-dock {
    position: absolute; z-index: 3; background: var(--dock); border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 2px 10px #00000006, inset 0 0 0 1px #00000003; border-radius: 8px;
}
.camera-dock { left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; }
.camera-dock button { height: 30px; min-width: 45px; border-radius: 5px; padding: 0 10px; font-size: 11px; background: transparent; color: var(--muted); transition: background .25s, color .25s; }
.camera-dock button.is-active, .camera-dock button:hover { background: var(--active); color: var(--ink); box-shadow: 0 1px 3px #00000007; }
.orbit-pad { left: 24px; bottom: 24px; display: grid; grid-template: repeat(3,27px) / repeat(3,27px); padding: 3px; }
.orbit-pad button, .zoom-dock button { display: grid; place-items: center; padding: 0; border-radius: 5px; background: transparent; color: var(--secondary); transition: background .2s, color .2s; }
.orbit-pad button:hover, .zoom-dock button:hover { background: var(--active); color: var(--ink); }
.orbit-pad [data-orbit="up"] { grid-area: 1 / 2; }
.orbit-pad [data-orbit="left"] { grid-area: 2 / 1; }
.orbit-pad [data-action="camera-reset"] { grid-area: 2 / 2; }
.orbit-pad [data-orbit="right"] { grid-area: 2 / 3; }
.orbit-pad [data-orbit="down"] { grid-area: 3 / 2; }
.zoom-dock { right: 24px; bottom: 24px; display: flex; gap: 2px; padding: 4px; }
.zoom-dock button { width: 30px; height: 30px; }
.safe-frame { position: absolute; top: 50%; left: 50%; width: var(--safe-width,60%); height: var(--safe-height,70%); transform: translate(-50%,-50%); pointer-events: none; opacity: 0; transition: opacity .35s,width .4s var(--ease),height .4s var(--ease); }
.stage.is-composing .safe-frame { opacity: .25; }
.safe-frame span { position: absolute; width: 12px; height: 12px; border: solid var(--muted); }
.safe-frame span:nth-child(1) { top:0;left:0;border-width:1px 0 0 1px; }
.safe-frame span:nth-child(2) { top:0;right:0;border-width:1px 1px 0 0; }
.safe-frame span:nth-child(3) { bottom:0;right:0;border-width:0 1px 1px 0; }
.safe-frame span:nth-child(4) { bottom:0;left:0;border-width:0 0 1px 1px; }
.stage-loading, .stage-fallback { position: absolute; inset: 0; z-index: 6; background: var(--scene-colour); display: grid; place-content: center; justify-items: center; gap: 12px; color: #aaa; font-size: 11px; transition: opacity .4s,visibility .4s; }
.stage-loading.is-hidden { opacity: 0; visibility: hidden; }
.stage-fallback p { margin: 0; }
.recording-indicator { position: absolute; left: 24px; top: 24px; display: flex; align-items: center; gap: 6px; font-size: 10px; color: #c5786e; }
.toast { position: fixed; z-index: 30; bottom: 80px; left: calc((100% - var(--inspector-width)) / 2); transform: translate(-50%,6px); padding: 9px 14px; border-radius: 8px; background: var(--dock); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); color: var(--secondary); font-size: 11px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease); }
.toast.is-visible { opacity: 1; transform: translate(-50%,0); }
@media (max-width: 950px) {
    :root { --inspector-width: 312px; }
    .sidebar-top { gap: 4px; padding-inline: 10px; }
    .app-title { gap: 5px; }
    .orbit-pad { left: 16px; top: 16px; bottom: auto; }
    .zoom-dock { right: 16px; top: 16px; bottom: auto; }
}
@media (max-width: 720px) {
    .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0,48%) minmax(0,1fr); }
    .inspector { margin: 0 8px 8px; }
    .sidebar-top { padding: 10px 12px; }
    .inspector-tabs { margin-bottom: 10px; }
    .camera-dock { bottom: 12px; }
    .orbit-pad { grid-template: repeat(3,23px) / repeat(3,23px); left: 12px; top: 12px; }
    .zoom-dock { right: 12px; top: 12px; }
    .toast { left: 50%; bottom: calc(52% + 60px); }
    .recording-indicator { top: 100px; left: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
