:root {
  --base:#050505; --panel:#151515; --panel-lift:#202020; --field:#292929;
  --line:#393939; --soft-line:#292929; --text:#f6f6f6; --muted:#a9a9a9;
  --active:#323232; --accent:#c9dbf9;
  background:var(--base);
}
.appbar { position:relative; background:var(--panel); border:0 }
.brand { gap:7px; color:#fafafa; white-space:nowrap }
.brand span { font:690 .97rem/1.1 Inter,"Segoe UI",sans-serif; letter-spacing:-.045em }
.brand .glyph { width:24px; height:24px }
.appbar .project-link {
  display:inline-flex; align-items:center; justify-content:center; gap:5px; flex:none;
  min-height:30px; padding-inline:6px; border-radius:6px; color:#c7c7c7; text-decoration:none;
  font:550 .73rem/1.15 Inter,"Segoe UI",sans-serif;
}
.appbar .project-link:hover { color:#ffffff; background:#252525 }
.project-link::before {
  content:''; width:15px; height:14px; display:block; flex:none; background:currentColor;
  clip-path:polygon(0 15%,42% 15%,52% 30%,100% 30%,100% 87%,0 87%,0 15%,8% 23%,8% 79%,92% 79%,92% 39%,48% 39%,38% 23%,8% 23%);
}
.header-save { background:#242424; color:#f7f7f7; border-radius:8px }
.header-save .glyph { width:16px; height:16px }
#export.paid { background:#fafafa; color:#191919; border:1px solid #ffffff; font-family:Inter,"Segoe UI",sans-serif; font-weight:650; font-size:.76rem }
#export.paid:hover:not(:disabled) { background:#ebebeb; color:#090909 }
.shelf-heading { display:flex; flex:none; gap:7px; align-items:center; margin:0 0 2px; color:#f7f7f7 }
.shelf-heading .glyph { width:15px; height:15px }
.shelf-heading h2 { margin:0; font:640 .82rem/1.25 Inter,"Segoe UI","Yu Gothic UI",sans-serif; letter-spacing:-.01em }
.bin,.inspector,.edit,.transport,.track-heads { background:var(--panel) }
.screen { background:#ffffff }
#stage { box-shadow:0 0 0 1px #17171712; border-radius:5px }
#poster { border-radius:5px }
.workroom[aria-busy=true] .screen::after { color:#616161 }
#play { width:29px; height:27px; min-width:29px; min-height:27px; color:#141414; background:#fafafa; border:0; border-radius:7px }
#play:hover:not(:disabled) { background:#dcdcdc; color:#171717 }
#play .glyph { width:15px; height:15px }
.transport :is(#prev-frame,#next-frame) { min-width:25px; min-height:26px; padding:4px }
.transport :is(#prev-frame,#next-frame) .glyph { width:14px; height:14px }
.transport output { font-size:.66rem; color:#c4c4c4 }
.transport input::-webkit-slider-runnable-track { background:#393939; height:3px }
.transport input::-webkit-slider-thumb { background:#f5f5f5; width:9px; height:9px; margin-top:-3px }
.track-heads { border-color:#292929 }
.timeline-bar { border-bottom-color:#272727 }
.timeline-bar #text-add-quick { color:#8fb4f3; background:#212833; border-radius:6px }
.timeline-bar #aabddd { color:#c6d9f9; background:#282f3a; border-radius:6px }
.timeline-bar #audio-quick { color:#adc0e1; background:#202732; border-radius:6px }
.cue[aria-pressed=true]::after { border-color:#b2cbf6; box-shadow:inset 0 0 0 1px #3b67b4 }
#playhead { background:linear-gradient(90deg,transparent calc(50% - 1px),#6b9cef calc(50% - 1px),#6b9cef calc(50% + 1px),transparent calc(50% + 1px)) }
#playhead::before { background:#6b9cef }

/* The rail controls which property editor accompanies the canvas. Native hidden
   attributes still own whether a caption, effect span, or shape is selected. */
body:not([data-panel=rig]) #rig-inspector,
body:not([data-panel=text]) #caption-fields,
body:not([data-panel=fx]) #fx-fields,
body:not([data-face=background]) #geometry-inspector,
body:is([data-panel=rig],[data-panel=media],[data-panel=text],[data-panel=audio],[data-panel=fx]) #animate-person { display:none }
body[data-face=background][data-panel=fx] .inspector>#fx-fields:not([hidden]) { display:block }
body[data-face=background][data-panel=fx]:has(#fx-fields:not([hidden])) #geometry-inspector { display:none }
body:is([data-panel=media],[data-panel=text],[data-panel=audio],[data-panel=fx]) .inspector>#acting { display:none }
.inspector>:is(#rig-inspector,#caption-fields,#fx-fields,#geometry-inspector) { margin:0; padding-block:13px 12px; border:0 }
.inspector :is(#rig-inspector,#caption-fields,#fx-fields):not([hidden]) { min-width:0 }
#rig-inspector .edit-label:first-child,#fx-selection { display:block; margin:0 0 9px; color:#f4f4f4; font-size:.85rem }
.inspector #rig-key,.inspector #animate-person {
  min-height:33px; margin:2px 0 4px; border:1px solid #f2f2f2; border-radius:7px;
  background:#f3f3f3; color:#181818; font:640 .78rem/1.25 Inter,"Segoe UI","Yu Gothic UI",sans-serif;
}
.inspector #rig-key[aria-pressed=true] { background:#313131; border-color:#515151; color:#f4f4f4 }
#rig-inspector>details>summary,#parts-list>summary,.inspector details.property-group>summary {
  display:flex; align-items:center; justify-content:space-between; width:100%; min-height:30px;
  margin:0; padding:4px 3px; color:#cacaca; font-size:.75rem; font-weight:550;
}
#rig-inspector>details>summary::after { content:'+'; color:#949494 }
#rig-inspector>details[open]>summary::after { content:'−' }
.action-hint { margin:6px 0 10px; color:#a5a5a5; line-height:1.5 }
.inspector .property-group { padding-block:8px; border-bottom-color:#2b2b2b }
.inspector .group-mark { margin-bottom:6px; color:#a4a4a4 }
.inspector .field-grid { min-width:0 }
.inspector .number-field,.inspector .select-field,#fx-fields input[type=number] { background:#242424; border-color:#333333 }
.inspector :is(#caption-remove,#fx-remove) { margin-top:7px; min-height:29px; color:#d6d6d6; background:#232323 }
.shelf-tools { border-top-color:#292929 }
.bin .library-tabs { background:#202020 }
.bin .template-choice,.bin #library-list button { background:#222222; border-radius:9px }
.bin .template-choice[aria-pressed=true] { border-color:#636363; background:#262626 }
.bin .template-choice[aria-pressed=true]::after { background:#dce7fb }

@media(min-width:601px) {
  body { padding:6px }
  .appbar { height:50px; padding:0 10px; border-radius:11px; gap:5px }
  .appbar :is(button,.tool) { min-height:32px }
  .appbar .history {
    position:absolute; left:50%; transform:translateX(-50%); display:flex; align-items:center; gap:2px;
    margin:0; padding:0; border:0;
  }
  .history button { width:32px; min-width:32px; border-radius:8px }
  .header-save { min-width:34px; height:32px }
  #language { margin-right:1px }
  #export.paid { height:32px; padding-inline:11px; gap:6px; border-radius:8px }
  .workroom,.workroom:has(#layer-tracks:not([hidden])>.layer-track) {
    display:grid; height:calc(100svh - 68px); min-height:448px; margin-top:6px;
    grid-template-columns:41px clamp(142px,14.4vw,206px) minmax(0,1fr) clamp(173px,17.9vw,254px);
    grid-template-rows:minmax(200px,1fr) clamp(168px,26svh,265px);
    grid-template-areas:"rail bin monitor inspector" "rail bin edit inspector";
    align-content:stretch; gap:6px; background:var(--base);
  }
  .rail {
    z-index:1; align-self:stretch; align-items:center; margin-right:-6px; padding:12px 3px;
    border-radius:11px 0 0 11px; background:var(--panel);
  }
  .rail button { min-width:34px; width:34px; min-height:39px; padding:6px; border:0; border-radius:7px }
  .rail button .glyph { width:18px; height:18px }
  .rail button[aria-pressed=true] { color:#eeeeee }
  .rail.fb-tool-rail .fb-tool-pill { background:#343434; border-radius:7px }
  .bin { border-radius:0 11px 11px 0; padding-left:0 }
  .pane { padding:14px 12px 12px 7px; gap:11px }
  #presets:has(>.template-choice:only-child) { grid-template-columns:minmax(0,1fr) }
  .inspector { padding:12px clamp(9px,1vw,16px); border-radius:11px }
  .monitor { grid-template-rows:minmax(0,1fr) 34px; gap:6px; background:transparent; border-radius:11px 11px 0 0 }
  .screen { border-radius:11px; padding:0 }
  #stage { max-width:80cqw; max-height:82cqh; border-radius:7px }
  .screen #poster { max-width:80%; max-height:82%; object-fit:contain }
  .transport { justify-content:center; min-width:0; padding:4px 12px 0; gap:6px; border:0; border-radius:11px 11px 0 0 }
  .transport input { flex:0 1 164px; min-width:36px; margin-inline:5px }
  .edit {
    min-height:0; min-width:0; margin-top:-6px; padding:0 9px 9px; border:0; border-radius:0 0 11px 11px;
    overflow:auto; scrollbar-width:thin; scrollbar-color:#414141 transparent;
  }
  .timeline-bar { min-width:0; min-height:36px; height:auto; padding-block:3px; flex-wrap:wrap; row-gap:2px; gap:2px }
  .timeline-bar button,.timeline-bar .backdrop-file-tools .upload { min-width:25px; min-height:26px; padding:4px }
  .timeline-bar .glyph { width:15px; height:15px }
  .timeline-bar .grid-tools { min-width:0; margin-left:3px; padding-left:3px }
  .timeline-bar .zoom-control { margin-left:auto; flex-shrink:1 }
  .timeline-frame { min-width:0 }
}
@media(min-width:601px) and (max-width:900px) {
  .workroom,.workroom:has(#layer-tracks:not([hidden])>.layer-track) {
    grid-template-columns:34px clamp(101px,15vw,139px) minmax(0,1fr) clamp(129px,18vw,162px);
  }
  .pane { padding:10px 5px 8px 3px }
  .inspector { padding:8px 6px }
  .rail { padding-inline:1px }
  .rail button { min-width:29px; width:29px }
  .transport { gap:3px; padding-inline:4px }
  .timeline-bar :is(#text-add-quick,#aabddd,#duplicate,#remove,#audio-quick,#delete-audio) { min-width:24px }
  .edit { padding-inline:5px }
  #stage { max-width:90cqw; max-height:86cqh }
}
@media(max-width:600px) {
  .appbar { gap:2px; padding:0 5px; border-bottom:1px solid #262626 }
  .brand { gap:4px; padding:2px }
  .brand span { font-size:.78rem }
  .brand .glyph { width:21px; height:21px }
  .history { border:0; margin:0; padding:0; gap:0 }
  .history button,.appbar :is(.tool,.header-save) { min-width:27px; min-height:30px; padding:4px }
  .appbar #language { margin-right:0 }
  .appbar #account { min-width:24px; min-height:30px; padding:3px; gap:2px }
  .appbar #export { padding:4px 7px; min-height:30px; gap:4px }
  .screen { padding:8px }
  .screen #stage { max-width:96cqw; max-height:96cqh }
  .transport { gap:5px }
  .transport output { font-size:.67rem }
  .shelf-heading { grid-column:1/-1; margin:0; padding:0 2px }
  .shelf-heading h2 { font-size:.7rem }
  .shelf-heading .glyph { width:12px; height:12px }
  .inspector { display:block; padding:7px 10px 14px }
  .inspector #rig-inspector:not([hidden]) { display:block }
  body:not([data-panel=rig]) .inspector #rig-inspector { display:none }
  .inspector .property-group { padding-block:5px }
  .inspector>:is(#rig-inspector,#caption-fields,#fx-fields,#geometry-inspector) { padding-block:5px }
  .workroom .timeline-bar { flex-wrap:wrap }
}
@media(max-width:380px) {
  .appbar #account span { display:none }
}
@media(max-width:490px) {
  .appbar .project-link { min-width:25px; width:25px; height:30px; padding:3px; gap:0; font-size:0 }
  .appbar #account span { display:none }
}

.appbar .header-save { width:auto; min-width:3.5em; padding-inline:11px; color:#f7f7f7; font-size:.81rem; font-weight:600; border:1px solid #565656; border-radius:7px }
#save-dialog { width:min(360px,calc(100vw - 28px)); padding:23px; color:#f5f5f5; background:#1e1e1e; border:1px solid #444444; border-radius:13px }
#save-dialog form { display:grid; gap:10px }
#save-dialog h2 { margin:0 0 9px; font-size:1.15rem }
#save-dialog label { font-weight:600; font-size:.82rem }
#save-name { min-width:0; width:100%; box-sizing:border-box; padding:9px 10px; border:1px solid #595959; border-radius:6px; font:inherit; background:#141414; color:#ffffff }
#save-name:focus-visible { outline:2px solid #c7d5ed; outline-offset:2px }
#save-error:empty { display:none }
#save-error { font-size:.8rem; margin:0 }
.save-actions { display:flex; align-items:center; justify-content:flex-end; gap:8px }
.save-actions { margin-top:8px }
.save-actions button { min-height:34px; padding-inline:13px; border-radius:7px }
.save-actions button[type=submit] { color:#171717; background:#f4f4f4; font-weight:650 }
.save-actions button[type=submit]:hover { background:#ffffff }
.save-actions button:disabled { opacity:.55 }
@media(max-width:400px) { .appbar .header-save { min-width:35px; padding-inline:5px } .appbar .brand span { display:none } }

body[data-scene=ink-cels][data-inspect-part=true] .inspector #rig-inspector:not([hidden]){display:block}
body[data-scene=ink-cels] #media-panel .slot .upload,body[data-scene=ink-cels] #media-panel .slot button,body[data-scene=ink-cels] #acting{display:none}
.part-caption{display:none}
body[data-scene=ink-cels] .part-caption{display:block;text-align:center;font:500 .69rem/1.3 system-ui;color:#c6c6c6}
body[data-scene=ink-cels] #slots .slot{padding:5px 4px 8px;gap:5px;background:#202020;border-radius:7px}
body[data-scene=ink-cels] #slots .slot[hidden]{display:none}
body[data-scene=ink-cels] #slots canvas{background:#e9e9e9;cursor:pointer}
body[data-scene=ink-cels] #slots .slot:has(canvas[aria-pressed=true]){border-color:#a2beee}
#audio-panel .panel-tools{justify-content:flex-start}
#audio-panel .audio-file-button{display:inline-flex;align-items:center;gap:.4rem;position:relative;min-height:32px;padding:4px 9px;border:1px solid #484848;border-radius:5px;font:550 .72rem system-ui;cursor:pointer}
#audio-panel .ma-place{display:inline-flex;align-items:center;justify-content:center;gap:.35rem;flex-basis:100%;padding:4px 8px;font-size:11px}
#audio-panel [hidden],#text-panel[hidden],#audio-panel[hidden]{display:none!important}
@media(max-width:600px){#audio-panel,#text-panel{width:100%;min-width:0}.bin:has(#audio-panel:not([hidden]),#text-panel:not([hidden])){overflow:auto}}

body[data-scene="ink-cels"] :is(label:has(#rig-parent), #puppet-properties details:has(#swing-angle), label:has(#cut-motion)) {display:none}

#audio-panel {gap:8px}
#audio-panel .shelf-heading {align-items:center;flex-wrap:wrap;gap:4px}
#audio-panel .shelf-heading .panel-tools {margin:0 0 0 auto;padding:0}
#audio-panel .audio-file-button {min-height:25px;padding:3px 5px;font-size:10px;white-space:nowrap}
#audio-panel .ma-library:not(:has(.ma-asset)) {display:none}
