/* Gallery tiles stay compact; all text and actions live in the native dialog. */
#template-grid.template-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(128px,1fr));gap:12px;align-items:start}
#template-grid .template-tile{min-width:0;padding:0;overflow:visible;border:0;border-radius:16px;background:none;box-shadow:none;transform:none}
.template-tile-open{display:block;width:100%;padding:0;border-radius:16px;overflow:hidden;border:1px solid var(--border);background:var(--panel)}
#template-grid .template-tile .template-art.template-static{width:100%;height:auto;aspect-ratio:1;padding:14px;border:0;border-radius:15px;background:#232326!important}
#template-grid .template-tile .template-art img{width:100%;height:100%;min-height:0;max-width:112px;max-height:112px;object-fit:contain;transform:none}
.template-tile-open:hover{border-color:#79797f;background:#303034}
.template-tile-open:focus-visible{outline:2px solid var(--text);outline-offset:3px}
.template-detail-dialog{position:fixed;width:min(540px,calc(100% - 28px));max-width:540px;max-height:calc(100dvh - 28px);padding:26px;overflow:auto;border:1px solid var(--border);border-radius:22px;background:var(--panel);color:var(--text)}
.template-detail-dialog::backdrop{background:rgb(0 0 0 / .72)}
.template-detail-close{position:absolute;right:12px;top:12px;width:44px;height:44px;display:grid;place-items:center;font-size:28px;border:1px solid var(--border);border-radius:50%;background:var(--bg);z-index:1}
.template-detail-art{display:grid;place-items:center;padding:16px;min-height:200px;background:#232326;border-radius:16px}
.template-detail-art img{display:block;width:192px;height:192px;max-width:100%;object-fit:contain}
.template-detail-dialog .template-copy{padding:22px 0 0}
.template-detail-dialog .template-copy>div:first-child{display:flex;flex-direction:column;align-items:flex-start;gap:6px}
.template-detail-dialog .template-copy h3{font-size:22px;overflow-wrap:anywhere}
.template-detail-dialog .template-copy small{font-size:12px;color:var(--muted)}
.template-detail-dialog .template-copy p{font-size:13px;min-height:0;overflow-wrap:anywhere}
.template-detail-dialog .template-prompt{margin-top:16px}
.template-detail-dialog .template-prompt summary{cursor:pointer;min-height:32px}
.template-detail-dialog .template-prompt textarea{display:block;width:100%;box-sizing:border-box;resize:vertical;min-height:150px;font-size:13px}
.template-detail-dialog .template-prompt .gallery-source{display:block;margin-top:12px;text-decoration:underline;font-size:12px}
.template-detail-dialog .template-copy .template-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:20px}
.template-detail-dialog .template-actions .secondary-button{display:flex;align-items:center;justify-content:center;text-align:center;min-height:46px;white-space:normal;font-size:12px}
.template-detail-dialog .template-kit-button{grid-column:1 / -1}
.template-detail-dialog .copy-prompt{min-height:44px}
@media(max-width:760px){#template-grid.template-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}#template-grid .template-tile .template-art.template-static{padding:12px}.template-detail-dialog{padding:20px}.template-detail-art img{width:168px;height:168px}}
