/* ── Striqr editor — Glitch × Canva ── */

:root {
    --purple: #7c3aed;
    --purple-deep: #5b21b6;
    --purple-soft: #ede9fe;
    --purple-glow: rgba(124, 58, 237, 0.35);
    --pink: #ec4899;
    --teal: #06b6d4;
    --coral: #fb7185;

    --ink: #1a1625;
    --ink-muted: #6b6578;
    --ink-faint: #9b94a8;

    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-sunken: #f8f6ff;
    --surface-glass: rgba(255, 255, 255, 0.82);
    --stage-bg: #fcfbff;
    --preview-bg: #faf9ff;
    --input-bg: #ffffff;
    --canvas: #f4f0ff;
    --dropdown-shadow: 0 8px 24px rgba(26, 22, 37, 0.14);

    --border: rgba(124, 58, 237, 0.1);
    --border-strong: rgba(124, 58, 237, 0.22);
    --splitter-bg: rgba(124, 58, 237, 0.08);
    --splitter-bg-hover: rgba(124, 58, 237, 0.14);
    --cm-gutter-bg: #faf9fc;
    --sk-base: #e8e4f3;
    --sk-high: #f6f4fc;

    --shadow-xs: 0 1px 2px rgba(26, 22, 37, 0.04);
    --shadow-sm: 0 4px 14px rgba(124, 58, 237, 0.08);
    --shadow-md: 0 10px 30px rgba(124, 58, 237, 0.12);
    --shadow-lg: 0 20px 50px rgba(124, 58, 237, 0.14);

    --ambient-base: linear-gradient(165deg, #f8f5ff 0%, #faf8ff 40%, #f0f7ff 100%);
    --ambient-orb-1: rgba(167, 139, 250, 0.45);
    --ambient-orb-2: rgba(236, 72, 153, 0.28);
    --ambient-orb-3: rgba(6, 182, 212, 0.22);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 999px;

    --header-h: 56px;
    --rail-w: 76px;
    --files-w: 240px;
    --preview-w: 28%;
    --ws-preview-w: 340px;
    --ws-terminal-h: 220px;

    --font-ui: "DM Sans", "Outfit", system-ui, sans-serif;
    --font-display: "Outfit", "DM Sans", system-ui, sans-serif;
    --font-mono: "Overpass", ui-monospace, monospace;

    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: 0.2s var(--ease-out);
    color-scheme: light;

    --remix-btn-bg: #ffffff;
    --remix-btn-fg: #0e121a;
    --remix-btn-border: rgba(14, 18, 26, 0.1);
    --remix-btn-hover-bg: #f5f5f9;
}

/* ── Discord-style dark theme ── */

[data-theme="dark"] {
    color-scheme: dark;
    --purple: #5865f2;
    --purple-deep: #4752c4;
    --purple-soft: rgba(88, 101, 242, 0.18);
    --purple-glow: rgba(88, 101, 242, 0.4);
    --pink: #eb459e;
    --teal: #00a8fc;
    --coral: #ed4245;

    --ink: #f2f3f5;
    --ink-muted: #b5bac1;
    --ink-faint: #949ba4;

    --surface: #313338;
    --surface-raised: #383a40;
    --surface-sunken: #2b2d31;
    --surface-glass: rgba(43, 45, 49, 0.96);
    --stage-bg: #1e1f22;
    --preview-bg: #2b2d31;
    --input-bg: #1e1f22;
    --canvas: #313338;
    --dropdown-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);

    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.1);
    --splitter-bg: rgba(88, 101, 242, 0.12);
    --splitter-bg-hover: rgba(88, 101, 242, 0.22);
    --cm-gutter-bg: #2b2d31;
    --sk-base: #2b2d31;
    --sk-high: #3b3e46;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);

    --ambient-base: linear-gradient(165deg, #313338 0%, #2b2d31 50%, #1e1f22 100%);
    --ambient-orb-1: rgba(88, 101, 242, 0.12);
    --ambient-orb-2: rgba(235, 69, 158, 0.08);
    --ambient-orb-3: rgba(0, 168, 252, 0.06);

    --remix-btn-bg: #0e121a;
    --remix-btn-fg: #ffffff;
    --remix-btn-border: rgba(255, 255, 255, 0.14);
    --remix-btn-hover-bg: #1a1f2a;
}

/* ── Ambient background ── */

.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 10% 0%, rgba(167, 139, 250, 0.22), transparent 55%),
        radial-gradient(ellipse 70% 50% at 90% 10%, rgba(236, 72, 153, 0.14), transparent 50%),
        radial-gradient(ellipse 60% 40% at 50% 100%, rgba(6, 182, 212, 0.1), transparent 55%),
        var(--ambient-base);
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.55;
    animation: orb-drift 18s ease-in-out infinite;
}

.ambient-orb--1 {
    width: 420px;
    height: 420px;
    top: -8%;
    left: -4%;
    background: var(--ambient-orb-1);
}

.ambient-orb--2 {
    width: 320px;
    height: 320px;
    top: 35%;
    right: -6%;
    background: var(--ambient-orb-2);
    animation-delay: -6s;
}

.ambient-orb--3 {
    width: 280px;
    height: 280px;
    bottom: -5%;
    left: 35%;
    background: var(--ambient-orb-3);
    animation-delay: -12s;
}

@keyframes orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(24px, -18px) scale(1.04); }
    66% { transform: translate(-16px, 12px) scale(0.96); }
}

/* ── Base ── */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow: hidden;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

input {
    font-family: inherit;
}

/* ── Shared button styles ── */

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-ghost:hover {
    color: var(--purple);
    background: var(--purple-soft);
    border-color: var(--border);
}

.btn-ghost:active {
    transform: scale(0.97);
}

.btn-compact {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-remix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--remix-btn-fg);
    background: var(--remix-btn-bg);
    border: 1px solid var(--remix-btn-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.btn-remix-icon {
    flex-shrink: 0;
}

.btn-remix:hover {
    background: var(--remix-btn-hover-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.btn-remix:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.remix-action-wrap,
.buy-action-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.remix-action-wrap[hidden],
.buy-action-wrap[hidden] {
    display: none !important;
}

.catalog-action-hint {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1205;
    width: max-content;
    max-width: min(280px, calc(100vw - 24px));
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffe234;
    border: 1px solid rgba(26, 22, 0, 0.14);
    box-shadow: 0 10px 28px rgba(18, 18, 18, 0.14);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catalog-action-hint::before {
    content: "";
    position: absolute;
    top: -6px;
    right: 28px;
    width: 10px;
    height: 10px;
    background: #ffe234;
    border-left: 1px solid rgba(26, 22, 0, 0.14);
    border-top: 1px solid rgba(26, 22, 0, 0.14);
    transform: rotate(45deg);
}

.catalog-action-hint[hidden] {
    display: none !important;
}

.catalog-action-hint-text {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    color: #1a1600;
}

.catalog-action-hint-ok {
    align-self: flex-end;
    height: 28px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid rgba(26, 22, 0, 0.18);
    background: rgba(255, 255, 255, 0.58);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #1a1600;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.catalog-action-hint-ok:hover {
    background: rgba(255, 255, 255, 0.88);
}

.catalog-action-hint-ok:active {
    transform: scale(0.98);
}

.btn-remix.is-hint-target,
.btn-buy.is-hint-target,
#visibilityMenu .visibility-btn.is-hint-target {
    box-shadow:
        0 0 0 2px rgba(255, 226, 52, 0.95),
        0 0 0 5px rgba(255, 226, 52, 0.35);
    border-color: rgba(26, 22, 0, 0.2);
}

.btn-buy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #fff;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border: none;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.35);
    transition: filter var(--transition), transform var(--transition), box-shadow var(--transition);
}

.btn-buy:hover {
    filter: brightness(1.05);
}

.btn-buy:active {
    transform: scale(0.98);
}

.btn-buy-price {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.btn-buy-price[hidden] {
    display: none !important;
}

.edit-buy-shell {
    position: fixed;
    top: var(--header-h, 56px);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 950;
    pointer-events: none;
    background: transparent;
}

.edit-buy-shell:not([hidden]) {
    pointer-events: auto;
}

.edit-buy-shell .st-rec-panel-backdrop {
    display: block;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background: rgba(18, 18, 18, 0.14);
    backdrop-filter: blur(5px) saturate(1.08);
    -webkit-backdrop-filter: blur(5px) saturate(1.08);
}

.edit-buy-shell .edit-buy-panel {
    position: fixed;
    top: var(--header-h, 56px);
    right: 0;
    bottom: 0;
    z-index: 952;
    width: min(420px, 46vw);
    max-width: 46vw;
    margin: 0;
    border-radius: 0;
    border-top: none;
    border-right: none;
    border-bottom: none;
    overflow-y: auto;
    box-shadow: -12px 0 40px rgba(18, 18, 18, 0.12);
}

@media (max-width: 720px) {
    .edit-buy-shell .edit-buy-panel {
        width: min(420px, 100vw);
        max-width: 100vw;
    }
}

/* ── Header ── */

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 12px;
    background: var(--surface-glass);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    overflow: visible;
}

#leftHeader {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    float: none;
    min-width: 0;
    flex: 1;
}

#rightHeader {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 100%;
    float: none;
    flex-shrink: 0;
    width: auto;
}

#settingsMenu {
    position: relative;
    margin-right: 4px;
}

#settingsBtn {
    gap: 4px;
}

#settingsBtn[aria-expanded="true"] {
    color: var(--purple);
    background: var(--purple-soft);
    border-color: var(--border);
}

#settingsBtn[aria-expanded="true"] .settings-chevron {
    transform: rotate(180deg);
}

.settings-chevron {
    transition: transform var(--transition);
    opacity: 0.7;
}

.settings-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    padding: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--dropdown-shadow);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out), visibility 0.18s;
}

.settings-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    text-align: left;
    transition: background var(--transition), color var(--transition);
}

.settings-item:hover {
    background: var(--purple-soft);
    color: var(--ink);
}

.settings-item--theme .settings-check {
    opacity: 0;
    color: var(--purple);
    flex-shrink: 0;
}

.settings-item--theme.is-active {
    color: var(--purple);
}

.settings-item--theme.is-active .settings-check {
    opacity: 1;
}

.settings-divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--border-strong);
}

.settings-item-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.settings-item-ico {
    flex-shrink: 0;
    color: var(--purple);
    opacity: 0.85;
}

/* ── Workspace mode menu (Canva-style Viewing / Editing) ── */

#modeMenu {
    position: relative;
}

.mode-history-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
}

.mode-history-group .mode-btn {
    margin-top: 0;
}

.file-history-nav {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.file-history-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition), color var(--transition), opacity var(--transition);
}

.file-history-btn svg {
    flex-shrink: 0;
    opacity: 0.88;
}

.file-history-btn:hover:not(:disabled) {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.file-history-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .file-history-nav {
        display: none;
    }
}

#build_editing_text {
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
        height: 39px;
    padding: 0 10px 0 8px;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
        margin-top: 9px;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.mode-btn:hover {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.mode-btn[aria-expanded="true"] {
    color: var(--purple);
    background: var(--purple-soft);
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.mode-btn[aria-expanded="true"] .mode-chevron {
    transform: rotate(180deg);
}

.mode-btn-icon {
    flex-shrink: 0;
    opacity: 0.85;
}

.mode-chevron {
    flex-shrink: 0;
    opacity: 0.65;
    transition: transform var(--transition);
}

.mode-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 280px;
    padding: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--dropdown-shadow);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out), visibility 0.18s;
}

.mode-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.mode-option:hover {
    background: var(--surface-sunken);
}

.mode-option.is-active {
    background: var(--purple-soft);
}

.mode-option-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--surface-sunken);
    color: var(--ink-muted);
    flex-shrink: 0;
}

.mode-option.is-active .mode-option-icon {
    color: var(--purple);
    background: rgba(124, 58, 237, 0.12);
}

.mode-option-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.mode-option-copy strong {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.mode-option-copy small {
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.3;
}

.mode-check {
    flex-shrink: 0;
    opacity: 0;
    color: var(--purple);
    transition: opacity var(--transition);
}

.mode-option.is-active .mode-check {
    opacity: 1;
}

.mode-option-divider {
    height: 1px;
    margin: 6px 10px;
    background: var(--border);
}

#visibilityDropdown .mode-option[hidden],
#visibilityDropdown .mode-option-divider[hidden] {
    display: none !important;
}

.mode-builder-picks {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.mode-builder-label {
    padding: 6px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.mode-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.mode-picker:hover {
    background: var(--surface-sunken);
}

.mode-picker-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}

.mp-html .mode-picker-logo { background: linear-gradient(160deg, #f16529, #e44d26); }
.mp-css .mode-picker-logo  { background: linear-gradient(160deg, #33a9dc, #1572b6); }
.mp-js .mode-picker-logo   { background: #f7df1e; color: #1a1a1a; }

.mode-picker-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.mode-picker-name {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.mode-picker-state {
    font-size: 12px;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.header-actions .project-name-field {
    margin-left: 0;
    margin-top: 9px;
}

/* ── Project name + boost badge (Google-style tab on box edge) ── */

.project-name-field {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    min-width: 0;
    max-width: min(420px, 46vw);
}

.project-status-badges {
    position: absolute;
    top: 0;
    left: 10px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 6px;
    transform: translateY(-50%);
    pointer-events: none;
}

.project-boost-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 10px 0 6px;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--ink-muted);
    white-space: nowrap;
    pointer-events: none;
}

.project-github-badge {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid rgba(34, 197, 94, 0.38);
    background: rgba(34, 197, 94, 0.14);
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.12);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #166534;
    white-space: nowrap;
}

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

.project-github-badge:not([hidden]) {
    pointer-events: auto;
    cursor: pointer;
}

.project-boost-bolts {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    color: var(--ink-faint);
}

.project-boost-bolts svg {
    display: block;
    width: 17px;
    height: 17px;
}

.project-boost-text {
    line-height: 1;
}

.project-name-field .breadcrumb-path {
    margin-left: 0;
    width: 100%;
    max-width: none;
    padding-top: 11px;
}

.header-domain-display {
    display: none;
    min-width: 0;
    max-width: min(480px, 42vw);
    height: 22px;
    line-height: 22px;
    padding: 0 2px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
    flex: 0 1 auto;
    overflow: hidden;
}

.header-domain-display:not([hidden]) {
    display: block;
}

.header-domain-text {
    display: block;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--purple-deep);
    line-height: 22px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-domain-display.is-expanded {
    height: auto;
    max-width: min(480px, 42vw);
    overflow: visible;
}

.header-domain-display.is-expanded .header-domain-text {
    white-space: normal;
    word-break: break-all;
    overflow: visible;
    text-overflow: clip;
}

.project-name-field.is-domain-mode .headerInput {
    display: none;
}

.project-name-field.is-domain-mode .breadcrumb-path {
    border-color: rgba(124, 58, 237, 0.28);
    background: rgba(124, 58, 237, 0.05);
}

[data-theme="dark"] .header-domain-text {
    color: #c4b5fd;
}

[data-theme="dark"] .project-name-field.is-domain-mode .breadcrumb-path {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(167, 139, 250, 0.35);
}

.project-name-field[data-boost="none"] .project-boost-badge {
    color: var(--ink-muted);
    background: var(--surface);
    border-color: var(--remix-btn-border);
}

.project-name-field[data-boost="boost"] .project-boost-badge {
    color: #854d0e;
    background: linear-gradient(135deg, #fefce8 0%, #fef08a 100%);
    border-color: rgba(234, 179, 8, 0.45);
    box-shadow: 0 1px 3px rgba(234, 179, 8, 0.18);
}

.project-name-field[data-boost="boost"] .project-boost-bolts {
    color: #ca8a04;
}

.project-name-field[data-boost="boost"] .breadcrumb-path {
    border-color: rgba(234, 179, 8, 0.42);
    background: linear-gradient(180deg, rgba(254, 240, 138, 0.35) 0%, var(--surface) 58%);
    box-shadow: 0 1px 2px rgba(234, 179, 8, 0.12);
}

.project-name-field[data-boost="super"] .project-boost-badge {
    color: #78350f;
    background: linear-gradient(135deg, #fde047 0%, #facc15 45%, #eab308 100%);
    border-color: rgba(202, 138, 4, 0.65);
    box-shadow: 0 1px 5px rgba(202, 138, 4, 0.28);
}

.project-name-field[data-boost="super"] .project-boost-bolts {
    color: #a16207;
}

.project-name-field[data-boost="super"] .breadcrumb-path {
    border-color: rgba(202, 138, 4, 0.58);
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.42) 0%, rgba(254, 243, 199, 0.2) 40%, var(--surface) 62%);
    box-shadow:
        0 1px 3px rgba(202, 138, 4, 0.18),
        0 0 0 1px rgba(250, 204, 21, 0.14);
}

[data-theme="dark"] .project-name-field[data-boost="boost"] .project-boost-badge {
    color: #fef08a;
    background: linear-gradient(135deg, #713f12 0%, #854d0e 100%);
    border-color: rgba(250, 204, 21, 0.4);
}

[data-theme="dark"] .project-name-field[data-boost="boost"] .project-boost-bolts {
    color: #facc15;
}

[data-theme="dark"] .project-name-field[data-boost="boost"] .breadcrumb-path {
    border-color: rgba(250, 204, 21, 0.35);
    background: linear-gradient(180deg, rgba(113, 63, 18, 0.55) 0%, var(--surface) 58%);
}

[data-theme="dark"] .project-name-field[data-boost="super"] .project-boost-badge {
    color: #fffbeb;
    background: linear-gradient(135deg, #b45309 0%, #ca8a04 40%, #eab308 100%);
    border-color: rgba(251, 191, 36, 0.55);
    box-shadow: 0 1px 6px rgba(251, 191, 36, 0.32);
}

[data-theme="dark"] .project-name-field[data-boost="super"] .project-boost-bolts {
    color: #fde047;
}

[data-theme="dark"] .project-name-field[data-boost="super"] .breadcrumb-path {
    border-color: rgba(251, 191, 36, 0.48);
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.65) 0%, rgba(113, 63, 18, 0.35) 45%, var(--surface) 62%);
    box-shadow:
        0 1px 4px rgba(251, 191, 36, 0.2),
        0 0 0 1px rgba(251, 191, 36, 0.12);
}

.breadcrumb-path {
    display: inline-flex;
    align-items: center;
    align-self: center;
    flex: 0 0 auto;
    gap: 4px;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--remix-btn-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    min-width: 0;
    max-width: min(420px, 46vw);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

#headerIcon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 4px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform var(--transition), background var(--transition);
    flex-shrink: 0;
    text-decoration: none;
    border: none;
    background: transparent;
}

#headerIcon img {
    display: block;
    width: 28px;
    height: 28px;
    object-fit: contain;
}

#headerIcon:hover {
    transform: scale(1.06);
    background: var(--purple-soft);
}

.breadcrumb-path:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

#headerProjectName {
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    padding: 0 2px;
    min-width: 0;
    height: 22px;
    line-height: 22px;
    white-space: nowrap;
}

#headerProjectName {
    width: auto;
    max-width: 148px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 1 auto;
    transition: max-width var(--transition), width var(--transition);
}

#headerProjectName:focus,
#headerProjectName.is-expanded {
    max-width: min(480px, 42vw);
    overflow: visible;
    text-overflow: clip;
}

#headerProjectName.is-readonly,
#headerProjectName:read-only {
    cursor: default;
    user-select: text;
}

#headerProjectName.is-readonly:focus,
#headerProjectName:read-only:focus {
    max-width: 148px;
    box-shadow: none;
}

.breadcrumb-path:has(#headerProjectName.is-readonly) {
    cursor: default;
}

.breadcrumb-path:has(#headerProjectName.is-readonly):focus-within {
    border-color: var(--remix-btn-border);
    box-shadow: none;
}

/* ── Editor chrome (file bar + storage, above code stage) ── */

.editor-chrome {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    transition: gap 0.2s var(--ease-out), padding 0.2s var(--ease-out);
}

.editor-chrome .editor-file-actions {
    transition: opacity 0.2s var(--ease-out), max-height 0.25s var(--ease-out), margin 0.2s var(--ease-out);
}

.file-editor-storage {
    flex-shrink: 0;
    margin-top: 0;
    margin-bottom: 8px;
    padding-top: 0;
    padding-bottom: 10px;
    border-top: none;
    border-bottom: 1px solid var(--border);
}

#fileEditor.panel-empty .file-editor-storage {
    display: none;
}

.editor-file-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

.editor-file-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.editor-file-input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 2px var(--purple-soft);
}

.editor-file-input::placeholder {
    color: var(--ink-faint);
}

.editor-file-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.editor-action-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 64px;
    height: 52px;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.editor-action-btn svg {
    flex-shrink: 0;
}

.editor-action-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.editor-action-btn:hover {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.editor-action-btn:active {
    transform: scale(0.98);
}

.editor-action-btn--format:hover {
    color: var(--purple-deep);
}

.editor-action-btn--copy:hover,
.editor-action-btn--copy.is-copied {
    color: var(--purple-deep);
}

.editor-action-btn--close:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.06);
}

.editor-action-btn--delete {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.45);
    background: rgba(220, 38, 38, 0.1);
}

.editor-action-btn--delete:hover {
    color: #fff;
    border-color: #dc2626;
    background: #dc2626;
}

.editor-storage {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.editor-storage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-storage-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.editor-storage-usage {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-faint);
    white-space: nowrap;
}

.editor-storage-bar {
    position: relative;
    height: 8px;
    border-radius: 4px;
    border: 1px solid var(--remix-btn-border);
    background: var(--input-bg);
    overflow: hidden;
}

.editor-storage-fill {
    display: block;
    height: 100%;
    width: 0%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--purple), #a78bfa);
    transition: width 0.35s var(--ease-out);
}

.editor-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    background: rgba(124, 58, 237, 0.12);
    border: 2px dashed var(--purple);
    border-radius: 8px;
    pointer-events: none;
    text-align: center;
}

.editor-drop-overlay[hidden] {
    display: none !important;
}

.editor-drop-overlay-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--purple-deep);
}

.editor-drop-overlay-sub {
    margin: 0;
    font-size: 12px;
    color: var(--ink-muted);
}

#fileEditor.is-drop-target,
#stage.is-drop-target {
    outline: 2px dashed var(--purple);
    outline-offset: -4px;
}

main {
    position: relative;
}

#leftHeader .btn-ghost,
#rightHeader .btn-ghost {
    height: auto;
    width: auto;
    margin-left: 0;
    font-weight: 600;
}

/* ── Share link (header) ── */

.btn-share-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 12px;
    margin-right: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.btn-share-link:hover {
    color: var(--ink);
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.btn-share-link.is-copied {
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.35);
    background: rgba(124, 58, 237, 0.08);
}

.btn-share-link svg {
    flex-shrink: 0;
}

.btn-share-link[hidden] {
    display: none !important;
}

html:not(.is-logged-in) .btn-share-link {
    position: relative;
    width: 34px;
    padding: 0;
    justify-content: center;
}

html:not(.is-logged-in) .btn-share-link #shareLinkBtnLabel {
    display: none;
}

/* ── Profile team circles (legacy — invite UI removed from header) ── */

.profile-team {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    height: 100%;
    padding-right: 8px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
}

.profile-team-row {
    display: flex;
    align-items: center;
    height: 100%;
}

.profile-circles {
    display: flex;
    align-items: center;
}

.profile-circle {
    position: relative;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    margin-left: -8px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    cursor: default;
    transition: transform var(--transition), box-shadow var(--transition);
}

.profile-circles .profile-circle:first-child {
    margin-left: 0;
}

.profile-circle:hover {
    transform: translateY(-1px);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Online: Vibrant color */
.profile-circle { opacity: 1; filter: grayscale(0); border: 2px solid #10b981; }

/* Offline: Faded / Grayscale */
.profile-circle--offline {
    opacity: 0.6;
    filter: grayscale(0.8);
    border: 2px solid transparent;
    background: rgb(56, 56, 56);
}

.profile-circle--pending {
    opacity: 0.82;
    border-style: dashed;
    background: grey;
    border: 2px dotted #ccc;
}

.profile-circle--add {
    margin-left: 4px;
    background: var(--input-bg);
    border: 2px dashed var(--border-strong);
    color: var(--ink-muted);
    cursor: pointer;
    box-shadow: none;
}

.profile-circle--add:hover {
    color: var(--purple);
    border-color: var(--purple);
    background: var(--purple-soft);
    transform: none;
    box-shadow: none;
}

.profile-circle--add[aria-expanded="true"] {
    color: var(--purple);
    border-color: var(--purple);
    border-style: solid;
    background: var(--purple-soft);
}

.profile-invite-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1100;
    width: 240px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.profile-invite-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
}

.profile-invite-form {
    display: flex;
    gap: 6px;
}

.profile-invite-form input {
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 13px;
}

.profile-invite-form input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 2px var(--purple-soft);
}

.profile-invite-submit {
    flex-shrink: 0;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--purple-soft);
    color: var(--purple-deep);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.profile-invite-submit:hover {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
}

.profile-invite-status {
    margin: 8px 0 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-muted);
}

.profile-invite-status.is-awaiting {
    color: var(--purple);
}

/* ── Layout shell ── */

.main-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    margin-top: var(--header-h);
    height: calc(100vh - var(--header-h));
    gap: 0;
}

aside,
#fileEditor,
#workspace {
    animation: panel-rise 0.45s var(--ease-out) backwards;
}

#fileEditor { animation-delay: 0.04s; }
#workspace { animation-delay: 0.08s; }

@keyframes panel-rise {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Icon rail (aside) ── */

aside {
    width: var(--rail-w);
    flex-shrink: 0;
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding-top: 8px;
}

.sideMenuIcon {
    position: relative;
    margin-top: 6px;
    padding: 10px 6px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    transition: background var(--transition), transform var(--transition);
}

.sideMenuIcon::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
    transition: background var(--transition);
}

.sideMenuIcon:hover {
    background: rgba(124, 58, 237, 0.06);
}

.sideMenuIcon:hover svg {
    transform: scale(1.08);
}

.sideMenuIcon svg {
    width: 26px;
    height: 26px;
    transition: transform var(--transition);
}

.sideMenuIcon span {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-faint);
    letter-spacing: 0.01em;
    transition: color var(--transition);
}

.sideMenuIcon:hover span {
    color: var(--ink-muted);
}

.sideMenuIcon.side-active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.04));
    font-weight: inherit;
}

.sideMenuIcon.side-active::before {
    background: linear-gradient(180deg, var(--purple), var(--pink));
}

.sideMenuIcon.side-active span {
    color: var(--purple-deep);
    font-weight: 700;
}

#githubSideBtn.is-gh-connected:not(.side-active) {
    background: rgba(34, 197, 94, 0.1);
}

#githubSideBtn.is-gh-connected:not(.side-active)::before {
    background: #22c55e;
}

#githubSideBtn.is-gh-connected:not(.side-active) span {
    color: #166534;
}

#githubSideBtn.is-gh-connected:not(.side-active):hover {
    background: rgba(34, 197, 94, 0.16);
}

[data-theme="dark"] .project-github-badge {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(74, 222, 128, 0.4);
}

[data-theme="dark"] #githubSideBtn.is-gh-connected:not(.side-active) {
    background: rgba(34, 197, 94, 0.14);
}

[data-theme="dark"] #githubSideBtn.is-gh-connected:not(.side-active) span {
    color: #86efac;
}

/* Collapsible side panel: hide files panel + its splitter when closed */
.main-wrapper.side-collapsed #fileEditor,
.main-wrapper.side-collapsed #builderEditor,
.main-wrapper.side-collapsed #domainsEditor,
.main-wrapper.side-collapsed #portsEditor,
.main-wrapper.side-collapsed #quickEditor,
.main-wrapper.side-collapsed #githubEditor,
.main-wrapper.side-collapsed #aiEditor,
.main-wrapper.side-collapsed #filesDragFrame {
    display: none;
}

/* Empty side panels (Assets / Builder / Domains) show only their title */
#fileEditor.panel-empty #fileEditorHolder,
#fileEditor.panel-empty #FolderList,
#fileEditor.panel-empty #filesSkeleton {
    display: none !important;
}

/* Logs view — a lightweight terminal vibe inside the bottom terminal panel (no xterm) */
#logsView {
    display: none;
    flex: 1;
    min-height: 0;
    width: 100%;
}

#terminal.is-logs #terminalPreview {
    display: none;
}

#terminal.is-logs #logsView {
    display: flex;
}

.logterm {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #0b0d12;
    padding: 8px 0;
    font-family: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro",
        "Fira Code", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    font-variant-ligatures: none;
    line-height: 1.6;
    letter-spacing: 0.01em;
    color: #c9d1d9;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    -webkit-font-smoothing: antialiased;
}

.logterm-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 1px 14px;
    border-left: 2px solid transparent;
    transition: background var(--transition);
}

.logterm-line:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Left gutter marker, like a prompt arrow */
.logterm-gutter {
    flex: 0 0 auto;
    color: #4b5263;
    user-select: none;
}

.logterm-msg {
    flex: 1 1 auto;
    min-width: 0;
}

/* Optional timestamp prefix injected by addLog() */
.logterm-time {
    flex: 0 0 auto;
    color: #5a6373;
    font-variant-numeric: tabular-nums;
}

/* Severity flavours */
.logterm-line.is-system {
    border-left-color: var(--teal);
}

.logterm-line.is-system .logterm-msg {
    color: #58e6ff;
    font-weight: 600;
}

.logterm-line.is-system .logterm-gutter {
    color: var(--teal);
}

.logterm-line.is-info .logterm-msg {
    color: #c9d1d9;
}

.logterm-line.is-success {
    border-left-color: #3fb950;
}

.logterm-line.is-success .logterm-msg {
    color: #56d364;
}

.logterm-line.is-warn {
    border-left-color: #d29922;
}

.logterm-line.is-warn .logterm-msg {
    color: #e3b341;
}

.logterm-line.is-error {
    border-left-color: #f85149;
}

.logterm-line.is-error .logterm-msg {
    color: #ff7b72;
}

.logterm-line.is-cursor .logterm-gutter {
    color: var(--teal);
}

.logterm-caret {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: var(--teal);
    box-shadow: 0 0 6px rgba(0, 168, 252, 0.6);
    vertical-align: text-bottom;
    animation: logterm-blink 1.1s steps(1) infinite;
}

@keyframes logterm-blink {
    50% {
        opacity: 0;
    }
}

.logterm::-webkit-scrollbar {
    width: 8px;
}

.logterm::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.logterm::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
    background-clip: padding-box;
}

.main-wrapper:has(#workspace.terminal-open:not(.terminal-logs)) #terminalButton {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.14), rgba(236, 72, 153, 0.08));
}

.main-wrapper:has(#workspace.terminal-open:not(.terminal-logs)) #terminalButton::before {
    background: linear-gradient(180deg, var(--purple), var(--pink));
}

/* Setup running: paint the whole terminal panel yellow so it's impossible to miss. */
#terminal.terminal-setup-active {
    outline: 3px solid #ffe234;
    outline-offset: -3px;
    animation: terminal-setup-pulse 1.5s ease-in-out infinite;
}

#terminal.terminal-setup-active #terminal_top {
    background: #ffe234;
    border-bottom-color: rgba(26, 22, 0, 0.3);
}

#terminal.terminal-setup-active #terminalTitle,
#terminal.terminal-setup-active #terminalSvg {
    color: #1a1600;
}

#terminal.terminal-setup-active .terminal-top-actions button {
    border-color: rgba(26, 22, 0, 0.3);
    color: #1a1600;
}

#terminal.terminal-setup-active #closeTerminal {
    color: #7a1418;
    border-color: rgba(122, 20, 24, 0.35);
}

#terminalButton.terminal-setup-active {
    background: #ffe234 !important;
    color: #1a1600;
    box-shadow: 0 0 0 2px rgba(255, 226, 52, 0.5), 0 8px 24px rgba(255, 226, 52, 0.3);
}

#terminalButton.terminal-setup-active::before {
    background: #f5a623 !important;
}

@keyframes terminal-setup-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 1px rgba(255, 226, 52, 0.5), 0 0 22px rgba(255, 226, 52, 0.3);
    }

    50% {
        box-shadow: 0 0 0 1px rgba(255, 226, 52, 0.8), 0 0 40px rgba(255, 226, 52, 0.55);
    }
}

/* Builder panel */
#builderEditor {
    width: var(--ws-files-w, 240px);
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 170px;
    background: var(--surface);
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

#builderEditor:has(#buildInspector:not([hidden])) {
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

#builderEditor:has(#buildInspector:not([hidden]))::before {
    display: none;
}

#buildInspector[hidden] {
    display: none !important;
}

/* Builder panel head + compact file picks */
.builder-panel-head {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 2;
}

.builder-panel-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.builder-panel-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.build-file-picks {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.build-file-picks--menu {
    padding: 8px 10px 10px;
    border-top: 1px solid var(--border);
}

.build-file-picks--duo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.build-file-picks--menu .build-file-pick {
    padding: 10px 8px;
}

.build-file-picks--menu .build-file-pick-logo {
    width: 44px;
    height: 44px;
    font-size: 15px;
    border-radius: 10px;
}

.build-file-picks--menu .build-file-pick-state {
    font-size: 10px;
}

.build-file-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 6px 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.build-file-pick:hover {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
    transform: translateY(-1px);
}

.build-file-pick-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.mp-html .build-file-pick-logo { background: linear-gradient(160deg, #f16529, #e44d26); }
.mp-css .build-file-pick-logo  { background: linear-gradient(160deg, #33a9dc, #1572b6); }
.mp-js .build-file-pick-logo   { background: #f7df1e; color: #1a1a1a; }

.build-file-pick-state {
    max-width: 100%;
    font-size: 9px;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.build-file-pick.is-selected {
    border-color: var(--purple);
    background: var(--purple-soft);
}
#builderEditor::before {
    content: attr(data-panel-title);
    display: block;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0 4px 8px;
}

#builderEditor:has(.builder-panel-head)::before {
    display: none;
}

/* ── Generic empty side-panel frames (populated externally) ── */
#domainsEditor,
#portsEditor,
#githubEditor,
#aiEditor {
    width: var(--ws-files-w, 240px);
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 170px;
    background: var(--surface);
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

#quickEditor {
    width: var(--ws-quick-w, 320px);
    min-width: 280px;
    max-width: 380px;
    flex-shrink: 0;
    flex-grow: 0;
    background: var(--surface);
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

#domainsEditor::before {
    display: none;
}

#quickEditor::before {
    display: none;
}

.domains-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.domains-panel-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.domains-default-url {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-sunken);
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-muted);
    word-break: break-all;
}

.domains-boost-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 16px;
    border-radius: var(--radius-md);
    border: 1px dashed rgba(124, 58, 237, 0.35);
    background:
        radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.1), transparent 62%),
        var(--surface-sunken);
    text-align: center;
}

.domains-boost-icon {
    font-size: 28px;
    line-height: 1;
}

.domains-boost-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
}

.domains-boost-copy {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ink-muted);
    max-width: 220px;
}

.domains-boost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    transition: background var(--transition), transform var(--transition);
}

.domains-boost-btn:hover {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

.domains-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.domains-dns {
    position: relative;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    overflow: hidden;
    border-radius: var(--radius-md);
    background: transparent;
}

.domains-dns-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
}

.domains-dns-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.domains-dns-head-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.domains-dns-head-copy strong {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.domains-dns-head-copy span {
    font-size: 11px;
    color: var(--ink-muted);
}

.domains-dns-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
}

.domains-dns-row {
    display: grid;
    grid-template-columns: 52px 44px 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11.5px;
}

.domains-dns-row--head {
    padding: 4px 10px 2px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.domains-dns-row:not(.domains-dns-row--head) {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.domains-dns-type {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--purple-deep);
}

.domains-dns-name {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
}

.domains-dns-value {
    justify-self: stretch;
    padding: 6px 8px;
    border: 1px dashed rgba(124, 58, 237, 0.25);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.7);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
    word-break: break-all;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.domains-dns-value:hover {
    border-color: var(--purple);
    background: var(--purple-soft);
    color: var(--purple-deep);
}

.domains-dns-value.is-copied {
    border-color: #15803d;
    background: rgba(21, 128, 61, 0.08);
    color: #15803d;
}

.domains-dns-value.is-pending {
    color: var(--ink-faint);
    font-style: italic;
    cursor: default;
}

.domains-dns-notes {
    margin: 0;
    padding: 0 0 0 16px;
    font-size: 11px;
    line-height: 1.55;
    color: var(--ink-muted);
}

.domains-dns-notes li + li {
    margin-top: 4px;
}

.domains-dns-notes strong {
    color: var(--ink);
    font-weight: 600;
}

.domains-label {
    display: block;
    margin-bottom: 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.domains-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.domains-input-row input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    color: var(--ink);
}

.domains-input-row input:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.domains-save-btn {
    flex-shrink: 0;
    height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
}

.domains-save-btn:hover:not(:disabled) {
    background: var(--purple-deep);
}

.domains-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.domains-connected {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 6px;
    margin-bottom: 12px;
}

.domains-connected-value {
    padding: 10px 12px;
    border: 1px solid rgba(124, 58, 237, 0.22);
    border-radius: var(--radius-sm);
    background: rgba(124, 58, 237, 0.06);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--purple-deep);
    word-break: break-all;
}

.domains-action-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.domains-action-btn {
    flex: 1;
    min-width: 120px;
    height: 38px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.domains-action-btn--primary {
    border-color: rgba(124, 58, 237, 0.28);
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple-deep);
}

.domains-action-btn--primary:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.14);
    border-color: var(--purple);
}

.domains-action-btn--danger {
    border-color: rgba(220, 38, 38, 0.25);
    color: #b91c1c;
}

.domains-action-btn--danger:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.45);
}

.domains-action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.domains-hint {
    margin: 8px 0 0;
    font-size: 11px;
    color: var(--ink-faint);
    line-height: 1.45;
}

.domains-status {
    margin: 6px 0 0;
    font-size: 11.5px;
    font-weight: 600;
}

.domains-status.is-error {
    color: #b91c1c;
}

.domains-status.is-success {
    color: #15803d;
}

.project-boost-badge.is-clickable {
    pointer-events: auto;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.project-boost-badge.is-clickable:hover {
    border-color: var(--border-strong);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

#githubEditor::before {
    display: none;
}

#aiEditor::before {
    display: none;
}

/* ── Ports panel ── */
.ports-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.ports-panel-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.ports-note {
    margin: 0;
    padding: 7px 12px;
    border-radius: 6px;
    background: #ffe234;
    border: 1px solid rgba(26, 22, 0, 0.14);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.45;
    color: #1a1600;
}

.ports-note code {
    font-family: inherit;
    font-size: inherit;
}

.ports-toolbar {
    display: flex;
    justify-content: flex-end;
}

.ports-refresh-btn {
    height: 30px;
    padding: 0 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-sunken);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.ports-refresh-btn:hover:not(:disabled) {
    border-color: var(--purple);
    color: var(--purple-deep);
    background: var(--purple-soft);
}

.ports-refresh-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

.ports-status {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
}

.ports-status.is-error {
    color: #b91c1c;
}

.ports-status.is-success {
    color: #15803d;
}

.ports-list-wrap {
    margin-top: 2px;
}

.ports-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
}

.ports-row {
    display: grid;
    grid-template-columns: 56px 72px 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11.5px;
}

.ports-row--head {
    padding: 4px 10px 2px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.ports-row:not(.ports-row--head) {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--border);
    backdrop-filter: blur(6px);
}

.ports-cell--port {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--purple-deep);
}

.ports-cell--proc {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink);
    word-break: break-word;
}

.ports-cell--proc.is-unknown {
    color: var(--ink-faint);
    font-style: italic;
}

.ports-kill-btn {
    justify-self: center;
    min-width: 52px;
    height: 28px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.08);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #b91c1c;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.ports-kill-btn:hover:not(:disabled) {
    background: rgba(220, 38, 38, 0.16);
    border-color: rgba(220, 38, 38, 0.55);
    transform: translateY(-1px);
}

.ports-kill-btn:disabled,
.ports-kill-btn.is-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.ports-empty {
    padding: 18px 10px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-muted);
}

/* ── Quick install panel (Canva-style) ── */
.quick-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 10px 10px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.quick-search-wrap {
    position: relative;
    flex-shrink: 0;
}

.quick-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    pointer-events: none;
}

.quick-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-sunken);
    font-family: var(--font-display);
    font-size: 12.5px;
    color: var(--ink);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.quick-search-input::placeholder {
    color: var(--ink-faint);
}

.quick-search-input:focus {
    border-color: var(--purple);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.quick-status {
    margin: 0;
    padding: 6px 10px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.4;
    flex-shrink: 0;
}

.quick-status.is-error {
    color: #b91c1c;
    background: rgba(185, 28, 28, 0.06);
}

.quick-status.is-success {
    color: #15803d;
    background: rgba(21, 128, 61, 0.06);
}

.quick-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}

.quick-catalog {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-loading,
.quick-empty {
    padding: 24px 10px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink-muted);
}

.quick-section {
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}

.quick-section.is-collapsed .quick-section-body {
    display: none;
}

.quick-section-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: var(--surface-sunken);
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.quick-section-toggle:hover {
    background: var(--purple-soft);
}

.quick-section-chevron {
    flex-shrink: 0;
    color: var(--ink-faint);
    transition: transform 0.2s ease;
}

.quick-section.is-collapsed .quick-section-chevron {
    transform: rotate(-90deg);
}

.quick-section-label {
    flex: 1;
    min-width: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink);
}

.quick-section-count {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--purple-soft);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    color: var(--purple-deep);
}

.quick-section-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
}

.quick-card {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: border-color var(--transition), box-shadow var(--transition), transform 0.15s ease;
}

.quick-card:hover {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.1);
    transform: translateY(-1px);
}

.quick-card:active {
    transform: translateY(0);
}

.quick-card.is-installing {
    border-color: rgba(245, 158, 11, 0.55);
    background: rgba(255, 226, 52, 0.07);
    cursor: progress;
    pointer-events: none;
}

.quick-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.quick-card-icon svg {
    width: 26px;
    height: 26px;
}

.quick-card-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quick-card-name {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.25;
}

.quick-card-desc {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-muted);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quick-card-action {
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--purple);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #fff;
    line-height: 28px;
    pointer-events: none;
}

.quick-card.is-installing .quick-card-action {
    background: #f59e0b;
    color: #1a1600;
}

/* ── GitHub panel ── */
.gh-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 14px 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.gh-account-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.gh-account-top .gh-disconnect {
    width: 100%;
    padding: 9px 12px;
    font-size: 12px;
}

.gh-card-export {
    margin-top: auto;
}

.gh-card-export.is-locked {
    opacity: 0.42;
    pointer-events: none;
    user-select: none;
}

.gh-card-export.is-locked .gh-action-btn {
    opacity: 0.55;
}

.gh-export-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


.gh-connect {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.gh-disconnect {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: var(--radius-sm);
    background: rgba(220, 38, 38, 0.06);
    color: #b91c1c;
    font-family: var(--font-display);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.gh-disconnect[hidden] {
    display: none !important;
}

.gh-disconnect:hover {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(220, 38, 38, 0.4);
    color: #991b1b;
}

.gh-connect:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.gh-connect-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--ink);
    color: var(--surface);
    flex-shrink: 0;
}

.gh-connect-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
}

.gh-connect-copy strong {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.gh-connect-copy small {
    font-size: 11px;
    color: var(--ink-faint);
}

.gh-connect-status {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: rgba(155, 148, 168, 0.16);
    color: var(--ink-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.gh-connect.is-connected .gh-connect-status {
    background: rgba(34, 197, 94, 0.16);
    color: #16a34a;
}
.gh-connect-status.is-connected {
     background: rgba(34, 197, 94, 0.16);
    color: #16a34a;
}

.gh-section {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.gh-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.gh-input {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    color: var(--ink-faint);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.gh-input:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.gh-input input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--ink);
}

.gh-hint {
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink-faint);
}

.gh-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.gh-steps-title {
    margin: 0 0 2px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.gh-step {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition), background var(--transition);
}

.gh-step:hover {
    border-color: var(--border-strong);
}

.gh-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1.5px solid var(--remix-btn-border);
    background: var(--surface);
    color: transparent;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.gh-check svg {
    width: 12px;
    height: 12px;
}

.gh-step.is-done .gh-check {
    background: var(--purple);
    border-color: var(--purple);
    color: #fff;
}

.gh-step.is-done {
    border-color: var(--border-strong);
    background: var(--purple-soft);
}

.gh-step-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.gh-step-copy strong {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink);
}

.gh-step-copy small {
    font-size: 10.5px;
    color: var(--ink-faint);
}

.gh-start-cmd {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.gh-start-cmd-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
    cursor: pointer;
    user-select: none;
}

.gh-start-cmd-toggle input {
    width: 14px;
    height: 14px;
    accent-color: var(--ink);
    cursor: pointer;
}

.gh-start-cmd-input {
    transition: opacity 0.18s ease;
}

.gh-start-cmd-input.is-disabled {
    opacity: 0.5;
}

.gh-start-cmd-input.is-disabled:focus-within {
    border-color: var(--remix-btn-border);
    box-shadow: none;
}

/* ── GitHub panel cards ── */
.gh-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.gh-card-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gh-card-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
}

.gh-card-sub {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-faint);
}

.gh-action-btn {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.gh-action-btn:hover:not(:disabled) {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

.gh-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gh-action-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gh-action-with-hint {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gh-action-hint {
    margin: 0;
    padding: 0 2px;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--ink-faint);
    text-align: center;
}

.gh-action-btn--soft {
    background: transparent;
    color: var(--purple);
    border: 1.5px solid rgba(124, 58, 237, 0.45);
    height: auto;
    min-height: 40px;
    padding: 10px 12px;
}

.gh-action-btn--soft:hover:not(:disabled) {
    background: rgba(124, 58, 237, 0.08);
    color: var(--purple-deep);
    border-color: var(--purple);
    transform: translateY(-1px);
}

.gh-import-picker {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
}

.gh-import-picker[hidden] {
    display: none !important;
}

.gh-import-picker-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
}

.gh-import-picker-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.gh-import-picker-arrow {
    display: inline-flex;
    color: var(--ink-faint);
    transition: transform 0.16s ease;
}

.gh-import-picker.is-collapsed .gh-import-picker-arrow {
    transform: rotate(-90deg);
}

.gh-import-picker.is-collapsed .gh-repo-list {
    display: none;
}

.gh-connect-prompt {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gh-connect-prompt[hidden] {
    display: none !important;
}

.gh-connect-prompt-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.gh-connect-active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gh-connect-active[hidden] {
    display: none !important;
}

.gh-connected-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
}

.gh-connected-row .gh-connect-status {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(34, 197, 94, 0.16);
    color: #16a34a;
}

.gh-connected-row .gh-disconnect {
    display: inline-flex;
    width: auto;
    padding: 6px 12px;
    font-size: 11px;
}

.gh-import-btn {
    width: 100%;
    height: 42px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.gh-import-btn:hover:not(:disabled) {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

.gh-import-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gh-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    flex-shrink: 0;
}

/* Export & push (bottom section) */
.gh-export {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
    padding-top: 4px;
}

.gh-export-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gh-export-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.gh-export-sub {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--ink-faint);
}

.gh-export-hint {
    margin: 0;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    border: 1px dashed var(--border);
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.gh-export-hint[hidden] {
    display: none !important;
}

.gh-account-pick-hint {
    margin: 0;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--ink-faint);
}

.gh-account-pick-hint[hidden] {
    display: none !important;
}

.gh-top-linked {
    margin-top: 2px;
}

.gh-export-linked-bar.is-none {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.22);
}

.gh-export-linked-bar.is-none .gh-export-linked-label {
    color: #dc2626;
}

.gh-export-linked-bar.is-none .gh-export-linked-repo {
    color: #dc2626;
    font-weight: 700;
}

.gh-export-linked-bar.is-linked {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.22);
}

.gh-export-linked-bar.is-linked .gh-export-linked-label {
    color: #16a34a;
}

.gh-export-linked-bar.is-linked .gh-export-linked-repo {
    color: var(--ink);
}

.gh-export-linked-bar.is-linked .gh-export-linked-repo.is-link {
    text-decoration: none;
}

.gh-export-linked-bar.is-linked .gh-export-linked-repo.is-link:hover {
    color: var(--purple);
    text-decoration: underline;
}

.gh-export-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
    padding-top: 4px;
}

.gh-export-bottom[hidden] {
    display: none !important;
}

.gh-export-connect-btn {
    border: 0;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    background: var(--ink);
    color: var(--surface);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}

.gh-export-connect-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.gh-export-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.gh-repo-disconnect {
    margin-left: auto;
    flex-shrink: 0;
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 10.5px;
    font-weight: 700;
    padding: 5px 10px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.gh-repo-disconnect:hover {
    background: var(--purple-deep);
    border-color: var(--purple-deep);
    transform: translateY(-1px);
}

.gh-repo-disconnect[hidden] {
    display: none !important;
}

.gh-action-btn--disconnect {
    margin-top: 4px;
    background: var(--purple);
    color: #fff;
}

.gh-action-btn--disconnect:hover:not(:disabled) {
    background: var(--purple-deep);
}

.gh-action-btn--disconnect.is-faded,
.gh-action-btn--disconnect:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.gh-export-setup,
.gh-export-linked {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gh-export-linked[hidden] {
    display: none !important;
}

.gh-export-primary {
    width: 100%;
    height: 40px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: var(--surface);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.gh-export-primary:hover:not(:disabled) {
    background: #111;
    transform: translateY(-1px);
}

.gh-export-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gh-export-linked-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.gh-export-linked-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #16a34a;
}

.gh-export-linked-repo {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-export-linked-repo:hover {
    color: var(--purple);
    text-decoration: underline;
}

.gh-diff {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
}

.gh-diff-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.gh-diff-title {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

.gh-diff-refresh {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), transform var(--transition);
}

.gh-diff-refresh:hover {
    border-color: var(--border-strong);
    color: var(--ink);
    transform: rotate(-20deg);
}

.gh-diff-empty {
    margin: 0;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    text-align: center;
}

.gh-diff-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: min(220px, 30vh);
    overflow-y: auto;
}

.gh-diff-file {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.gh-diff-file:hover {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.gh-diff-file.is-active {
    border-color: var(--purple);
    background: rgba(124, 58, 237, 0.06);
}

.gh-diff-file-status {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}

.gh-diff-file-status.is-added {
    background: rgba(34, 197, 94, 0.14);
    color: #16a34a;
}

.gh-diff-file-status.is-modified {
    background: rgba(234, 179, 8, 0.16);
    color: #ca8a04;
}

.gh-diff-file-status.is-deleted {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.gh-diff-file-path {
    flex: 1;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-diff-file-stats {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-faint);
}

/* GitHub diff: tint only the line-number gutter, never the code area */
.CodeMirror-gutter-wrapper.gh-diff-gutter-added .CodeMirror-linenumber,
.CodeMirror-gutter-wrapper.gh-diff-gutter-added .CodeMirror-gutter-elt {
    background-color: rgba(34, 197, 94, 0.28) !important;
    color: #15803d !important;
    border-radius: 2px;
}

.CodeMirror-gutter-wrapper.gh-diff-gutter-removed .CodeMirror-linenumber,
.CodeMirror-gutter-wrapper.gh-diff-gutter-removed .CodeMirror-gutter-elt {
    background-color: rgba(239, 68, 68, 0.22) !important;
    color: #b91c1c !important;
    border-radius: 2px;
}

.gh-diff-removed-widget {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: #b91c1c;
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid #ef4444;
    padding: 2px 8px;
    margin: 0;
}

.fDesign--gh-changed {
    background: rgba(34, 197, 94, 0.06);
}

.fDesign--gh-changed[data-gh-status="added"] {
    background: rgba(34, 197, 94, 0.1);
}

.fDesign--gh-changed[data-gh-status="deleted"] {
    background: rgba(239, 68, 68, 0.08);
}

.fDesign-gh-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    margin-left: auto;
    margin-right: 6px;
    flex-shrink: 0;
}

.fDesign--gh-changed[data-gh-status="deleted"] .fDesign-gh-dot {
    background: #ef4444;
}

.fDesign--gh-changed[data-gh-status="modified"] .fDesign-gh-dot {
    background: #ca8a04;
}

/* Connect-account dropdown (private repos) */
.gh-account {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.gh-connect {
    flex-shrink: 0;
}

.gh-account-menu {
    display: none;
    max-height: min(240px, 40vh);
    overflow-y: auto;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
}

.gh-account.is-open .gh-account-menu {
    display: block;
}

.gh-account.is-open .gh-connect-chevron {
    transform: rotate(180deg);
}

.gh-account-menu-title {
    margin: 0;
    padding: 10px 12px 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.gh-repo-list {
    display: flex;
    flex-direction: column;
    padding: 0 6px 6px;
}

.gh-repo {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.gh-repo:hover {
    background: rgba(124, 58, 237, 0.07);
}

.gh-repo.is-selected {
    background: var(--purple-soft);
    outline: 1px solid var(--border-strong);
}

#newRepo {
    display: none;
}

.gh-repo-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-faint);
    flex-shrink: 0;
}

.gh-repo-name {
    flex: 1;
    min-width: 0;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-repo-meta {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 3px 7px;
    border-radius: var(--radius-pill);
    background: rgba(155, 148, 168, 0.16);
    color: var(--ink-muted);
    flex-shrink: 0;
}

/* ── Files: Upload File dropdown ── */
.file-upload {
    position: relative;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--surface);
    overflow: hidden;
}

.file-upload.is-open {
    overflow: visible;
}

.file-upload-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    transition: background var(--transition), color var(--transition);
}

.file-upload-toggle:hover {
    background: var(--purple-soft);
    color: var(--purple-deep);
}

.file-upload-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-muted);
    flex-shrink: 0;
    transition: color var(--transition);
}

.file-upload-toggle:hover .file-upload-ico {
    color: var(--purple-deep);
}

.file-upload-label {
    flex: 1;
    min-width: 0;
}

.file-upload-chevron {
    flex-shrink: 0;
    color: var(--ink-faint);
    transition: transform var(--transition);
}

.file-upload.is-open .file-upload-chevron {
    transform: rotate(180deg);
}

.file-upload-body {
    display: flex;
    align-items: center;
    gap: 6px;
    max-height: 0;
    padding: 0 10px;
    opacity: 0;
    overflow: hidden;
    transition: max-height var(--transition), opacity var(--transition), padding var(--transition);
}

.file-upload.is-open .file-upload-body {
    max-height: 90px;
    padding: 0 10px 10px;
    opacity: 1;
    overflow: visible;
}

/* Route field: "root/" prefix + typed path, styled like a button */
.file-upload-route {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-sm);
    background: var(--surface-sunken);
    cursor: text;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.file-upload-route:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.file-upload-root {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.file-upload-path {
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
}

.file-upload-path::placeholder {
    color: var(--ink-faint);
}

/* Route suggestions popup */
.file-upload-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 168px;
    overflow-y: auto;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 12px 28px rgba(15, 12, 25, 0.16);
}

.file-upload-suggest[hidden] {
    display: none;
}

.file-upload-suggest-item {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    padding: 7px 8px;
    border: 0;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--ink);
    transition: background var(--transition);
}

.file-upload-suggest-item:hover {
    background: rgba(124, 58, 237, 0.08);
}

.file-upload-suggest-item svg {
    color: var(--ink-faint);
    flex-shrink: 0;
}

.file-upload-suggest-root {
    color: var(--ink-faint);
}

.file-upload-submit {
    flex-shrink: 0;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.file-upload-submit:hover {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

/* ── Upload file modal ── */
.upload-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upload-modal[hidden] {
    display: none;
}

.upload-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 25, 0.5);
    backdrop-filter: blur(3px);
}

.upload-modal-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 22px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 60px rgba(15, 12, 25, 0.32);
    animation: uploadModalIn 0.16s var(--ease-out);
}

@keyframes uploadModalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.upload-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.upload-modal-head h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
}

.upload-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink-muted);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.upload-modal-close:hover {
    background: var(--surface-sunken);
    color: var(--ink);
}

.upload-modal-sub {
    margin: 6px 0 18px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-muted);
}

.upload-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    margin-bottom: 10px;
}

.upload-field-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--purple-soft);
    color: var(--purple-deep);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.upload-field-body {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.upload-btn {
    align-self: flex-start;
    padding: 8px 14px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.upload-btn:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.upload-field-val {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-field-val.is-set {
    color: var(--ink);
}

.upload-modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.upload-cancel {
    padding: 10px 16px;
    border: 1px solid var(--remix-btn-border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}

.upload-cancel:hover {
    border-color: var(--border-strong);
    color: var(--ink);
}

.upload-confirm {
    padding: 10px 18px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.upload-confirm:hover:not(:disabled) {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

.upload-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#uploadAddField {
    margin-top: 4px;
}

.upload-field-remove {
    padding: 6px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: none;
    color: var(--ink-muted);
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

.upload-field-remove:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}



/* ── File panel ── */

#fileEditor {
    width: var(--ws-files-w, 240px);
    flex-shrink: 0;
    flex-grow: 0;
    min-width: 170px;
    background: var(--surface);
    display: none;
    flex-direction: column;
    padding: 12px 10px 10px;
    overflow: hidden;
    position: relative;
}

/* Only the side panel whose data-panel-title matches the clicked icon is shown */
#fileEditor.is-open,
#builderEditor.is-open,
#domainsEditor.is-open,
#portsEditor.is-open,
#quickEditor.is-open,
#githubEditor.is-open,
#aiEditor.is-open {
    display: flex;
}

#fileEditor::before {
    content: none;
    display: none;
}

.file-panel-kicker {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    padding: 0 4px 8px;
}

#fileEditorHolder {
    position: relative;
    margin-top: 4px;
    width: 100%;
    height: 40px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px solid var(--remix-btn-border);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    transition: border-color var(--transition), box-shadow var(--transition);
}

#fileEditorHolder:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

#fileEditorHolder input {
    flex: 1;
    border: none;
    outline: none;
    margin-left: 14px;
    background: none;
    font-size: 13px;
    color: var(--ink);
}

#fileEditorHolder input::placeholder {
    color: var(--ink-faint);
}

#fileSearch {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--purple);
    background: var(--purple-soft);
    transition: background var(--transition), color var(--transition);
}

#fileSearch:hover {
    background: var(--purple);
    color: #fff;
}

.fDesign--search-hidden {
    display: none !important;
}

.fDesign--search-match {
    background: rgba(124, 58, 237, 0.08);
}

.file-search-results {
    margin: 8px 0 0;
    padding: 6px;
    list-style: none;
    max-height: 220px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--remix-btn-border);
    border-radius: 8px;
    flex-shrink: 0;
}

.file-search-result {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.35;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.file-search-result:hover,
.file-search-result.is-active {
    background: var(--purple-soft);
}

.file-search-result-name {
    display: block;
    font-weight: 650;
}

.file-search-result-path {
    display: block;
    color: var(--ink-faint);
    font-size: 11px;
}

.file-search-empty {
    padding: 10px 8px;
    color: var(--ink-faint);
    font-size: 12px;
}

#FolderList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin-top: 16px;
    padding-right: 2px;
    position: relative;
}

.file-tree-select-hint {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    max-width: 100%;
    margin-top: 10px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #ffe234;
    border: 1px solid rgba(26, 22, 0, 0.14);
    pointer-events: none;
    box-sizing: border-box;
}

.file-tree-select-hint-line,
.file-tree-select-hint-sub {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 12px;
    line-height: 1.45;
    color: #1a1600;
}

.file-tree-select-hint-line {
    font-weight: 600;
}

.file-tree-select-hint-sub {
    font-weight: 500;
    opacity: 0.88;
}

@media (max-width: 768px) {
    .file-tree-select-hint {
        display: none !important;
    }
}

.main-wrapper.mobile-layout .file-tree-select-hint {
    display: none !important;
}

#FolderList::-webkit-scrollbar {
    width: 5px;
}

#FolderList::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.2);
    border-radius: var(--radius-pill);
}

#FolderFileAdder {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    height: auto;
    position: relative;
    margin-bottom: 8px;
}

.FolderButton {
    width: 100%;
    height: auto;
    float: none;
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
}

.FolderButton:hover {
    background: var(--purple-soft);
    border-color: var(--purple);
    border-style: solid;
    color: var(--purple-deep);
    box-shadow: var(--shadow-sm);
}

.FolderButton svg {
    margin-right: 0;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.FolderButton span {
    margin-left: 0;
    width: auto;
}

#foldersDrop {
    height: auto;
    width: 100%;
    overflow: visible;
    min-height: 100px; /* Ensures there is space at the bottom to drop into */
    padding-bottom: 50px;
    position: relative;
    user-select: none;
}

/* ── File tree items ── */

.fDesign {
    margin-top: 0;
    margin-bottom: 8px;
    height: 34px;
    position: relative;
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.fDesign > * {
    pointer-events: none;
}

.fDesign.is-renaming,
.fDesign.is-renaming * {
    pointer-events: auto;
}

.fDesign:active,
body.is-file-dragging,
body.is-file-dragging .fDesign {
    cursor: grabbing;
}

.fDesign img,
.fDesign video {
    -webkit-user-drag: none;
    user-drag: none;
}

.fDesign:hover {
    opacity: 1;
    background: rgba(124, 58, 237, 0.07);
}

.fDesign.is-selected {
    background: rgba(124, 58, 237, 0.16);
    outline: 1px solid rgba(124, 58, 237, 0.35);
}

.fDesign.is-selected:hover {
    background: rgba(124, 58, 237, 0.2);
}

.file-tree-marquee {
    position: absolute;
    z-index: 30;
    pointer-events: none;
    border: 1px solid rgba(124, 58, 237, 0.85);
    background: rgba(124, 58, 237, 0.18);
    border-radius: 3px;
    box-sizing: border-box;
}

.file-tree-menu {
    position: fixed;
    z-index: 4000;
    min-width: 148px;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border-strong, rgba(0, 0, 0, 0.12));
    background: var(--panel, #fff);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

.file-tree-menu[hidden] {
    display: none !important;
}

.file-tree-menu-item {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 8px 12px;
    border-radius: 7px;
    font-family: var(--font-ui, inherit);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink, #111);
    cursor: pointer;
}

.file-tree-menu-item:hover {
    background: rgba(124, 58, 237, 0.1);
}

.file-tree-menu-item.is-danger {
    color: #dc2626;
}

.file-tree-menu-item.is-danger:hover {
    background: rgba(220, 38, 38, 0.1);
}

body.is-view-only .file-tree-menu,
body.is-view-only #headerFileDelete {
    display: none !important;
}

.fDesignSvg {
    float: none;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.fDesign span {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    display: block;
    float: none;
    width: auto;
    position: static;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    /* flex: 1; */
    min-width: 0;
}

.fDesign-name-wrap {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.fDesign-name-wrap .fDesign-name {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.fDesign .file-ext {
    display: inline;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    margin-left: 0;
}

.fDesign.is-renaming {
    background: rgba(124, 92, 255, 0.1);
    outline: 1px solid rgba(124, 92, 255, 0.35);
    outline-offset: -1px;
}

.fDesign-rename-wrap {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.fDesign-rename-input {
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    background: var(--surface, #fff);
    border: 1px solid rgba(124, 92, 255, 0.55);
    border-radius: 4px;
    padding: 0 4px;
    margin: 0;
    min-width: 3ch;
    max-width: 100%;
    line-height: 1.3;
    outline: none;
    box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.15);
}

.fDesign-rename-input:focus {
    border-color: rgba(124, 92, 255, 0.85);
    box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.22);
}

.fDesign-rename-ext {
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
}

.fDesignFolder {
    position: absolute;
    right: 8px;
    /* top: 50%;
    transform: translateY(-50%); */
    transition: transform var(--transition);
}

.fDesign--upload-pending,
.fDesign--upload-error {
    height: auto;
    min-height: 34px;
    flex-wrap: wrap;
    align-items: flex-start;
    padding-top: 6px;
    padding-bottom: 8px;
    pointer-events: none;
    cursor: default;
}

.fDesign--upload-pending:hover,
.fDesign--upload-error:hover {
    background: transparent;
}

.fDesign--upload-pending .fDesign-upload-bar,
.fDesign--upload-error .fDesign-upload-bar {
    flex-basis: 100%;
    height: 3px;
    margin-top: 6px;
    margin-left: 30px;
    margin-right: 4px;
    background: var(--surface-sunken);
    border-radius: 999px;
    overflow: hidden;
}

.fDesign--upload-pending .fDesign-upload-bar span {
    display: block;
    height: 100%;
    width: 42%;
    background: var(--purple);
    border-radius: 999px;
    animation: fDesignUploadBar 1.1s ease-in-out infinite;
}

.fDesign--upload-error {
    background: rgba(220, 53, 69, 0.1);
}

.fDesign--upload-error .fDesign-upload-bar span {
    width: 100%;
    background: #dc3545;
    animation: none;
}

@keyframes fDesignUploadBar {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.hoverDrag {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.22), rgba(236, 72, 153, 0.14)) !important;
    outline: 2px dashed var(--purple);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.25);
}

#newFile,
#newFolder {
    display: none;
}

/* ── Media file rows (image / video previews) ── */

.fDesign--media {
    height: auto;
    min-height: 56px;
    padding: 6px 8px;
    gap: 10px;
    align-items: center;
    border: 1px solid transparent;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.fDesign--media .fDesignSvg {
    display: none !important;
}

.fDesign--media:hover {
    border-color: rgba(124, 58, 237, 0.12);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.06);
}

.fDesign--media.is-selected {
    border-color: rgba(124, 58, 237, 0.28);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.12);
}

.fDesign-media-thumb {
    width: 44px;
    height: 44px;
    border-radius: 9px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: var(--surface-sunken, #f3f4f6);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.fDesign-media-thumb img,
.fDesign-media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.fDesign-media-thumb--loading::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.55) 45%,
        rgba(255, 255, 255, 0) 90%
    );
    transform: translateX(-120%);
    animation: fDesignMediaShimmer 1.2s ease-in-out infinite;
}

.fDesign-media-thumb--error::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(236, 72, 153, 0.1));
}

.fDesign-media-play {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(15, 23, 42, 0.62);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.fDesign--media.is-thumb-playing .fDesign-media-play {
    opacity: 0;
}

.fDesign-media-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.fDesign-media-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    line-height: 1.25;
}

.fDesign--media.fDesign--upload-pending,
.fDesign--media.fDesign--upload-error {
    min-height: 56px;
    flex-wrap: wrap;
}

.fDesign--media .fDesign-upload-bar {
    flex: 0 0 100%;
    margin-left: 54px;
}

@keyframes fDesignMediaShimmer {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

[data-theme="dark"] .fDesign-media-thumb {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .fDesign-media-thumb--loading::before {
    background: linear-gradient(
        110deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.12) 45%,
        rgba(255, 255, 255, 0) 90%
    );
}

/* ── Connected workspace (editor + terminal + preview) ── */

#workspace {
    flex: 1 1 0;
    display: flex;
    align-items: stretch;
    min-width: 280px;
    margin: 0;
    background: var(--surface);
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
}

#workspace.is-resizing {
    transition: none;
}

#workspace.is-resizing * {
    transition: none !important;
}

/* Soft sleep — Striqr storm window overlay */
.soft-sleep-overlay {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    background:
        radial-gradient(ellipse 120% 80% at 50% 0%, rgba(124, 58, 237, 0.28), transparent 55%),
        radial-gradient(ellipse 90% 60% at 80% 100%, rgba(88, 28, 135, 0.22), transparent 50%),
        rgba(6, 6, 10, 0.88);
    backdrop-filter: blur(10px) saturate(1.1);
    animation: soft-sleep-fade-in 0.45s var(--ease-out, ease-out) forwards;
}

.soft-sleep-overlay[hidden] {
    display: none !important;
}

@keyframes soft-sleep-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.soft-sleep-storm-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.75;
}

.soft-sleep-rain {
    position: absolute;
    inset: -20% 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: repeating-linear-gradient(
        112deg,
        transparent 0,
        transparent 6px,
        rgba(168, 85, 247, 0.07) 6px,
        rgba(168, 85, 247, 0.07) 7px
    );
    animation: soft-sleep-rain 0.55s linear infinite;
}

@keyframes soft-sleep-rain {
    from { transform: translateY(-8%); }
    to { transform: translateY(8%); }
}

.soft-sleep-window {
    position: relative;
    z-index: 2;
    width: min(420px, calc(100% - 28px));
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(168, 85, 247, 0.35);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 28px 80px rgba(0, 0, 0, 0.55),
        0 0 48px rgba(124, 58, 237, 0.25);
    pointer-events: auto;
    animation: soft-sleep-window-in 0.55s var(--ease-out, ease-out) 0.08s both;
}

@keyframes soft-sleep-window-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.soft-sleep-window-chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    background: linear-gradient(180deg, rgba(30, 27, 46, 0.98), rgba(18, 16, 28, 0.98));
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.soft-sleep-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.soft-sleep-dot--close { background: #ff5f57; box-shadow: 0 0 6px rgba(255, 95, 87, 0.45); }
.soft-sleep-dot--min { background: #febc2e; box-shadow: 0 0 6px rgba(254, 188, 46, 0.35); }
.soft-sleep-dot--max { background: #28c840; box-shadow: 0 0 6px rgba(40, 200, 64, 0.35); }

.soft-sleep-window-title {
    margin-left: 6px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: rgba(228, 228, 231, 0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soft-sleep-card {
    padding: 28px 26px 24px;
    text-align: center;
    background:
        linear-gradient(165deg, rgba(24, 20, 36, 0.97) 0%, rgba(12, 10, 18, 0.98) 100%);
}

.soft-sleep-bolt {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 14px;
    border-radius: 20px;
    color: #ffcf33;
    background: radial-gradient(circle at 35% 30%, rgba(168, 85, 247, 0.35), rgba(88, 28, 135, 0.15));
    border: 1px solid rgba(168, 85, 247, 0.35);
    box-shadow: 0 0 24px rgba(124, 58, 237, 0.35);
    animation: soft-sleep-bolt-pulse 2.4s ease-in-out infinite;
}

.soft-sleep-bolt svg {
    filter: drop-shadow(0 0 8px #f5a623) drop-shadow(0 0 14px #7c3aed);
}

@keyframes soft-sleep-bolt-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 24px rgba(124, 58, 237, 0.35); }
    50% { transform: scale(1.04); box-shadow: 0 0 36px rgba(168, 85, 247, 0.5); }
}

.soft-sleep-kicker {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #a855f7;
}

.soft-sleep-scribble.st-glitch-line {
    display: block;
    margin: 0 auto 12px;
    font-size: 26px;
    font-weight: 700;
    color: #fafafa;
    min-height: 1.1em;
}

.soft-sleep-desc {
    margin: 0 0 20px;
    font-size: 13.5px;
    line-height: 1.55;
    color: rgba(212, 212, 216, 0.88);
    max-width: 32ch;
    margin-left: auto;
    margin-right: auto;
}

.soft-sleep-wake-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 11rem;
    padding: 0.65rem 1.35rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 45%, #9333ea 100%);
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(124, 58, 237, 0.45);
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.soft-sleep-wake-btn svg {
    color: #ffcf33;
    filter: drop-shadow(0 0 4px #f5a623);
}

.soft-sleep-wake-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 12px 32px rgba(168, 85, 247, 0.55);
}

.soft-sleep-waking {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.soft-sleep-waking-bar {
    display: block;
    width: min(220px, 100%);
    height: 4px;
    border-radius: 999px;
    background: rgba(168, 85, 247, 0.2);
    overflow: hidden;
    position: relative;
}

.soft-sleep-waking-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #ffcf33);
    animation: soft-sleep-waking-sweep 1.1s ease-in-out infinite;
}

@keyframes soft-sleep-waking-sweep {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

.soft-sleep-waking-text {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(196, 181, 253, 0.9);
}

.soft-sleep-overlay.is-waking .soft-sleep-wake-btn {
    opacity: 0.45;
    pointer-events: none;
    transform: none;
}

.soft-sleep-overlay.is-waking .soft-sleep-waking {
    display: flex;
}

.soft-sleep-overlay.is-waking .soft-sleep-bolt {
    animation: soft-sleep-bolt-wake 0.6s ease-in-out infinite;
}

@keyframes soft-sleep-bolt-wake {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.35); }
}

/* Storm partial — soft sleep layer */
.soft-sleep-storm-wrap .st-status-storm {
    position: absolute;
    inset: 0;
}

.soft-sleep-storm-wrap .st-status-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 55% at 50% 35%, rgba(124, 58, 237, 0.28), transparent 65%);
    animation: st-status-flash 4.2s ease-out infinite;
}

.soft-sleep-storm-wrap .st-status-bolts {
    position: absolute;
    inset: -40px 0;
    width: 100%;
    height: calc(100% + 80px);
}

.soft-sleep-storm-wrap .st-status-strike {
    fill: none;
    stroke: #a855f7;
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    opacity: 0;
    filter: drop-shadow(0 0 6px #c084fc) drop-shadow(0 0 16px #7c3aed) drop-shadow(0 0 34px #7c3aed);
    animation: st-status-strike-draw 4.2s ease-out var(--sd, 0s) infinite;
}

.soft-sleep-storm-wrap .st-status-strike--gold {
    stroke: #ffcf33;
    filter: drop-shadow(0 0 6px #ffe234) drop-shadow(0 0 16px #f5a623);
}

.soft-sleep-storm-wrap .st-status-lb {
    position: absolute;
    width: 56px;
    height: 56px;
    opacity: 0.22;
    animation: st-editor-lb-float 7s ease-in-out infinite;
}

.soft-sleep-storm-wrap .st-status-lb svg {
    width: 100%;
    height: 100%;
    fill: #7c3aed;
    filter: drop-shadow(0 0 8px #7c3aed);
}

.soft-sleep-storm-wrap .st-status-lb--gold svg {
    fill: #f5a623;
    filter: drop-shadow(0 0 8px #f5a623);
}

.soft-sleep-storm-wrap .st-status-lb--1 { left: 6%; top: 14%; --rot: -12deg; animation-delay: 0.2s; }
.soft-sleep-storm-wrap .st-status-lb--2 { right: 8%; top: 18%; --rot: 18deg; animation-delay: 0.8s; }
.soft-sleep-storm-wrap .st-status-lb--3 { left: 38%; bottom: 8%; --rot: 6deg; animation-delay: 1.4s; }
.soft-sleep-storm-wrap .st-status-strike--1 { --sd: 0.1s; }
.soft-sleep-storm-wrap .st-status-strike--2 { --sd: 0.34s; }
.soft-sleep-storm-wrap .st-status-strike--3 { --sd: 0.02s; stroke-width: 9; }
.soft-sleep-storm-wrap .st-status-strike--4 { --sd: 0.55s; }
.soft-sleep-storm-wrap .st-status-strike--5 { --sd: 0.42s; }

#workspace > main {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 0;
}

#stage {
    position: relative;
    flex: 1 1 auto;
    width: 100%;
    min-height: 80px;
    align-self: stretch;
    background: var(--input-bg);
    border: 1px solid var(--remix-btn-border);
    border-radius: 6px;
    box-shadow: none;
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
    margin: 0 12px 12px;
    width: calc(100% - 24px);
}

#stage:focus-within {
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

#stage.stage--media-open .CodeMirror {
    visibility: hidden;
    pointer-events: none;
}

#stage.stage--instruct-open .CodeMirror {
    visibility: hidden;
    pointer-events: none;
}

#stage.stage--readme-open .CodeMirror {
    visibility: hidden;
    pointer-events: none;
}

.st-modal-backdrop--heavy {
    background: rgba(20, 16, 34, 0.58);
    backdrop-filter: blur(12px) saturate(1.12);
    -webkit-backdrop-filter: blur(12px) saturate(1.12);
}

.si-shell {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.si-main-panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    pointer-events: none;
    transition: filter 0.28s var(--ease-out), opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
}

.si-main-panel .si-modal-card {
    pointer-events: auto;
    transition: transform 0.28s var(--ease-out), opacity 0.28s var(--ease-out), filter 0.28s var(--ease-out);
}

.si-docker-blur {
    position: fixed;
    inset: 0;
    right: min(420px, 92vw);
    z-index: 2;
    background: rgba(20, 16, 34, 0.18);
    backdrop-filter: blur(10px) saturate(1.08);
    -webkit-backdrop-filter: blur(10px) saturate(1.08);
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.24s var(--ease-out);
}

.si-shell.is-side-picker-open .si-docker-blur,
.si-shell.is-docker-picker-open .si-docker-blur {
    opacity: 1;
}

.si-shell.is-side-picker-open .si-main-panel,
.si-shell.is-docker-picker-open .si-main-panel {
    justify-content: flex-start;
    padding-right: min(440px, 94vw);
}

.si-shell.is-docker-picker-open .si-docker-drawer,
.si-shell.is-framework-picker-open .si-framework-drawer {
    transform: translateX(0);
}

.si-docker-blur[hidden] {
    display: block !important;
    opacity: 0;
    pointer-events: none;
}

.si-docker-overlay {
    position: fixed;
    inset: 0;
    z-index: 6090;
    background: rgba(20, 16, 34, 0.42);
    backdrop-filter: blur(8px) saturate(1.08);
    -webkit-backdrop-filter: blur(8px) saturate(1.08);
}

.si-docker-overlay[hidden] {
    display: none !important;
}

.si-side-drawer,
.si-docker-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 92vw);
    z-index: 3;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.08), transparent 42%),
        var(--surface-raised);
    border-left: 1px solid var(--border-strong);
    box-shadow: -28px 0 90px rgba(20, 16, 34, 0.22);
    transform: translateX(102%);
    transition: transform 0.32s var(--ease-out);
    pointer-events: auto;
}

.si-docker-drawer {
    z-index: 6100;
}

.si-shell.is-docker-picker-open .si-docker-drawer,
body.is-docker-picker-open .si-docker-drawer,
.si-docker-drawer.is-open {
    transform: translateX(0);
    pointer-events: auto;
}

.si-side-drawer[hidden],
.si-docker-drawer[hidden],
.si-framework-drawer[hidden] {
    display: flex !important;
    transform: translateX(102%) !important;
    visibility: hidden;
    pointer-events: none;
    transition: none;
}

.si-side-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.si-side-drawer-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}

.si-side-drawer-sub {
    margin: 4px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.si-docker-drawer-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 22px 20px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.si-docker-head-copy {
    flex: 1;
    min-width: 0;
}

.si-docker-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-top: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.16s var(--ease-out), color 0.16s var(--ease-out), background 0.16s var(--ease-out);
}

.si-docker-back:hover {
    border-color: var(--purple);
    color: var(--purple);
    background: var(--purple-soft);
}

.si-docker-back[hidden] {
    display: none !important;
}

.si-docker-repo-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.si-docker-repo-banner[hidden] {
    display: none !important;
}

.si-docker-repo-banner-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.si-docker-repo-banner-copy strong {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    word-break: break-all;
}

.si-docker-repo-banner-copy span {
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--ink-muted);
}

.si-hub-list {
    list-style: none;
    margin: 0;
    padding: 6px 10px 18px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.si-hub-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.16s var(--ease-out), background 0.16s var(--ease-out), transform 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
}

.si-hub-card:hover {
    border-color: rgba(124, 58, 237, 0.35);
    background: var(--purple-soft);
    transform: translateX(-2px);
}

.si-hub-card.is-selected {
    border-color: var(--purple);
    background: rgba(124, 58, 237, 0.08);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.12);
}

.si-hub-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--input-bg);
}

.si-hub-logo--docker {
    color: var(--purple);
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.14);
}

.si-hub-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.si-hub-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #fff;
}

.si-hub-card-body {
    flex: 1;
    min-width: 0;
}

.si-hub-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.si-hub-card-title {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    word-break: break-all;
}

.si-hub-card-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--purple);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.16);
}

.si-hub-card-badge--official {
    color: #15803d;
    background: rgba(21, 128, 61, 0.12);
    border-color: rgba(21, 128, 61, 0.22);
}

.si-hub-card-badge--verified {
    color: #1d4ed8;
    background: rgba(29, 78, 216, 0.1);
    border-color: rgba(29, 78, 216, 0.22);
}

.si-hub-card-badge--hardened {
    color: #6d28d9;
    background: rgba(109, 40, 217, 0.1);
    border-color: rgba(109, 40, 217, 0.22);
}

.si-hub-card-badge--community {
    color: var(--ink-muted);
    background: var(--surface-glass);
    border-color: var(--border);
}

.si-hub-card-desc {
    margin: 4px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.si-hub-card-meta {
    margin: 6px 0 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
}

.si-hub-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-muted);
    list-style: none;
}

.si-hub-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--input-bg), rgba(124, 58, 237, 0.05));
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}

.si-hub-trigger:hover:not(:disabled) {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
    transform: translateY(-1px);
}

.si-hub-trigger:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.si-hub-trigger-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.si-framework-trigger .si-field-optional {
    margin-left: auto;
    flex-shrink: 0;
}

.si-field--framework {
    padding: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.05), transparent 42%),
        var(--surface);
}

.si-framework-other {
    padding: 0 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    flex-shrink: 0;
}

.si-framework-other[hidden] {
    display: none !important;
}

.si-framework-other-label {
    margin-top: 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.si-framework-list {
    flex: 1;
    min-height: 0;
}


.si-docker-search-wrap {
    position: relative;
    padding: 14px 16px 10px;
}

.si-docker-search-icon {
    position: absolute;
    left: 28px;
    top: 50%;
    transform: translateY(calc(-50% + 2px));
    color: var(--ink-muted);
    pointer-events: none;
}

.si-docker-search {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 16px;
}

.si-docker-search:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.si-docker-list {
    list-style: none;
    margin: 0;
    padding: 6px 10px 18px;
    overflow: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.si-docker-section-label {
    list-style: none;
    margin: 4px 4px 8px;
    padding: 8px 6px 2px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.gh-image-env {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin: 4px 0 2px;
}

.gh-image-trigger {
    width: 100%;
    text-align: left;
}

.si-docker-drawer-notice {
    margin: 0 16px 10px;
    display: flex;
}

.si-docker-drawer-notice span {
    display: block;
}

.si-docker-status {
    margin: 0;
    padding: 0 18px 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink-muted);
}

.si-docker-drawer-foot {
    padding: 12px 16px 18px;
    border-top: 1px solid var(--border);
}

.si-docker-drawer-foot .tm-btn {
    width: 100%;
}

.si-field--docker {
    padding: 16px;
    background:
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.06), transparent 42%),
        var(--surface);
}

.si-docker-notice {
    margin: 0 0 12px;
    display: flex;
}

.si-docker-notice span {
    display: block;
}

.si-docker-card {
    margin-top: 2px;
}

.si-docker-option {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.16s var(--ease-out), background 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}

.si-docker-option:hover {
    border-color: rgba(124, 58, 237, 0.35);
    background: var(--purple-soft);
    transform: translateX(-2px);
}

.si-docker-option.is-selected {
    border-color: var(--purple);
    background: rgba(124, 58, 237, 0.08);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.12);
}

.si-docker-option.is-recommended {
    border-color: rgba(124, 58, 237, 0.28);
}

.si-docker-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.si-docker-option-tag {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink);
    word-break: break-all;
}

.si-docker-option-badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--purple);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.16);
}

.si-docker-option-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ink-muted);
}

.si-docker-empty {
    padding: 28px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--ink-muted);
    list-style: none;
}

.si-docker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--input-bg), rgba(124, 58, 237, 0.05));
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out), transform 0.16s var(--ease-out);
}

.si-docker-trigger:hover:not(:disabled) {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
    transform: translateY(-1px);
}

.si-docker-trigger:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.si-docker-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--purple);
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.14);
    flex-shrink: 0;
}

.si-docker-card-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.si-docker-trigger-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    word-break: break-all;
}

.si-docker-trigger-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.si-docker-trigger-chevron {
    display: inline-flex;
    color: var(--ink-muted);
    flex-shrink: 0;
}

.si-modal-card {
    width: min(640px, calc(100vw - 32px));
}

.si-field-key-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.si-field-locked {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-muted);
    background: transparent;
    border: 1px solid var(--border);
}

.si-field--readonly {
    opacity: 0.48;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.si-field-input--readonly {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    color: var(--ink-muted);
    cursor: default;
    caret-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

@media (max-width: 860px) {
    .si-shell.is-side-picker-open .si-main-panel,
    .si-shell.is-docker-picker-open .si-main-panel {
        padding-right: 24px;
    }

    .si-shell.is-side-picker-open .si-main-panel .si-modal-card,
    .si-shell.is-docker-picker-open .si-main-panel .si-modal-card {
        transform: scale(0.96);
        opacity: 0.35;
    }

    .si-side-drawer,
    .si-docker-drawer,
    .si-framework-drawer {
        width: 100vw;
        max-width: 100vw;
    }

    .si-docker-blur {
        right: 0;
        background: rgba(20, 16, 34, 0.42);
    }
}

.si-field-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0 12px;
}

.si-field {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--surface);
}

.si-field-key {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--purple);
    letter-spacing: 0.01em;
}

.si-field-desc {
    margin: 5px 0 10px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.si-field-input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 12.5px;
}

.si-field-input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.si-field-input--textarea {
    min-height: 72px;
    resize: vertical;
    line-height: 1.45;
    font-family: var(--font-sans);
}

.si-field--command {
    padding-bottom: 12px;
}

.si-command-editor {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--input-bg);
}

.si-command-editor .CodeMirror {
    height: auto !important;
    min-height: 96px;
    max-height: 280px;
    font-size: 12.5px;
    line-height: 1.5;
}

.si-command-editor .CodeMirror-scroll {
    min-height: 96px;
    max-height: 280px;
}

.si-command-editor .CodeMirror-gutters {
    border-right: 1px solid var(--border);
}

/* README editor — GitHub markdown look, flush white */
.readme-editor {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

.readme-editor[hidden] {
    display: none !important;
}

.readme-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 12px;
    background: #ffffff;
    border-bottom: 1px solid #d0d7de;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.readme-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.readme-tool-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #656d76;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.readme-tool-btn:hover {
    background: #f3f4f6;
    color: #1f2328;
}

.readme-tool-btn.is-active {
    background: #ddf4ff;
    color: #0969da;
}

.readme-tool-btn:active {
    background: #eaeef2;
}

.readme-tool-btn--line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: auto;
    padding: 0 10px;
}

.readme-tool-line-icon {
    display: block;
    width: 14px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 -4px 0 currentColor, 0 4px 0 currentColor;
    opacity: 0.85;
}

.readme-dd {
    position: relative;
    flex-shrink: 0;
}

.readme-dd-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    min-width: 132px;
    padding: 0 10px 0 12px;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #1f2328;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(18, 18, 18, 0.04);
}

.readme-dd-trigger:hover,
.readme-dd.is-open .readme-dd-trigger {
    border-color: rgba(124, 58, 237, 0.35);
}

.readme-dd-trigger svg {
    margin-left: auto;
    color: #656d76;
    transition: transform 0.16s ease;
}

.readme-dd.is-open .readme-dd-trigger svg {
    transform: rotate(180deg);
}

.readme-dd-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 200px;
    max-height: 280px;
    overflow: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid #d0d7de;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(18, 18, 18, 0.12);
}

.readme-dd-menu[hidden] {
    display: none !important;
}

.readme-dd-option {
    display: flex;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #1f2328;
    cursor: pointer;
}

.readme-dd-option:hover {
    background: #f4f4f6;
}

.readme-dd-option.is-active {
    background: rgba(99, 102, 241, 0.1);
    color: #4338ca;
}

.readme-size {
    display: inline-flex;
    align-items: center;
    height: 32px;
    border: 1px solid #d0d7de;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(18, 18, 18, 0.04);
}

.readme-size-btn {
    width: 28px;
    height: 100%;
    border: none;
    background: transparent;
    color: #1f2328;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
}

.readme-size-btn:hover {
    background: #f3f4f6;
}

.readme-size-input {
    width: 42px;
    height: 100%;
    border: none;
    border-left: 1px solid #d0d7de;
    border-right: 1px solid #d0d7de;
    background: transparent;
    color: #1f2328;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

.readme-size-input::-webkit-outer-spin-button,
.readme-size-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.readme-size-input:focus {
    outline: none;
    background: #f6f8fa;
}

.readme-tool-sep {
    width: 1px;
    height: 18px;
    background: #d0d7de;
    margin: 0 6px;
    flex-shrink: 0;
}

.readme-gh-status {
    font-size: 12px;
    font-weight: 500;
    color: #656d76;
    white-space: nowrap;
    padding: 0 4px;
    background: transparent;
    box-shadow: none;
}

.readme-gh-status[data-tone="changed"] {
    color: #9a6700;
}

.readme-gh-status[data-tone="synced"] {
    color: #1a7f37;
}

.readme-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0;
    background: #ffffff;
}

.readme-page {
    max-width: none;
    margin: 0;
    min-height: 100%;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
}

.readme-surface {
    min-height: 100%;
    padding: 32px 40px 64px;
    color: #1f2328;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    outline: none;
    word-wrap: break-word;
}

.readme-surface:focus {
    outline: none;
}

.readme-surface:empty::before {
    content: "Start writing your README…";
    color: #8c959f;
    pointer-events: none;
}

.readme-surface h1,
.readme-surface h2,
.readme-surface h3 {
    line-height: 1.25;
    margin: 24px 0 16px;
    font-weight: 600;
    letter-spacing: 0;
    color: #1f2328;
}

.readme-surface h1:first-child,
.readme-surface h2:first-child,
.readme-surface h3:first-child,
.readme-surface p:first-child {
    margin-top: 0;
}

.readme-surface h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #d1d9e0;
}

.readme-surface h2 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #d1d9e0;
}

.readme-surface h3 {
    font-size: 1.25em;
}

.readme-surface p {
    margin: 0 0 16px;
}

.readme-surface strong,
.readme-surface b {
    font-weight: 600;
    color: #1f2328;
}

.readme-surface em,
.readme-surface i {
    font-style: italic;
}

.readme-surface u {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.readme-surface ul,
.readme-surface ol {
    margin: 0 0 16px;
    padding-left: 2em;
}

.readme-surface li {
    margin: 0.25em 0;
}

.readme-surface li::marker {
    color: #1f2328;
}

.readme-surface hr {
    border: none;
    height: 0.25em;
    background: #d1d9e0;
    margin: 24px 0;
}

.readme-surface code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 85%;
    background: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 6px;
}

.readme-surface blockquote {
    margin: 0 0 16px;
    padding: 0 1em;
    border-left: 0.25em solid #d1d9e0;
    color: #656d76;
}

.readme-surface[contenteditable="false"] {
    opacity: 0.72;
    cursor: not-allowed;
}

[data-theme="dark"] .readme-editor,
[data-theme="dark"] .readme-toolbar,
[data-theme="dark"] .readme-body,
[data-theme="dark"] .readme-page {
    background: #0d1117;
}

[data-theme="dark"] .readme-toolbar {
    border-bottom-color: #3d444d;
}

[data-theme="dark"] .readme-tool-btn {
    color: #9198a1;
}

[data-theme="dark"] .readme-tool-btn:hover {
    background: #21262d;
    color: #f0f6fc;
}

[data-theme="dark"] .readme-tool-btn.is-active {
    background: #13233a;
    color: #58a6ff;
}

[data-theme="dark"] .readme-dd-trigger,
[data-theme="dark"] .readme-dd-menu,
[data-theme="dark"] .readme-size {
    background: #161b22;
    border-color: #3d444d;
    color: #f0f6fc;
}

[data-theme="dark"] .readme-dd-option {
    color: #f0f6fc;
}

[data-theme="dark"] .readme-dd-option:hover {
    background: #21262d;
}

[data-theme="dark"] .readme-dd-option.is-active {
    background: #13233a;
    color: #58a6ff;
}

[data-theme="dark"] .readme-size-input {
    color: #f0f6fc;
    border-left-color: #3d444d;
    border-right-color: #3d444d;
}

[data-theme="dark"] .readme-size-btn {
    color: #f0f6fc;
}

[data-theme="dark"] .readme-size-btn:hover,
[data-theme="dark"] .readme-size-input:focus {
    background: #21262d;
}

[data-theme="dark"] .readme-tool-sep {
    background: #3d444d;
}

[data-theme="dark"] .readme-gh-status {
    color: #9198a1;
}

[data-theme="dark"] .readme-surface {
    color: #f0f6fc;
}

[data-theme="dark"] .readme-surface h1,
[data-theme="dark"] .readme-surface h2,
[data-theme="dark"] .readme-surface h3,
[data-theme="dark"] .readme-surface strong,
[data-theme="dark"] .readme-surface b {
    color: #f0f6fc;
}

[data-theme="dark"] .readme-surface h1,
[data-theme="dark"] .readme-surface h2 {
    border-bottom-color: #3d444d;
}

[data-theme="dark"] .readme-surface hr {
    background: #3d444d;
}

[data-theme="dark"] .readme-surface code {
    background: rgba(110, 118, 129, 0.4);
}

[data-theme="dark"] .readme-surface blockquote {
    border-left-color: #3d444d;
    color: #9198a1;
}

.si-field-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.si-field-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--purple);
}

.si-save-status {
    font-size: 12px;
    color: var(--ink-muted);
}

.si-save-status[data-tone="pending"] {
    color: var(--ink);
}

.si-save-status[data-tone="ok"] {
    color: #16a34a;
}

.si-save-status[data-tone="readonly"] {
    color: var(--ink-muted);
}

.st-modal-sub code {
    font-family: var(--font-mono);
    font-size: 0.92em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--purple-soft);
    color: var(--purple);
}

.media-viewer {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(circle at 50% 20%, rgba(124, 58, 237, 0.07), transparent 55%),
        var(--input-bg);
}

.media-viewer[hidden] {
    display: none !important;
}

.media-viewer-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.media-viewer-asset {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(15, 12, 25, 0.18);
}

.media-viewer-status {
    margin: 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.editor-action-btn--format[hidden],
.editor-action-btn--copy[hidden] {
    display: none !important;
}

.CodeMirror {
    height: 100% !important;
    width: 100% !important;
    font-size: 14px;
    line-height: 1.65;
    font-family: var(--font-mono), "Fira Code", monospace;
    /* Editor surface follows the search-input tone so it reads as a darker,
       recessed block (Cursor-style) against the lighter chrome panels. */
    background: var(--input-bg) !important;
}

.CodeMirror-gutters {
    min-width: 48px;
    background: var(--input-bg) !important;
    border-right: 1px solid var(--border);
}

.CodeMirror-linenumber {
    font-size: 12px;
    color: var(--ink-faint);
    padding: 0 10px;
}

.CodeMirror-placeholder,
.CodeMirror-empty .CodeMirror-placeholder {
    color: var(--ink-faint) !important;
    opacity: 0.9;
    font-style: italic;
    pointer-events: none;
}

/* ── Terminal ── */

#terminal {
    display: none;
    flex: 0 0 var(--ws-terminal-h, 220px);
    width: 100%;
    height: var(--ws-terminal-h, 220px);
    margin-top: 0;
    background: #13111a;
    border-radius: 0;
    border: none;
    box-shadow: none;
    position: relative;
    overflow: hidden;
    flex-direction: column;
}

#workspace.terminal-open #terminal {
    display: flex;
}

#terminal_top {
    position: relative;
    width: 100%;
    height: 40px;
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 12px;
}

#terminalTitle {
    position: static;
    display: inline-flex;
    align-items: center;
    width: auto;
    height: auto;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    float: none;
    top: auto;
    left: auto;
    margin-left: 8px;
}

#terminalSvg {
    position: static;
    display: block;
    width: 18px;
    height: 18px;
    float: none;
    top: auto;
    left: auto;
    font-family: inherit;
    color: inherit;
}

.terminal-top-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.terminal-top-actions button {
    float: none;
    margin: 0;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border);
    position: relative;
    z-index: 20;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

#newTerminal {
    color: var(--ink-muted);
}

#newTerminal:hover {
    color: var(--purple);
    background: var(--purple-soft);
    border-color: var(--border-strong);
}

#closeTerminal {
    color: #e5484d;
    border-color: rgba(229, 72, 77, 0.35);
}

#closeTerminal:hover {
    color: #fff;
    background: #e5484d;
    border-color: #e5484d;
}

#terminalPreview {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: auto;
    background: #0d0b12;
    overflow: hidden;
    touch-action: pan-y;
}

#terminalPreview .xterm {
    height: 100%;
    padding: 8px 10px 12px;
}

#terminalPreview .xterm-viewport {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#terminalPreview .xterm-screen {
    touch-action: manipulation;
}

/* ── Cursor-style resize seams ── */

/* Shared thin seam. A 1px visible line with a wider invisible hit area. */
.ws-splitter {
    position: relative;
    flex-shrink: 0;
    z-index: 40;
    background: var(--border);
    transition: background var(--transition);
}

.ws-splitter::before {
    content: "";
    position: absolute;
}

.ws-splitter:hover,
.ws-splitter.is-active {
    background: var(--purple);
}

/* Vertical seams (resize horizontally) — files + preview */
.ws-splitter--col {
    width: 1px;
    align-self: stretch;
    cursor: col-resize;
}

.ws-splitter--col::before {
    top: 0;
    bottom: 0;
    left: -3px;
    right: -3px;
}

/* Horizontal seam (resize vertically) — terminal */
.ws-splitter--row {
    width: 100%;
    height: 1px;
    cursor: row-resize;
}

.ws-splitter--row::before {
    left: 0;
    right: 0;
    top: -3px;
    bottom: -3px;
}

/* Hide the old decorative grips — seams are clean lines now */
#previewDragCS,
#terminalDrag {
    display: none;
}

#mobileSplitFrame {
    display: none;
}

#preview {
    width: var(--ws-preview-w, 340px);
    flex-shrink: 0;
    flex-grow: 0;
    background: var(--surface);
    border-left: none;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 12px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#topFramer {
    width: 100%;
    height: auto;
    flex-shrink: 0;
}

#preview::before {
    content: none;
}

.preview-panel-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 0 10px 4px;
    flex-shrink: 0;
}

.preview-panel-title {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.preview-offline-label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f87171;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(127, 29, 29, 0.14);
    border: 1px solid rgba(248, 113, 113, 0.35);
}

.preview-offline-label.is-online {
    color: #15803d;
    background: rgba(22, 163, 74, 0.12);
    border-color: rgba(22, 163, 74, 0.28);
}

[data-theme="dark"] .preview-offline-label.is-online {
    color: #4ade80;
    background: rgba(22, 163, 74, 0.18);
    border-color: rgba(74, 222, 128, 0.32);
}

.preview-offline-label[hidden] {
    display: none !important;
}

.preview-action-btn--mode .preview-mode-icon {
    display: none;
    flex-shrink: 0;
}

.preview-action-btn--mode .preview-mode-icon--online {
    display: block;
}

.preview-action-btn--mode.is-offline-active {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(127, 29, 29, 0.12);
}

.preview-action-btn--mode.is-offline-active .preview-mode-icon--offline {
    display: block;
}

.preview-action-btn--mode.is-offline-active .preview-mode-icon--online {
    display: none;
}

.preview-offline-build-overlay {
    position: absolute;
    inset: 0;
    z-index: 7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px;
    background: rgba(10, 10, 12, 0.82);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-sm);
}

.preview-offline-build-overlay[hidden] {
    display: none !important;
}

.preview-offline-build-label {
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: #f3f4f6;
    text-align: center;
}

.preview-offline-build-track {
    width: min(280px, 90%);
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.preview-offline-build-bar {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
    transition: width 180ms ease;
}

.preview-offline-dock {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    container-type: inline-size;
    container-name: offline-dock;
    pointer-events: none;
}

.preview-offline-dock[hidden] {
    display: none !important;
}

.preview-offline-dock-panels {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    pointer-events: none;
}

.preview-offline-dock-bar {
    display: flex;
    align-items: center;
    justify-content: stretch;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    padding: 8px;
    overflow: hidden;
    pointer-events: none;
}

.preview-offline-dock.is-open .preview-offline-dock-bar {
    background: var(--surface);
    border-top: 1px solid var(--border);
    pointer-events: auto;
}

.preview-offline-assets,
.preview-offline-logs {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    pointer-events: none;
}

.preview-offline-assets[hidden],
.preview-offline-logs[hidden] {
    display: none !important;
}

.preview-offline-assets-toggle,
.preview-offline-assets-panel,
.preview-offline-logs-panel,
.preview-offline-rerun {
    pointer-events: auto;
}

.preview-offline-assets-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.preview-offline-rerun {
    flex: 1 1 0;
    min-width: 0;
}

.preview-offline-assets-toggle > span:not(.preview-offline-assets-count) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@container offline-dock (max-width: 380px) {
    .preview-offline-assets-toggle {
        gap: 4px;
        padding: 0 8px;
    }

    .preview-offline-assets-toggle > span:not(.preview-offline-assets-count) {
        display: none;
    }
}

.preview-offline-assets-toggle svg {
    display: block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.preview-offline-assets-toggle:hover {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.preview-offline-assets-toggle[aria-expanded="true"] {
    color: #6d28d9;
    border-color: rgba(124, 58, 237, 0.35);
    background: var(--purple-soft, rgba(124, 58, 237, 0.1));
}

[data-theme="dark"] .preview-offline-assets-toggle[aria-expanded="true"] {
    color: #c4b5fd;
}

.preview-offline-rerun.is-spinning svg {
    animation: striqr-rerun-spin 520ms ease;
}

@keyframes striqr-rerun-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.preview-offline-assets-count {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--purple-soft, rgba(124, 58, 237, 0.12));
    color: var(--purple-deep, #6d28d9);
    border: 1px solid rgba(124, 58, 237, 0.22);
    font-size: 10px;
    font-weight: 700;
}

.preview-offline-assets-panel {
    width: 100%;
    margin: 0;
    min-height: 0;
    max-height: min(300px, 44vh);
    overflow: auto;
    border: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 -10px 30px rgba(14, 18, 26, 0.12);
}

.preview-offline-dock.is-stacked .preview-offline-assets-panel {
    max-height: min(190px, 28vh);
}

.preview-offline-assets-panel[hidden] {
    display: none !important;
}

.preview-offline-assets-head {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.preview-offline-assets-kicker {
    flex-shrink: 0;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7c3aed;
}

.preview-offline-assets-sub {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--ink-faint);
}

.preview-offline-assets-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 10px 14px 14px;
}

.preview-offline-asset-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-sunken);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink);
    transition: border-color var(--transition), background var(--transition);
}

.preview-offline-asset-row:hover {
    border-color: var(--border-strong);
}

.preview-offline-asset-row.is-missing {
    opacity: 0.55;
}

.preview-offline-asset-row.is-empty {
    justify-content: center;
    border-style: dashed;
    color: var(--ink-faint);
    font-family: var(--font-display);
}

.preview-offline-asset-kind {
    flex-shrink: 0;
    min-width: 36px;
    padding: 3px 7px;
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-muted);
}

.preview-offline-asset-kind--css {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.18);
    color: #6d28d9;
}

.preview-offline-asset-kind--js {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.18);
    color: #6d28d9;
}

.preview-offline-asset-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-offline-asset-toggle {
    flex-shrink: 0;
    min-width: 62px;
    height: 28px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.preview-offline-asset-toggle:hover:not(:disabled) {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.preview-offline-asset-toggle.is-on {
    color: var(--ink-muted);
}

.preview-offline-asset-toggle.is-off {
    color: #7c3aed;
    border-color: rgba(124, 58, 237, 0.28);
    background: var(--purple-soft, rgba(124, 58, 237, 0.1));
}

[data-theme="dark"] .preview-offline-asset-toggle.is-off {
    color: #c4b5fd;
}

.preview-offline-asset-toggle:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.preview-offline-logs-head {
    align-items: center;
    justify-content: space-between;
}

.preview-offline-logs-head-copy {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.preview-offline-logs-list {
    font-family: var(--font-mono);
}

.preview-offline-log-row {
    align-items: flex-start;
}

.preview-offline-log-row .preview-offline-asset-name {
    white-space: pre-wrap;
    overflow: visible;
    text-overflow: unset;
    word-break: break-word;
}

.preview-offline-log-row.is-empty {
    opacity: 0.55;
    font-style: italic;
}

.preview-offline-asset-kind--log,
.preview-offline-asset-kind--info,
.preview-offline-asset-kind--debug {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.18);
    color: #6d28d9;
}

.preview-offline-asset-kind--warn {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.22);
    color: #b45309;
}

.preview-offline-asset-kind--error {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.22);
    color: #b91c1c;
}

.preview-offline-log-row.is-warn {
    color: #b45309;
}

.preview-offline-log-row.is-error {
    color: #b91c1c;
}

[data-theme="dark"] .preview-offline-assets-kicker {
    color: #a78bfa;
}

[data-theme="dark"] .preview-offline-assets-count,
[data-theme="dark"] .preview-offline-asset-kind--css,
[data-theme="dark"] .preview-offline-asset-kind--js,
[data-theme="dark"] .preview-offline-asset-kind--log,
[data-theme="dark"] .preview-offline-asset-kind--info,
[data-theme="dark"] .preview-offline-asset-kind--debug {
    color: #c4b5fd;
    background: rgba(124, 58, 237, 0.22);
    border-color: rgba(167, 139, 250, 0.32);
}

[data-theme="dark"] .preview-offline-asset-kind--warn,
[data-theme="dark"] .preview-offline-log-row.is-warn {
    color: #fbbf24;
}

[data-theme="dark"] .preview-offline-asset-kind--warn {
    background: rgba(217, 119, 6, 0.22);
    border-color: rgba(251, 191, 36, 0.32);
}

[data-theme="dark"] .preview-offline-asset-kind--error,
[data-theme="dark"] .preview-offline-log-row.is-error {
    color: #f87171;
}

[data-theme="dark"] .preview-offline-asset-kind--error {
    background: rgba(220, 38, 38, 0.22);
    border-color: rgba(248, 113, 113, 0.32);
}

.preview-url-bar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.preview-device-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    padding: 3px;
    border: 1px solid var(--remix-btn-border);
    border-radius: 8px;
    background: var(--surface-sunken);
}

.preview-device-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink-faint);
    cursor: pointer;
    transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}

.preview-device-btn:hover {
    color: var(--ink-muted);
    background: rgba(124, 58, 237, 0.06);
}

.preview-device-btn.is-active {
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.14);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.22);
}

.preview-device-btn svg {
    display: block;
}

.preview-phone-picker {
    position: relative;
    flex-shrink: 0;
}

.preview-phone-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    min-width: 0;
    max-width: 168px;
    padding: 0 10px 0 8px;
    border: 1px solid rgba(124, 58, 237, 0.28);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08), rgba(124, 58, 237, 0.03));
    color: var(--ink);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform 0.18s var(--ease-out);
}

.preview-phone-picker-btn:hover {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.preview-phone-picker-btn[aria-expanded="true"] {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14);
}

.preview-phone-picker-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(124, 58, 237, 0.12);
    color: #7c3aed;
    flex-shrink: 0;
}

.preview-phone-picker-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    line-height: 1.15;
}

.preview-phone-picker-copy strong {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 92px;
}

.preview-phone-picker-copy small {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    letter-spacing: 0.02em;
}

.preview-phone-picker-chevron {
    flex-shrink: 0;
    color: var(--ink-faint);
    transition: transform 0.18s var(--ease-out);
}

.preview-phone-picker-btn[aria-expanded="true"] .preview-phone-picker-chevron {
    transform: rotate(180deg);
    color: #7c3aed;
}

.preview-phone-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 2200;
    width: min(92vw, 320px);
    max-height: min(62vh, 420px);
    display: flex;
    flex-direction: column;
    padding: 8px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    background:
        radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.12), transparent 42%),
        var(--surface-raised);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.16),
        0 0 0 1px rgba(124, 58, 237, 0.06);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.98);
    transform-origin: top left;
    transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), visibility 0.2s;
}

.preview-phone-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.preview-phone-dropdown-head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.preview-phone-dropdown-kicker {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7c3aed;
}

.preview-phone-dropdown-sub {
    font-size: 11px;
    color: var(--ink-faint);
}

.preview-phone-list {
    overflow: auto;
    padding-right: 2px;
    scrollbar-width: thin;
}

.preview-phone-group {
    padding: 4px 0 6px;
}

.preview-phone-group-label {
    display: block;
    padding: 6px 8px 4px;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.preview-phone-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), transform 0.15s var(--ease-out);
}

.preview-phone-option:hover {
    background: rgba(124, 58, 237, 0.08);
}

.preview-phone-option.is-active {
    background: rgba(124, 58, 237, 0.14);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.18);
}

.preview-phone-option-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.preview-phone-option-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.preview-phone-option-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
}

.preview-phone-option-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.preview-phone-option-dpr {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
}

.preview-phone-option-check {
    width: 16px;
    height: 16px;
    color: #7c3aed;
    opacity: 0;
}

.preview-phone-option.is-active .preview-phone-option-check {
    opacity: 1;
}

.preview-phone-dropdown.is-opening .preview-phone-option {
    animation: preview-phone-option-in 0.28s var(--ease-out) both;
}

@keyframes preview-phone-option-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .preview-phone-dropdown.is-opening .preview-phone-option {
        animation: none;
    }
}

@media (max-width: 420px) {
    .preview-phone-picker-copy {
        display: none;
    }

    .preview-phone-picker-btn {
        max-width: 44px;
        padding: 0 8px;
    }
}

#previewSearch {
    flex: 1;
    min-width: 0;
    width: auto;
    border: 1px solid var(--remix-btn-border);
    outline: none;
    height: 40px;
    margin-top: 0;
    border-radius: 6px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
    padding: 0 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: border-color var(--transition), box-shadow var(--transition);
}

#previewSearch:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

#previewSearch::placeholder {
    color: var(--ink-faint);
}

/* Pulsed once the app comes up, since frameworks like Jupyter refuse to render in the iframe. */
.preview-url-bar.is-project-live #previewSearch {
    animation: preview-url-live 1.4s ease-in-out 3;
}

@keyframes preview-url-live {
    0%, 100% {
        border-color: var(--remix-btn-border);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    50% {
        border-color: #ffe234;
        box-shadow: 0 0 0 4px rgba(255, 226, 52, 0.45);
    }
}

@media (prefers-reduced-motion: reduce) {
    .preview-url-bar.is-project-live #previewSearch {
        animation: none;
        border-color: #ffe234;
        box-shadow: 0 0 0 3px rgba(255, 226, 52, 0.4);
    }
}

#previewButtons {
    display: flex;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.preview-action-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 68px;
    height: 40px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.preview-action-btn svg {
    flex-shrink: 0;
    display: block;
}

.preview-action-btn:hover {
    background: var(--remix-btn-hover-bg);
    border-color: var(--border-strong);
}

.preview-action-btn:active {
    transform: scale(0.98);
}

.preview-action-btn--primary {
    color: var(--remix-btn-fg);
    background: var(--remix-btn-bg);
    border-color: var(--remix-btn-border);
}

.preview-action-btn--primary:hover {
    background: var(--remix-btn-hover-bg);
    color: var(--remix-btn-fg);
}

#previewFramer {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    outline: 0;
    border: none;
    border-radius: inherit;
    box-shadow: none;
    background: #fff;
}

.preview-phone-stage {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
}

.preview-frame-wrap--desktop .preview-phone-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ── Mobile device stage ── */

.preview-frame-wrap--mobile {
    align-items: center;
    justify-content: center;
    padding: 10px 8px;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 18%, rgba(124, 58, 237, 0.1), transparent 58%),
        linear-gradient(180deg, var(--surface-sunken) 0%, var(--surface) 100%);
}

.preview-phone-option-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.preview-phone-option-brand--google {
    color: #4285f4;
    background: rgba(66, 133, 244, 0.12);
}

.preview-phone-option-brand--apple {
    color: #111827;
    background: rgba(15, 23, 42, 0.08);
}

.preview-phone-picker-glyph.is-apple {
    background: rgba(15, 23, 42, 0.1);
    color: #111827;
}

.preview-phone-picker-glyph.is-google {
    background: rgba(66, 133, 244, 0.12);
    color: #4285f4;
}

.preview-frame-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at 50% 40%, rgba(124, 58, 237, 0.14), transparent 62%),
        var(--surface-sunken);
    overflow: hidden;
}

.preview-loading-overlay.is-active {
    display: flex;
}

.preview-loading-copy {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 16px;
}

.preview-loading-status {
    margin: 10px 0 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    line-height: 1.45;
    max-width: 260px;
}

.preview-loading-overlay.is-waiting .preview-loading-status {
    color: #b45309;
}

[data-theme="dark"] #terminalPreview {
    background: #111214;
}

[data-theme="dark"] #fileEditorHolder input,
[data-theme="dark"] #headerProjectName,
[data-theme="dark"] .editor-file-input {
    color: var(--ink);
}

[data-theme="dark"] .breadcrumb-path {
    background: var(--surface-sunken);
}

[data-theme="dark"] .FolderButton {
    background: var(--surface-sunken);
    border-color: var(--border-strong);
}

[data-theme="dark"] .fDesign:hover {
    background: rgba(88, 101, 242, 0.12);
}


[data-theme="dark"] .preview-action-btn {
    color: var(--ink);
}

[data-theme="dark"] .preview-action-btn--primary {
    color: var(--remix-btn-fg);
}

/* ── Workspace drag cursors ── */

body.ws-col-resize,
body.ws-col-resize * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.ws-row-resize,
body.ws-row-resize * {
    cursor: row-resize !important;
    user-select: none !important;
}

/* ════════════════════════════════════════════════
   Loading state — "Love, Death & Robots" remix
   Toggle from edit.js:  doLoading(true) / doLoading(false)
   ════════════════════════════════════════════════ */

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 50% 38%, rgba(124, 58, 237, 0.12), transparent 62%),
        var(--input-bg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s var(--ease-out), visibility 0.35s;
    overflow: hidden;
}

.editor-storm-wrap,
.preview-storm-wrap,
.domains-dns-storm-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.85;
}

.preview-storm-wrap,
.domains-dns-storm-wrap {
    opacity: 0.65;
}

.editor-storm-wrap .st-status-storm,
.preview-storm-wrap .st-status-storm,
.domains-dns-storm-wrap .st-status-storm {
    position: absolute;
    inset: 0;
}

.editor-storm-wrap .st-status-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 55% at 50% 35%, rgba(124, 58, 237, 0.22), transparent 65%);
    animation: st-status-flash 4.2s ease-out infinite;
}

.preview-storm-wrap .st-status-flash,
.domains-dns-storm-wrap .st-status-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 55% at 50% 35%, rgba(124, 58, 237, 0.18), transparent 65%);
    animation: st-status-flash 4.2s ease-out infinite;
}

@keyframes st-status-flash {
    0%, 1% { opacity: 0; }
    4% { opacity: 0.85; }
    8% { opacity: 0.08; }
    11% { opacity: 0.65; }
    16% { opacity: 0; }
    100% { opacity: 0; }
}

.editor-storm-wrap .st-status-bolts,
.preview-storm-wrap .st-status-bolts,
.domains-dns-storm-wrap .st-status-bolts {
    position: absolute;
    inset: -40px 0;
    width: 100%;
    height: calc(100% + 80px);
}

.editor-storm-wrap .st-status-strike,
.preview-storm-wrap .st-status-strike,
.domains-dns-storm-wrap .st-status-strike {
    fill: none;
    stroke: #a855f7;
    stroke-width: 7;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
    opacity: 0;
    filter: drop-shadow(0 0 6px #c084fc) drop-shadow(0 0 16px #7c3aed) drop-shadow(0 0 34px #7c3aed);
    animation: st-status-strike-draw 4.2s ease-out var(--sd, 0s) infinite;
}

.editor-storm-wrap .st-status-strike--gold,
.preview-storm-wrap .st-status-strike--gold,
.domains-dns-storm-wrap .st-status-strike--gold {
    stroke: #ffcf33;
    filter: drop-shadow(0 0 6px #ffe234) drop-shadow(0 0 16px #f5a623);
}

@keyframes st-status-strike-draw {
    0%, 1% { stroke-dashoffset: 1600; opacity: 0; }
    5% { opacity: 1; }
    14% { stroke-dashoffset: 0; opacity: 1; }
    18% { opacity: 0.35; }
    22%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

.editor-storm-wrap .st-status-lb,
.preview-storm-wrap .st-status-lb,
.domains-dns-storm-wrap .st-status-lb {
    position: absolute;
    width: 72px;
    height: 72px;
    opacity: 0.2;
    animation: st-editor-lb-float 7s ease-in-out infinite;
}

.preview-storm-wrap .st-status-lb,
.domains-dns-storm-wrap .st-status-lb {
    width: 48px;
    height: 48px;
}

.editor-storm-wrap .st-status-lb svg,
.preview-storm-wrap .st-status-lb svg,
.domains-dns-storm-wrap .st-status-lb svg {
    width: 100%;
    height: 100%;
    fill: #7c3aed;
    filter: drop-shadow(0 0 8px #7c3aed);
}

.editor-storm-wrap .st-status-lb--gold svg,
.preview-storm-wrap .st-status-lb--gold svg,
.domains-dns-storm-wrap .st-status-lb--gold svg {
    fill: #f5a623;
    filter: drop-shadow(0 0 8px #f5a623);
}

.editor-storm-wrap .st-status-lb--1,
.preview-storm-wrap .st-status-lb--1,
.domains-dns-storm-wrap .st-status-lb--1 { left: 8%; top: 18%; --rot: -12deg; animation-delay: 0.2s; }
.editor-storm-wrap .st-status-lb--2,
.preview-storm-wrap .st-status-lb--2,
.domains-dns-storm-wrap .st-status-lb--2 { right: 10%; top: 22%; --rot: 18deg; animation-delay: 0.8s; }
.editor-storm-wrap .st-status-lb--3,
.preview-storm-wrap .st-status-lb--3,
.domains-dns-storm-wrap .st-status-lb--3 { left: 42%; bottom: 12%; --rot: 6deg; animation-delay: 1.4s; }

@keyframes st-editor-lb-float {
    0%, 100% { transform: rotate(var(--rot, 0deg)) translate(0, 0); }
    50% { transform: rotate(calc(var(--rot, 0deg) + 5deg)) translate(10px, -12px); }
}

.editor-storm-wrap .st-status-strike--1,
.preview-storm-wrap .st-status-strike--1,
.domains-dns-storm-wrap .st-status-strike--1 { --sd: 0.1s; }
.editor-storm-wrap .st-status-strike--2,
.preview-storm-wrap .st-status-strike--2,
.domains-dns-storm-wrap .st-status-strike--2 { --sd: 0.34s; }
.editor-storm-wrap .st-status-strike--3,
.preview-storm-wrap .st-status-strike--3,
.domains-dns-storm-wrap .st-status-strike--3 { --sd: 0.02s; stroke-width: 9; }
.editor-storm-wrap .st-status-strike--4,
.preview-storm-wrap .st-status-strike--4,
.domains-dns-storm-wrap .st-status-strike--4 { --sd: 0.55s; }
.editor-storm-wrap .st-status-strike--5,
.preview-storm-wrap .st-status-strike--5,
.domains-dns-storm-wrap .st-status-strike--5 { --sd: 0.42s; }

.st-glitch-line {
    display: block;
    line-height: 1.08;
    min-height: 1.08em;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
}

.preview-scribble.st-glitch-line {
    font-size: 16px;
}

.st-glitch-canvas {
    display: block;
    max-width: 100%;
    margin: 0 auto;
}

.st-glitch-line.is-fallback {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    color: inherit;
}

body.is-loading .loading-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.loader-stage {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 22px;
    padding: 24px;
    opacity: 0;
    transform: translateY(8px);
    animation: loader-in 0.5s var(--ease-out) 0.05s forwards;
}

@keyframes loader-in {
    to { opacity: 1; transform: translateY(0); }
}

/* ── Queue waiting state (normal machine cap) ── */

.loader-queue {
    position: relative;
    z-index: 2;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    width: min(420px, 100%);
    margin: 0 auto;
}

.loading-overlay.is-queue-mode .loader-stage,
.loading-overlay.is-idle-mode .loader-stage {
    display: none;
}

.loading-overlay.is-queue-mode .loader-queue {
    display: flex;
    animation: loader-in 0.5s var(--ease-out) 0.05s forwards;
}

.loader-idle {
    display: none;
    position: relative;
    z-index: 2;
    width: min(420px, calc(100% - 32px));
    margin: auto;
}

.loading-overlay.is-idle-mode .loader-idle {
    display: flex;
    animation: loader-in 0.5s var(--ease-out) 0.05s forwards;
}

.loading-overlay.is-idle-mode .loader-queue {
    display: none !important;
}

.loader-idle-card {
    width: 100%;
    padding: 28px 24px 24px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
    text-align: center;
}

[data-theme="dark"] .loader-idle-card {
    background: rgba(24, 24, 27, 0.92);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.loader-idle-label {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--purple);
}

.loader-idle-title {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink, #0f172a);
}

[data-theme="dark"] .loader-idle-title {
    color: #f4f4f5;
}

.loader-idle-sub {
    margin: 0 0 20px;
    font-size: 13.5px;
    line-height: 1.45;
    color: var(--ink-muted, #64748b);
}

.loader-idle-btn {
    width: 100%;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.loader-idle-btn:hover {
    background: var(--purple-deep);
    transform: translateY(-1px);
}

.loader-queue-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 32px 28px 28px;
    border: 1px solid rgba(124, 58, 237, 0.22);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.12);
    text-align: center;
}

[data-theme="dark"] .loader-queue-card {
    background: rgba(18, 18, 24, 0.82);
    border-color: rgba(168, 85, 247, 0.28);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.loader-queue-bolt {
    color: var(--purple, #7c3aed);
    filter: drop-shadow(0 0 12px rgba(124, 58, 237, 0.45));
    animation: queue-bolt-pulse 2.4s ease-in-out infinite;
}

@keyframes queue-bolt-pulse {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.08); opacity: 1; }
}

.loader-queue-label {
    margin: 4px 0 0;
    font-family: var(--font-mono, "IBM Plex Mono", ui-monospace, monospace);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--purple-deep, #5b21b6);
}

.loader-queue-position {
    margin: 0;
    font-family: var(--font-display, "Outfit", sans-serif);
    font-size: clamp(3rem, 10vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1;
    color: var(--ink, #1a1625);
}

[data-theme="dark"] .loader-queue-position {
    color: #f5f3ff;
}

.loader-queue-sub {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink-muted, #6b6578);
}

.loader-queue-meta {
    margin: 0;
    font-family: var(--font-mono, "IBM Plex Mono", ui-monospace, monospace);
    font-size: 11px;
    color: var(--ink-faint, #9b94a8);
}

.loader-queue-grace {
    margin: 8px 0 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(124, 58, 237, 0.08);
    font-size: 12px;
    line-height: 1.45;
    color: var(--ink-muted, #6b6578);
}

.loader-queue-grace strong {
    color: var(--purple-deep, #5b21b6);
}

/* ── LDR-style decoder emblem (Love · Death + Robots, remixed) ── */

.ldr-emblem {
    position: relative;
    display: grid;
    place-items: center;
    padding: 10px;
    filter: drop-shadow(0 0 24px rgba(124, 58, 237, 0.45));
    animation: ldr-emblem-flick 5s steps(1, end) infinite;
}

/* Rare whole-unit flicker, like a powering-on signal */
@keyframes ldr-emblem-flick {
    0%, 90%, 94%, 100% { opacity: 1; }
    91% { opacity: 0.35; }
    92% { opacity: 1; }
    93% { opacity: 0.6; }
}

/* Soft pulsing aura behind the glyph row */
.ldr-emblem-glow {
    position: absolute;
    inset: -12px;
    z-index: 0;
    border-radius: 24px;
    background: radial-gradient(60% 70% at 50% 50%, rgba(124, 58, 237, 0.28), transparent 70%);
    animation: ldr-aura 2.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes ldr-aura {
    0%, 100% { opacity: 0.5; transform: scale(0.96); }
    50%      { opacity: 0.9; transform: scale(1.04); }
}

.ldr-glyphs {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 14px;
    animation: ldr-shift 3.7s steps(1, end) infinite;
}

/* Occasional sideways VHS tracking slip */
@keyframes ldr-shift {
    0%, 70%, 100% { transform: translateX(0); }
    71% { transform: translateX(-3px); }
    72% { transform: translateX(2px); }
    73% { transform: translateX(0); }
}

.ldr-glyph {
    position: relative;
    width: 74px;
    height: 74px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.25)),
        #0c0a16;
    border: 1px solid rgba(124, 58, 237, 0.45);
    box-shadow:
        inset 0 0 18px rgba(124, 58, 237, 0.28),
        inset 0 0 2px rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

/* Glitching, decoding glyph with RGB chromatic split */
.ldr-glyph::before {
    content: "◆";
    position: relative;
    z-index: 1;
    font-family: var(--font-display), system-ui, sans-serif;
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow:
        2px 0 rgba(236, 72, 153, 0.9),
        -2px 0 rgba(0, 168, 252, 0.9);
}

/* Rolling scanlines per cell */
.ldr-glyph::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.32) 2px 3px);
    opacity: 0.45;
    animation: ldr-scanroll 0.8s linear infinite;
}

@keyframes ldr-scanroll {
    to { transform: translateY(3px); }
}

.g-build::before {
    animation:
        ldr-decode-build 2.6s steps(1, end) infinite,
        ldr-jitter 0.42s steps(2, end) infinite;
}

.g-boost::before {
    animation:
        ldr-decode-boost 2.6s steps(1, end) infinite 0.2s,
        ldr-jitter 0.5s steps(2, end) infinite;
}

.g-ship::before {
    animation:
        ldr-decode-ship 2.6s steps(1, end) infinite 0.4s,
        ldr-jitter 0.38s steps(2, end) infinite;
}

/* Each cell scrambles through symbols, then locks onto its final mark */
@keyframes ldr-decode-build {
    0%  { content: "◇"; }
    8%  { content: "⌁"; }
    16% { content: "⬡"; }
    24% { content: "✶"; }
    32% { content: "⟁"; }
    40% { content: "⚙"; }
    48%, 100% { content: "⚡"; }
}

@keyframes ldr-decode-boost {
    0%  { content: "△"; }
    8%  { content: "▚"; }
    16% { content: "✕"; }
    24% { content: "❖"; }
    32% { content: "⬢"; }
    40% { content: "✦"; }
    48%, 100% { content: "◆"; }
}

@keyframes ldr-decode-ship {
    0%  { content: "□"; }
    8%  { content: "≋"; }
    16% { content: "⌖"; }
    24% { content: "⬟"; }
    32% { content: "⊙"; }
    40% { content: "➤"; }
    48%, 100% { content: "◎"; }
}

/* Tiny positional + chroma jitter */
@keyframes ldr-jitter {
    0%   { transform: translate(0, 0); }
    50%  { transform: translate(0.6px, -0.6px); }
    100% { transform: translate(-0.6px, 0.6px); }
}

/* Vertical scan light sweeping across all three cells */
.ldr-emblem-sweep {
    position: absolute;
    z-index: 3;
    left: 6px;
    right: 6px;
    top: 6px;
    height: 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, transparent, rgba(0, 168, 252, 0.5), rgba(124, 58, 237, 0.4), transparent);
    mix-blend-mode: screen;
    pointer-events: none;
    animation: ldr-sweep-y 2.6s cubic-bezier(0.7, 0, 0.3, 1) infinite;
}

@keyframes ldr-sweep-y {
    0%   { transform: translateY(-14px); opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(74px); opacity: 0; }
}

/* ── Title + status ── */

.loader-copy {
    text-align: center;
}

.loader-title {
    position: relative;
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, var(--purple), var(--pink), var(--teal), var(--purple));
    background-size: 250% 100%;
    -webkit-background-clip: text;
            background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: loader-title-flow 6s linear infinite;
}

@keyframes loader-title-flow { to { background-position: 250% 0; } }

.loader-title::before,
.loader-title::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    background: none;
    -webkit-text-fill-color: initial;
    opacity: 0;
    pointer-events: none;
}

.loader-title::before {
    color: var(--teal);
    clip-path: inset(0 0 55% 0);
    animation: ldr-glitch-a 2.8s steps(2, end) infinite;
}

.loader-title::after {
    color: var(--pink);
    clip-path: inset(55% 0 0 0);
    animation: ldr-glitch-b 3.3s steps(2, end) infinite;
}

@keyframes ldr-glitch-a {
    0%, 92%, 100% { transform: translate(0, 0); opacity: 0; }
    93%           { transform: translate(-2px, -1px); opacity: 0.85; }
    96%           { transform: translate(2px, 1px);   opacity: 0.85; }
}

@keyframes ldr-glitch-b {
    0%, 90%, 100% { transform: translate(0, 0); opacity: 0; }
    91%           { transform: translate(2px, 1px);   opacity: 0.85; }
    95%           { transform: translate(-2px, -1px); opacity: 0.85; }
}

.loader-sub {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}

/* ── Indeterminate progress bar ── */

.ldr-bar {
    position: relative;
    width: min(340px, 70vw);
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(124, 58, 237, 0.12);
    overflow: hidden;
}

.ldr-bar-sweep {
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 38%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--purple), var(--pink), transparent);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.7);
    animation: ldr-sweep 1.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes ldr-sweep {
    0%   { left: -40%; }
    100% { left: 100%; }
}

/* ── Lightning-strike countdown (replaces stage checklist) ── */

.ldr-strike {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: min(340px, 70vw);
    margin-top: 2px;
}

.ldr-strike-bar {
    position: relative;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(124, 58, 237, 0.12);
    overflow: hidden;
}

.ldr-strike-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--purple), #a855f7);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.7);
}

.ldr-strike-label {
    margin: 4px 0 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--purple);
    white-space: nowrap;
}

.ldr-strike-count {
    margin: 0;
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    color: var(--purple);
    font-variant-numeric: tabular-nums;
}

.ldr-strike-late {
    margin: 2px 0 0;
    max-width: 260px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink-muted);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}

.ldr-strike.is-over .ldr-strike-count {
    display: none;
}

.ldr-strike.is-over .ldr-strike-bar {
    opacity: 0.45;
}

.ldr-strike.is-late .ldr-strike-late {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .ldr-strike-late {
        transition: none;
    }
}

/* ── Stage checklist ── */

/* ── Builder panel: language picker cards ── */

.builder_grid {
    display: grid;
    /* Responsive: fits 3 across when wide, drops to 2 (then 1 below),
       and stacks to a single column when the panel is narrow. */
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
    min-height: 0;
    padding: 4px 2px 8px;
}

.builder_btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 8px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    cursor: pointer;
    text-align: center;
    overflow: hidden;
    transition: transform var(--transition), border-color var(--transition),
        box-shadow var(--transition), background var(--transition);
}

.builder_btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 80% at 50% 0%, var(--lang-glow, transparent), transparent 70%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.builder_btn:hover {
    transform: translateY(-2px);
    border-color: var(--lang-color, var(--border-strong));
    box-shadow: 0 12px 30px -14px var(--lang-color, var(--purple-glow));
    background: var(--surface);
}

.builder_btn:hover::before { opacity: 0.55; }

.builder_btn:focus-visible {
    outline: none;
    border-color: var(--lang-color, var(--purple));
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.builder_btn.is-selected {
    border-color: var(--lang-color, var(--purple));
    background: var(--surface);
}

.builder_btn .lang-logo {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
}

.builder_name {
    position: relative;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
    line-height: 1;
}

.builder_state {
    position: relative;
    max-width: 100%;
    margin: 0;
    padding: 4px 9px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink-muted);
    font-family: var(--font-ui);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}

.builder_btn:hover .builder_state {
    color: var(--ink);
    border-color: var(--lang-color, var(--border-strong));
}

/* Per-language brand accents */
#builder_selectHTML { --lang-color: #e44d26; --lang-glow: rgba(228, 77, 38, 0.22); }
#builder_selectCSS  { --lang-color: #1572b6; --lang-glow: rgba(33, 169, 220, 0.22); }
#builder_selectJS   { --lang-color: #d9bf00; --lang-glow: rgba(247, 223, 30, 0.20); }

/* ── Build inspector (Framer-style) ── */

.build-inspector {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    font-family: var(--font-ui);
    font-size: 12px;
    color: var(--ink-muted);
    container-type: inline-size;
    container-name: build-inspector;
}

.build-inspector-head {
    display: none;
}

/* Reset global topnav `header` styles inside the build inspector */
#buildInspector header {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    width: auto;
    height: auto;
    z-index: auto;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    box-shadow: none;
    overflow: visible;
}

.build-inspector-back {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.build-inspector-back:hover {
    color: var(--ink);
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.build-meta-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 10px 4px;
}

.build-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.build-field-row--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

.build-field-row--stack .build-field-label {
    flex: none;
}

.build-input--full,
.build-select--full {
    width: 100%;
    flex: none;
}

/* Font picker — Google Fonts preview dropdown */
.build-font-picker {
    position: relative;
    width: 100%;
}

.build-font-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.build-font-picker-trigger:hover {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.build-font-picker-trigger[aria-expanded="true"] {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.build-font-picker-label {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.build-font-picker-chevron {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: var(--ink-faint);
    transition: transform var(--transition), color var(--transition);
}

.build-font-picker-trigger[aria-expanded="true"] .build-font-picker-chevron {
    transform: rotate(180deg);
    color: var(--purple);
}

.build-font-picker-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface-raised);
    box-shadow: var(--dropdown-shadow);
}

.build-font-picker-menu::-webkit-scrollbar {
    width: 6px;
}

.build-font-picker-menu::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.25);
    border-radius: var(--radius-pill);
}

.build-font-picker-option {
    display: block;
    width: 100%;
    min-height: 34px;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.build-font-picker-option:hover {
    background: var(--surface-sunken);
}

.build-font-picker-option.is-active {
    background: var(--purple-soft);
    color: var(--purple);
}

/* Large text content editor */
.build-textarea {
    width: 100%;
    min-height: 140px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 15px;
    font-weight: 400;
    line-height: 1.55;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.build-textarea:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.build-textarea::placeholder {
    color: var(--ink-faint);
}

/* DOM structure tools (Element section) */
.build-dom-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.build-dom-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

@container build-inspector (min-width: 300px) {
    .build-dom-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.build-dom-action {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink-muted);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}

@container build-inspector (min-width: 300px) {
    .build-dom-action {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        min-height: 52px;
        padding: 8px 6px;
    }
}

.build-dom-action:hover {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
    color: var(--ink);
}

.build-dom-action.is-active,
.build-dom-action:active {
    border-color: var(--purple);
    background: var(--purple-soft);
    color: var(--purple);
    transform: scale(0.98);
}

.build-dom-action-key {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--surface-sunken);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

.build-dom-action:hover .build-dom-action-key,
.build-dom-action.is-active .build-dom-action-key,
.build-dom-action:active .build-dom-action-key {
    background: rgba(147, 51, 234, 0.12);
}

.build-dom-action-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-align: left;
}

@container build-inspector (min-width: 300px) {
    .build-dom-action-label {
        font-size: 10px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        text-align: center;
    }
}

.build-dom-element {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    width: 100%;
}

.build-dom-element-label {
    font-size: 11px;
    color: var(--ink-muted);
}

.build-dom-element-field {
    position: relative;
    min-width: 0;
}

.build-dom-element-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.build-dom-element-trigger:hover {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
}

.build-dom-element-trigger[aria-expanded="true"] {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.build-dom-element-chevron {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    color: var(--ink-faint);
}

.build-dom-element-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 25;
    margin: 0;
    padding: 4px;
    list-style: none;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: var(--surface-raised);
    box-shadow: var(--dropdown-shadow);
}

.build-dom-element-option {
    display: block;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.build-dom-element-option:hover {
    background: var(--surface-sunken);
}

.build-dom-element-option.is-active {
    background: var(--purple-soft);
    color: var(--purple);
}

.build-field-suffix {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--ink-faint);
}

.build-pos-wrap.is-hidden {
    display: none;
}

.build-meta-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--ink);
}

.build-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.2;
}

.build-badge--unassigned {
    background: rgba(87, 219, 109, 0.15);
    color: #42ed4a;
    border: 1px solid rgba(0, 92, 31, 0.35);
}

[data-theme="dark"] .build-badge--unassigned {
    background: rgba(87, 219, 109, 0.15);
    color: #42ed4a;
    border-color: rgba(0, 92, 31, 0.35);
}

.build-section {
    padding: 10px 10px 12px;
    border-top: 1px solid var(--border);
}

.build-section--stub {
    padding-bottom: 8px;
}

.build-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
}

.build-subsection {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-sunken);
}

.build-group {
    margin-bottom: 2px;
}

.build-group[hidden] {
    display: none !important;
}

.build-group + .build-group {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.build-group-head {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.build-section-head + .build-group .build-group-head,
.build-meta-rows > .build-group:first-child .build-group-head {
    margin-top: 0;
}

.build-section > .build-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.build-meta-rows .build-group + .build-group {
    margin-top: 10px;
    padding-top: 10px;
}

.build-subsection-head {
    margin: 0 0 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.build-segment--compact .build-segment-btn {
    padding: 5px 6px;
    font-size: 10px;
}

.build-layout-pad {
    margin-bottom: 2px;
}

.build-layout-pad-grid {
    display: grid;
    grid-template-columns: 1fr 40px 1fr;
    grid-template-rows: auto 40px auto;
    gap: 4px;
    align-items: center;
}

.build-layout-pad-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.build-layout-pad-cell--t {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 2px);
}

.build-layout-pad-cell--l { grid-column: 1; grid-row: 2; }
.build-layout-pad-cell--r { grid-column: 3; grid-row: 2; }

.build-layout-pad-cell--b {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 2px);
}

.build-layout-pad-cell .build-input {
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 0 6px;
    text-align: center;
    font-size: 12px;
}

.build-layout-pad-key {
    flex-shrink: 0;
    width: 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    text-align: center;
}

.build-layout-pad-anchor {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.build-layout-pad-cross-v,
.build-layout-pad-cross-h {
    position: absolute;
    background: var(--purple);
    opacity: 0.4;
    border-radius: 1px;
}

.build-layout-pad-cross-v {
    top: 6px;
    bottom: 6px;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
}

.build-layout-pad-cross-h {
    left: 6px;
    right: 6px;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
}

#buildLayoutStack[hidden],
#buildLayoutGrid[hidden] {
    display: none !important;
}

.build-section-add {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ink-faint);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
}

.build-section-add:hover {
    color: var(--purple);
    background: var(--purple-soft);
}

.build-pos-wrap {
    margin-bottom: 8px;
}

.build-pos-grid {
    display: grid;
    grid-template-columns: 1fr 52px 1fr;
    grid-template-rows: auto 52px auto;
    gap: 4px;
    align-items: center;
}

.build-pos-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.build-pos-cell--t { grid-column: 1 / -1; justify-self: center; width: calc(50% - 2px); }
.build-pos-cell--l { grid-column: 1; grid-row: 2; }
.build-pos-cell--r { grid-column: 3; grid-row: 2; }
.build-pos-cell--b { grid-column: 1 / -1; justify-self: center; width: calc(50% - 2px); }

.build-pos-key {
    flex-shrink: 0;
    width: 12px;
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    text-align: center;
}

.build-pos-anchor {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.build-pos-cross-v,
.build-pos-cross-h {
    position: absolute;
    background: var(--purple);
    opacity: 0.55;
    border-radius: 1px;
}

.build-pos-cross-v {
    top: 8px;
    bottom: 8px;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
}

.build-pos-cross-h {
    left: 8px;
    right: 8px;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
}

.build-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    min-width: 0;
}

.build-field-row[hidden] {
    display: none !important;
}

.build-field-row:last-child {
    margin-bottom: 0;
}

.build-field-row--slider {
    flex-wrap: wrap;
}

.build-field-label {
    flex: 0 0 58px;
    font-size: 11px;
    color: var(--ink-muted);
}

.build-input {
    flex: 1;
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 11px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.build-input:focus {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 2px var(--purple-soft);
}

.build-input--num {
    flex: 0 0 52px;
    text-align: center;
}

.build-input--compact {
    flex: 0 0 40px;
}

.build-select {
    flex: 1;
    min-width: 0;
    height: 28px;
    padding: 0 24px 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 11px;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23949ba4' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.build-select--mode {
    flex: 0 0 62px;
}

.build-slider {
    flex: 1;
    min-width: 60px;
    height: 4px;
    margin: 0;
    accent-color: var(--purple);
    cursor: pointer;
}

.build-segment {
    display: flex;
    flex: 1;
    gap: 2px;
    padding: 2px;
    border-radius: 6px;
    background: var(--input-bg);
    border: 1px solid var(--border);
}

.build-segment-btn {
    flex: 1;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--ink-muted);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.build-segment-btn:hover {
    color: var(--ink);
}

.build-segment-btn.is-active {
    background: var(--purple-soft);
    color: var(--purple);
}

.build-segment--icons .build-segment-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.build-segment--icons .build-segment-btn svg {
    width: 14px;
    height: 14px;
}

.build-stepper {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.build-stepper-btn {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--ink-muted);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.build-stepper-btn:hover {
    color: var(--ink);
    border-color: var(--border-strong);
}

.ldr-stages {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 220px;
}

.ldr-stage {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-faint);
    transition: color 0.3s var(--ease-out);
}

.ldr-stage-dot {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--ink-faint);
    flex-shrink: 0;
    transition: border-color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}

.ldr-stage.is-active {
    color: var(--ink);
}

.ldr-stage.is-active .ldr-stage-dot {
    border-color: var(--purple);
    animation: ldr-dot-pulse 1.1s ease-in-out infinite;
}

@keyframes ldr-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.14); }
    50%      { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0.04); }
}

.ldr-stage.is-done {
    color: var(--ink-muted);
}

.ldr-stage.is-done .ldr-stage-dot {
    border-color: var(--teal);
    background: var(--teal);
}

.ldr-stage.is-done .ldr-stage-dot::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* ── Skeleton loading (files + preview) ── */

.skeleton-block {
    display: none;
}

@keyframes sk-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.sk-row,
.sk-block,
.sk-tile {
    display: block;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--sk-base) 25%, var(--sk-high) 50%, var(--sk-base) 75%);
    background-size: 200% 100%;
    animation: sk-shimmer 1.5s linear infinite;
}

#filesSkeleton {
    flex-direction: column;
    gap: 12px;
    padding: 14px 6px;
}

#filesSkeleton .sk-row { height: 14px; }
#filesSkeleton .sk-row:nth-child(2n) { animation-delay: 0.15s; }
#filesSkeleton .sk-row:nth-child(3n) { animation-delay: 0.3s; }

.sk-indent { margin-left: 22px; }

.sk-w38 { width: 38%; }
.sk-w40 { width: 40%; }
.sk-w45 { width: 45%; }
.sk-w50 { width: 50%; }
.sk-w55 { width: 55%; }
.sk-w58 { width: 58%; }
.sk-w60 { width: 60%; }
.sk-w64 { width: 64%; }
.sk-w65 { width: 65%; }
.sk-w68 { width: 68%; }
.sk-w70 { width: 70%; }
.sk-w72 { width: 72%; }
.sk-w75 { width: 75%; }
.sk-w78 { width: 78%; }
.sk-w80 { width: 80%; }
.sk-w82 { width: 82%; }
.sk-w85 { width: 85%; }
.sk-w90 { width: 90%; }
.sk-w95 { width: 95%; }

.sk-preview {
    flex: 1;
    min-height: 0;
    margin-top: 12px;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.sk-hero { height: 120px; border-radius: var(--radius-sm); }

.sk-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.sk-tile { height: 64px; }
.sk-preview .sk-row { height: 14px; }

body.is-view-only #fileEditorHolder {
    opacity: 1;
    pointer-events: auto;
}

body.is-view-only .CodeMirror {
    cursor: text;
}

body.is-view-only #build_editing_text {
    opacity: 0.72;
}

body.is-loading #FolderList { display: none; }
body.is-loading #filesSkeleton { display: flex; }
body.is-loading #fileEditorHolder { opacity: 0.5; pointer-events: none; }

body.is-loading #previewFramer { visibility: hidden; }
body.is-loading #previewLoadingOverlay.is-active { display: flex; }
body.is-loading #previewSkeleton { display: none !important; }

.preview-frame-wrap:has(#previewLoadingOverlay.is-active) #previewFramer {
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .editor-storm-wrap,
    .preview-storm-wrap,
    .domains-dns-storm-wrap {
        display: none;
    }

    .ldr-emblem,
    .ldr-emblem-glow,
    .ldr-glyphs,
    .ldr-glyph::after,
    .ldr-emblem-sweep,
    .ldr-bar-sweep,
    .loader-title,
    .ldr-stage.is-active .ldr-stage-dot,
    .sk-row, .sk-block, .sk-tile, .sk-avatar {
        animation-duration: 3.2s !important;
    }

    .ai-sk-setup-badge {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .ai-msg-dots span {
        animation: none;
        opacity: 0.55;
    }

    .ai-thought-cursor {
        animation: none;
        opacity: 0.5;
    }

    #terminal.terminal-setup-active {
        animation: none;
    }

    .notify-icon.is-spin svg {
        animation-duration: 2.4s;
    }

    .notify-progress::after {
        animation-duration: 3.6s;
    }

    /* Keep glyphs legible: lock to final marks, drop the jitter/scramble */
    .g-build::before { content: "⚡"; animation: none; }
    .g-boost::before { content: "◆"; animation: none; }
    .g-ship::before  { content: "◎"; animation: none; }

    .loader-title::before,
    .loader-title::after { animation: none; }
}

/* ── Responsive: tablet / phone ── */

/* Sidebar controls that only apply on mobile workspace layout */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    /* Fixed viewport split: top pane (preview / terminal) + bottom editor */
    body {
        overflow: hidden;
    }

    .main-wrapper {
        flex-direction: column;
        height: calc(100dvh - var(--header-h));
        min-height: 0;
        overflow: hidden;
        padding-top: var(--mobile-rail-h, 54px);
    }

    .main-wrapper.mobile-layout {
        --mobile-split-h: 10px;
    }

    /* Pin icon toolbar directly under the header (fixed, not in scroll flow) */
    aside {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        z-index: 70;
        width: 100%;
        height: var(--mobile-rail-h, 54px);
        flex: 0 0 var(--mobile-rail-h, 54px);
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 4px;
        padding: 6px 8px;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: var(--surface-glass);
        backdrop-filter: blur(12px);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        animation: none;
    }

    aside::-webkit-scrollbar { display: none; }

    .sideMenuIcon {
        flex: 0 0 auto;
        flex-direction: column;
        margin-top: 0;
        padding: 7px 12px;
        border-radius: var(--radius-md);
    }

    .sideMenuIcon span { font-size: 10px; }

    /* Side panels join the top resize stack (same split as preview / terminal) */
    #filesDragFrame { display: none; }

    .main-wrapper.mobile-layout:not(.side-collapsed) #fileEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #builderEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #domainsEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #portsEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #quickEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #githubEditor.is-open,
    .main-wrapper.mobile-layout:not(.side-collapsed) #aiEditor.is-open {
        order: 1;
        flex: 1 1 0;
        width: 100% !important;
        min-width: 0;
        min-height: 0;
        max-height: none;
        height: auto;
        padding: 12px;
        overflow-y: auto;
        border-bottom: none;
    }

    .main-wrapper.mobile-layout .gh-account,
    .main-wrapper.mobile-layout .gh-connect {
        flex-shrink: 0;
    }

    .main-wrapper.mobile-layout .gh-panel {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Flatten workspace so stage, preview, terminal, and split share main-wrapper flex */
    .main-wrapper.mobile-layout #workspace {
        display: contents;
    }

    .main-wrapper.mobile-layout #workspace > main {
        display: contents;
    }

    #previewDragFrame,
    #terminalDragFrame {
        display: none !important;
    }

    #mobileSplitFrame {
        display: none;
        order: 2;
        flex-shrink: 0;
        height: var(--mobile-split-h, 10px);
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
        cursor: row-resize;
        background: var(--surface-sunken);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }

    #mobileSplitFrame::before {
        top: -14px;
        bottom: -14px;
    }

    #mobileSplitFrame::after {
        content: "";
        position: absolute;
        left: 50%;
        top: 50%;
        width: 40px;
        height: 4px;
        border-radius: 999px;
        background: var(--ink-faint);
        opacity: 0.55;
        transform: translate(-50%, -50%);
        pointer-events: none;
    }

    .main-wrapper.mobile-layout #mobileSplitFrame {
        display: block;
    }

    #preview {
        order: 1;
        flex: 1 1 0;
        min-height: 0;
        width: 100% !important;
        height: auto !important;
        border-left: none;
        border-bottom: none;
        padding: 8px 10px;
    }

    #preview .preview-url-bar {
        flex-wrap: nowrap;
    }

    #previewButtons {
        flex-shrink: 0;
    }

    #workspace:not(.mobile-preview-open) #preview,
    #workspace.terminal-open #preview {
        display: none !important;
    }

    #terminal {
        order: 1;
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        height: auto !important;
    }

    #workspace:not(.terminal-open) #terminal {
        display: none !important;
    }

    #stage {
        order: 3;
        flex: 0 0 var(--mobile-stage-h, 50%);
        min-height: 0;
        height: auto !important;
        margin: 0 8px 8px;
        width: calc(100% - 16px);
    }

    .editor-chrome {
        order: 2;
        flex: 0 0 auto;
        padding: 8px 8px 6px;
    }

    .editor-file-row {
        flex-wrap: wrap;
    }

    .editor-file-actions {
        width: 100%;
    }

    .editor-action-btn {
        flex: 1 1 0;
    }

    .editor-chrome--scroll-collapsed .editor-file-actions {
        display: none;
    }

    .editor-chrome--scroll-collapsed .editor-file-input {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }

    .editor-chrome--scroll-collapsed {
        gap: 0;
        padding-bottom: 6px;
    }

    /* Header compaction */
    #leftHeader { flex: 1; min-width: 0; }
    #rightHeader { width: auto; gap: 4px; }

    .headerInput,
    .breadcrumb-path,
    .header-actions {
        display: none;
    }

    #rightHeader .btn-ghost,
    #settingsBtn {
        padding: 6px 8px;
        font-size: 12px;
    }

    .btn-remix {
        padding: 7px 10px;
        font-size: 12px;
        border-radius: 6px;
    }

    .btn-share-link {
        padding: 0;
        width: 32px;
        height: 32px;
        font-size: 12px;
        margin-right: 0;
        justify-content: center;
    }

    html.is-logged-in .btn-share-link {
        width: auto;
        padding: 0 10px;
    }

    html:not(.is-logged-in) .btn-share-link #shareLinkBtnLabel {
        display: none;
    }

    .btn-auth-login {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }

    #visibilityBtn {
        height: 32px;
        padding: 0 8px 0 8px;
        gap: 4px;
        font-size: 12px;
        margin-top: 0;
    }

    #visibilityBtn .mode-btn-icon {
        display: none;
    }

    #visibilityDropdown.mode-dropdown {
        min-width: min(260px, calc(100vw - 12px));
        left: auto;
        right: 0;
        transform-origin: top right;
    }

    /* Loading overlay can scroll if it ever runs short on height */
    .loading-overlay { overflow: auto; }

    .loader-stage {
        gap: 16px;
        padding: 18px;
    }
}

/* ── Responsive: small phones ── */

@media (max-width: 480px) {
    #stage {
        min-height: 120px;
    }

    .ldr-glyphs { gap: 10px; }

    .ldr-glyph {
        width: 58px;
        height: 58px;
        border-radius: 12px;
    }

    .ldr-glyph::before { font-size: 30px; }

    .loader-title { font-size: 18px; }

    .loader-sub { font-size: 12px; }

    .ldr-bar { width: min(280px, 82vw); }

    .ldr-strike { width: min(280px, 82vw); }
    .ldr-strike-count { font-size: 36px; }

    .settings-btn-label {
        display: none;
    }

    #settingsBtn {
        padding: 6px 8px;
        min-width: 32px;
        justify-content: center;
    }

    .btn-auth-login {
        padding: 6px 8px;
    }
}

/* ════════════════════════════════════════════════════════════
   Floating quick-edit toolbar (Canva-style editBox)
   ════════════════════════════════════════════════════════════ */

.edit-box-toolbar {
    position: fixed;
    z-index: 6000;
    display: inline-flex;
    align-items: flex-end;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--remix-btn-border);
    box-shadow:
        0 4px 6px rgba(26, 22, 37, 0.04),
        0 16px 40px rgba(26, 22, 37, 0.14);
    pointer-events: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.96);
    transform-origin: bottom center;
    transition:
        opacity 0.16s var(--ease-out),
        transform 0.16s var(--ease-out),
        visibility 0.16s;
}

.edit-box-toolbar.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.edit-box-toolbar[hidden] {
    display: none !important;
}

.ebt-kind {
    align-self: center;
    margin-right: 2px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--purple-soft);
    color: var(--purple-deep);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    white-space: nowrap;
}

.ebt-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0 2px;
}

.ebt-group-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ink-faint);
    line-height: 1;
    user-select: none;
}

.ebt-group-btns {
    display: flex;
    align-items: center;
    gap: 2px;
}

.ebt-sep {
    align-self: stretch;
    width: 1px;
    margin: 4px 3px;
    background: var(--border);
    flex-shrink: 0;
}

.ebt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.ebt-btn:hover {
    background: var(--surface-sunken);
    color: var(--purple);
}

.ebt-btn:active {
    transform: scale(0.94);
}

.ebt-btn.is-active {
    background: var(--purple-soft);
    color: var(--purple);
}

.ebt-btn--text strong {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}

.ebt-aa {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
}

.ebt-btn.is-danger {
    color: #ef4444;
}

.ebt-btn.is-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Layer arrows get a subtle tint so the two arrow groups read differently */
.ebt-group[data-group="layer"] .ebt-btn {
    color: var(--purple);
}

.ebt-group[data-group="layer"] .ebt-btn:hover {
    background: var(--purple-soft);
}

#build_ID {
    display: none;
}
#build_CLASS {
display: none;
}

@media (max-width: 680px) {
    .edit-box-toolbar {
        max-width: calc(100vw - 16px);
        overflow-x: auto;
        border-radius: var(--radius-lg);
    }
}


/* The main container for a remote user's dragging ghost */
.remote-drag-ghost {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none; /* Crucial: mouse passes through to drop targets */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.3));
    transition: transform 0.05s linear; /* Smooth micro-movements */
}

/* The username pill */
.ghost-user-badge {
    background: var(--remote-color, var(--purple));
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px 6px 6px 0;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: -1px;
    white-space: nowrap;
}

/* The file/folder box mimicking .fDesign */
.ghost-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-glass);
    backdrop-filter: blur(8px);
    border: 2px solid var(--remote-color, var(--purple));
    padding: 6px 12px 6px 8px;
    border-radius: 0 8px 8px 8px;
    min-width: 140px;
}

.ghost-icon-wrap {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.ghost-name-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
}

#foldersDrop.root-hover-drag {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.1), rgba(236, 72, 153, 0.05)) !important;
    outline: 2px dashed var(--purple);
    outline-offset: -4px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

/* ── AI chat panel (Cursor-style) ── */

#aiEditor {
    min-width: 280px;
    max-width: 420px;
    border-right: 1px solid var(--border);
}

.ai-chat {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    position: relative;
    background: var(--surface);
}

.ai-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--surface);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}

.ai-loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ai-skeleton-block {
    gap: 0;
}

.ai-sk-head {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px 12px;
    border-bottom: 1px solid var(--border);
}

.ai-sk-head .sk-row:first-child { height: 13px; }
.ai-sk-head .sk-row:last-child { height: 11px; }

.ai-sk-messages {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 10px;
    overflow: hidden;
    background: var(--input-bg);
}

.ai-sk-msg {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.ai-sk-msg--user {
    flex-direction: column;
}

.ai-sk-msg--user .ai-sk-bubble {
    max-width: 100%;
}

.ai-sk-bubble {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--remix-btn-border);
    background: var(--surface);
}

.ai-sk-bubble .sk-row { height: 12px; }
.ai-sk-bubble .sk-row:nth-child(2n) { animation-delay: 0.12s; }
.ai-sk-bubble .sk-row:nth-child(3n) { animation-delay: 0.24s; }

.ai-sk-compose {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ai-sk-compose > .sk-row {
    height: 11px;
    width: 38%;
}

.ai-sk-input-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.ai-sk-input {
    flex: 1 1 auto;
    height: 40px;
    border-radius: 6px;
}

.ai-sk-send {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 6px;
}

.ai-sk-setup {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ai-sk-setup-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-sk-setup-label {
    display: block;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--purple-deep);
    line-height: 1.2;
}

.ai-sk-setup-status {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-faint);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-chat--loading .ai-chat-head,
.ai-chat--loading .ai-chat-messages,
.ai-chat--loading .ai-chat-compose {
    visibility: hidden;
    pointer-events: none;
}

.ai-chat-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 10px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.ai-chat-title {
    display: block;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.ai-chat-sub {
    display: block;
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--ink-muted);
}

.ai-plan-open-btn {
    flex: 0 0 auto;
    height: 26px;
    padding: 0 10px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink-muted);
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
}

.ai-plan-open-btn:hover {
    color: var(--ink);
    border-color: var(--border-strong);
}

.ai-card {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    overflow: hidden;
}

.ai-card-head {
    padding: 10px 12px 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
}

.ai-card-steps {
    margin: 0;
    padding: 0 12px 10px 28px;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.ai-card-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.ai-card-label {
    flex: 0 0 72px;
    color: var(--ink-muted);
    font-weight: 700;
}

.ai-card-value {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--ink);
    font-family: var(--font-mono, ui-monospace, monospace);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-card-copy {
    flex: 0 0 auto;
    height: 24px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: var(--purple-soft);
    color: var(--purple-deep);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.ai-card-notes {
    margin: 0;
    padding: 8px 12px 10px;
    font-size: 11.5px;
    color: var(--ink-muted);
}

.ai-card-actions {
    display: flex;
    gap: 8px;
    padding: 0 12px 12px;
}

.ai-card-cta {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--purple);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    border: 0;
    cursor: pointer;
}

.ai-card-cta--ghost {
    background: transparent;
    color: var(--purple-deep);
    border: 1px solid var(--border);
}

.ai-card-question {
    margin: 0;
    padding: 10px 12px 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink);
}

.ai-card-waiting {
    margin: 0;
    padding: 8px 12px 0;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ink-muted);
}

.ai-card-prompts {
    flex-wrap: wrap;
    padding-top: 4px;
}

.ai-card--ask .ai-card-prompts .ai-card-cta {
    min-width: 112px;
    justify-content: center;
}

.ai-msg[data-ai-answered="1"] .ai-card-waiting {
    display: none;
}

.ai-msg[data-ai-answered="1"] .ai-card-prompts button {
    opacity: 0.55;
    pointer-events: none;
}

.ai-plan-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-plan-modal[hidden] {
    display: none;
}

.ai-plan-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 12, 0.45);
}

.ai-plan-dialog {
    position: relative;
    width: min(440px, calc(100vw - 32px));
    max-height: min(72vh, 560px);
    overflow: auto;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    padding: 16px;
}

.ai-plan-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-plan-title-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
    outline: none;
}

.ai-plan-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-muted);
    font-size: 20px;
    cursor: pointer;
}

.ai-plan-steps {
    margin: 0 0 12px;
    padding-left: 22px;
}

.ai-plan-steps li {
    margin: 0 0 8px;
}

.ai-plan-steps input {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    padding: 4px 0;
    outline: none;
}

.ai-plan-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.ai-plan-add,
.ai-plan-use {
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

.ai-plan-add {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--ink-muted);
}

.ai-plan-use {
    border: 0;
    background: var(--purple);
    color: #fff;
}

.ai-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--input-bg);
}

.ai-msg {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    max-width: 100%;
}

.ai-msg--user {
    flex-direction: column;
}

.ai-msg-bubble {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ai-msg--user .ai-msg-bubble {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    color: var(--ink);
}

.ai-msg-bubble--status {
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    box-shadow: none;
}

.ai-msg-bubble--thought {
    background: var(--input-bg);
    border: 1px solid var(--border);
    box-shadow: none;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
}

.ai-thought-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.ai-thought-toggle .ai-msg-status-label {
    margin-bottom: 0;
}

.ai-thought-chevron {
    flex: 0 0 auto;
    color: var(--ink-faint);
    transition: transform 0.2s var(--ease-out);
}

.ai-msg--thought-done .ai-thought-chevron {
    transform: rotate(-90deg);
}

.ai-msg--thought-done .ai-msg-status-label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.ai-thought-body {
    max-height: 220px;
    overflow-y: auto;
    padding: 0 12px 12px;
    border-top: 1px solid var(--border);
}

.ai-thought-body.is-collapsed {
    display: none;
}

.ai-msg--thought-done .ai-thought-body:not(.is-collapsed) {
    max-height: 120px;
}

.ai-thought-text {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: var(--ink-faint);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-thought-cursor {
    display: inline-block;
    width: 2px;
    height: 13px;
    margin-left: 1px;
    vertical-align: text-bottom;
    background: var(--ink-faint);
    opacity: 0.75;
    animation: ai-thought-cursor 1s step-end infinite;
}

@keyframes ai-thought-cursor {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.85; }
}

.ai-msg-status-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.ai-msg-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 2px;
}

.ai-msg-dots span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--ink-faint);
    opacity: 0.35;
    animation: ai-msg-dot 1.2s ease-in-out infinite;
}

.ai-msg-dots span:nth-child(2) { animation-delay: 0.15s; }
.ai-msg-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-msg-dot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.ai-msg-status-text {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    font-style: italic;
    color: var(--ink-faint);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-msg--assistant:not(.ai-msg--status):not(.ai-msg--thought) .ai-msg-bubble {
    padding: 2px 2px 4px;
    background: transparent;
    border: 0;
}

.ai-msg--assistant:not(.ai-msg--status):not(.ai-msg--thought) .ai-msg-bubble p {
    color: var(--ink);
}

.ai-chat--streaming .ai-chat-send {
    opacity: 0.55;
    cursor: wait;
}

.ai-msg-bubble p {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--ink);
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-chat-compose {
    flex: 0 0 auto;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* Unified composer box */
.ai-composer {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 8px 8px;
    border-radius: 12px;
    border: 1px solid var(--remix-btn-border);
    background: var(--input-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ai-composer:focus-within {
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.ai-chat-input {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    max-height: min(40vh, 280px);
    resize: none;
    overflow-y: auto;
    padding: 4px 6px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 13.5px;
    line-height: 1.5;
    outline: none;
    transition: height 0.12s ease;
}

.ai-chat-input::placeholder {
    color: var(--ink-faint);
}

.ai-composer-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-model-menu {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 55%;
}

.ai-chat-model-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ai-model-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink-muted);
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.ai-model-btn:hover:not(:disabled) {
    background: var(--surface-sunken);
    border-color: var(--border-strong);
    color: var(--ink);
}

.ai-model-btn:focus-visible {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.ai-model-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ai-model-btn[aria-expanded="true"] {
    border-color: var(--border-strong);
    background: var(--surface-sunken);
    color: var(--ink);
}

.ai-model-btn[aria-expanded="true"] .ai-model-chevron {
    transform: rotate(180deg);
}

#aiModelBtnLabel {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-model-chevron {
    flex: 0 0 auto;
    opacity: 0.65;
    transition: transform var(--transition);
}

.ai-model-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    max-width: min(320px, calc(100vw - 48px));
    max-height: min(280px, 40vh);
    overflow-y: auto;
    padding: 6px;
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--dropdown-shadow);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px) scale(0.98);
    transform-origin: bottom left;
    transition: opacity 0.18s var(--ease-out), transform 0.18s var(--ease-out), visibility 0.18s;
}

.ai-model-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ai-model-option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
    transition: background var(--transition);
}

.ai-model-option:hover {
    background: var(--surface-sunken);
}

.ai-model-option.is-active {
    background: var(--purple-soft);
}

.ai-model-option-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-model-check {
    flex: 0 0 auto;
    opacity: 0;
    color: var(--purple);
    transition: opacity var(--transition);
}

.ai-model-option.is-active .ai-model-check {
    opacity: 1;
}

/* Credits chip */
.ai-chat-credits {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--purple-soft);
    color: var(--purple-deep);
    font-family: var(--font-ui);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: default;
    user-select: none;
}

.ai-chat-credits svg {
    flex: 0 0 auto;
}

.ai-chat-credits.is-low {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.ai-chat-credits {
    text-decoration: none;
}

.ai-chat-attach {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
}

.ai-chat-attach:hover {
    background: var(--surface-hover, rgba(124, 58, 237, 0.08));
    color: var(--ink);
}

.ai-attach-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 4px 0;
}

.ai-attach-chip {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.ai-attach-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-attach-chip button {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    cursor: pointer;
}

.ai-chat-gate {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.ai-chat-gate[hidden] {
    display: none;
}

.ai-chat-gate-card {
    max-width: 280px;
    text-align: center;
}

.ai-chat-gate-title {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
}

.ai-chat-gate-text {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ink-muted);
}

.ai-chat-gate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 9px;
    background: var(--purple);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.ai-chat--gated .ai-chat-messages,
.ai-chat--gated .ai-chat-compose {
    display: none;
}

.ai-chat-send {
    flex: 0 0 auto;
    margin-left: auto;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 0;
    background: var(--purple);
    color: #fff;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
}

.ai-chat-send:hover {
    background: var(--purple-deep);
}

.ai-chat-send:active {
    transform: scale(0.94);
}

.ai-chat-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


.ai-line-highlight {
    background-color: rgba(0, 255, 120, 0.3) !important; /* Brighter Green */
    border-left: 4px solid #00ff80 !important;        /* Solid left bar */
    display: block;
    position: relative;
    z-index: 5;
}

/* If you are using a dark theme, sometimes the text needs to stay bright */
.ai-line-highlight .cm-text {
    color: #ffffff !important;
}



#github_not_logged_message,
#github_public_notice,
.gh-notice-banner {
        align-items: center;
    gap: 8px;
    padding: 7px 16px;
    border-radius: 6px;
    background: #ffe234;
    border: 1px solid rgba(26, 22, 0, 0.14);
    font-family: var(--st-font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #1a1600;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
    margin-bottom: 10px;
}

#github_public_notice span,
#github_not_logged_message span {
    display: block;
}

.publish-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.publish-form textarea,
.publish-form select {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    resize: vertical;
    min-height: 72px;
}

.publish-form select {
    min-height: auto;
    cursor: pointer;
}

.publish-form textarea:focus,
.publish-form select:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.publish-price-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.publish-price-row select {
    flex: 0 0 120px;
}

.publish-price-row input {
    flex: 1;
}

.publish-field-hint {
    margin: 0;
    font-size: 11px;
    color: var(--ink-muted);
    line-height: 1.4;
}

.publish-field-error {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: #b42318;
}

.stripe-sell-prompt {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(124, 58, 237, 0.28);
    background: var(--purple-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stripe-sell-prompt[hidden] {
    display: none !important;
}

.stripe-sell-prompt-copy {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--purple-deep);
}

.stripe-sell-prompt-btn {
    align-self: flex-start;
    height: 32px;
    padding: 0 14px;
    border-radius: 999px;
    border: none;
    background: var(--purple);
    color: #fff;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
}

.stripe-sell-prompt-btn:hover:not(:disabled) {
    background: var(--purple-deep);
}

.stripe-sell-prompt-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

/* Stripe connect popup (paid listing) */
.stripe-connect-overlay {
    position: fixed;
    inset: 0;
    z-index: 7000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.stripe-connect-overlay[hidden] {
    display: none !important;
}

body.stripe-connect-open {
    overflow: hidden;
}

.stripe-connect-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 34, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.stripe-connect-dialog {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 24px;
    border-radius: 18px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    background: var(--surface-raised);
    box-shadow: 0 28px 80px rgba(20, 16, 34, 0.22);
}

.stripe-connect-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(20, 16, 34, 0.06);
    color: var(--ink-muted);
    cursor: pointer;
}

.stripe-connect-title {
    margin: 0 28px 0 0;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.stripe-connect-modal-copy {
    margin: 10px 0 0;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--ink-muted);
}

.stripe-connect-modal-error {
    margin: 10px 0 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: #b91c1c;
}

.stripe-connect-modal-error[hidden] {
    display: none;
}

.stripe-connect-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.stripe-connect-dismiss {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink-muted);
    cursor: pointer;
}

.stripe-connect-dismiss:hover {
    color: var(--ink);
}

.stripe-connect-wallet-link {
    display: inline-block;
    margin-top: 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--purple);
    text-decoration: none;
}

.stripe-connect-wallet-link:hover {
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════════
   Modals — marketing-site look (grid lines + lightning corners)
   Shared shell for every editor modal.
   ══════════════════════════════════════════════════════════════ */

.st-modal {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: none;
}

.st-modal.is-open {
    display: block;
}

.st-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 16, 34, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s var(--ease-out);
}

.st-modal.is-open .st-modal-backdrop {
    opacity: 1;
}

.st-modal-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -46%) scale(0.98);
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    background: var(--surface-raised);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: 0 40px 100px rgba(20, 16, 34, 0.32);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.2s var(--ease-out), transform 0.24s var(--ease-out);
}

.st-modal-card--wide {
    width: min(940px, calc(100vw - 32px));
}

/* Blueprint frame — thin accent lines down the sides + across top/bottom,
   echoing the marketing site's outline. The lightning bolts sit on its
   corners. */
.st-modal-card::before {
    content: "";
    position: absolute;
    inset: 14px;
    border: 1px solid rgba(124, 58, 237, 0.16);
    border-radius: 13px;
    pointer-events: none;
    z-index: 1;
}

.st-modal.is-open .st-modal-card {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* striqr_instruct shell — card is flex-centered, not absolutely positioned */
.si-main-panel .si-modal-card {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    opacity: 1;
    max-height: calc(100vh - 48px);
}

.st-modal.is-open .si-main-panel .si-modal-card {
    opacity: 1;
    transform: none;
}

.si-shell.is-docker-picker-open .si-main-panel .si-modal-card {
    transform: translateX(-2%) scale(0.985);
    opacity: 0.72;
    filter: blur(1px);
}

/* Faint grid backdrop, masked so it fades toward the edges */
.st-modal-grid {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    pointer-events: none;
    opacity: 0.6;
    background-image:
        linear-gradient(to right, rgba(124, 58, 237, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(124, 58, 237, 0.08) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 30%, #000 20%, transparent 78%);
    mask-image: radial-gradient(ellipse 85% 70% at 50% 30%, #000 20%, transparent 78%);
}

.st-modal-bolt {
    position: absolute;
    width: 26px;
    height: 26px;
    color: var(--purple);
    filter: drop-shadow(0 2px 7px rgba(124, 58, 237, 0.45));
    pointer-events: none;
    z-index: 3;
}

.st-modal-bolt svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Corners sit exactly on the blueprint frame (inset 14px).
   All bolts keep the same upright orientation (matching the marketing site);
   only their position changes so they never look flipped/upside-down. */
.st-modal-bolt--tl { left: 14px; top: 14px; transform: translate(-50%, -50%); }
.st-modal-bolt--tr { right: 14px; top: 14px; transform: translate(50%, -50%); }
.st-modal-bolt--bl { left: 14px; bottom: 14px; transform: translate(-50%, 50%); }
.st-modal-bolt--br { right: 14px; bottom: 14px; transform: translate(50%, 50%); }

/* Smaller lightning accents halfway down each side line. */
.st-modal-bolt--ml,
.st-modal-bolt--mr {
    top: 50%;
    width: 16px;
    height: 16px;
    color: rgba(124, 58, 237, 0.5);
    filter: drop-shadow(0 1px 4px rgba(124, 58, 237, 0.3));
}

.st-modal-bolt--ml { left: 14px; transform: translate(-50%, -50%); }
.st-modal-bolt--mr { right: 14px; transform: translate(50%, -50%); }

.st-modal-head {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
}

.st-modal-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.st-modal-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--ink-muted);
}

.st-modal-close {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--ink-muted);
    background: transparent;
    transition: background var(--transition), color var(--transition);
}

.st-modal-close:hover {
    background: var(--purple-soft);
    color: var(--ink);
}

.st-modal-body {
    position: relative;
    z-index: 2;
    padding: 4px 24px 8px;
    overflow: auto;
}

.st-modal-foot {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border);
}

/* ── Theme modal internals ── */

.tm-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

/* Whole-editor preview mock — a self-contained mini editor. All the mock
   elements reference the same CSS variable names the real editor uses, but
   those variables are set ONLY on #tmPreview, so nothing leaks to the page. */
.tm-preview {
    position: sticky;
    top: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--surface);
    font-size: 12px;
}

.tm-pv-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface-glass);
    border-bottom: 1px solid var(--border);
}

.tm-pv-logo {
    display: inline-flex;
    color: var(--purple);
}

.tm-pv-name {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
}

.tm-pv-grow { flex: 1; }

.tm-pv-btn {
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--remix-btn-bg);
    color: var(--remix-btn-fg);
    border: 1px solid var(--remix-btn-border);
    font-size: 10.5px;
    font-weight: 600;
}

.tm-pv-btn--accent {
    background: var(--purple);
    color: #fff;
    border-color: var(--purple);
}

.tm-pv-main {
    display: grid;
    grid-template-columns: 48px 118px 1fr;
    min-height: 244px;
    background: var(--stage-bg);
}

.tm-pv-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--surface-glass);
    border-right: 1px solid var(--border);
}

.tm-pv-rail-item {
    width: 100%;
    padding: 6px 2px;
    border-radius: 6px;
    text-align: center;
    font-size: 9px;
    color: var(--ink-muted);
}

.tm-pv-rail-item.is-active {
    color: var(--purple);
    background: var(--purple-soft);
}

.tm-pv-files {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.tm-pv-btn--block {
    width: 100%;
    margin-bottom: 4px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-strong);
}

.tm-pv-file {
    padding: 3px 6px;
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--ink-muted);
}

.tm-pv-file.is-active {
    color: var(--ink);
    background: var(--surface-sunken);
}

.tm-editor {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);

    --tm-bg: #ffffff;
    --tm-gutter: #faf9fc;
    --tm-line: #9b94a8;
    --tm-line-size: 12px;
    --tm-text: #1a1625;
    --tm-text-size: 13px;
    --tm-font: var(--font-mono);
    --tm-kw: #7c3aed;
    --tm-str: #0b8043;
    --tm-cm: #9b94a8;
    --tm-fn: #1a56db;
    --tm-num: #b45309;
    --tm-op: #6b6578;

    background: var(--tm-bg);
}

/* Inside the preview the code pane is flush (no floating card look) */
.tm-preview .tm-editor {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.tm-editor-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: var(--tm-gutter);
    border-bottom: 1px solid rgba(128, 128, 128, 0.16);
}

.tm-editor-dots {
    display: inline-flex;
    gap: 5px;
}

.tm-editor-dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.tm-editor-dots i:nth-child(1) { background: #ff6b6b; }
.tm-editor-dots i:nth-child(2) { background: #ffd93d; }
.tm-editor-dots i:nth-child(3) { background: #6bcb77; }

.tm-editor-bar em {
    font-family: var(--tm-font);
    font-size: 11px;
    font-style: normal;
    color: var(--tm-line);
}

.tm-editor-body {
    display: grid;
    grid-template-columns: 44px 1fr;
    min-height: 260px;
}

.tm-gutter {
    padding: 14px 0;
    text-align: right;
    background: var(--tm-gutter);
    color: var(--tm-line);
    font-family: var(--tm-font);
    font-size: var(--tm-line-size);
    line-height: 1.7;
    user-select: none;
}

.tm-gutter span {
    display: block;
    padding-right: 10px;
}

.tm-code {
    margin: 0;
    padding: 14px 16px;
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: var(--tm-font);
    font-size: var(--tm-text-size);
    line-height: 1.7;
    white-space: pre;
    overflow-x: auto;
}

.tm-code .tk-kw { color: var(--tm-kw); }
.tm-code .tk-str { color: var(--tm-str); }
.tm-code .tk-cm { color: var(--tm-cm); font-style: italic; }
.tm-code .tk-fn { color: var(--tm-fn); }
.tm-code .tk-num { color: var(--tm-num); }
.tm-code .tk-op { color: var(--tm-op); }

.tm-parts {
    max-height: 62vh;
    overflow-y: auto;
    padding-right: 4px;
}

.tm-group-title {
    margin: 14px 0 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.tm-group-title:first-child {
    margin-top: 0;
}

.tm-parts-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Size sliders + font select */
.tm-ctrl {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.tm-ctrl:hover {
    background: var(--surface-sunken);
}

.tm-ctrl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tm-ctrl-val {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
}

.tm-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    cursor: pointer;
}

.tm-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--purple);
    border: 2px solid #fff;
    box-shadow: var(--shadow-xs);
}

.tm-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--purple);
    border: 2px solid #fff;
}

.tm-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 13px;
    cursor: pointer;
}

.tm-part {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border-radius: var(--radius-sm);
    text-align: left;
    transition: background var(--transition);
}

.tm-part:hover {
    background: var(--surface-sunken);
}

.tm-part-swatch {
    position: relative;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    border: 1px solid var(--border-strong);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
    overflow: hidden;
    cursor: pointer;
}

.tm-part-swatch input[type="color"] {
    position: absolute;
    inset: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.tm-part-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tm-part-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink);
}

.tm-part-hex {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-faint);
    text-transform: uppercase;
}

.tm-note {
    font-size: 12px;
    color: var(--ink-muted);
}

.tm-foot-actions {
    display: inline-flex;
    gap: 8px;
}

.tm-btn {
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.tm-btn--ghost {
    color: var(--ink-muted);
    border: 1px solid var(--border-strong);
    background: transparent;
}

.tm-btn--ghost:hover {
    color: var(--ink);
    background: var(--surface-sunken);
}

.tm-btn--primary {
    color: #fff;
    background: var(--purple);
    border: 1px solid var(--purple);
}

.tm-btn--primary:hover {
    background: var(--purple-deep);
    border-color: var(--purple-deep);
}

.tm-btn--primary.is-saved {
    background: #16a34a;
    border-color: #16a34a;
}

@media (max-width: 720px) {
    .tm-layout {
        grid-template-columns: 1fr;
    }
    .st-modal-foot {
        flex-direction: column;
        align-items: stretch;
    }
    .tm-foot-actions {
        justify-content: flex-end;
    }
}

/* ─────────────────────────────────────────────
   Header "Log in" button (only shown to guests)
   ───────────────────────────────────────────── */
.btn-auth-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--purple);
    border: 1px solid var(--purple);
    box-shadow: 0 1px 2px rgba(124, 58, 237, 0.25);
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn-auth-login:hover {
    background: var(--purple-deep);
    border-color: var(--purple-deep);
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.32);
    transform: translateY(-1px);
}

.btn-auth-login svg { flex-shrink: 0; }

/* ── Project visibility menu (header, project owner) ── */
#visibilityMenu {
    position: relative;
    display: none;
    align-items: center;
}

#visibilityMenu .visibility-btn {
    margin-top: 0;
}

.visibility-hint {
    left: 0;
    right: auto;
    z-index: 2010;
    max-width: min(320px, calc(100vw - 24px));
}

.visibility-hint::before {
    left: 22px;
    right: auto;
}

/* ─────────────────────────────────────────────
   Auth modal (login / sign up)
   ───────────────────────────────────────────── */
.st-modal-card--auth {
    width: min(440px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.am-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.am-oauth {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.am-oauth:hover {
    border-color: var(--purple);
    background: var(--purple-soft);
    transform: translateY(-1px);
}

.am-oauth + .am-oauth {
    margin-top: 8px;
}

.am-oauth svg { width: 18px; height: 18px; flex-shrink: 0; }

.am-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 2px 0;
}

.am-divider::before,
.am-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.am-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* The [hidden] attribute must win over the flex display above. */
.am-form[hidden] {
    display: none;
}

.am-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.am-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-muted);
}

.am-field input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--input-bg);
    color: var(--ink);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.am-field input:focus {
    outline: none;
    border-color: var(--purple);
    box-shadow: 0 0 0 3px var(--purple-soft);
}

.am-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 11px 14px;
    margin-top: 2px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--purple);
    background: var(--purple);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.am-submit:hover {
    background: var(--purple-deep);
    border-color: var(--purple-deep);
    transform: translateY(-1px);
}

.am-submit:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.am-status {
    margin: 0;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.am-status.is-error {
    color: #b42318;
    background: rgba(217, 45, 32, 0.08);
    border: 1px solid rgba(217, 45, 32, 0.2);
}

.am-status.is-success {
    color: #067647;
    background: rgba(6, 118, 71, 0.08);
    border: 1px solid rgba(6, 118, 71, 0.2);
}

.am-foot {
    justify-content: center;
    gap: 8px;
}

.am-switch-label {
    color: var(--ink-muted);
    font-size: 13px;
}

.am-switch-btn {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--purple);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.am-switch-btn:hover {
    background: var(--purple-soft);
    border-color: var(--purple);
}


/* ── Notification stack (notify_error / notify_warning / notify_success / notify_info) ── */

.notify-stack {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 16px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.notify-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 16px;
    border-radius: 10px;
    background: #ffe234;
    border: 1px solid rgba(26, 22, 0, 0.2);
    box-shadow: 0 12px 34px rgba(26, 22, 37, 0.22);
    font-family: var(--font-ui);
    color: #1a1600;
    pointer-events: auto;
    overflow: hidden;
    animation: notify-in 0.22s var(--ease-out);
}

.notify-card.is-leaving {
    animation: notify-out 0.2s var(--ease-out) forwards;
}

.notify-card.is-pulse {
    animation: notify-pulse 0.4s var(--ease-out);
}

.notify-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(26, 22, 0, 0.12);
}

.notify-icon svg {
    width: 17px;
    height: 17px;
    display: block;
}

.notify-icon.is-spin svg {
    animation: notify-spin 0.9s linear infinite;
}

.notify-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
    padding-top: 1px;
}

.notify-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.7;
}

.notify-message {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.notify-hint {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0.72;
}

/* Countdown to auto-dismiss: drains left to right, pauses while hovered. */
.notify-timer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    overflow: hidden;
    background: rgba(26, 22, 0, 0.14);
}

.notify-timer-fill {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(1);
    transform-origin: left center;
    background: currentColor;
    opacity: 0.72;
    will-change: transform;
}

/* Indeterminate sweep — the work has no measurable progress, just a heartbeat. */
.notify-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    overflow: hidden;
    background: rgba(26, 22, 0, 0.22);
}

.notify-progress::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 38%;
    border-radius: 4px;
    background: linear-gradient(90deg, transparent, rgba(26, 22, 0, 0.9), transparent);
    animation: notify-progress-sweep 1.5s ease-in-out infinite;
}

.notify-close {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 6px;
    background: rgba(26, 22, 0, 0.1);
    color: inherit;
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition);
}

.notify-close:hover {
    background: rgba(26, 22, 0, 0.22);
}

/* Docked variant: setup notice lives inside the terminal panel */
.terminal-notify {
    display: none;
    flex-shrink: 0;
    padding: 10px;
    background: linear-gradient(180deg, rgba(255, 226, 52, 0.1), rgba(255, 226, 52, 0));
    border-bottom: 1px solid rgba(255, 226, 52, 0.22);
}

.terminal-notify:has(.notify-card) {
    display: block;
}

.terminal-notify .notify-card {
    width: 100%;
    padding: 12px 14px;
    gap: 13px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffe95c 0%, #ffe234 45%, #f7cf1f 100%);
    border-color: rgba(26, 22, 0, 0.28);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.45);
    animation: notify-in-down 0.22s var(--ease-out);
}

.terminal-notify .notify-card.is-leaving {
    animation: notify-out-up 0.2s var(--ease-out) forwards;
}

/* Ties the banner to the terminal output it's describing. */
.terminal-notify .notify-label {
    font-family: var(--font-mono);
    opacity: 0.78;
}

.terminal-notify .notify-icon {
    width: 30px;
    height: 30px;
    background: rgba(26, 22, 0, 0.16);
}

.terminal-notify .notify-icon svg {
    width: 19px;
    height: 19px;
}

.notify-card--error {
    background: #ffd5d5;
    border-color: rgba(120, 20, 20, 0.18);
    color: #5c1111;
}

.notify-card--error .notify-close {
    background: rgba(92, 17, 17, 0.1);
}

.notify-card--error .notify-close:hover {
    background: rgba(92, 17, 17, 0.2);
}

.notify-card--success {
    background: #ccf5dd;
    border-color: rgba(11, 84, 48, 0.18);
    color: #0b5430;
}

.notify-card--success .notify-close {
    background: rgba(11, 84, 48, 0.1);
}

.notify-card--success .notify-close:hover {
    background: rgba(11, 84, 48, 0.2);
}

.notify-card--info {
    background: var(--surface-raised);
    border-color: var(--border-strong);
    color: var(--ink);
}

.notify-card--info .notify-close {
    background: var(--purple-soft);
}

@keyframes notify-in {
    from {
        opacity: 0;
        transform: translateX(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes notify-in-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes notify-out {
    to {
        opacity: 0;
        transform: translateX(16px) scale(0.98);
    }
}

@keyframes notify-out-up {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes notify-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes notify-progress-sweep {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(360%);
    }
}

@keyframes notify-timer-drain {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@keyframes notify-pulse {
    50% {
        transform: scale(1.03);
    }
}

@media (max-width: 640px) {
    .notify-stack {
        right: 12px;
        left: 12px;
        width: auto;
    }
}