/* Template discovery and creator workspace: shared Ko2 tokens and controls. */
body {
    margin: 0;
    background: var(--bg-primary, #0a080f);
    color: var(--text-primary, #f5f3ff);
    font-family: var(--font-body, system-ui, sans-serif);
    line-height: 1.5;
}
.template-page, .template-detail, .template-workspace {
    max-width: 1120px;
    margin: auto;
    padding: 32px 20px 72px;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}
.template-detail { max-width: 900px; }
.template-workspace { max-width: 980px; }
main [hidden] { display: none !important; }
main .btn { min-height: 44px; box-sizing: border-box; white-space: normal; line-height: 1.3; }
main :is(a, button, input, textarea, select, summary):focus-visible {
    outline: 3px solid var(--brand-300, #c4b5fd);
    outline-offset: 3px;
}
main :is(input, textarea, select) {
    background: var(--bg-elevated, #1b1825);
    color: inherit;
    border: 1px solid #655a75;
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 44px;
    font: inherit;
    box-sizing: border-box;
    max-width: 100%;
}
main input[type=checkbox] { min-height: auto; width: 18px; height: 18px; accent-color: var(--brand-400, #a78bfa); }
.template-workspace label { display: block; margin: 12px 0; }
.template-workspace input:not([type=checkbox]):not([type=hidden]), .template-workspace textarea { display: block; width: 100%; margin-top: 6px; }
.template-workspace textarea { min-height: 100px; resize: vertical; }
.template-workspace-actions, .template-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.template-workspace-actions { margin-bottom: 24px; }
.template-actions { margin-top: 20px; }
.template-meta, .template-selection-note { color: var(--text-secondary, #bcb5cc); }
.template-page header, .template-detail header { margin-bottom: 24px; }
.template-guide {
    padding: 18px 20px;
    border: 1px solid var(--border-default, #494152);
    border-radius: 12px;
    background: var(--bg-secondary, #12101a);
    font-size: 15px;
}
.template-guide :is(h2, h3) { margin: 0 0 10px; font-size: 21px; line-height: 1.3; }
.template-guide p { margin: 8px 0; }
.template-guide a:not(.btn) { color: var(--brand-300, #c4b5fd); text-decoration: underline; text-underline-offset: 3px; }
.template-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 28px; margin: 0; padding-left: 22px; }
.template-guide-steps li { padding-left: 2px; }
.template-guide-creator { border-top: 1px solid var(--border-default, #494152); margin-top: 14px; padding-top: 8px; }
.template-guide-creator .btn { margin-top: 4px; }
.template-publish-guide { margin: 0 0 18px; }
.template-reward-details { margin: 10px 0; }
.template-reward-details summary { min-height: 44px; cursor: pointer; padding: 10px 0; box-sizing: border-box; font-weight: 600; }
.template-reward-details ul { margin: 4px 0 12px; padding-left: 22px; }
.template-reward-details li + li { margin-top: 8px; }
.template-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 24px 0; }
.template-filter-field { display: grid; gap: 6px; flex: 1 1 160px; }
.template-filters select { width: 100%; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.template-card, .earning {
    background: var(--bg-secondary, #12101a);
    border: 1px solid var(--border-default, rgba(155, 109, 255, .2));
    border-radius: 16px;
    padding: 20px;
    min-width: 0;
}
.template-card h2 { margin: 14px 0 6px; }
.template-card p { margin: 8px 0; }
.template-pair, .example-pair, .preview-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.template-triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.template-mode-badge { display: inline-block; padding: 4px 9px; margin-bottom: 12px; border-radius: 8px; background: rgba(155,109,255,.14); color: var(--brand-300, #c4b5fd); font-size: 13px; }
.template-pair figure, .example-pair figure, .preview-pair figure { margin: 0; min-width: 0; }
.template-pair img, .example-pair img, .preview-pair img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #08070c;
    border-radius: 10px;
}
.example-pair img { max-height: 340px; }
.preview-pair { max-width: 620px; margin: 18px 0; }
.preview-pair img { max-height: 280px; }
.template-pair figcaption, .example-pair figcaption, .preview-pair figcaption { margin-top: 6px; font-size: 13px; color: var(--text-secondary, #bcb5cc); }
.earnings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.earning strong { display: block; font-size: 26px; margin-top: 4px; }
.template-private-editor, .template-advanced-settings { padding: 16px; border: 1px solid var(--border-default, #494152); border-radius: 12px; margin-top: 16px; }
.template-advanced-settings summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.template-tag-options { border: 0; padding: 0; margin: 16px 0; }
.template-tag-options legend { margin-bottom: 6px; }
.template-workspace .template-tag-choice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin: 4px 8px 4px 0; padding: 0 10px; border: 1px solid var(--border-default, #494152); border-radius: 8px; }
.template-workspace .template-review-consent { display: flex; align-items: flex-start; gap: 10px; }
.template-review-consent input { flex: 0 0 18px; margin-top: 3px; }
.template-feedback:not(:empty), .template-unpublish-confirmation { padding: 14px; margin: 16px 0; border: 1px solid var(--border-default, #655a75); border-radius: 10px; background: var(--bg-secondary, #12101a); }
#creator-template-list { display: grid; gap: 20px; margin: 24px 0; }
@media (max-width: 560px) {
    .template-page, .template-detail, .template-workspace { padding: 22px 14px 48px; }
    .template-card { padding: 16px; }
    .template-guide { padding: 14px; }
    .template-guide-steps { grid-template-columns: 1fr; gap: 6px; }
    .template-pair, .example-pair, .preview-pair { gap: 8px; }
    .template-triple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .template-triple > figure:last-child { grid-column: 1 / -1; }
    .template-workspace-actions { justify-content: flex-start; }
    .template-actions .btn { flex: 1 1 auto; }
    .template-private-editor, .template-advanced-settings { padding: 12px; }
}
