.templates-page [hidden] {
    display: none !important;
}

.templates-page {
    background:
        radial-gradient(ellipse at 84% 17%, rgba(225, 220, 255, 0.52), transparent 34rem),
        #f7f8fc;
}

.template-detail-page { 
    height: 100svh;
    overflow: hidden;
    scrollbar-width: thin;
    scrollbar-color: #596172 #1e1e1e;
}

.template-detail-page * {
    scrollbar-width: thin;
    scrollbar-color: #596172 #1e1e1e;
}

.template-detail-page *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.template-detail-page *::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.template-detail-page *::-webkit-scrollbar-thumb {
    border: 2px solid #1e1e1e;
    border-radius: 8px;
    background: #596172;
}

.template-detail-page *::-webkit-scrollbar-thumb:hover {
    background: #788194;
}

.templates-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.templates-nav > a,
.templates-footer a {
    color: #646a80;
    font-size: 13px;
    font-weight: 650;
    text-decoration: none;
}

.templates-nav > a:hover,
.templates-footer a:hover {
    color: var(--purple);
}

.templates-main {
    width: min(calc(100% - var(--page-gutter) * 2), 1240px);
    margin-inline: auto;
}

.template-detail-main {
    position: fixed;
    inset: 88px 0 0;
    z-index: 10;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.template-detail-main > .project-live-workspace {
    width: 100%;
    height: 100%;
    margin: 0;
}

.templates-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 12px;
}

.templates-breadcrumb a {
    color: var(--purple);
    font-weight: 700;
    text-decoration: none;
}

.templates-breadcrumb a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.templates-hero {
    padding-block: clamp(52px, 8vw, 92px) clamp(38px, 6vw, 64px);
}

.templates-eyebrow {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
    color: #777b92;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1.6px;
}

.templates-eyebrow > span,
.templates-hero > .templates-eyebrow::before {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #7c6cf1;
    box-shadow: 0 0 0 4px rgba(124, 108, 241, 0.12);
}

.templates-hero > .templates-eyebrow > span {
    display: none;
}

.templates-hero h2 {
    margin: 20px 0 0;
    color: var(--ink);
    font-size: clamp(40px, 6vw, 68px);
    font-weight: 740;
    letter-spacing: clamp(-3.6px, -0.3vw, -2px);
    line-height: 1.08;
}

.templates-hero h2 span {
    color: var(--purple);
}

.templates-lead {
    max-width: 66ch;
    margin: 20px 0 0;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.template-browser {
    display: grid;
    grid-template-columns: minmax(230px, 0.72fr) minmax(0, 2fr);
    align-items: start;
    gap: 20px;
    margin-bottom: 18px;
}

.project-catalog {
    margin-bottom: 28px;
}

.project-catalog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.project-catalog-heading h2 {
    margin: 8px 0 0;
    color: var(--ink);
    font-size: 21px;
    letter-spacing: -0.6px;
}

.project-search {
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 18px;
    padding: 0 13px;
    border: 1px solid #e5e2ef;
    background: #fff;
    color: #85899a;
    border: 1px solid black;
    box-shadow: 2px 2px 0px black;
}

.project-search:focus-within {
    border-color: #9c8eff;
    box-shadow: none;
    border: 1px solid black;
    box-shadow: 2px 2px 0px black;
}

.project-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

.templates-page .project-search input:focus-visible {
    outline: none;
}

.project-search input::placeholder {
    color: #9296a7;
}

.project-search kbd {
    flex: 0 0 auto;
    padding: 2px 6px;
    border: 1px solid #e5e2ef;
    border-radius: 4px;
    background: #f7f8fc;
    color: #777b92;
    font: inherit;
    font-size: 10px;
}

.project-sidebar,
.project-detail {
    min-width: 0;
    border: 1px solid #e7e4f2;
    background: rgba(255, 255, 255, 0.84);
    box-shadow: 6px 6px 0 rgba(104, 86, 232, 0.09), 0 16px 44px rgba(44, 42, 83, 0.05);
}

.project-sidebar {
    padding: 20px;
}

.project-sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eeecf5;
}

.project-sidebar-heading h2,
.project-title-group h2 {
    margin: 8px 0 0;
    color: var(--ink);
    font-size: 19px;
    letter-spacing: -0.5px;
}

.project-count {
    min-width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eeecff;
    color: var(--purple);
    font-size: 12px;
    font-weight: 750;
}

.project-list-status,
.source-status {
    margin: 14px 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 16px;
}

.project-card {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 20px;
    border: 1px solid black;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.86);
    color: inherit;
    text-align: left;
    text-decoration: none;
    transition: border-color 150ms ease, background-color 150ms ease, transform 150ms ease;
    box-shadow: 3px 3px 0px black;
}

.project-card-heading,
.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.project-card-heading > i {
    flex: 0 0 auto;
    color: var(--purple);
    font-size: 12px;
}

.project-card:hover {
    transform: translateY(-3px);
}

.project-card[hidden] {
    display: none;
}

.project-card-name {
    overflow-wrap: anywhere;
    color: var(--ink);
    font-size: 14px;
    font-weight: 720;
}

.project-card-author {
    color: var(--muted);
    font-size: 11px;
}

.project-card-author i {
    margin-right: 5px;
    color: var(--purple);
}

.project-card-description {
    min-height: 42px;
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.project-card-footer {
    padding-top: 10px;
    border-top: 1px solid #eeecf5;
    color: #777b92;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.project-card-footer > span:last-child {
    color: var(--purple);
    font-size: 11px;
    letter-spacing: 0;
}

.project-card-footer i {
    margin-right: 4px;
}

.project-detail {
    padding: clamp(18px, 2.5vw, 28px);
}

.project-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.preview-open-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid #ded9f8;
    border-radius: 7px;
    background: #fff;
    color: #5b4acb;
    font-size: 11px;
    font-weight: 720;
    text-decoration: none;
    white-space: nowrap;
}

.preview-open-link:hover {
    border-color: #b9adff;
    background: #f8f6ff;
}

.project-title-group {
    min-width: 0;
}

.project-title-group h2 {
    font-size: clamp(20px, 2.5vw, 27px);
    overflow-wrap: anywhere;
}

.project-description {
    max-width: 68ch;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.repository-link,
.panel-heading a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--purple);
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
}

.repository-link:hover,
.panel-heading a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.license-notice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 18px 0;
    padding: 11px 13px;
    border: 1px solid #efdfb7;
    background: #fffaf0;
    color: #80662e;
    font-size: 11px;
    line-height: 1.6;
}

.license-notice i {
    margin-top: 2px;
}

.project-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
}

.repository-files {
    max-height: 200px;
    overflow: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #20242c;
    scrollbar-color: #555c69 #20242c;
}

.repository-files .source-status {
    min-height: 48px;
}

.project-list-status[data-state="error"],
.project-empty-state {
    color: #a44343;
}

.project-empty-state {
    margin: 18px 0 0;
    font-size: 13px;
}

.file-list {
    display: grid;
    padding: 6px;
}

.file-list-item {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border: 0;
    background: transparent;
    color: #c5cad4;
    cursor: pointer;
    font: inherit;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
    text-align: left;
}

.file-list-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-list-item > i {
    flex: 0 0 auto;
    color: #a99cff;
}

.file-list-item:hover,
.file-list-item[aria-pressed="true"] {
    background: #34303f;
    color: #fff;
}

.file-list-item[aria-pressed="true"] {
    box-shadow: inset 2px 0 0 #a99cff;
}

.code-panel,
.preview-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dedee8;
    background: #1d2128;
}

.panel-heading {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: #252a33;
}

.panel-heading h3 {
    overflow: hidden;
    margin: 0;
    color: #f1f2f5;
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-heading h3 i {
    margin-right: 6px;
    color: #a99cff;
}

.panel-heading a {
    color: #c4baff;
    white-space: nowrap;
}

.source-filename {
    overflow: hidden;
    color: #aab0bd;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.source-status {
    min-height: 64px;
    display: grid;
    align-content: center;
    margin: 0;
    padding: 14px;
    color: #c5cad4;
}

.source-status[data-state="error"] {
    color: #ffaaa7;
}

.source-code {
    max-height: 560px;
    min-height: 280px;
    overflow: auto;
    margin: 0;
    padding: 16px;
    background: #1d2128;
    scrollbar-color: #555c69 #1d2128;
}

.source-code code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: 1.65;
    tab-size: 2;
}

.preview-frame-wrap {
    position: relative;
    min-height: 360px;
    background:
        linear-gradient(45deg, #262b34 25%, transparent 25%),
        linear-gradient(-45deg, #262b34 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #262b34 75%),
        linear-gradient(-45deg, transparent 75%, #262b34 75%),
        #20242c;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-size: 14px 14px;
}

.preview-frame-wrap iframe {
    width: 100%;
    height: 520px;
    display: block;
    border: 0;
    background: white;
}

.preview-placeholder {
    min-height: 360px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 12px;
    padding: 24px;
    color: #c5cad4;
    font-size: 12px;
    text-align: center;
}

.preview-placeholder i {
    color: #a99cff;
    font-size: 28px;
}

.templates-footnote {
    margin: 0 0 42px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}

.templates-footer {
    width: min(calc(100% - var(--page-gutter) * 2), 1240px);
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-inline: auto;
    border-top: 1px solid rgba(38, 42, 69, 0.08);
}

.templates-page a:focus-visible,
.templates-page button:focus-visible,
.templates-page input:focus-visible {
    outline: 3px solid rgba(104, 86, 232, 0.48);
    outline-offset: 3px;
}

.vscode-editor {
    overflow: visible;
    border: 0;
    background: #1e1e1e;
}

.project-live-workspace {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    align-items: stretch;
    gap: 1px;
}

.template-detail-page.code-only .project-live-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.template-detail-page.code-only .project-live-preview {
    display: none;
}

.template-detail-page .vscode-editor,
.template-detail-page .project-live-preview {
    height: 100%;
    min-height: 0;
}

.template-detail-page .vscode-editor {
    display: flex;
    flex-direction: column;
}

.template-detail-page .editor-titlebar {
    position: relative;
    top: auto;
    flex: 0 0 auto;
}

.template-detail-page .editor-workspace {
    height: auto;
    flex: 1 1 0;
    min-height: 0;
    overscroll-behavior: contain;
}

.template-detail-page .project-live-preview {
    display: flex;
    flex-direction: column;
}

.template-detail-page .live-preview-heading {
    flex: 0 0 auto;
}

.template-detail-page .project-preview-stage {
    height: auto;
    flex: 1 1 0;
    min-height: 0;
}

.project-live-preview {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dedee8;
    border-radius: 8px;
    background: #1e1e1e;
}

.live-preview-heading {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid #353a45;
    background: #252526;
}

.preview-eyebrow {
    margin: 0 0 4px;
    color: #aaa1e8;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 1px;
}

.live-preview-heading h3 {
    margin: 0;
    color: #f1f2f5;
    font-size: 13px;
    font-weight: 700;
}

.live-preview-heading h3 i {
    margin-right: 5px;
    color: #a99cff;
}

.live-preview-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.preview-state {
    color: #aeb4c0;
    font-size: 10px;
    white-space: nowrap;
}

.preview-open-link {
    padding: 7px 9px;
    font-size: 10px;
}

.project-preview-stage {
    min-width: 0;
    min-height: 520px;
    height: min(680px, calc(100svh - 270px));
    position: relative;
    overflow: hidden;
    background: #fff;
}

.project-preview-stage iframe {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    display: block;
    border: 0;
    background: #fff;
}

.project-preview-stage .preview-placeholder {
    position: absolute;
    inset: 0;
    min-height: 0;
    color: #71768b;
    background: #f8f8fb;
}

.project-preview-stage .preview-placeholder i {
    color: var(--purple);
}

.editor-titlebar {
    position: sticky;
    top: 88px;
    z-index: 19;
    min-height: 48px;
    display: grid;
    grid-template-columns: 1fr minmax(0, 2fr) 1fr;
    align-items: center;
    gap: 14px;
    padding: 7px 14px;
    border-bottom: 1px solid #353a45;
    background: #252526;
}

.editor-window-controls {
    display: flex;
    gap: 7px;
}

.editor-window-controls i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5f57;
}

.editor-window-controls i:nth-child(2) {
    background: #febc2e;
}

.editor-window-controls i:nth-child(3) {
    background: #28c840;
}

.editor-project-title {
    overflow: hidden;
    color: #c8c8c8;
    font-size: 11px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-run-button {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid #40935f;
    border-radius: 4px;
    background: #238636;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.editor-run-button:hover:not(:disabled) {
    background: #2ea043;
}

.editor-run-button:disabled {
    border-color: #4a4a4a;
    background: #3a3a3a;
    color: #858585;
    cursor: not-allowed;
}

.editor-title-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-download-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #5a4bc2;
    border-radius: 4px;
    background: #6955df;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.editor-download-button:hover {
    background: #5845cb;
}

.editor-files-button {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #eee;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
}

.editor-workspace {
    height: 620px;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(190px, 245px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.explorer-backdrop {
    display: none;
}

.editor-explorer {
    min-width: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border-right: 1px solid #353a45;
    background: #252526;
}

.explorer-heading {
    padding: 14px 15px 12px;
    color: #bbbbbb;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1px;
}

.explorer-project-name {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #dedede;
    font-size: 11px;
    font-weight: 700;
}

.explorer-project-name i {
    color: #dcb67a;
}

.explorer-project-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-explorer .source-status {
    padding-inline: 12px;
    color: #b8b8b8;
}

.editor-explorer .source-status[data-state="error"] {
    color: #f48771;
}

.editor-explorer .source-status[data-state="warning"] {
    color: #e2bf74;
}

.editor-explorer .file-list {
    padding: 2px 0 12px;
}

.file-list-directory {
    min-width: 0;
}

.file-list-folder {
    width: 100%;
    padding-left: calc(9px + var(--folder-depth, 0) * 12px);
}

.file-list-folder .folder-chevron {
    width: 9px;
    color: #969baa;
    font-size: 8px;
}

.file-list-folder .folder-icon {
    color: #dcb67a;
}

.file-list-folder-children {
    display: grid;
    margin-left: 16px;
    border-left: 1px solid #3a3d45;
}

.editor-code-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-rows: 42px 34px auto minmax(0, 1fr);
    background: #1e1e1e;
}

.editor-tabs {
    min-height: 42px;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #353a45;
    background: #252526;
}

.editor-tab {
    max-width: min(70%, 420px);
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    border-top: 1px solid #8b75ff;
    background: #1e1e1e;
    color: #e2e2e2;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-tab i {
    color: #a99cff;
}

.editor-repository-link {
    margin-right: 14px;
    color: #b6aaff;
}

.editor-breadcrumb {
    min-height: 34px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #282828;
    color: #9d9d9d;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
}

.editor-code-panel > .source-status {
    margin: 0;
    padding: 18px;
    color: #c5cad4;
}

.editor-code-panel > .source-status[data-state="error"] {
    color: #f48771;
}

.editor-code-panel > .source-status[data-state="warning"] {
    border-bottom: 1px solid #554526;
    background: #332b1d;
    color: #e2bf74;
}

.readme-preview {
    grid-row: 4;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    padding: 20px 24px;
    color: #d4d4d4;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.readme-preview[hidden] {
    display: none;
}

.readme-preview > :first-child {
    margin-top: 0;
}

.readme-preview h1,
.readme-preview h2,
.readme-preview h3,
.readme-preview h4 {
    margin-block: 1.4em 0.6em;
    color: #f1f1f1;
    line-height: 1.3;
}

.readme-preview h1,
.readme-preview h2 {
    padding-bottom: 0.3em;
    border-bottom: 1px solid #3b4048;
}

.readme-preview a {
    color: #a99cff;
}

.readme-preview img {
    max-width: 100%;
    height: auto;
}

.readme-preview pre {
    overflow: auto;
    padding: 12px;
    border: 1px solid #3b4048;
    border-radius: 5px;
    background: #21252b;
}

.readme-preview code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.readme-preview :not(pre) > code {
    padding: 2px 5px;
    border-radius: 3px;
    background: #30343c;
}

.readme-preview blockquote {
    margin-inline: 0;
    padding-left: 12px;
    border-left: 3px solid #6955df;
    color: #aeb4c0;
}

.readme-preview table {
    display: block;
    max-width: 100%;
    overflow: auto;
    border-collapse: collapse;
}

.readme-preview th,
.readme-preview td {
    padding: 6px 10px;
    border: 1px solid #3b4048;
}

.readme-preview th {
    background: #252a33;
}

.source-editor {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    background: #282c34;
}

.source-line-numbers {
    min-width: 0;
    overflow: hidden;
    padding: 0;
    border-right: 1px solid #3b404a;
    background: #21252b;
    color: #636d83;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.7;
    text-align: right;
    user-select: none;
}

.source-line-numbers span {
    height: 1.7em;
    display: block;
    padding-right: 10px;
}

.editor-code-panel .source-code {
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    overflow: auto;
    margin: 0;
    padding: 0;
    border: 0;
    overscroll-behavior: contain;
    background: #282c34;
    scrollbar-color: #596172 #282c34;
}

.editor-code-panel .source-code code,
.editor-code-panel .source-code code.hljs {
    min-height: 100%;
    display: block;
    margin: 0;
    padding: 0 0 48px;
    overflow: visible;
    background: transparent;
    color: #abb2bf;
    font-size: 12px;
    line-height: 1.7;
    white-space: pre;
}

.editor-code-panel .source-code code {
    font-size: 12px;
}

.editor-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 13px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.7;
}

.editor-hint i {
    color: var(--purple);
}

.editor-hint strong {
    color: var(--ink);
}

.preview-is-open {
    overflow: hidden;
}

.preview-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    background: #1e1e1e;
}

.preview-fullscreen[hidden] {
    display: none;
}

.preview-fullscreen-toolbar {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 7px 14px;
    border-bottom: 1px solid #353a45;
    background: #252526;
}

.preview-fullscreen-toolbar h2 {
    overflow: hidden;
    flex: 1;
    margin: 0;
    color: #d4d4d4;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-fullscreen-toolbar h2 i {
    margin-right: 7px;
    color: #a99cff;
}

.preview-files-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #eee;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
}

.preview-fullscreen-toolbar > a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #b6aaff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.preview-close-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #333;
    color: #eee;
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
}

.codepen-workspace {
    min-height: 0;
    position: relative;
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) minmax(0, 1fr);
    background: #1e1e1e;
}

.codepen-file-sidebar {
    min-width: 0;
    overflow: auto;
    border-right: 1px solid #353a45;
    background: #252526;
}

.codepen-sidebar-heading {
    padding: 14px 14px 12px;
    color: #bbb;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 1px;
}

.codepen-sidebar-project {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: #dedede;
    font-size: 11px;
    font-weight: 700;
}

.codepen-sidebar-project i {
    color: #dcb67a;
}

.codepen-sidebar-project span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.codepen-file-list {
    display: grid;
    padding: 2px 0 12px;
}

.codepen-file-list .file-list-item {
    width: 100%;
}

.codepen-file-list .file-list-item[aria-pressed="true"] {
    background: #34303f;
    box-shadow: inset 2px 0 0 #a99cff;
}

.codepen-source-pane,
.codepen-preview-pane {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.codepen-source-pane {
    border-right: 1px solid #353a45;
    background: #1e1e1e;
}

.codepen-pane-heading {
    min-width: 0;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid #353a45;
    background: #252526;
    color: #bcbcbc;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.7px;
}

.codepen-pane-heading > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.codepen-pane-heading i {
    margin-right: 6px;
    color: #a99cff;
}

.codepen-source-code {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    margin: 0;
    padding: 14px 16px;
    background: #1e1e1e;
    scrollbar-color: #555c69 #1e1e1e;
}

.codepen-source-code code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: 1.65;
    tab-size: 2;
}

.codepen-preview-pane {
    position: relative;
    background: #fff;
}

.codepen-preview-stage {
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.codepen-preview-stage .preview-placeholder {
    position: absolute;
    inset: 0;
}

.codepen-preview-pane .preview-placeholder {
    min-height: 0;
    color: #71768b;
}

.codepen-preview-pane .preview-placeholder i {
    color: var(--purple);
}

.codepen-preview-stage iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: block;
    border: 0;
    background: #fff;
}

.preview-files-backdrop {
    display: none;
}

.preview-is-open .editor-explorer,
.preview-is-open .editor-workspace > .explorer-backdrop {
    visibility: hidden;
}

@media (max-width: 900px) {
    .template-browser {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-live-workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .project-preview-stage {
        min-height: 0;
        height: auto;
    }

    .codepen-workspace {
        grid-template-columns: minmax(160px, 190px) minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 680px) {
    .templates-page header {
        min-height: 72px;
    }

    .editor-titlebar {
        top: 72px;
    }

    .templates-nav {
        gap: 12px;
    }

    .templates-nav > a {
        font-size: 11px;
    }

    .templates-hero {
        padding-block: 44px 34px;
    }

    .templates-hero h2 {
        font-size: clamp(38px, 10vw, 54px);
        letter-spacing: -2.4px;
    }

    .templates-lead {
        font-size: 13px;
    }

    .project-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-files-button {
        display: inline-flex;
    }

    .editor-workspace {
        height: auto;
        min-height: calc(100svh - 280px);
        display: block;
        position: relative;
        overflow: hidden;
    }

    .editor-explorer {
        position: fixed;
        inset: 72px auto 0 0;
        z-index: 1002;
        width: min(82vw, 320px);
        max-height: none;
        border: 0;
        border-right: 1px solid #45454f;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.32);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    .explorer-is-open .editor-explorer {
        transform: translateX(0);
    }

    .explorer-backdrop {
        position: fixed;
        inset: 72px 0 0;
        z-index: 1001;
        display: block;
        border: 0;
        background: rgba(10, 10, 14, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .explorer-is-open .explorer-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .editor-window-controls {
        display: none;
    }

    .editor-workspace {
        height: calc(100svh - 254px);
        min-height: 0;
    }

    .editor-code-panel {
        height: 100%;
        display: block;
        min-height: 0;
    }

    .editor-code-panel .source-code {
        height: calc(100% - 76px);
        min-height: 0;
        padding: 14px 10px;
    }

    .editor-code-panel .source-code code {
        font-size: 10px;
    }

    .live-preview-heading {
        align-items: flex-start;
        padding: 10px;
    }

    .live-preview-actions {
        flex-wrap: wrap;
        gap: 6px;
    }

    .project-preview-stage {
        min-height: 390px;
        height: 68svh;
    }

    .template-detail-page .project-live-workspace {
        height: 100%;
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
        gap: 1px;
    }

    .template-detail-page .vscode-editor {
        min-height: 0;
    }

    .template-detail-page .editor-workspace {
        height: auto;
        min-height: 0;
        flex: 1 1 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        overflow: hidden;
    }

    .template-detail-page .editor-code-panel {
        height: 100%;
        min-height: 0;
        display: block;
    }

    .template-detail-page .editor-code-panel .source-code {
        height: calc(100% - 76px);
        min-height: 0;
        overflow: auto;
    }

    .template-detail-page .source-editor {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .template-detail-page .readme-preview {
        height: calc(100% - 76px);
    }

    .template-detail-page .source-line-numbers {
        font-size: 10px;
    }

    .template-detail-page .editor-code-panel .source-code code,
    .template-detail-page .editor-code-panel .source-code code.hljs {
        font-size: 10px;
    }

    .template-detail-page .project-live-preview {
        min-height: 0;
    }

    .template-detail-page .project-preview-stage {
        height: auto;
        min-height: 0;
        flex: 1 1 0;
    }

    .project-detail-heading {
        flex-direction: column;
        gap: 14px;
    }

    .preview-frame-wrap,
    .preview-placeholder {
        min-height: 300px;
    }

    .preview-frame-wrap iframe {
        height: 420px;
    }

    .preview-fullscreen-toolbar {
        gap: 8px;
        padding-inline: 10px;
    }

    .preview-fullscreen-toolbar h2 {
        font-size: 11px;
    }

    .preview-fullscreen-toolbar h2 i {
        display: none;
    }

    .preview-files-toggle,
    .preview-close-button {
        padding: 7px 8px;
        font-size: 10px;
    }

    .preview-fullscreen-toolbar > a {
        font-size: 10px;
    }

    .codepen-workspace {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }

    .codepen-file-sidebar {
        position: fixed;
        inset: 48px auto 0 0;
        z-index: 1002;
        width: min(82vw, 320px);
        transform: translateX(-105%);
        transition: transform 180ms ease;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.32);
    }

    .preview-files-open .codepen-file-sidebar {
        transform: translateX(0);
    }

    .preview-files-backdrop {
        position: fixed;
        inset: 48px 0 0;
        z-index: 1001;
        display: block;
        border: 0;
        background: rgba(10, 10, 14, 0.58);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .preview-files-open .preview-files-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .codepen-source-pane,
    .codepen-preview-pane {
        min-height: 0;
    }

    .codepen-source-pane {
        grid-column: 1 / -1;
        grid-row: 1;
        border-right: 0;
        border-bottom: 1px solid #353a45;
    }

    .codepen-preview-pane {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .codepen-source-code code {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-card,
    .editor-explorer,
    .explorer-backdrop {
        transition-duration: 0.01ms;
    }
}
/* Disable the browser blue tap/click highlight across the site. */
html, body, button, a, input, textarea, select, label, summary { -webkit-tap-highlight-color: transparent !important; }

/* Refined template catalogue: calm surfaces, consistent spacing, no harsh black outlines. */
.templates-page:not(.template-detail-page) {
    background: var(--theme-background, #f7f8fc);
}

.templates-page:not(.template-detail-page) .templates-main {
    width: min(calc(100% - var(--page-gutter, 24px) * 2), 1180px);
}

.templates-page:not(.template-detail-page) .templates-hero {
    max-width: 850px;
    padding-block: clamp(48px, 7vw, 78px) clamp(30px, 4vw, 46px);
}

.templates-page:not(.template-detail-page) .templates-hero h2 {
    max-width: 820px;
    font-size: clamp(38px, 5.4vw, 62px);
    line-height: 1.08;
    letter-spacing: clamp(-2.8px, -0.22vw, -1.5px);
}

.templates-page:not(.template-detail-page) .templates-lead {
    max-width: 62ch;
    margin-top: 18px;
    font-size: 15px;
}

.templates-page:not(.template-detail-page) .project-catalog {
    margin-bottom: 44px;
}

.templates-page:not(.template-detail-page) .project-catalog-heading {
    align-items: end;
    margin-bottom: 16px;
}

.templates-page:not(.template-detail-page) .project-catalog-heading h2 {
    font-size: clamp(21px, 2.5vw, 26px);
    letter-spacing: -0.8px;
}

.templates-page:not(.template-detail-page) .project-search {
    min-height: 52px;
    padding-inline: 16px;
    border: 1px solid var(--theme-line, rgba(38, 42, 69, .12));
    border-radius: 13px;
    background: var(--theme-surface, #fff);
    box-shadow: 0 5px 18px rgba(38, 42, 69, .045);
    color: var(--muted);
}

.templates-page:not(.template-detail-page) .project-search:focus-within {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(104, 86, 232, .12);
}

.templates-page:not(.template-detail-page) .project-search input:focus {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    outline: none;
}

.templates-page:not(.template-detail-page) .project-search kbd {
    border-color: var(--theme-line, rgba(38, 42, 69, .12));
    border-radius: 6px;
    background: var(--theme-surface-soft, #f2f0ff);
    color: var(--muted);
}

.templates-page:not(.template-detail-page) .project-list {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 18px;
}

.templates-page:not(.template-detail-page) .project-card {
    min-height: 190px;
    gap: 13px;
    padding: 21px;
    border: 1px solid var(--theme-line, rgba(38, 42, 69, .12));
    border-radius: 16px;
    background: var(--theme-surface, #fff);
    box-shadow: 0 5px 18px rgba(38, 42, 69, .045);
}

.templates-page:not(.template-detail-page) .project-card:hover {
    transform: translateY(-3px);
    border-color: rgba(104, 86, 232, .42);
    box-shadow: 0 12px 28px rgba(38, 42, 69, .09);
}

.templates-page:not(.template-detail-page) .project-card-heading > i {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 9px;
    background: var(--theme-surface-soft, #f2f0ff);
}

.templates-page:not(.template-detail-page) .project-card-name {
    font-size: 15px;
    line-height: 1.45;
}

.templates-page:not(.template-detail-page) .project-card-author,
.templates-page:not(.template-detail-page) .project-card-description {
    font-size: 12px;
}

.templates-page:not(.template-detail-page) .project-card-description {
    min-height: 40px;
    line-height: 1.65;
}

.templates-page:not(.template-detail-page) .project-card-footer {
    margin-top: auto;
    padding-top: 13px;
    border-color: var(--theme-line, rgba(38, 42, 69, .12));
}

.templates-page:not(.template-detail-page) .project-count {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--theme-line, rgba(38, 42, 69, .12));
    border-radius: 11px;
    background: var(--theme-surface-soft, #f2f0ff);
}

.templates-page:not(.template-detail-page) .templates-footer {
    border-color: var(--theme-line, rgba(38, 42, 69, .12));
}

@media (max-width: 680px) {
    .templates-page:not(.template-detail-page) .templates-hero {
        padding-block: 42px 30px;
    }
    .templates-page:not(.template-detail-page) .templates-hero h2 {
        font-size: clamp(36px, 10vw, 50px);
    }
    .templates-page:not(.template-detail-page) .project-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .templates-page:not(.template-detail-page) .project-card {
        min-height: 0;
        padding: 18px;
    }
}

/* Template catalog and live preview: theme-aware surfaces and scrollbars. */
:root[data-theme="dark"] .templates-page {
  color: var(--ink, #f0efff) !important;
  background: radial-gradient(ellipse at 84% 17%, rgba(111, 94, 230, .15), transparent 34rem), #11121c !important;
}
:root[data-theme="dark"] .templates-page .templates-hero,
:root[data-theme="dark"] .templates-page .project-sidebar,
:root[data-theme="dark"] .templates-page .project-detail,
:root[data-theme="dark"] .templates-page .project-card,
:root[data-theme="dark"] .templates-page .project-search,
:root[data-theme="dark"] .templates-page .readme-preview,
:root[data-theme="dark"] .templates-page .project-search kbd {
  color: #f0efff !important;
  background-color: #1a1c2a !important;
  border-color: rgba(231,232,255,.13) !important;
}
:root[data-theme="dark"] .templates-page .templates-hero h1,
:root[data-theme="dark"] .templates-page .templates-hero h2,
:root[data-theme="dark"] .templates-page .project-catalog-heading h2,
:root[data-theme="dark"] .templates-page .project-card-name,
:root[data-theme="dark"] .templates-page .project-detail h1,
:root[data-theme="dark"] .templates-page .project-detail h2 { color: #f0efff !important; }
:root[data-theme="dark"] .templates-page .templates-lead,
:root[data-theme="dark"] .templates-page .project-card-description,
:root[data-theme="dark"] .templates-page .project-card-author,
:root[data-theme="dark"] .templates-page .project-card-footer,
:root[data-theme="dark"] .templates-page .project-list-status { color: #b0b2c7 !important; }
:root[data-theme="dark"] .templates-page .project-count {
  color: #d9d4ff !important; background: #282541 !important; border-color: rgba(231,232,255,.15) !important;
}
:root[data-theme="dark"] .templates-page .project-card:hover {
  background-color: #222438 !important; border-color: rgba(169,156,255,.45) !important;
  box-shadow: 0 16px 38px rgba(0,0,0,.22) !important;
}
:root[data-theme="dark"] .template-detail-page,
:root[data-theme="dark"] .template-detail-page * { scrollbar-color: #7464d9 #171925; }
:root[data-theme="dark"] .template-detail-page *::-webkit-scrollbar-track { background: #171925; }
:root[data-theme="dark"] .template-detail-page *::-webkit-scrollbar-thumb { background: #7464d9; border-color: #171925; }

/* Template page: panel netral, tidak terlalu terang dan tetap terpisah dari latar. */
:root, :root[data-theme="dark"] { color-scheme: light !important; }
:root[data-theme="dark"] .templates-page,
:root[data-theme="dark"] body { background: #f5f6fb !important; color: #25283b !important; }
:root[data-theme="dark"] .project-card,
:root[data-theme="dark"] .project-sidebar,
:root[data-theme="dark"] .project-detail,
:root[data-theme="dark"] .readme-preview { background: #fff !important; color: #25283b !important; border-color: #dfe2ee !important; }
