:root{color-scheme:dark;--bg:#101216;--panel:#191c22;--line:#2b303a;--muted:#8b93a5;--text:#e7eaf1;--accent:#a99aff;--left:252px;--right:310px;font:13px 'Segoe UI','Malgun Gothic',sans-serif}
*{box-sizing:border-box}body{margin:0;color:var(--text);background:var(--bg);height:100vh;min-width:1000px;display:flex;flex-direction:column;overflow:hidden}button,input,select,textarea{font:inherit;color:inherit}button{border:1px solid transparent;background:transparent;border-radius:5px;padding:7px 10px;cursor:pointer;white-space:nowrap}button:hover{background:#303540}button:disabled{opacity:.35;cursor:default}button:focus-visible,input:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent);outline-offset:1px}input,select,textarea{background:#11141a;border:1px solid #353b48;border-radius:5px;padding:7px;min-width:0}input[type=checkbox]{accent-color:var(--accent)}input[type=number]{width:100%}kbd{font-size:10px;opacity:.65;margin-left:12px}.primary{background:#a999f6;color:#171225;font-weight:650}.primary:hover{background:#bdadff}.play{border:1px solid #43695c;color:#98ddbd;background:#20372d}.spacer{flex:1}.topbar{height:65px;display:flex;gap:8px;align-items:center;padding:0 18px;border-bottom:1px solid var(--line);background:#181b21}.brand{display:flex;gap:10px;align-items:center;width:212px}.brand-icon{background:var(--accent);color:#171225;font-weight:800;font-size:22px;border-radius:9px;padding:3px 11px}.brand strong{letter-spacing:2px;font-size:15px}.brand strong span{display:block;letter-spacing:4px;font-weight:400;font-size:9px;margin-top:2px;color:var(--muted)}.project-control{display:flex;align-items:center;gap:9px}.caption{font-size:9px;letter-spacing:1px;color:var(--muted)}#project{min-width:100px}#dirty{color:#7f899a;font-size:9px}#dirty.unsaved{color:#e9bc72}.toolbar{height:45px;display:flex;align-items:center;gap:3px;padding:0 15px;border-bottom:1px solid var(--line);background:#1a1d24}.toolbar button{font-size:12px}.toolbar select{padding:4px}.separator{height:18px;width:1px;background:var(--line);margin:0 8px}#workspace{flex:1;min-height:0;display:grid;grid-template-columns:var(--left) 5px minmax(280px,1fr) 5px var(--right)}.panel{background:var(--panel);min-height:0;display:flex;flex-direction:column;overflow:hidden}.panel-heading{height:46px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;padding:0 15px;border-bottom:1px solid var(--line)}h2{font-size:12px;font-weight:600;margin:0}.panel-heading button{padding:3px 7px}.asset-tools{display:grid;gap:8px;padding:12px}.asset-tools select{width:100%}.resource-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:0 12px 12px;overflow:auto;align-content:start;flex:1}.resource-card{border:1px solid var(--line);background:#222630;padding:7px;text-align:left;overflow:hidden;min-height:100px;display:flex;flex-direction:column;gap:7px}.resource-card.active{border-color:var(--accent);background:#302b44}.resource-card img{width:100%;height:72px;object-fit:contain;background:repeating-conic-gradient(#282c35 0% 25%,#242830 0% 50%) 50%/16px 16px}.resource-card .asset-symbol{height:66px;display:grid;place-items:center;font-size:27px;color:var(--accent)}.resource-card span:last-child{font-size:11px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%}.panel-footer{padding:9px 12px;border-top:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;font-size:11px;color:var(--muted)}.splitter{background:#101216;cursor:col-resize}.splitter:hover,.splitter:focus{background:var(--accent)}.stage-panel{min-width:0;display:flex;flex-direction:column;overflow:hidden}.stage-heading,.stage-footer{height:38px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;flex-shrink:0;font-size:10px;color:var(--muted);background:#15181e}.stage-heading{letter-spacing:1px}.stage-heading #scene-name{margin-left:14px;letter-spacing:0;color:#c2c8d5}.live-dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#9d91e7;margin-right:8px}.stage-footer{height:30px;font-size:10px;gap:12px}.stage-footer span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#viewport{flex:1;position:relative;overflow:hidden;background-color:#101216;background-image:radial-gradient(#303541 1px,transparent 1px);background-size:20px 20px;touch-action:none}#surface{position:absolute;transform-origin:0 0;box-shadow:0 14px 70px #0009}#runtime{border:0;display:block;width:100%;height:100%;background:black;pointer-events:none}#interaction{position:absolute;inset:0;touch-action:none}#selection-box{position:absolute;border:2px solid #b9a9ff;display:none;pointer-events:none;transform-origin:center center}#selection-box i{position:absolute;width:12px;height:12px;background:#e9e1ff;border:2px solid #7964c5;pointer-events:auto}#selection-box i[data-corner=nw]{left:-7px;top:-7px;cursor:nwse-resize}#selection-box i[data-corner=ne]{right:-7px;top:-7px;cursor:nesw-resize}#selection-box i[data-corner=sw]{left:-7px;bottom:-7px;cursor:nesw-resize}#selection-box i[data-corner=se]{right:-7px;bottom:-7px;cursor:nwse-resize}.viewport-tools{position:absolute;bottom:18px;left:50%;transform:translateX(-50%);background:#222630eF;border:1px solid #3b4250;border-radius:8px;display:flex;align-items:center;box-shadow:0 4px 15px #0005;font-size:11px}.viewport-tools span{min-width:48px;text-align:center}.viewport-tools button{font-size:11px}#loading{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:15px 22px;background:#252a35;border:1px solid #4a435f;border-radius:8px;max-width:85%;line-height:1.6;z-index:3}.hierarchy{height:34%;min-height:100px;overflow:auto;padding:8px 0}.tree-row{display:flex;align-items:center;height:30px;gap:4px;padding:0 10px;cursor:pointer;font-size:12px}.tree-row:hover{background:#252a34}.tree-row.active{background:#38314e;color:#e0d5ff;border-left:2px solid #a99aff}.tree-row.object{padding-left:31px}.tree-row .name{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tree-row .type{color:var(--muted);font-size:10px}.tree-row button{padding:2px 5px;font-size:11px}.tree-row.hidden-item .name{opacity:.45}.inspector-heading{background:#1e222a;border-top:1px solid var(--line)}#inspector-kind{font-size:9px;color:var(--accent);letter-spacing:1px}.inspector{padding:15px;overflow:auto;flex:1}.field{display:grid;grid-template-columns:95px minmax(0,1fr);align-items:center;gap:9px;margin-bottom:11px;font-size:11px}.field>span{color:#a2aaba;overflow-wrap:anywhere}.field input,.field textarea,.field select{width:100%;font-size:12px}.field input[type=checkbox]{width:16px;justify-self:start}.field textarea{resize:vertical;min-height:64px}.inspector .note{color:var(--muted);font-size:11px;line-height:1.7;border-top:1px solid var(--line);padding-top:12px}.inspector h3{font-size:11px;margin:20px 0 12px;color:#beb1fa}.statusbar{height:28px;display:flex;align-items:center;justify-content:space-between;padding:0 14px;background:#1c2028;border-top:1px solid var(--line);font-size:11px;color:#9da7ba;gap:12px}#status{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}#status.error{color:#ffa9a9}#engine-status{white-space:nowrap;font-size:10px}.empty{grid-column:1/-1;padding:30px 5px;text-align:center;color:var(--muted);font-size:12px;line-height:1.8}dialog{width:480px;border:1px solid #4a425f;border-radius:12px;background:#20242c;padding:25px;color:var(--text)}dialog::backdrop{background:#080a10b0}dialog h2{font-size:18px}dialog p{color:var(--muted);line-height:1.7;font-size:12px}dialog input{width:100%}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:22px}body.left-hidden #workspace{grid-template-columns:0 0 minmax(280px,1fr) 5px var(--right)}body.right-hidden #workspace{grid-template-columns:var(--left) 5px minmax(280px,1fr) 0 0}body.left-hidden.right-hidden #workspace{grid-template-columns:0 0 1fr 0 0}body.left-hidden #assets,body.right-hidden #details{visibility:hidden}@media(max-width:1200px){:root{--left:215px;--right:270px}.brand{width:155px}.topbar{gap:3px;padding:0 10px}.topbar button{font-size:11px;padding:7px}.caption,kbd{display:none}}

/* Keep handle hit areas centered on the exact object boundary at every zoom. */
#selection-box{border:0;outline:2px solid #b9a9ff}
#viewport:focus-visible{outline:none}
#selection-area{position:absolute;pointer-events:none;z-index:2;border:2px solid #b9a9ff;background:#b9a9ff20}
.inline-text-editor{position:absolute;z-index:4;width:320px;max-width:calc(100% - 16px);padding:6px;background:#20242c;border:1px solid var(--accent);border-radius:7px;box-shadow:0 8px 28px #0009}
.inline-text-editor textarea{display:block;width:100%;min-height:72px;resize:vertical}
.inline-text-hint{margin-top:5px;color:#c5bbef;font-size:10px;line-height:1.4}
#selection-box i{width:18px;height:18px;background:transparent;border:0;transform-origin:center;right:auto;bottom:auto}
#selection-box i::after{content:'';position:absolute;inset:5px;background:#e9e1ff;border:1px solid #7964c5;box-shadow:0 0 0 1px #fff}
#selection-box i[data-corner=nw]{left:0;top:0}
#selection-box i[data-corner=n]{left:50%;top:0}
#selection-box i[data-corner=ne]{left:100%;top:0}
#selection-box i[data-corner=e]{left:100%;top:50%}
#selection-box i[data-corner=se]{left:100%;top:100%}
#selection-box i[data-corner=s]{left:50%;top:100%}
#selection-box i[data-corner=sw]{left:0;top:100%}
#selection-box i[data-corner=w]{left:0;top:50%}
#viewport.manipulating,#viewport.manipulating *{user-select:none}

/* Shared control styling; native select semantics and keyboard navigation remain intact. */
:root {
    --control-bg: #161a22;
    --control-border: #363d4b;
    --control-hover: #4b5365;
    --control-radius: 6px;
}
button, input, select, textarea { line-height: 1.4; }
button {
    min-height: 30px;
    border-radius: var(--control-radius);
    transition: background-color 100ms, border-color 100ms, color 100ms;
}
button:disabled { pointer-events: none; }
input:not([type=checkbox]), select, textarea {
    background-color: var(--control-bg);
    border-color: var(--control-border);
    border-radius: var(--control-radius);
    transition: border-color 100ms, box-shadow 100ms;
}
input:not([type=checkbox]), select { height: 32px; padding: 6px 10px; }
input::placeholder, textarea::placeholder { color: #7e889b; opacity: 1; }
input:not(:disabled):hover, select:not(:disabled):hover, textarea:not(:disabled):hover {
    border-color: var(--control-hover);
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px #a99aff26;
}
button:focus-visible, .tree-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}
input:disabled, select:disabled, textarea:disabled {
    background-color: #1b1e25;
    border-color: #2b303b;
    color: #8993a6;
    cursor: not-allowed;
}
select {
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23aeb7c9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
    text-overflow: ellipsis;
}
select option { background: #20252f; color: #e7eaf1; }
select option:checked { background: #403755; color: #f2edff; }
select:disabled { opacity: .65; }
input[type=checkbox] {
    appearance: none;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    border: 1px solid #596176;
    background: var(--control-bg);
    cursor: pointer;
}
input[type=checkbox]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='m3 7 2.5 2.5L11 4' fill='none' stroke='%23231c38' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: center;
}
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.topbar, .toolbar, .statusbar { flex-shrink: 0; }
.topbar > button { height: 32px; padding: 6px 10px; }
.project-control { min-width: 0; }
#project { min-width: 120px; max-width: 190px; }
.toolbar button, .toolbar select { height: 30px; }
.toolbar button { padding: 4px 9px; }
.toolbar select { min-width: 98px; padding: 4px 30px 4px 10px; font-size: 12px; }
.toolbar button[aria-pressed=true] { background: #2b263b; border-color: #49405f; color: #d4c8ff; }
.asset-tools { gap: 10px; }
.asset-tools select, .asset-tools input { font-size: 12px; }
#search {
    padding-left: 31px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='6' cy='6' r='3.5' fill='none' stroke='%238b93a5' stroke-width='1.3'/%3E%3Cpath d='m9 9 3 3' stroke='%238b93a5' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
}
.panel-heading button { min-width: 26px; min-height: 26px; height: 26px; padding: 2px 6px; line-height: 20px; }
.panel-heading > div { display: flex; gap: 3px; }
.resource-card { border-radius: 7px; }
.resource-card:hover { border-color: #586075; background: #2a303c; }
.resource-card.active:hover { border-color: var(--accent); background: #38304c; }
.resource-card img { border-radius: 4px; }
.panel-footer { min-height: 48px; }
.panel-footer button { padding: 4px 10px; color: var(--text); border: 1px solid var(--control-border); }
.tree-row { border-left: 2px solid transparent; }
.tree-row button { min-height: 22px; height: 22px; min-width: 22px; padding: 0 4px; line-height: 22px; }
.tree-row.active .type { color: #baafd7; }
#inspector-kind { text-transform: uppercase; }
.field { gap: 10px; margin-bottom: 10px; min-height: 32px; }
.field > span { line-height: 1.5; }
.field input[type=number] { font-variant-numeric: tabular-nums; }
.field textarea { padding: 8px 10px; line-height: 1.6; min-height: 80px; }
.inspector > .primary { width: 100%; margin: 6px 0; }
.viewport-tools { padding: 3px; gap: 2px; }
.viewport-tools button { height: 28px; min-height: 28px; padding: 4px 9px; }
.viewport-tools #fit { border-left: 1px solid #3b4250; border-radius: 0 4px 4px 0; }
.viewport-tools #zoom-label { font-variant-numeric: tabular-nums; }
dialog { box-shadow: 0 20px 80px #0008; }
dialog input { height: 36px; }
.dialog-actions button { min-width: 64px; height: 32px; }
.resource-list, .hierarchy, .inspector { scrollbar-width: thin; scrollbar-color: #4c5465 transparent; }
@media (max-width: 1200px) {
    #project { min-width: 108px; max-width: 132px; }
    .topbar > button { padding: 6px 8px; }
    .toolbar button { padding: 4px 7px; }
    .field { grid-template-columns: 82px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
    button, input, select, textarea { transition: none; }
}
@media (forced-colors: active) {
    select, input[type=checkbox] { appearance: auto; background-image: none; }
}

/* Style the native popup when supported; older browsers retain their accessible native menu. */
@supports (appearance: base-select) {
    select, select::picker(select) { appearance: base-select; }
    select { align-items: center; }
    select::picker-icon { display: none; }
    select::picker(select) {
        margin-top: 5px;
        padding: 5px;
        background: #20252f;
        color: var(--text);
        border: 1px solid #444b5c;
        border-radius: 8px;
        box-shadow: 0 8px 24px #0007;
        max-height: 280px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: #4c5465 transparent;
    }
    select option {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 30px;
        padding: 6px 9px;
        border-radius: 4px;
        font-size: 12px;
        cursor: pointer;
        outline: none;
    }
    select option:hover, select option:focus { background: #333b4a; }
    select option:checked { background: #403755; color: #eee7ff; }
    select option::checkmark { order: 1; margin-left: auto; color: var(--accent); }
    @media (forced-colors: active) {
        select, select::picker(select) { appearance: auto; }
    }
}

#recovery{padding:8px 16px;background:#322d42;border-bottom:1px solid #65577f;display:flex;align-items:center;gap:10px;font-size:12px}
#recovery[hidden]{display:none}#recovery-message{flex:1}
.color-controls{display:flex;align-items:center;gap:5px}.color-controls input[type=color]{width:42px;flex-shrink:0;padding:3px}.color-controls input[type=number]{min-width:0}
.array-field{display:grid;gap:6px;margin-bottom:14px;font-size:11px;color:var(--muted)}.array-item{display:flex;gap:5px}.array-item input{width:100%;min-width:0}
.arrange-tools{display:grid;grid-template-columns:1fr 1fr;gap:6px}.arrange-tools button{border:1px solid var(--line)}
.extra-selection{position:absolute;outline:2px solid #b9a9ff;pointer-events:none;transform-origin:center}#selection-box.multiple i{display:none}
.placement-tools{display:flex;align-items:center;gap:8px;padding:6px 12px;background:#191c22;font-size:11px;flex-shrink:0}.placement-tools label{display:flex;align-items:center;gap:6px;white-space:nowrap}.placement-tools input[type=number]{width:60px;height:26px}.placement-tools span{color:var(--muted);white-space:nowrap}

#project-template-field{display:grid;gap:7px;margin-bottom:14px}#project-template-field[hidden]{display:none}
.pack-dialog{width:min(920px,94vw);max-height:92vh;overflow:auto}.pack-settings{display:flex;gap:12px;margin:16px 0}.pack-settings label{display:grid;gap:6px;flex:1;min-width:0}.pack-settings label:first-child{flex:2}
.pack-columns{display:grid;grid-template-columns:1fr 1fr;gap:18px}.pack-columns section{min-width:0}.pack-library-tools{display:flex;gap:6px}.pack-library-tools input{min-width:0}.pack-library{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-height:300px;overflow:auto;margin-top:8px}.pack-library-card{min-width:0;border:1px solid var(--line);border-radius:6px}.pack-library-card button{width:100%;overflow:hidden;text-overflow:ellipsis;font-size:11px}.pack-thumb{width:50px;height:50px;background-repeat:no-repeat;flex-shrink:0;background-color:#252933}.pack-library .pack-thumb{width:100%;height:65px;margin-bottom:6px}.pack-sequence{height:310px;overflow:auto}.pack-entry{display:flex;align-items:center;gap:4px;padding:5px 0;border-bottom:1px solid var(--line)}.pack-entry>span{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.pack-entry input{width:48px}.pack-entry button{padding:5px}.pack-entry .pack-thumb{width:36px;height:36px}.pack-preview-bar{display:flex;align-items:center;gap:12px;margin-top:14px}.pack-preview .pack-thumb{width:76px;height:76px}.pack-preview-bar label{display:flex;align-items:center;gap:6px}.pack-preview-bar input{width:60px}.pack-error{color:#ffb3a9;min-height:18px}.pack-position{font-size:12px;color:var(--muted)}

.hierarchy{padding:0 8px 8px;min-height:150px}
.paper-group{border:1px solid #353b49;border-radius:7px;margin-bottom:9px;overflow:hidden;background:#15181e}
.tree-row.paper-row{height:37px;padding:0 5px;background:#252a35;border-bottom:1px solid #353b49;font-weight:600;gap:3px}
.paper-badge{font-size:8px;letter-spacing:.5px;background:#403752;color:#d6c5ff;padding:3px;border-radius:3px;flex-shrink:0}
.tree-row.paper-row .name{font-size:12px}.tree-row.paper-row .type{font-size:10px;white-space:nowrap}
.paper-children{margin-left:12px;border-left:1px solid #414656;padding:3px 0 7px 4px}
.tree-row.object{height:32px;padding:0 4px;gap:5px}.object-icon{width:15px;text-align:center;color:#aea1d6;font-size:12px;flex-shrink:0}
.tree-row.object .type{max-width:45px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.tree-row.active,.tree-row.paper-row.active{background:#38314e;border-left-color:#b9a9ff}
.tree-row .tree-delete{color:#b8a5ac;font-size:17px;padding:0 4px}.tree-row .tree-delete:hover{color:#ffc1c1;background:#54313b}
.paper-empty{color:var(--muted);font-size:11px;padding:12px 8px;line-height:1.6}
.tree-add-object{display:block;width:calc(100% - 10px);margin:5px;height:28px;font-size:11px;background-color:#20242d;border-style:dashed}

.paper-group{overflow:visible}.tree-row.paper-row{position:sticky;top:0;z-index:1;border-radius:0}

.resource-group{grid-column:1/-1;border:1px solid var(--line);border-radius:6px;overflow:hidden}.resource-group summary{padding:9px;background:#242935;cursor:pointer;font-weight:600;font-size:12px}.resource-group-body{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:6px}.resource-actions{display:flex;flex-wrap:wrap;gap:3px;padding:4px 8px}.resource-actions button{font-size:11px;padding:5px}.drop-before{box-shadow:inset 0 3px #b7a4ff}.drop-after{box-shadow:inset 0 -3px #b7a4ff}.tree-row[draggable=true]{cursor:grab}.resource-menu{position:fixed;z-index:1000;display:grid;min-width:175px;background:#242935;border:1px solid #615578;border-radius:8px;padding:5px;box-shadow:0 8px 25px #0008}.resource-menu button{text-align:left}#workspace:fullscreen{background:#11141a;width:100vw;height:100vh}

#game-preview-dialog{width:94vw;max-width:none;height:90vh;padding:10px}#game-preview-dialog .dialog-actions{margin:0 0 8px}#game-preview-frame{width:100%;height:calc(100% - 50px);border:0;background:#000}
.viewport-tools{max-width:calc(100% - 16px);flex-wrap:wrap;justify-content:center;width:max-content}.viewport-tools button{padding:6px}

/* Keep resource groups at content height so overflow belongs to the list. */
.resource-list{grid-auto-rows:max-content}
.resource-browser-tools{display:flex;gap:6px;padding:4px 12px 10px;flex-shrink:0}.resource-browser-tools select{min-width:0;font-size:11px}.resource-browser-tools #resource-group-filter{flex:1;width:0}.resource-browser-tools #resource-view{display:flex;flex:0 0 auto;padding:2px;gap:2px;border:1px solid #41495a;border-radius:6px;background:#15181e;margin-left:auto}
#resource-view button{display:grid;place-items:center;width:32px;height:28px;padding:4px;color:#aeb8ca;border-radius:4px}
#resource-view button[aria-pressed=true]{background:#49405f;color:#f2eaff;border-color:#8e7cbe}
#resource-view svg{width:18px;height:18px;pointer-events:none}
.resource-pagination{display:flex;align-items:center;justify-content:space-between;padding:5px 12px;border-top:1px solid var(--line);flex-shrink:0;font-size:11px;color:var(--muted)}.resource-pagination button{padding:3px 12px;font-size:18px}
.resource-list[data-view=list],.resource-list[data-view=list] .resource-group-body{grid-template-columns:minmax(0,1fr);gap:3px}
.resource-list[data-view=list] .resource-card{flex-direction:row;align-items:center;min-height:38px;padding:4px 6px;text-align:left;gap:8px}
.resource-list[data-view=list] .resource-card img,.resource-list[data-view=list] .resource-card .asset-symbol{width:30px;height:30px;flex-shrink:0;object-fit:contain;font-size:20px}
.resource-list[data-view=list] .resource-card span:last-child{min-width:0;flex:1;width:auto}

.image-resource-group{position:relative}.image-resource-group>summary{padding:10px 65px 10px 9px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.image-resource-group>summary>.resource-actions{position:absolute;top:4px;right:4px;padding:0;gap:2px}
.image-resource-group>summary>.resource-actions button{width:26px;height:26px;padding:0;color:var(--muted);font-size:18px;border-radius:4px}
.image-resource-group>summary>.resource-actions button:hover,.image-resource-group>summary>.resource-actions button:focus-visible{background:#383f4e;color:var(--text)}
.group-menu[hidden]{display:none}.group-menu .danger-action{color:#eea4a4}


/* A dedicated rail keeps fold controls outside the editable scene. */
#workspace{grid-template-columns:var(--left) 18px minmax(280px,1fr) 18px var(--right)}
.splitter{position:relative;z-index:4;background:#15181e;border-inline:1px solid var(--line)}
.splitter:hover,.splitter:focus{background:#20252e}
.panel-fold{position:absolute;top:50%;left:0;transform:translateY(-50%);width:100%;height:48px;padding:0;border:0;border-radius:3px;background:#242a34;color:#aeb7c8;font-size:19px;cursor:pointer}
.panel-fold:hover{background:#343b48;color:#eee7ff}.panel-fold:focus-visible{outline-offset:-2px}
body.left-hidden #workspace{grid-template-columns:0 18px minmax(280px,1fr) 18px var(--right)}
body.right-hidden #workspace{grid-template-columns:var(--left) 18px minmax(280px,1fr) 18px 0}
body.left-hidden.right-hidden #workspace{grid-template-columns:0 18px minmax(280px,1fr) 18px 0}
body.left-hidden #left-split,body.right-hidden #right-split{cursor:default}
#assets>.resource-actions{padding:0 12px 10px;gap:6px;flex-wrap:nowrap;flex-shrink:0}
#assets>.resource-actions button{flex:1;min-width:0;height:30px;padding:0 7px;border:1px solid #353b48;background:#20252e;border-radius:5px;font-size:11px;color:#c6cdd9}
#assets>.resource-actions button:hover{background:#2d3440;border-color:#596477}

.hierarchy-create{display:flex;gap:6px;padding:8px 10px;border-bottom:1px solid var(--line);background:#1c2028;flex-shrink:0}
.hierarchy-create select{flex:1;min-width:0;height:30px;padding:4px 7px;font-size:11px}
.hierarchy-create button{height:30px;padding:4px 9px;border:1px solid #353b48;background:#252a35;font-size:11px}
.hierarchy-create button:hover{background:#343b48}

.tree-row.paper-row .tree-fold{flex:0 0 24px;width:24px;height:24px;display:grid;place-items:center;padding:0;font-size:16px;line-height:1;color:#c9c3da;background:transparent;border:1px solid transparent;border-radius:4px}
.tree-row.paper-row .tree-fold:hover{background:#363c49;color:#fff}
.tree-row.paper-row .name{min-width:0}

.resource-usages{display:grid;gap:5px;max-height:190px;overflow:auto;margin-bottom:14px}
.resource-usages button{text-align:left;white-space:normal;overflow-wrap:anywhere;padding:8px;border:1px solid var(--line);background:#252a35;font-size:12px}
.usage-dialog .resource-usages{max-height:45vh}.usage-dialog{max-height:85vh;overflow:auto}

/* Header actions share one button shape; save is the primary action. */
.topbar>button{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:32px;padding:0 11px;border:1px solid #3b4250;border-radius:5px;background:#242a34;color:#e1e5ee;font-size:12px;font-weight:500;line-height:1;flex-shrink:0}
.topbar>button:hover{background:#303846;border-color:#5c677b}
.topbar>button.primary{background:#a999f6;border-color:#a999f6;color:#171225}
.topbar>button.primary:hover{background:#bdadff;border-color:#bdadff}
.topbar>button kbd{margin:0;font-family:inherit;font-size:10px;font-weight:400;opacity:.75}
@media(max-width:1200px){.topbar>button{padding:0 8px;font-size:11px}}

.context-menu{max-height:calc(100vh - 16px);overflow:auto}.context-menu .danger-action{color:#eea4a4}

.message-dialog{width:min(440px,calc(100vw - 32px));max-height:85vh;overflow:auto}.message-dialog p{white-space:pre-wrap;overflow-wrap:anywhere;color:#edf0f5;font-size:14px;font-weight:500;line-height:1.7}


/* Audit improvements: readable state, grouped properties and accessible panel sizing. */
#dirty{font-size:11px;white-space:nowrap;color:#aab4c6}#dirty.unsaved{color:#f0c783}
#hierarchy-search{margin:6px 10px;flex-shrink:0;width:calc(100% - 20px)}
#inspector-split{height:7px;flex:0 0 7px;cursor:row-resize;background:#303644;touch-action:none}
#inspector-split:hover,#inspector-split:focus-visible{background:var(--accent)}
.inspector-section{margin-bottom:12px;border:1px solid var(--line);border-radius:6px;padding:0 9px 0}
.inspector-section summary{cursor:pointer;padding:10px 0;font-size:12px;color:#d0c5f8}
.inspector-section .field{grid-template-columns:82px minmax(0,1fr);margin-bottom:9px}
.tree-lock{color:#b9aedc}.tree-lock[aria-pressed=true]{background:#38314e}
#status.error{white-space:normal;overflow:auto;max-height:70px}.statusbar:has(#status.error){height:auto;min-height:28px;padding-top:6px;padding-bottom:6px}
@media(max-width:1050px){
 body{min-width:680px;overflow-x:auto}
 :root{--left:180px;--right:260px}
 .brand{width:auto}.brand strong{display:none}.topbar{flex-wrap:wrap;height:auto;min-height:65px;padding:8px;gap:5px}
 .topbar .spacer{display:none}#project{min-width:100px;max-width:130px}
 #workspace{grid-template-columns:var(--left) 12px minmax(160px,1fr) 12px var(--right)}
 .stage-heading,.stage-footer{padding:0 8px}.placement-tools{flex-wrap:wrap}
 .field{grid-template-columns:75px minmax(0,1fr)}
}
.style-color-controls{display:flex;align-items:center;gap:6px;min-width:0}.style-color-controls input[type=color]{width:34px;flex:0 0 34px;padding:2px}.style-color-controls input[type=text]{min-width:0;flex:1}

#runtime-alert:not([hidden]){display:flex;align-items:center;gap:12px;padding:8px 14px;background:#392b28;color:#ffd1ad;flex-shrink:0;font-size:12px}#runtime-message{flex:1;overflow-wrap:anywhere}#runtime-alert button{border:1px solid #8a6856}
/* Use the same clear state icons for Papers and their objects. */
.tree-row .tree-state{display:inline-flex;align-items:center;justify-content:center;width:28px;min-width:28px;height:28px;padding:3px;border:1px solid transparent;border-radius:5px;flex-shrink:0}
.tree-state svg{width:20px;height:20px;pointer-events:none}
.tree-visibility[aria-pressed=true]{color:#b4f1d6}
.tree-visibility[aria-pressed=false]{color:#d9bfdc;background:#35303c;border-color:#746279}
.tree-row .tree-lock[aria-pressed=true]{color:#ffe0a0;background:#493a23;border-color:#9b783b}
.tree-row .tree-lock[aria-pressed=false]{color:#cbd5e5;background:transparent}
.tree-state:hover{filter:brightness(1.2)}

.tree-row .tree-delete{display:inline-flex;align-items:center;justify-content:center;width:22px;min-width:22px;height:22px;padding:0;line-height:1;flex-shrink:0}
.tree-delete svg{display:block;width:16px;height:16px;pointer-events:none}

.pack-dialog .dialog-actions{position:sticky;bottom:-25px;background:#20242c;padding:12px 0;margin-bottom:0;z-index:2;border-top:1px solid var(--line)}

.pack-dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;position:sticky;top:-25px;background:#20242c;z-index:3;padding:12px 0}
.pack-dialog-heading h2{margin:0}.pack-dialog-heading button{display:grid;place-items:center;width:32px;height:32px;padding:6px;flex-shrink:0;color:#edf0f5}.pack-dialog-heading svg{width:20px;height:20px;pointer-events:none}

.resource-card>.pack-resource-frame{width:100%;height:90px;object-fit:contain;background:#15181e}
.resource-list[data-view=list] .resource-card>.pack-resource-frame{width:36px;height:30px;flex-shrink:0}

.resource-card>.resource-video{width:100%;height:72px;object-fit:contain;background:#15181e;border-radius:4px;pointer-events:none}
.resource-list[data-view=list] .resource-card>.resource-video{width:30px;height:30px;flex-shrink:0}

.pack-sheet-frame{display:flex;align-items:center;gap:4px;font-size:11px;color:#edf0f5;white-space:nowrap}.pack-sheet-frame input{width:52px}

.pack-library-tools{align-items:center}
.pack-library-tools input[type=search]{flex:1;width:0;height:32px;font-size:12px}
.pack-dialog [data-action=upload],.pack-dialog [data-action=all]{display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 10px;border:1px solid #41495a;border-radius:5px;background:#252a35;color:#edf0f5;font-size:12px;font-weight:500;line-height:1;flex-shrink:0}
.pack-dialog [data-action=all]{width:100%;margin-top:8px}
.pack-dialog [data-action=upload]:hover,.pack-dialog [data-action=all]:hover{background:#343b48;border-color:#64718a}

/* Shared action buttons. Cards, menu entries and state toggles retain their own roles. */
:root{--action-bg:#252a35;--action-border:#41495a;--action-text:#edf0f5;--action-hover:#343b48}
:is(.topbar>button,.toolbar>button,.panel-heading button,.panel-footer>button,#assets>.resource-actions button,.hierarchy-create button,.inspector>button,.arrange-tools button,.array-field>button,.array-item>button,.dialog-actions button,.pack-preview-bar>button,.pack-entry>button,.pack-dialog [data-action=upload],.pack-dialog [data-action=all],#recovery button,#runtime-alert button,.resource-pagination button):not([hidden]){display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:30px;height:30px;padding:0 9px;border:1px solid var(--action-border);border-radius:5px;background:var(--action-bg);color:var(--action-text);font-size:12px;font-weight:500;line-height:1;flex-shrink:0}
:is(.topbar>button,.toolbar>button,.panel-heading button,.panel-footer>button,#assets>.resource-actions button,.hierarchy-create button,.inspector>button,.arrange-tools button,.array-field>button,.array-item>button,.dialog-actions button,.pack-preview-bar>button,.pack-entry>button,.pack-dialog [data-action=upload],.pack-dialog [data-action=all],#recovery button,#runtime-alert button,.resource-pagination button):hover:not(:disabled){background:var(--action-hover);border-color:#64718a}
:is(.topbar>button,.toolbar>button,.panel-heading button,.panel-footer>button,#assets>.resource-actions button,.hierarchy-create button,.inspector>button,.arrange-tools button,.array-field>button,.array-item>button,.dialog-actions button,.pack-preview-bar>button,.pack-entry>button,.pack-dialog [data-action=upload],.pack-dialog [data-action=all],#recovery button,#runtime-alert button,.resource-pagination button).primary{background:#a999f6;border-color:#a999f6;color:#171225}
:is(.topbar>button,.toolbar>button,.panel-heading button,.panel-footer>button,#assets>.resource-actions button,.hierarchy-create button,.inspector>button,.arrange-tools button,.array-field>button,.array-item>button,.dialog-actions button,.pack-preview-bar>button,.pack-entry>button,.pack-dialog [data-action=upload],.pack-dialog [data-action=all],#recovery button,#runtime-alert button,.resource-pagination button).primary:hover:not(:disabled){background:#bdadff;border-color:#bdadff}
:is(.topbar>button,.toolbar>button,.panel-heading button,.panel-footer>button,#assets>.resource-actions button,.hierarchy-create button,.inspector>button,.arrange-tools button,.array-field>button,.array-item>button,.dialog-actions button,.pack-preview-bar>button,.pack-entry>button,.pack-dialog [data-action=upload],.pack-dialog [data-action=all],#recovery button,#runtime-alert button,.resource-pagination button):disabled{opacity:.35;cursor:default}
.topbar>button:not([hidden]),.dialog-actions button:not([hidden]),.pack-dialog [data-action=upload]:not([hidden]),.pack-dialog [data-action=all]:not([hidden]){height:32px}
.panel-heading>div{gap:5px}
#upload:not([hidden]),#move-up:not([hidden]),#move-down:not([hidden]),.pack-entry>button:not([hidden]),.array-item>button:not([hidden]){width:28px;min-width:28px;height:28px;min-height:28px;padding:0}
.inspector>button:not([hidden]){margin:3px 3px 3px 0;max-width:100%;height:auto;min-height:30px;padding:7px 9px;white-space:normal}
.pack-entry>button:last-child:hover:not(:disabled){background:#54313b;border-color:#986270;color:#ffc1c1}
@media(max-width:1200px){.topbar>button:not([hidden]){padding:0 8px}.panel-heading{padding-left:10px;padding-right:10px}}

#assets>.resource-actions{flex-wrap:wrap;gap:8px}
#assets>.resource-actions button:not([hidden]){flex:1 1 auto;min-width:0;max-width:100%;height:auto;min-height:34px;padding:8px 12px;white-space:normal;line-height:1.4}

.size-controls{display:grid;gap:12px;margin:16px 0}.size-controls label{display:grid;gap:6px;font-size:12px;color:#edf0f5}.size-controls select,.size-controls input{width:100%}.size-dimensions{display:grid;grid-template-columns:1fr 1fr;gap:12px}.size-preset-actions{display:flex;gap:6px;align-items:center}.size-preset-actions input{min-width:0;flex:1}.size-preset-actions button,#edit-screen-size{border:1px solid var(--action-border);background:var(--action-bg);color:var(--action-text);padding:7px 9px;border-radius:5px;font-size:12px}.size-controls .size-note{margin:0;font-size:12px;color:#cbd5e5}.size-dialog .size-note{font-size:12px}#edit-screen-size{padding:4px 8px}.size-preset-actions button:hover,#edit-screen-size:hover{background:var(--action-hover)}

.workspace-location{display:flex;align-items:center;gap:10px;padding:6px 18px;border-bottom:1px solid var(--line);font-size:12px;flex-shrink:0}.workspace-location>span{color:var(--muted)}#workspace-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.workspace-location button{margin-left:auto;border:1px solid var(--action-border);background:var(--action-bg);color:var(--action-text);padding:5px 9px;font-size:12px}.workspace-empty-mode #workspace,.workspace-empty-mode .toolbar{display:none}#workspace-empty:not([hidden]){padding:35px;text-align:center;color:var(--text)}
.export-progress{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:9px 18px;background:#29253a;border-bottom:1px solid #66558f;color:#eee7ff;font-size:12px;flex-shrink:0}.export-progress[hidden]{display:none}.export-progress strong{font-weight:600}.export-progress progress{width:220px;height:9px;accent-color:var(--accent)}

.history-dialog{width:min(560px,calc(100vw - 40px));height:min(620px,calc(100dvh - 48px));max-height:calc(100dvh - 48px)}
.history-dialog[open]{display:flex;flex-direction:column;gap:12px}
.history-dialog h2,.history-dialog .dialog-actions{flex-shrink:0}
.history-dialog .dialog-actions{margin-top:0}
.history-summary,.history-note{margin:0;font-size:12px;color:var(--muted);flex-shrink:0}
.history-list{list-style:none;margin:0;padding:8px;min-height:0;overflow:auto;flex:1;border:1px solid var(--line);border-radius:6px;background:var(--control-bg);scrollbar-width:thin;scrollbar-color:#4c5465 transparent}
.history-entry{display:flex;align-items:center;gap:8px;min-height:34px;padding:7px;font-size:12px;border-left:2px solid transparent}
.history-entry.current{background:#38314e;color:#e0d5ff;border-left-color:var(--accent)}
.history-number{width:22px;color:var(--muted);font-variant-numeric:tabular-nums;flex-shrink:0}
.history-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.history-state{font-size:10px;white-space:nowrap;color:var(--muted)}
.history-entry.current .history-state{color:#e0d5ff}
.history-entry.undone .history-label{color:var(--muted);text-decoration:line-through}
.history-restore{display:flex;align-items:center;gap:8px;width:100%;min-width:0;padding:0;text-align:left;color:inherit}
.history-restore:not(:disabled):hover{background:#303540}
.history-restore:disabled{opacity:1}
#show-history[aria-expanded=true]{background:#38314e;border-color:var(--accent);color:#e0d5ff}
.ai-panel{position:relative;min-width:0;min-height:0;display:flex;flex-direction:column;background:#1c2028;border-left:1px solid var(--line)}
.ai-panel[hidden],.ai-history[hidden],.ai-activity[hidden]{display:none}
body.ai-open #workspace{grid-template-columns:var(--left) 18px minmax(280px,1fr) 18px var(--right) 360px}
body.left-hidden.ai-open #workspace{grid-template-columns:0 18px minmax(280px,1fr) 18px var(--right) 360px}
body.right-hidden.ai-open #workspace{grid-template-columns:var(--left) 18px minmax(280px,1fr) 18px 0 360px}
body.left-hidden.right-hidden.ai-open #workspace{grid-template-columns:0 18px minmax(280px,1fr) 18px 0 360px}
.ai-heading{min-height:62px;flex-shrink:0;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 16px;border-bottom:1px solid var(--line)}
.ai-heading h2{margin:0 0 3px;font-size:14px;font-weight:600;letter-spacing:0}.ai-heading h2 span{color:var(--accent);margin-right:5px}
.ai-heading>div:first-child{min-width:0}#ai-project-label{display:block;max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--muted)}
.ai-heading-actions{display:flex;gap:3px;flex-shrink:0}.ai-heading-actions button{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 8px;font-size:11px;line-height:1;background:transparent;border:1px solid transparent;border-radius:5px}
.ai-heading-actions #close-ai{width:28px;padding:0;font-size:20px;line-height:1}.ai-heading-actions button:hover{background:#2c303b}
.ai-conversation-heading{min-height:38px;display:flex;align-items:center;gap:8px;padding:4px 16px;border-bottom:1px solid #303541;font-size:11px;flex-shrink:0}
#ai-conversation-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#cdd3df}
#ai-rename{padding:3px 5px;min-height:24px;font-size:10px;color:var(--muted);background:transparent;border:0;white-space:nowrap}
.ai-chat{flex:1;min-height:0;overflow:auto;padding:18px 16px;scrollbar-width:thin;scrollbar-color:#4c5465 transparent;overflow-wrap:anywhere}
.ai-message{margin:0 0 18px}.ai-message-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:10px;color:var(--muted)}
.ai-message-meta>span{font-weight:600;color:#bcb3dc}.ai-message-meta time{font-size:9px;font-variant-numeric:tabular-nums}
.ai-message-body{white-space:pre-wrap;font-size:12px;line-height:1.75;color:#d6dbe5;overflow-wrap:anywhere}
.ai-message-user{margin-left:24px}.ai-message-user .ai-message-body{padding:10px 12px;border-radius:10px 10px 2px 10px;background:#353047;border:1px solid #4b4165;color:#eee9ff}
.ai-message-assistant .ai-message-body{padding:1px 0 3px}.ai-message-event{padding:8px 10px;border-left:2px solid #526c62;background:#24302e55;border-radius:0 5px 5px 0;margin-bottom:12px}
.ai-message-event .ai-message-body{font-size:11px;color:#aabeb8}.ai-message-event .ai-message-meta{margin-bottom:3px}.ai-message-event .ai-message-meta>span{color:#9eb9ae}
.ai-message-error{padding:10px;background:#48292b55;border:1px solid #744049;border-radius:6px}.ai-message-error .ai-message-body,.ai-message-error .ai-message-meta>span{color:#ffb6b6}
.ai-empty{padding:24px 0 16px}.ai-empty-icon{display:flex;width:38px;height:38px;align-items:center;justify-content:center;background:#342e47;border:1px solid #4c4169;border-radius:12px;color:#c9b5ff;font-size:21px;margin-bottom:16px}
.ai-empty h3{font-size:16px;font-weight:600;letter-spacing:-.3px;margin:0 0 10px}.ai-empty p{font-size:12px;color:var(--muted);line-height:1.8;margin:0 0 20px}
.ai-suggestion{display:block;width:100%;margin:8px 0;padding:10px 12px;border:1px solid var(--line);background:#252a33;text-align:left;font-size:11px;line-height:1.5;color:#bac3d3}
.ai-interrupted{padding:10px;border:1px solid #6a5c3a;border-radius:6px;color:#d7c597;font-size:11px;line-height:1.6}
.ai-activity{display:flex;align-items:center;gap:8px;padding:10px 16px;color:#bdb1dd;font-size:11px;flex-shrink:0;border-top:1px solid #303541}
.ai-spinner{width:12px;height:12px;border:2px solid #4b425e;border-top-color:#c9b5ff;border-radius:50%;animation:ai-spin 1s linear infinite;flex-shrink:0}@keyframes ai-spin{to{transform:rotate(360deg)}}

.ai-composer{display:flex;flex-direction:column;gap:8px;padding:12px 16px 10px;border-top:1px solid var(--line);background:#20242d;flex-shrink:0}
.ai-target-row{display:flex;align-items:center;gap:8px}.ai-target-row label{font-size:11px;color:var(--muted);white-space:nowrap}.ai-target-row select{font-size:11px;height:28px;width:145px;padding-top:3px;padding-bottom:3px}
.ai-composer #ai-target-description{margin:0;color:#a49bbd;font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ai-input-label{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.ai-composer textarea{width:100%;min-height:86px;max-height:180px;padding:11px 12px;resize:vertical;font-size:12px;line-height:1.6;background:#181c24}
.ai-send-row{display:flex;align-items:center;justify-content:space-between;gap:8px}.ai-send-row>span{font-size:10px;color:#808a9d}#submit-ai{padding:6px 12px;font-size:11px}#submit-ai span{margin-left:7px}
.ai-composer #ai-storage{margin:0;color:#808a9d;font-size:10px;line-height:1.5}.ai-composer #ai-storage.error{color:#e9b87e}
.ai-history{position:absolute;inset:62px 0 0;z-index:3;display:flex;flex-direction:column;min-height:0;background:#1c2028;padding:14px 12px}
.ai-history-heading{display:flex;align-items:center;gap:8px;padding:0 4px 12px;font-size:12px}.ai-history-heading>span{color:var(--muted);font-size:10px}.ai-history-heading>button{margin-left:auto;font-size:18px;padding:2px 8px}
#ai-history-list{list-style:none;margin:0;padding:0;overflow:auto;min-height:0;flex:1}.ai-history>p{font-size:10px;color:var(--muted);line-height:1.6;margin:12px 4px 0}
.ai-thread{display:flex;border:1px solid transparent;border-radius:8px;margin-bottom:6px;align-items:center}.ai-thread.active{background:#302b40;border-color:#514568}.ai-thread:hover{background:#292e39}
.ai-thread-open{display:flex;flex-direction:column;align-items:stretch;gap:6px;flex:1;min-width:0;text-align:left;padding:12px;background:transparent;border:0}
.ai-thread-open strong{font-size:12px;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-thread-preview{color:#8f99ac;font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-thread-open time{font-size:9px;color:#7e889a}
.ai-thread-delete{margin-right:6px;padding:3px 8px;font-size:18px;color:#949daf;background:transparent;border:0}.ai-thread-delete:hover{color:#ffb6b6}
#ai-history-toggle[aria-expanded=true],#ai-edit[aria-expanded=true]{background:#38314e;border-color:var(--accent);color:#e0d5ff}
@media(max-width:1280px){
 body.ai-open #workspace,body.left-hidden.ai-open #workspace,body.right-hidden.ai-open #workspace,body.left-hidden.right-hidden.ai-open #workspace{grid-template-columns:var(--left) 12px minmax(160px,1fr) 12px var(--right)}
 body.left-hidden.ai-open #workspace,body.left-hidden.right-hidden.ai-open #workspace{grid-template-columns:0 12px minmax(160px,1fr) 12px var(--right)}
 body.right-hidden.ai-open #workspace,body.left-hidden.right-hidden.ai-open #workspace{grid-template-columns:var(--left) 12px minmax(160px,1fr) 12px 0}
 body.left-hidden.right-hidden.ai-open #workspace{grid-template-columns:0 12px minmax(160px,1fr) 12px 0}
 .ai-panel{position:fixed;top:0;right:0;bottom:0;width:min(380px,94vw);z-index:20;box-shadow:-8px 0 28px #0008}
}
.workspace-empty-mode .toolbar{display:flex}
.workspace-empty-mode.ai-open #workspace{display:block}
.workspace-empty-mode.ai-open #workspace>:not(#ai-panel){display:none}
.workspace-empty-mode.ai-open #ai-panel{display:flex;position:fixed;top:0;right:0;bottom:0;width:min(380px,94vw);z-index:20;box-shadow:-8px 0 28px #0008}
/* Pending AI changes are reviewed inside the chat. */
.ai-proposal{margin:-8px 0 22px;padding:0;border:0;background:transparent;min-width:0}
.ai-proposal>p{font-size:11px;line-height:1.6;color:var(--muted);white-space:pre-wrap}
.ai-proposal>.ai-action{justify-content:flex-end}
.ai-proposal button{padding:4px 8px;font-size:11px;color:#a9adbb;background:transparent;border:1px solid #414654;border-radius:5px}.ai-proposal button:hover{color:#eee9ff;border-color:#9984cf}.ai-review:empty{display:none}
.ai-review{max-height:45vh;overflow:auto;max-width:100%;text-align:left}
.ai-review pre{white-space:pre;overflow:auto;max-height:240px;padding:10px;background:#17191e;color:#eef0f4;font-size:12px}
.ai-review img{display:block;max-width:100%;max-height:260px;object-fit:contain}
.ai-review audio{max-width:100%}
.ai-review summary{cursor:pointer;overflow-wrap:anywhere}
.ai-action{display:flex;gap:8px;flex-wrap:wrap}

.ai-chat>.ai-activity{margin:4px 0 18px;padding:8px 0;border:0;background:transparent;color:#c5b9e2;font-size:12px;line-height:1.5}
.ai-chat .ai-spinner{display:block;width:16px;height:16px;animation:ai-spin .8s linear infinite}
.ai-change-details{font-size:11px;color:var(--muted)}
.ai-change-details summary{cursor:pointer;margin-bottom:6px}
.ai-message-body code{background:#303442;border-radius:3px;padding:1px 4px;font-size:11px}

.ai-conversation-heading[hidden],#ai-target-description[hidden]{display:none}
.ai-history-empty{padding:40px 16px;text-align:center;color:var(--muted);font-size:12px;line-height:1.8}
.ai-heading-actions button:disabled{opacity:.35}
