/* Library-first artwork / wording browser opened from the studio chat, and the chat edit-target line. */
.ai-edit-target{margin:8px 0 6px;padding:8px 12px;border:1px solid #c9d3cc;border-radius:10px;background:#f4f7f3;color:#233f34;font:14px/1.4 Georgia,serif}
.ai-edit-target strong{font-weight:700}
.ai-edit-target small{display:block;color:#4d5f55;font:12.5px/1.4 Arial,sans-serif;margin-top:2px}
.studio-library{width:min(1100px,100vw);max-width:100vw;height:min(940px,100dvh);max-height:100dvh;margin:auto;padding:0;border:0;border-radius:14px;background:#fffdf8;color:#233f34;overflow:auto;scroll-padding-top:120px;scroll-padding-bottom:180px;box-sizing:border-box}
.studio-library::backdrop{background:rgba(20,30,25,.55)}
.studio-library *{box-sizing:border-box}
.studio-library .sl-head{position:sticky;top:0;z-index:2;display:flex;gap:12px;justify-content:space-between;align-items:flex-start;padding:16px 20px 12px;background:#fffdf8;border-bottom:1px solid #e3e0d6}
.studio-library .sl-head small{font:12px/1.2 Arial,sans-serif;letter-spacing:.08em;text-transform:uppercase;color:#6b5b3e}
.studio-library h2{margin:4px 0 6px;font:600 22px/1.25 Georgia,serif;overflow-wrap:anywhere}
.studio-library .sl-target{margin:0;font:14px/1.4 Arial,sans-serif;color:#33443b}
.studio-library .sl-close{min-width:44px;min-height:44px;border:1px solid #c9d3cc;border-radius:10px;background:#fff;font-size:22px;color:#233f34;cursor:pointer}
.studio-library .sl-tabs,.studio-library .sl-cats{display:flex;flex-wrap:wrap;gap:8px;padding:0 20px}
.studio-library .sl-tabs{padding-top:12px}
.studio-library button{font:14px/1.3 Arial,sans-serif}
.studio-library .sl-tabs button,.studio-library .sl-cats button{min-height:44px;padding:8px 14px;border:1px solid #c9d3cc;border-radius:999px;background:#fff;color:#233f34;cursor:pointer}
.studio-library [aria-pressed="true"]{background:#233f34;color:#fff;border-color:#233f34}
.studio-library .sl-filters{padding:12px 0 0}
.studio-library .sl-search{display:block;padding:0 20px 10px;font:14px/1.3 Arial,sans-serif}
.studio-library .sl-search input{display:block;width:100%;min-height:44px;margin-top:4px;padding:8px 12px;border:1px solid #9fb0a6;border-radius:10px;font:16px Arial,sans-serif;color:#233f34;background:#fff}
.studio-library .sl-count{padding:10px 20px 0;margin:0;font:14px/1.4 Arial,sans-serif}
.studio-library .sl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;padding:12px 20px}
.studio-library .sl-card{display:flex;flex-direction:column;gap:4px;min-height:44px;padding:10px;text-align:left;border:1px solid #d7d3c6;border-radius:12px;background:#fff;color:#233f34;cursor:pointer;scroll-margin:120px 0 180px}
.studio-library .sl-card[aria-pressed="true"]{outline:3px solid #b8862b;outline-offset:1px;background:#fff;color:#233f34;border-color:#b8862b}
.studio-library .sl-card:focus-visible,.studio-library button:focus-visible,.studio-library input:focus-visible{outline:3px solid #1d5bd6;outline-offset:2px}
.studio-library .sl-thumb{display:block;aspect-ratio:1/1;border-radius:8px;background:#f1efe8;overflow:hidden}
.studio-library .sl-thumb img{display:block;width:100%;height:100%;object-fit:contain}
.studio-library .sl-card strong{font:600 16px/1.3 Georgia,serif;overflow-wrap:anywhere}
.studio-library .sl-card small{font:12.5px/1.35 Arial,sans-serif;color:#4d5f55;overflow-wrap:anywhere}
.studio-library .sl-card .sl-source{color:#6b5b3e}
.studio-library .sl-card--words .sl-words{display:block;font:20px/1.4 Georgia,'Noto Naskh Arabic',serif;unicode-bidi:isolate;overflow-wrap:anywhere}
.studio-library .sl-more{display:block;margin:4px 20px 12px;min-height:44px;padding:8px 16px;border:1px solid #233f34;border-radius:10px;background:#fff;color:#233f34;cursor:pointer}
.studio-library .sl-empty{padding:12px 20px;display:flex;flex-direction:column;gap:8px;align-items:flex-start}
.studio-library .sl-empty p{margin:0;font:14px Arial,sans-serif}
.studio-library .sl-empty button{min-height:44px;padding:8px 14px;border:1px solid #233f34;border-radius:10px;background:#fff;color:#233f34;cursor:pointer;text-align:left}
.studio-library .sl-foot{position:sticky;bottom:0;z-index:2;padding:12px 20px 16px;background:#fffdf8;border-top:1px solid #e3e0d6;font:14px/1.4 Arial,sans-serif}
.studio-library .sl-explain p{margin:0 0 4px}
.studio-library .sl-explain ul{margin:0 0 6px;padding-left:20px}
.studio-library .sl-warn{color:#8a1f11;margin:4px 0}
.studio-library .sl-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.studio-library .sl-actions button{min-height:44px;padding:8px 16px;border:1px solid #233f34;border-radius:10px;background:#fff;color:#233f34;cursor:pointer}
.studio-library .sl-actions .sl-primary{background:#233f34;color:#fff}
@media (max-width:600px){
 .studio-library{width:100vw;height:100dvh;border-radius:0}
 .studio-library{scroll-padding-top:12px}
 .studio-library .sl-head{position:static;padding:12px 14px 10px}
 .studio-library .sl-card{scroll-margin:12px 0 200px}
 .studio-library h2{font-size:19px}
 .studio-library .sl-tabs,.studio-library .sl-cats,.studio-library .sl-search,.studio-library .sl-count{padding-left:14px;padding-right:14px}
 .studio-library .sl-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding:10px 14px;gap:10px}
 .studio-library .sl-foot{padding:10px 14px 12px}
 .studio-library .sl-explain ul{max-height:22dvh;overflow:auto}
}
@media (max-width:340px){.studio-library .sl-grid{grid-template-columns:1fr}}
/* Unsaved tab state (browser storage could not store the latest change). */
.studio-unsaved{position:sticky;top:0;z-index:2147483000;display:flex;gap:12px;align-items:center;justify-content:space-between;padding:10px 16px;background:#fff3cd;color:#3d2a00;border-bottom:2px solid #b8862b;font:14px/1.45 Arial,sans-serif}
.studio-unsaved p{margin:0;max-width:72ch}
.studio-unsaved button{min-height:44px;min-width:44px;padding:8px 14px;border:1px solid #3d2a00;border-radius:10px;background:#fff;color:#3d2a00;cursor:pointer}
