.material-library{color:var(--text,#1d2939)}.material-picker{width:min(960px,calc(100vw - 32px));max-height:85vh;border:1px solid #dbe4f0;border-radius:18px;padding:24px;box-sizing:border-box}.material-picker::backdrop{background:#18233b66}.ml-heading,.ml-filters,.ml-actions,.ml-footer{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.ml-heading,.ml-footer{justify-content:space-between}.ml-filters input{flex:1;min-width:160px}.ml-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px;margin:20px 0}.ml-card{display:flex;flex-direction:column;gap:10px;padding:18px;border:1px solid #dbe4f0;border-radius:12px;background:white;min-width:0;overflow-wrap:anywhere}.ml-card small{color:#64748b}.ml-card:has(input:checked){border-color:#6366f1;background:#f4f5ff}.ml-choice{display:flex;gap:8px;align-items:center}.ml-choice input{width:auto}.ml-footer{position:sticky;bottom:0;background:white;padding:14px 0;border-top:1px solid #e2e8f0}.ml-upload{display:flex;gap:12px;align-items:center;flex-wrap:wrap}.ml-picker-trigger{margin:8px 0}.ml-card strong{line-height:1.5}@media(max-width:600px){.material-picker{padding:16px}.ml-grid{grid-template-columns:1fr}.ml-filters>*{max-width:100%}.ml-heading h2{font-size:22px}}

.material-library .ml-filters{display:flex;flex-direction:row;align-items:center;gap:12px}.material-library .ml-filters input{width:auto;flex:1}.material-library .ml-filters select{width:auto;min-width:130px}.material-library .ml-upload{display:flex;flex-direction:row;justify-content:flex-start;text-align:left;gap:12px;margin:16px 0}.material-library .ml-upload input{width:auto;max-width:100%}.material-library .ml-heading{margin:12px 0}.material-library .ml-filters button{white-space:nowrap}.material-library .ml-grid{margin-top:24px}

.material-library .ml-footer{position:static}.material-picker .ml-footer{position:sticky}

.ml-categories{display:flex;gap:8px;margin-bottom:20px;flex-wrap:wrap}
.ml-categories button.active{background:var(--primary,#775be8);color:#fff;border-color:transparent}
.ml-category-body{min-width:0}
.ml-system-badge{display:inline-block;font-size:12px;color:var(--accent,#7654ca);line-height:1.6}
.ml-preset-card{padding:18px;gap:12px;justify-content:space-between;min-height:220px}
.ml-preset-card h3{margin:0;font-size:16px;overflow-wrap:anywhere}
.ml-template-formula{line-height:1.7;margin:0;overflow-wrap:anywhere}
.ml-script{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit;font-size:13px;line-height:1.8;margin:16px 0}
.ml-preset-detail{max-height:75vh;overflow:auto}
@media(max-width:640px){.ml-categories button,.ml-preset-card button{min-height:44px}.ml-preset-detail{max-height:none}.ml-category-body .ml-filters{flex-wrap:wrap}}
body.aurora-ui #workspace #creation #materials .ml-preset-card .ml-actions{display:flex;gap:8px;flex-wrap:wrap}
body.aurora-ui #workspace #creation #materials .ml-preset-card .ml-actions button{min-height:44px;flex:1}
body.aurora-ui #workspace #creation #materials .ml-category-body:has(.ml-preset-detail) .ml-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
body.aurora-ui #workspace #creation #materials .ml-categories button[aria-pressed=true]{background:var(--creation-purple,#775be8)!important;color:#fff!important;border-color:transparent!important}
@media(max-width:1050px){body.aurora-ui #workspace #creation #materials .ml-category-body:has(.ml-preset-detail) .ml-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){body.aurora-ui #workspace #creation #materials .ml-category-body:has(.ml-preset-detail) .ml-grid{grid-template-columns:1fr}}
/* The picker is a body-level dialog, outside #creation's thumbnail rules. */
.material-picker[open]{display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto;gap:12px;height:min(800px,calc(100dvh - 40px));max-height:calc(100dvh - 40px);overflow:hidden;background:var(--ui-surface,#fff);color:var(--ui-text,#223448)}
.material-picker .ml-heading{margin:0}.material-picker .ml-heading h2{margin:0;font-size:20px}
.material-picker>p{margin:0;font-size:13px}
.material-picker .ml-grid{overflow-y:auto;overflow-x:hidden;min-height:0;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));align-content:start;align-items:stretch;gap:12px;margin:0;padding:2px 4px 8px 0;scrollbar-gutter:stable}
.material-picker .ml-card{padding:12px;gap:8px;overflow:hidden;background:var(--ui-surface);border-color:var(--ui-border)}
.material-picker .ml-card:has(input:checked){background:var(--creation-soft,#f4f1ff);border-color:var(--ui-primary,#6549ef)}
.material-picker .ml-card>strong{font-size:13px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.material-picker .ml-card small{font-size:11px;color:var(--ui-text-muted,#64748b)}
.material-picker .studio-thumbnail{position:relative;display:block;flex:none;width:100%;height:150px;min-height:0;padding:0;overflow:hidden;border:0;border-radius:8px;background:var(--ui-surface-muted,#edf1f8);color:var(--ui-text-secondary,#405571)}
.material-picker .studio-thumbnail :is(video,img){position:absolute;inset:0;display:block;width:100%;height:100%;min-width:0;object-fit:contain;pointer-events:none}
.material-picker .studio-thumb-play{position:absolute;inset:0;display:grid;place-items:center;font-size:26px;color:#fff;text-shadow:0 1px 5px #0009}
.material-picker .studio-thumb-hint{font-size:12px;padding:12px}.material-picker .studio-duration{position:absolute;bottom:6px;right:6px;background:#142034cc;color:#fff;font-size:11px;padding:2px 5px;border-radius:4px}
.material-picker .ml-actions{gap:8px;margin-top:auto}.material-picker .ml-actions button{flex:1;padding:6px 10px;font-size:12px}
.material-picker .ml-choice{flex-direction:row;justify-content:flex-start;margin:0;min-height:32px;font-size:13px}
.material-picker .ml-choice input{width:16px;height:16px;margin:0}
.material-picker .ml-footer{position:static;margin:0;padding:12px 0 0;background:var(--ui-surface,#fff);border-color:var(--ui-border,#e2e8f0);gap:8px;font-size:13px}
.material-picker .ml-footer>span{margin-right:auto}.material-picker .ml-footer button{padding:8px 12px;font-size:13px}
@media(max-width:600px){.material-picker[open]{width:calc(100vw - 20px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);padding:14px;gap:10px}.material-picker .ml-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.material-picker .ml-card{padding:8px}.material-picker .studio-thumbnail{height:130px}.material-picker .ml-filters{gap:8px}.material-picker .ml-filters input{flex-basis:100%;min-width:0}.material-picker .ml-footer>span{flex-basis:100%}.material-picker .ml-footer button{flex:1}.material-picker .ml-actions{flex-wrap:wrap}}
.material-picker .ml-grid{grid-auto-rows:max-content}
.material-picker .ml-card>*{flex-shrink:0}
body.aurora-ui .material-picker .ml-card>strong{color:var(--ui-text,#223448)!important}
body.aurora-ui .material-picker .ml-card>small:nth-of-type(n+2){display:none!important}
