/* Poster studio -- every selector scoped under the tool root (.rp-collage) */
.rp-collage{--rp-danger:#dc2626;color:var(--text,#1e293b);font-size:16px;line-height:1.5;min-width:0}
.rp-collage *,.rp-collage *::before,.rp-collage *::after{box-sizing:border-box}
.rp-collage [hidden]{display:none!important}
.rp-collage .rp-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.rp-collage .rp-studio{display:grid;gap:24px;background:var(--card,#fff);border:1px solid var(--border,#e2e8f0);border-radius:16px;padding:16px;box-shadow:var(--shadow-1,0 1px 2px rgba(0,0,0,.06))}
@media (min-width:768px){.rp-collage .rp-studio{grid-template-columns:minmax(0,1fr) 320px;padding:24px}}
.rp-collage .rp-left,.rp-collage .rp-right,.rp-collage .rp-stack{display:flex;flex-direction:column;gap:12px;min-width:0}
.rp-collage .rp-right{gap:20px}
.rp-collage .rp-step{display:flex;align-items:center;gap:8px;margin:0;font-size:16px;font-weight:600;line-height:1.3}
.rp-collage .rp-step-n{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:999px;background:var(--primary,#4f46e5);color:#fff;font-size:12px;flex:none}
.rp-collage .rp-field{display:flex;flex-direction:column;gap:6px;min-width:0}
.rp-collage .rp-label{font-size:14px;font-weight:500}
.rp-collage .rp-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.rp-collage .rp-wrap{flex-wrap:wrap;justify-content:flex-start;gap:8px}
.rp-collage .rp-muted{color:var(--muted,#64748b);font-size:14px}
.rp-collage .rp-strong{font-weight:600}
.rp-collage .rp-hint{margin:0;font-size:12px;color:var(--muted,#64748b)}
.rp-collage .rp-block{display:block}
.rp-collage .rp-tabnum,.rp-collage .rp-num{font-variant-numeric:tabular-nums}
.rp-collage .rp-num{font-size:14px}
/* Segmented */
.rp-collage .rp-seg{display:flex;flex-wrap:wrap;gap:6px}
.rp-collage .rp-seg-btn{font:inherit;font-size:14px;line-height:1.3;padding:6px 12px;border-radius:8px;border:1px solid var(--border,#e2e8f0);background:var(--card,#fff);color:inherit;cursor:pointer;transition:background .15s,border-color .15s}
.rp-collage .rp-seg-btn:hover:not(:disabled){background:var(--primary-soft,#eef2ff)}
.rp-collage .rp-seg-btn[aria-checked=true]{background:var(--primary,#4f46e5);border-color:var(--primary,#4f46e5);color:#fff}
.rp-collage button:disabled{opacity:.5;cursor:default}
.rp-collage button:focus-visible,.rp-collage input:focus-visible,.rp-collage textarea:focus-visible{outline:2px solid var(--primary,#4f46e5);outline-offset:2px}
/* Range */
.rp-collage .rp-range{--rp-pct:0%;width:100%;height:20px;margin:0;background:transparent;-webkit-appearance:none;appearance:none;cursor:pointer}
.rp-collage .rp-range::-webkit-slider-runnable-track{height:6px;border-radius:999px;background:linear-gradient(var(--primary,#4f46e5),var(--primary,#4f46e5)) 0/var(--rp-pct) 100% no-repeat,var(--border,#e2e8f0)}
.rp-collage .rp-range::-moz-range-track{height:6px;border-radius:999px;background:var(--border,#e2e8f0)}
.rp-collage .rp-range::-moz-range-progress{height:6px;border-radius:999px;background:var(--primary,#4f46e5)}
.rp-collage .rp-range::-webkit-slider-thumb{-webkit-appearance:none;width:18px;height:18px;margin-top:-6px;border-radius:50%;background:#fff;border:2px solid var(--primary,#4f46e5);box-shadow:var(--shadow-1,0 1px 2px rgba(0,0,0,.06))}
.rp-collage .rp-range::-moz-range-thumb{width:14px;height:14px;border-radius:50%;background:#fff;border:2px solid var(--primary,#4f46e5)}
/* Switch */
.rp-collage .rp-toggle{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;font-size:14px;cursor:pointer}
.rp-collage .rp-switch{-webkit-appearance:none;appearance:none;flex:none;width:40px;height:22px;margin:0;border-radius:999px;background:var(--border,#e2e8f0);position:relative;cursor:pointer;transition:background .15s}
.rp-collage .rp-switch::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:transform .15s}
.rp-collage .rp-switch:checked{background:var(--primary,#4f46e5)}
.rp-collage .rp-switch:checked::after{transform:translateX(18px)}
/* Stats + notices */
.rp-collage .rp-stats{display:grid;grid-template-columns:1fr auto;gap:4px 12px;margin:0;padding:12px;border-radius:8px;background:var(--bg,#f8fafc);font-size:14px}
.rp-collage .rp-stats dt{color:var(--muted,#64748b)}
.rp-collage .rp-stats dd{margin:0;text-align:right;font-weight:500;font-variant-numeric:tabular-nums}
.rp-collage .rp-notice{margin:0;padding:12px;border-radius:8px;border:1px solid;font-size:14px}
.rp-collage .rp-notice-info{border-color:#bae6fd;background:#f0f9ff;color:#0c4a6e}
.rp-collage .rp-notice-warn{border-color:#fcd34d;background:#fffbeb;color:#78350f}
.rp-collage .rp-error{margin:0;font-size:14px;color:var(--rp-danger)}
/* Export */
.rp-collage .rp-export{display:flex;flex-direction:column;gap:12px;padding-top:20px;border-top:1px solid var(--border,#e2e8f0)}
.rp-collage .rp-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;padding:0 16px;border:0;border-radius:10px;background:var(--primary,#4f46e5);color:#fff;font:inherit;font-weight:600;cursor:pointer;transition:background .15s}
.rp-collage .rp-btn:hover:not(:disabled){background:var(--primary-hover,#4338ca)}
.rp-collage .rp-btn.is-busy .rp-ico{animation:rp-spin 1s linear infinite}
@keyframes rp-spin{to{transform:rotate(360deg)}}
.rp-collage .rp-btn-ghost,.rp-collage .rp-btn-text{display:inline-flex;align-items:center;gap:6px;font:inherit;font-size:14px;padding:6px 12px;border-radius:8px;border:1px solid var(--border,#e2e8f0);background:var(--card,#fff);color:inherit;cursor:pointer;white-space:nowrap}
.rp-collage .rp-btn-text{border-color:transparent;background:transparent}
.rp-collage .rp-btn-ghost:hover,.rp-collage .rp-btn-text:hover{background:var(--primary-soft,#eef2ff)}
.rp-collage .rp-ico{display:inline-flex;line-height:0}
.rp-collage .rp-bar{height:8px;border-radius:999px;background:var(--border,#e2e8f0);overflow:hidden}
.rp-collage .rp-bar-fill{height:100%;width:0;background:var(--primary,#4f46e5);transition:width .2s}
.rp-collage .rp-progress{display:flex;flex-direction:column;gap:4px}
/* Preview */
.rp-collage .rp-preview{position:relative;width:100%;overflow:hidden;border-radius:8px;border:1px solid var(--border,#e2e8f0);background:repeating-conic-gradient(#f4f4f5 0% 25%,#fff 0% 50%) 0 0/16px 16px}
.rp-collage .rp-preview canvas{position:absolute;inset:0;width:100%;height:100%}
.rp-collage .rp-grid{position:absolute;inset:0;display:grid}
.rp-collage .rp-tile{position:relative;border:1px dashed rgba(255,255,255,.9);box-shadow:inset 0 0 0 1px rgba(0,0,0,.25)}
.rp-collage .rp-tile span{position:absolute;left:4px;top:4px;padding:0 4px;border-radius:4px;background:rgba(0,0,0,.6);color:#fff;font-size:10px;font-weight:500;line-height:1.5}
/* Drop zone */
.rp-collage .rp-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;width:100%;aspect-ratio:4/3;padding:24px;border:2px dashed var(--border,#e2e8f0);border-radius:12px;background:transparent;color:inherit;font:inherit;text-align:center;cursor:pointer;transition:background .15s,border-color .15s}
.rp-collage .rp-drop:hover,.rp-collage .rp-drop.is-drag{border-color:var(--primary,#4f46e5);background:var(--primary-soft,#eef2ff)}
.rp-collage .rp-drop .rp-ico{color:var(--muted,#64748b)}
.rp-collage .rp-drop-title{font-weight:500}
.rp-collage .rp-drop-hint{font-size:14px;color:var(--muted,#64748b)}
.rp-collage .rp-skel{display:block;width:100%;height:100%;border-radius:6px;background:var(--border,#e2e8f0);animation:rp-pulse 1.5s ease-in-out infinite}
@keyframes rp-pulse{50%{opacity:.5}}
.rp-collage .rp-skel-row{height:56px}
@media (max-width:640px){.rp-collage .rp-drop{aspect-ratio:auto;min-height:220px}}
/* Collage: photo list + layout controls */
.rp-collage .rp-thumbs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:0;padding:0;list-style:none}
@media (min-width:640px){.rp-collage .rp-thumbs{grid-template-columns:repeat(6,minmax(0,1fr))}}
.rp-collage .rp-thumb{position:relative;aspect-ratio:1;overflow:hidden;border-radius:6px;border:1px solid var(--border,#e2e8f0)}
.rp-collage .rp-thumb img{display:block;width:100%;height:100%;object-fit:cover}
.rp-collage .rp-thumb-n{position:absolute;left:4px;top:4px;padding:0 4px;border-radius:4px;background:rgba(0,0,0,.6);color:#fff;font-size:10px;line-height:1.5}
.rp-collage .rp-thumb-x{position:absolute;right:4px;top:4px;display:inline-flex;padding:3px;border:0;border-radius:999px;background:rgba(0,0,0,.6);color:#fff;cursor:pointer}
.rp-collage .rp-thumb-x:hover{background:rgba(0,0,0,.8)}
.rp-collage .rp-thumb-add{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;aspect-ratio:1;border:2px dashed var(--border,#e2e8f0);border-radius:6px;background:transparent;color:var(--muted,#64748b);font:inherit;font-size:12px;cursor:pointer}
.rp-collage .rp-thumb-add:hover{border-color:var(--primary,#4f46e5)}
.rp-collage .rp-cols3{display:grid;gap:16px}
@media (min-width:640px){.rp-collage .rp-cols3{grid-template-columns:repeat(3,minmax(0,1fr))}}
/* Templates: gallery + editor */