/* Shared workbench geometry and frosted glass surfaces. */
:root {
    --workspace-width: clamp(340px, 36vw, 520px);
    --shell-inset: 16px;
    --shell-gap: 14px;
    --panel-radius: 22px;
    --glass-panel: rgba(22, 23, 25, .48);
    --glass-chrome: rgba(64, 64, 66, .42);
    --glass-edge: rgba(255, 246, 232, .13);
    --glass-sheen: linear-gradient(128deg, #ffffff24 0%, #ffffff09 26%, #ffffff00 46%, #ffab5f0d 100%);
    --panel-shadow: 0 28px 65px #0006, 0 8px 18px #0004, inset 0 2px 6px #ffffff24, inset 2px 0 8px #ffffff08, inset 0 -2px 8px #ffbe7512;
    --control-shadow: 0 7px 12px #0005, inset 0 2px 5px #ffffff29, inset 0 -2px 5px #0002;
    --reply-surface: rgba(29, 30, 32, .73);
    --ambient-warm: #db854322; --ambient-pearl: #e5e7ee28;
}
html[data-theme="light"] {
    --glass-panel: rgba(255, 255, 255, .32);
    --glass-chrome: rgba(255, 255, 255, .48);
    --glass-edge: rgba(255, 255, 255, .46);
    --glass-sheen: linear-gradient(128deg, #ffffffbf 0%, #ffffff45 25%, #ffffff05 52%, #fff8ed38 100%);
    --panel-shadow: 0 28px 60px #46372924, 0 7px 16px #46372912, inset 0 2px 6px #ffffffb3, inset 2px 0 8px #ffffff70, inset 0 -2px 8px #ffffff66;
    --control-shadow: 0 7px 12px #65503a20, inset 0 2px 5px #ffffffb3, inset 0 -2px 5px #8a796412;
    --reply-surface: rgba(255, 255, 255, .64);
    --ambient-warm: #eeb48326; --ambient-pearl: #ffffffa6;
}
body.workspace-app {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    isolation: isolate;
    background: linear-gradient(145deg, var(--ambient-pearl), transparent 65%),
                linear-gradient(325deg, var(--ambient-warm), transparent 70%), var(--bg);
}
#topbar {
    position: fixed; top: calc(12px + var(--viewport-top, 0px)); left: var(--shell-inset); right: var(--shell-inset);
    height: 54px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between;
    background: var(--glass-sheen), var(--glass-chrome); border: 1px solid var(--glass-edge); border-radius: 18px;
    backdrop-filter: blur(32px) saturate(135%); -webkit-backdrop-filter: blur(32px) saturate(135%);
    box-shadow: var(--control-shadow), 0 12px 30px #00000012; z-index: 20;
}
.platform-wordmark { font-size: 15px; font-weight: 700; letter-spacing: -.5px; margin-right: 12px; white-space: nowrap; }
.platform-wordmark > span { font-size: 8px; font-weight: 600; letter-spacing: 1px; color: var(--text-muted); margin-left: 5px; vertical-align: middle; }
#project-btn { border-radius: 10px; width: 34px; height: 34px; padding: 8px; }
.pinned-project-chip { border-radius: 10px; min-height: 30px; padding-inline: 12px; }
.pinned-project-chip.active { box-shadow: inset 0 1px 0 #ffffff12; }
.topbar-avatar { border-radius: 50%; width: 28px; height: 28px; border: 2px solid var(--glass-edge); }
#workbench {
    position: fixed; top: calc(80px + var(--viewport-top, 0px)); left: var(--shell-inset); right: var(--shell-inset);
    height: calc(var(--app-height, 100dvh) - 96px - env(safe-area-inset-bottom, 0px));
    display: none; grid-template-columns: var(--workspace-width) minmax(0, 1fr); gap: var(--shell-gap);
    min-height: 0; isolation: isolate;
}
body.logged-in #workbench { display: grid; }
#workspace-column, #preview-panel {
    min-width: 0; min-height: 0; overflow: hidden; border-radius: var(--panel-radius);
    border: 1px solid var(--glass-edge); background: var(--glass-sheen), var(--glass-panel); box-shadow: var(--panel-shadow);
    backdrop-filter: blur(32px) saturate(130%); -webkit-backdrop-filter: blur(32px) saturate(130%);
}
#workspace-column { position: relative; display: flex; flex-direction: column; }
#workspace-view { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
#sidebar { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 100%; overflow: hidden; background: transparent; }
#sidebar[data-mode="prompt"] { --sidebar-accent: var(--accent); --sidebar-border: var(--border); }
.pane-heading {
    min-height: 78px; height: 78px; flex-shrink: 0; padding: 18px 22px; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); background: transparent;
}
.pane-heading h1 { font-size: 18px; font-weight: 650; color: var(--text); letter-spacing: -.5px; line-height: 1.3; }
.pane-heading p { margin-top: 4px; font-size: 11px; color: var(--text-muted); font-weight: 400; }
#editor-toolbar { display: flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 12px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); }
#editor-toolbar[hidden] { display: none; }
#chat-messages { padding: 22px; }
#chat-messages > .system-msg:only-child { margin: 24px 0; text-align: center; color: var(--text-muted); line-height: 1.8; }
#chat-messages > .chat-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; margin: 0; padding: 24px 12px clamp(24px, 10vh, 90px); text-align: center; }
.chat-empty h2 { color: var(--text); font-size: 21px; line-height: 1.5; font-weight: 550; letter-spacing: -.4px; }
.chat-empty p { margin-top: 12px; color: var(--text-muted); font-size: 13px; line-height: 1.9; }

#chat-input-area { padding: 12px 16px 16px; border-top: 0; background: transparent; }
#chat-input-row { align-items: flex-end; gap: 8px; padding: 8px 10px; background: var(--glass-sheen), var(--glass-chrome); border: 1px solid var(--glass-edge); border-radius: 26px; box-shadow: var(--control-shadow), 0 10px 28px #00000015; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
#chat-input-row:focus-within { border-color: var(--accent-border); box-shadow: var(--control-shadow), 0 0 0 3px var(--accent-soft), 0 0 22px var(--accent-soft); }
#chat-input { background: transparent; border: 0; border-radius: 0; position: relative; min-width: 0; padding: 6px 2px; min-height: 36px; max-height: 200px; box-shadow: none; font-size: 16px; line-height: 24px; overflow-wrap: anywhere; }
#chat-input:focus { border: 0; box-shadow: none; outline: none; }
#image-upload-btn { border: 0; background: transparent; margin: 0; width: 36px; height: 36px; border-radius: 50%; }
#chat-send, #chat-stop { display: flex; align-items: center; justify-content: center; border-radius: 50%; margin: 0; padding: 0; width: 36px; height: 36px; box-shadow: none; }
#chat-input:empty::before { position: absolute; top: 6px; left: 2px; right: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#preview-panel { position: relative; display: flex; flex-direction: column; }
#preview-status { min-width: 0; max-width: 100%; overflow-wrap: anywhere; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
#preview-status::before { content: ''; flex-shrink: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint); }
#preview-status[data-state="ready"]::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 10%, transparent); }
.preview-actions button, .preview-actions a, #preview-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 7px 10px; font-size: 11px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.preview-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.preview-actions button, .preview-actions a { display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 7px 8px; }
.preview-actions svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preview-actions :is(button, a):hover { background: var(--hover); }
#preview-toggle { display: none; }
#source-export-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 7px 10px; font-size: 11px; white-space: nowrap; cursor: pointer; }
#source-export-btn[hidden] { display: none; }
#source-export-btn:disabled { opacity: .55; cursor: wait; }
@media (max-width: 600px) {
    #source-export-btn { padding: 8px; }
    #source-export-btn span { display: none; }
}
#preview-device-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; flex-shrink: 0; }
#preview-device-switch { display: flex; flex-shrink: 0; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; }
#preview-device-switch button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 5px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text-muted); font-size: 11px; cursor: pointer; }
#preview-device-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 2px 5px #00000008; }
#preview-device-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#preview-device-size { margin-right: auto; font-size: 10px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
#preview-stage { flex: 1; min-height: 0; min-width: 0; position: relative; overflow: hidden; margin: 0 14px; border: 1px solid var(--border); border-radius: 15px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--surface-sunken) 40%, transparent); box-shadow: inset 0 1px 12px #00000004; }
#preview-device { position: relative; flex: none; overflow: hidden; background: white; }
#preview-panel[data-preview-device="phone"] #preview-device { border-radius: 16px; box-shadow: 0 0 0 1px var(--border-strong), 0 10px 30px #0002; }
#preview-frame { position: absolute; top: 0; left: 0; border: 0; background: white; transform-origin: top left; }
#preview-device[hidden], #preview-frame[hidden], #preview-empty[hidden], #preview-open[hidden] { display: none; }
#preview-empty { margin: auto; max-width: 360px; padding: 32px; text-align: center; line-height: 1.8; color: var(--text-muted); font-size: 13px; }
#preview-help { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 10px 16px; font-size: 10px; color: var(--text-faint); text-align: center; }
.pane-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; }
.pane-empty-icon { display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.pane-empty-icon svg { width: 30px; height: 30px; }
.pane-empty h2 { font-size: 20px; font-weight: 600; letter-spacing: -.5px; }
.pane-empty p { font-size: 13px; line-height: 1.9; color: var(--text-muted); margin-top: 10px; }
.modal { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.workspace-app .modal-content { background: var(--glass-panel); border: 1px solid var(--glass-edge); border-radius: 26px; box-shadow: 0 24px 90px #0003, inset 0 1px 0 #ffffff15; backdrop-filter: blur(40px) saturate(150%); -webkit-backdrop-filter: blur(40px) saturate(150%); }
.settings-modal-content { padding: 26px; }
.settings-modal-header { padding-bottom: 20px; }
.settings-modal-header h3 { font-size: 20px; letter-spacing: -.5px; }
.settings-system-section { margin-top: 22px; }
#research-consent-dialog { margin: auto; width: min(580px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--glass-edge); border-radius: 24px; background: var(--glass-panel); color: var(--text); box-shadow: 0 24px 90px #0005; backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px); }
#research-consent-dialog[open] { display: flex; flex-direction: column; }
#research-consent-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.research-consent-header { flex-shrink: 0; padding: 26px 28px 16px; border-bottom: 1px solid var(--border); }
.research-consent-eyebrow { color: var(--accent); font-size: 12px; margin-bottom: 8px; }
#research-consent-title { font-size: 24px; line-height: 1.4; }
#research-consent-title:focus { outline: none; }
#research-consent-status { margin-top: 8px; font-size: 13px; color: var(--text-muted); }
.research-consent-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 28px; font-size: 14px; line-height: 1.8; }
.research-consent-body h3 { margin: 18px 0 6px; font-size: 14px; color: var(--text); }
.research-consent-body p { color: var(--text-muted); }
.research-consent-body p + p { margin-top: 8px; }
.research-consent-footer { flex-shrink: 0; padding: 18px 28px 22px; border-top: 1px solid var(--border); }
.research-consent-check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.65; cursor: pointer; }
#research-consent-checkbox { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
#research-consent-error { font-size: 13px; color: var(--danger); }
#research-consent-error:not(:empty) { margin-top: 10px; }
.research-consent-actions { display: flex; gap: 10px; margin-top: 18px; }
.research-consent-actions button { flex: 1; min-height: 44px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface); color: var(--text); font-size: 14px; cursor: pointer; }
#research-consent-agree { background: var(--action-bg); color: var(--action-ink); border-color: transparent; }
.research-consent-actions button:disabled { opacity: .45; cursor: not-allowed; }
.research-consent-remember { margin-top: 12px; font-size: 12px; text-align: center; color: var(--text-faint); }
.workspace-app :is(button, a, input, [contenteditable]):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
body.embedded-preview #workbench { grid-template-columns: minmax(0, 1fr); }
body.embedded-preview #preview-panel, body.embedded-preview #preview-toggle { display: none !important; }
@media (max-width: 1100px) {
    #preview-device-size { display: none; }
}
@media (max-width: 768px) {
    #research-consent-dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 20px; }
    .research-consent-header { padding: 20px 20px 14px; }
    .research-consent-body { padding: 16px 20px; }
    .research-consent-footer { padding: 14px 20px 18px; }
    .research-consent-actions button { font-size: 16px; }
    #research-consent-checkbox { font-size: 16px; }
    :root { --shell-inset: 8px; --panel-radius: 18px; --shell-gap: 0px; }
    #topbar { top: calc(8px + var(--viewport-top, 0px)); height: 48px; padding: 0 10px; border-radius: 15px; }
    .platform-wordmark { font-size: 13px; margin-right: 4px; }
    .platform-wordmark > span { display: none; }
    #project-btn { width: 30px; height: 30px; }
    #workbench { top: calc(64px + var(--viewport-top, 0px)); height: calc(var(--app-height, 100dvh) - 72px - env(safe-area-inset-bottom, 0px)); grid-template-columns: minmax(0, 1fr); }
    #preview-panel { display: none; }
    #preview-toggle { display: block; padding: 6px 8px; }
    #preview-panel { position: absolute; inset: 0; z-index: 5; }
    body.logged-in.show-preview #preview-panel { position: relative; display: flex; }
    body.show-preview #workspace-view { visibility: hidden; }
    .pane-heading { height: 72px; min-height: 72px; padding: 16px 18px; }
    #chat-messages { padding: 18px 16px; }
    #chat-input-area { padding: 8px 12px 12px; }
    #chat-input { font-size: 16px; min-height: 36px; max-height: min(200px, 35dvh); }
    #preview-device-toolbar { padding: 10px 12px; gap: 8px; }
    #preview-device-switch button { min-height: 34px; padding: 5px 10px; }
    #preview-stage { margin-inline: 8px; }
    #preview-help { padding: 8px; }
    .pane-empty { padding: 20px; }
}
@media (max-width: 370px) {
    .platform-wordmark { display: none; }
    #preview-device-switch button { gap: 4px; padding-inline: 5px; }
}
@media (prefers-reduced-motion: reduce) { .workspace-app * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Conversation attachments */
.attachment-file { display: flex; flex-direction: column; justify-content: center; gap: 5px; width: 180px; min-height: 64px; padding: 12px 28px 12px 12px; border: 0; border-radius: 12px; background: var(--surface); color: var(--text); }
.attachment-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.attachment-file small { color: var(--text-muted); font-size: 11px; }
.bubble-images a { text-decoration: none; max-width: 100%; }
.img-preview-thumb .bubble-img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
#sidebar.attachment-dragover #chat-input-area { outline: 2px dashed var(--accent); outline-offset: -4px; }
#image-upload-btn:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }

/* Warm highlights and quiet translucent cards. */
.platform-wordmark > span { color: var(--accent); }
.agent-card { background: var(--reply-surface); border: 0; border-radius: 18px; box-shadow: 0 8px 22px #0000000d; }
.agent-card-status { background: transparent; border-bottom: 0; }
.agent-card, #chat-input-row { position: relative; }
.agent-card::after {
    position: absolute; inset: 0; border-radius: inherit; padding: 1.5px;
    pointer-events: none; z-index: 1;
}
#chat-input-row::after {
    position: absolute; bottom: -1px; left: 17%; right: 17%; height: 16px;
    border-radius: 50%; pointer-events: none;
}
.chat-msg.user .bubble { background: var(--surface); border: 0; color: var(--text); border-radius: 18px 18px 5px 18px; box-shadow: none; }
#chat-send, #login-confirm, .input-dialog-ok { background: var(--action-bg); color: var(--action-ink); border-color: transparent; }
#chat-send:hover, #login-confirm:hover, .input-dialog-ok:hover { background: var(--action-hover); }
.pinned-project-chip.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.settings-theme-control button.active { box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow-sm); }
#context-menu { background: var(--glass-chrome); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px); }
@supports not (backdrop-filter: blur(1px)) {
    :root { --glass-panel: #24221f; --glass-chrome: #302d29; }
    html[data-theme="light"] { --glass-panel: #faf8f4; --glass-chrome: #fffdfa; }
}

#settings-skills-section[hidden] { display: none; }
.settings-skill-graph { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 14px; border: 1px solid var(--glass-edge); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm); }
.settings-skill-graph:hover { background: var(--hover-strong); border-color: var(--accent-border); }

/* Raised glass controls and a recessed preview stage. */
#project-btn, .pinned-project-chip, #preview-device-switch button[aria-pressed="true"],
.preview-actions button, .settings-skill-graph, .settings-theme-control button.active {
    background-image: linear-gradient(150deg, #ffffff16, #ffffff00 65%);
    box-shadow: var(--control-shadow);
}
#chat-send { box-shadow: 0 6px 12px #00000040, 0 0 16px var(--accent-soft), inset 0 2px 4px #ffffff59, inset 0 -2px 4px #0000001a; }
#preview-stage { box-shadow: inset 0 3px 14px #00000012, 0 1px 0 #ffffff14; }
#preview-device-switch { box-shadow: inset 0 2px 5px #00000018, 0 1px 0 #ffffff18; }
.platform-wordmark > span { text-shadow: 0 0 14px var(--accent-border); }
forme-orb { filter: drop-shadow(0 0 5px var(--accent-border)); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    #chat-send, #project-btn, .preview-actions button, .settings-skill-graph { transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease; }
    #chat-send:hover, #project-btn:hover, .preview-actions button:hover, .settings-skill-graph:hover { transform: translateY(-1px); }
    #chat-send:active, #project-btn:active, .preview-actions button:active, .settings-skill-graph:active { transform: translateY(1px); }
}

.settings-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#settings-reset-tests { color: var(--text); }
#settings-reset-tests:disabled { opacity: .55; cursor: wait; }
#settings-reset-result { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }

/* Top-level navigation and project directories share the workbench bounds. */
#primary-nav { display: flex; gap: 4px; flex-shrink: 0; }
#primary-nav button { min-height: 36px; padding: 7px 18px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text-muted); font: inherit; cursor: pointer; }
#primary-nav button[aria-current="page"] { color: var(--text); background: var(--surface); border-color: var(--glass-edge); box-shadow: var(--control-shadow); }
#current-project-name { min-width: 0; max-width: 320px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-muted); font-size: 12px; margin-left: 10px; padding: 7px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; cursor: pointer; }
#current-project-name:disabled { cursor: default; opacity: 1; }
#current-project-name.needs-profile { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); animation: profile-invite 2s ease-in-out infinite; }
@keyframes profile-invite { 50% { box-shadow: 0 0 0 4px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { #current-project-name.needs-profile { animation: none; } }
#project-btn[hidden], #current-project-name[hidden] { display: none; }
#project-profile-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto; padding: 28px; border: 1px solid var(--glass-edge); border-radius: 20px; color: var(--text); background: var(--surface); box-shadow: var(--panel-shadow); }
#project-profile-dialog::backdrop { background: #0006; backdrop-filter: blur(4px); }
#project-profile-form { display: flex; flex-direction: column; gap: 12px; }
#project-profile-form h2 { font-size: 20px; }
#project-profile-form p { color: var(--text-muted); font-size: 13px; line-height: 1.7; }
#project-profile-form label { font-size: 13px; margin-top: 4px; }
#project-profile-form input, #project-profile-form textarea { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
#project-profile-form textarea { resize: vertical; }
#project-profile-form #project-profile-error { color: #c34b43; }
#project-profile-error:empty { display: none; }
.project-profile-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.project-profile-actions button { font: inherit; padding: 9px 18px; border-radius: 9px; border: 1px solid var(--border); color: var(--text); background: var(--surface-2); cursor: pointer; }
.project-profile-actions #project-profile-save { color: var(--action-ink); background: var(--action-bg); }
body.logged-in[data-page="directory"] #workbench { display: none; }
body[data-page="directory"] #preview-toggle { display: none; }
#project-directory { position: fixed; top: calc(80px + var(--viewport-top, 0px)); left: var(--shell-inset); right: var(--shell-inset); height: calc(var(--app-height, 100dvh) - 96px - env(safe-area-inset-bottom, 0px)); overflow-y: auto; padding: clamp(24px, 4vw, 60px); border: 1px solid var(--glass-edge); border-radius: var(--panel-radius); background: var(--glass-sheen), var(--glass-panel); box-shadow: var(--panel-shadow); }
#project-directory[hidden] { display: none; }
.directory-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 32px; }
#directory-eyebrow { color: var(--accent); font-size: 10px; letter-spacing: 2px; font-weight: 600; margin-bottom: 12px; }
#directory-title { font-size: clamp(26px, 3vw, 36px); font-weight: 600; letter-spacing: -1px; }
#directory-description { margin-top: 12px; font-size: 14px; color: var(--text-muted); line-height: 1.8; }
#directory-count { white-space: nowrap; color: var(--text-muted); font-size: 12px; padding-bottom: 4px; }
#directory-status { color: var(--text-muted); line-height: 1.8; }
#directory-status:empty { display: none; }
#directory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; }
.directory-card { display: flex; flex-direction: column; text-align: left; gap: 14px; padding: 16px; min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--glass-edge); border-radius: 18px; cursor: pointer; font: inherit; box-shadow: var(--shadow-sm); }
.directory-card:hover { border-color: var(--accent-border); background: var(--hover); }
.directory-card-cover { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 8 / 5; overflow: hidden; border-radius: 11px; background: linear-gradient(135deg, var(--accent-soft), var(--glass-chrome)); }
.directory-card-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.directory-cover-placeholder { color: var(--text-muted); font-size: 12px; letter-spacing: .5px; text-align: center; }
.directory-cover-placeholder::before { content: ''; display: block; width: 60px; height: 42px; margin: 0 auto 12px; border: 1px solid var(--accent-border); border-radius: 7px; background: linear-gradient(155deg, transparent 45%, var(--accent-soft) 45% 65%, transparent 65%), var(--glass-sheen); box-shadow: var(--shadow-sm); }
.directory-cover-placeholder[hidden] { display: none; }
.directory-card:nth-child(3n+2) .directory-card-cover { background: linear-gradient(145deg, var(--glass-chrome), var(--surface-2)); }
.directory-card:nth-child(3n) .directory-card-cover { background: linear-gradient(35deg, var(--surface-2), var(--accent-soft)); }
.directory-card strong { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.directory-card-copy { display: flex; flex-direction: column; gap: 7px; }
.directory-card-description { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; max-height: 3.4em; color: var(--text-muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.directory-card-author { color: var(--text-muted); font-size: 11px; overflow-wrap: anywhere; margin-top: auto; }
.directory-card-cover[data-device="phone"] img { object-fit: contain; object-position: center; }
#directory-retry { margin: 16px 0; padding: 10px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
#directory-create { margin: 0 0 22px; padding: 10px 18px; border: 1px solid var(--accent-border); border-radius: 10px; background: var(--accent-soft); color: var(--accent); font: inherit; cursor: pointer; }
#directory-create[hidden] { display: none; }
#directory-create:disabled { opacity: .5; cursor: wait; }
body.readonly-project #image-upload-btn { opacity: .4; pointer-events: none; }
#settings-col-apps[hidden] { display: none; }
.settings-body { flex-direction: column; overflow-y: auto; gap: 24px; }
.settings-body .settings-col { width: 100%; flex: none; padding: 0; max-height: none; overflow: visible; }
@media (max-width: 768px) {
    #primary-nav button { min-height: 34px; padding: 6px 12px; }
    #topbar-left { gap: 5px; }
    #current-project-name { display: block; flex: 1; max-width: 180px; margin-left: 0; padding: 7px 5px; }
    body[data-page="project"] .platform-wordmark { display: none; }
    body[data-page="project"] #topbar-left { flex: 1; min-width: 0; }
    #project-directory { top: calc(64px + var(--viewport-top, 0px)); height: calc(var(--app-height, 100dvh) - 72px - env(safe-area-inset-bottom, 0px)); padding: 24px 18px; }
    .directory-heading { margin-bottom: 24px; gap: 10px; }
    #directory-count { display: none; }
    #directory-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
    .settings-body .settings-col.active { display: block; }
    #settings-col-apps[hidden] { display: none; }
    body.logged-in.show-preview #workspace-column { display: none; }
}

/* Community gallery. Keep the creation workbench's geometry independent. */
body[data-page="directory"][data-directory="home"] { --gallery-bg: #171716; background: var(--gallery-bg); }
html[data-theme="light"] body[data-page="directory"][data-directory="home"] { --gallery-bg: #faf9f6; }
body[data-page="directory"][data-directory="home"] #topbar {
    top: var(--viewport-top, 0px); left: 0; right: 0; height: 76px; padding: 0 clamp(24px, 4vw, 64px);
    border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--gallery-bg); box-shadow: none; backdrop-filter: none;
}
body[data-page="directory"][data-directory="home"] .platform-wordmark { font-size: 25px; letter-spacing: -1.2px; margin-right: 30px; }
body[data-page="directory"][data-directory="home"] .platform-wordmark > span { display: none; }
body[data-page="directory"][data-directory="home"] #primary-nav button { font-size: 14px; border-radius: 0; min-height: 76px; padding-inline: 16px; }
body[data-page="directory"][data-directory="home"] #primary-nav button[aria-current="page"] { background: transparent; border-color: transparent; box-shadow: inset 0 -2px var(--text); }
body[data-page="directory"][data-directory="home"] #project-directory {
    top: calc(76px + var(--viewport-top, 0px)); left: 0; right: 0;
    height: calc(var(--app-height, 100dvh) - 76px - env(safe-area-inset-bottom, 0px));
    padding: 0 max(4vw, calc((100vw - 1600px) / 2)) 28px; border: 0; border-radius: 0; background: var(--gallery-bg); box-shadow: none;
    scrollbar-gutter: stable;
}
[data-directory="home"] .directory-heading { min-height: 156px; margin: 0; padding: 30px 0 28px; align-items: center; gap: 32px; }
[data-directory="home"] #directory-eyebrow { font-size: 9px; letter-spacing: 2px; margin-bottom: 10px; }
[data-directory="home"] #directory-title { font-size: clamp(25px, 2.4vw, 34px); font-weight: 650; line-height: 1.35; letter-spacing: -1px; text-wrap: balance; }
[data-directory="home"] #directory-title > span { display: inline-block; }
[data-directory="home"] #directory-description { margin-top: 10px; font-size: 13px; line-height: 1.9; }
#directory-start { display: inline-flex; align-items: center; justify-content: space-between; gap: 28px; flex-shrink: 0; padding: 14px 20px; border-radius: 30px; color: var(--action-ink); background: var(--action-bg); font-size: 13px; text-decoration: none; }
#directory-start span { font-size: 22px; line-height: 1; }
#directory-start:hover { background: var(--action-hover); }
#directory-start[hidden], #directory-explore[hidden], #directory-clear[hidden], #directory-footer[hidden] { display: none; }
.directory-explore-heading { display: flex; align-items: center; gap: 14px; padding-top: 0; border-top: 0; }
.directory-explore-heading h2 { font-size: 18px; font-weight: 600; }
.directory-explore-heading h2 span { margin-left: 10px; font-size: 10px; letter-spacing: 1.5px; font-weight: 400; color: var(--text-faint); }
[data-directory="home"] #directory-count { display: inline-block; margin-left: auto; padding: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.directory-tools { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 0 26px; }
#directory-filters { display: flex; gap: 6px; flex-shrink: 0; }
#directory-filters button { min-height: 40px; padding: 9px 17px; border: 1px solid transparent; border-radius: 24px; background: transparent; color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
#directory-filters button:hover { color: var(--text); background: var(--hover-strong); }
#directory-filters button[aria-pressed="true"] { color: var(--text); background: var(--hover-strong); border-color: var(--border); font-weight: 600; }
.directory-search-sort { display: flex; align-items: center; gap: 12px; min-width: 0; }
.directory-search { display: flex; align-items: center; gap: 8px; width: clamp(180px, 21vw, 290px); min-height: 42px; padding: 0 13px; border: 1px solid var(--border); border-radius: 24px; color: var(--text-faint); }
.directory-search svg { flex-shrink: 0; }
#directory-search { width: 100%; min-width: 0; height: 40px; padding: 0; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13px; outline: none; }
#directory-search::placeholder { color: var(--text-faint); }
.directory-search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
#directory-sort { max-width: 125px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--gallery-bg); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
[data-directory="home"] #directory-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 34px 24px; }
[data-directory="home"] .directory-card { position: relative; padding: 0; gap: 0; border: 0; border-radius: 14px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); overflow: hidden; }
[data-directory="home"] .directory-card-cover { border-radius: 12px 12px 0 0; background: var(--surface-sunken); }
[data-directory="home"] .directory-card:nth-child(3n+2) .directory-card-cover { background: color-mix(in srgb, #9db6aa 14%, var(--gallery-bg)); }
[data-directory="home"] .directory-card:nth-child(3n) .directory-card-cover { background: color-mix(in srgb, #b0a8c2 14%, var(--gallery-bg)); }
[data-directory="home"] .directory-card-cover[data-device="phone"] img { inset: 12px 0; height: calc(100% - 24px); object-fit: contain; filter: drop-shadow(0 3px 5px #0002); }
[data-directory="home"] .directory-card-copy { width: 100%; padding: 16px 16px 0; gap: 6px; }
[data-directory="home"] .directory-card strong { font-size: 15px; font-weight: 650; line-height: 1.5; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
[data-directory="home"] .directory-card-description { -webkit-line-clamp: 1; font-size: 12px; }
.directory-card-meta { display: flex; align-items: center; gap: 7px; width: 100%; margin-top: auto; padding: 13px 16px 16px; }
.directory-author-avatar { display: grid; place-items: center; flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 600; }
[data-directory="home"] .directory-card-author { margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.directory-card-device { margin-left: auto; flex-shrink: 0; font-size: 10px; color: var(--text-faint); }
.directory-card-open { position: absolute; right: 12px; bottom: 12px; padding: 7px 11px; border-radius: 20px; background: #25231feb; color: #fffdf9; font-size: 11px; opacity: 0; transform: translateY(4px); pointer-events: none; }
[data-directory="home"] .directory-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: 12px; }
[data-directory="home"] .directory-card:focus-visible .directory-card-open { opacity: 1; transform: none; }
[data-directory="home"] #directory-status:not(:empty) { padding: 60px 20px; text-align: center; border: 1px dashed var(--border-strong); border-radius: 12px; font-size: 14px; }
#directory-clear { display: block; margin: 18px auto; border: 0; padding: 10px 16px; border-radius: 20px; background: var(--hover-strong); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
#directory-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 54px; padding: 24px 0 0; border-top: 1px solid var(--border); color: var(--text-faint); font-size: 11px; }
#directory-footer > span:last-child { font-size: 9px; letter-spacing: 1.5px; }
#directory-explore :is(button, select):focus-visible, #directory-start:focus-visible, #directory-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) {
    [data-directory="home"] .directory-card:hover .directory-card-open { opacity: 1; transform: none; }
    [data-directory="home"] .directory-card:hover strong { color: var(--accent); }
}
@media (prefers-reduced-motion: no-preference) {
    .directory-card-open { transition: opacity .18s ease, transform .18s ease; }
}
@media (min-width: 1600px) { [data-directory="home"] #directory-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1000px) {
    [data-directory="home"] .directory-heading { gap: 24px; }
    [data-directory="home"] #directory-title { font-size: 28px; }
    [data-directory="home"] #directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .directory-tools { flex-wrap: wrap; }
    .directory-search-sort { flex: 1; justify-content: flex-end; }
}
@media (max-width: 600px) {
    body[data-page="directory"][data-directory="home"] #topbar { height: 64px; padding-inline: 20px; }
    body[data-page="directory"][data-directory="home"] .platform-wordmark { display: inline; font-size: 23px; margin-right: 14px; }
    body[data-page="directory"][data-directory="home"] #primary-nav button { min-height: 64px; padding-inline: 12px; }
    body[data-page="directory"][data-directory="home"] #project-directory { top: calc(64px + var(--viewport-top, 0px)); height: calc(var(--app-height, 100dvh) - 64px - env(safe-area-inset-bottom, 0px)); padding: 0 20px 24px; }
    [data-directory="home"] .directory-heading { align-items: flex-start; flex-direction: column; min-height: 0; gap: 14px; padding: 26px 0 22px; }
    [data-directory="home"] #directory-eyebrow { font-size: 9px; letter-spacing: 1.5px; margin-bottom: 14px; }
    [data-directory="home"] #directory-title { max-width: 330px; font-size: 25px; line-height: 1.45; letter-spacing: -1.3px; }
    [data-directory="home"] #directory-description { max-width: 320px; font-size: 13px; margin-top: 12px; }
    #directory-start { padding: 9px 16px; gap: 18px; font-size: 11px; }
    .directory-explore-heading { padding-top: 24px; }
    .directory-explore-heading h2 { font-size: 17px; }
    .directory-explore-heading h2 span { font-size: 8px; margin-left: 6px; }
    .directory-tools { flex-direction: column; align-items: stretch; gap: 16px; padding: 18px 0 22px; }
    #directory-filters { gap: 4px; }
    #directory-filters button { padding-inline: 16px; min-height: 42px; }
    .directory-search-sort { width: 100%; gap: 8px; }
    .directory-search { flex: 1; width: auto; min-width: 0; }
    #directory-search { font-size: 16px; }
    #directory-sort { font-size: 16px; max-width: 126px; padding-inline: 8px; }
    [data-directory="home"] #directory-grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
    [data-directory="home"] .directory-card strong { font-size: 16px; }
    [data-directory="home"] .directory-card-description { font-size: 13px; }
    #directory-footer { align-items: flex-start; flex-direction: column; gap: 12px; margin-top: 36px; }
}

/* Editorial feature area, populated from the published community catalogue. */
#community-featured { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin-bottom: 38px; }
#community-featured[hidden], .community-slide[hidden], .community-carousel-controls button[hidden] { display: none; }
#community-carousel { min-width: 0; overflow: hidden; border-radius: 18px; background: #e9ece3; color: #24382e; }
#community-slides { min-width: 0; }
.community-slide { position: relative; display: grid; grid-template-columns: 46% 54%; grid-template-rows: minmax(0, 1fr); height: 390px; padding: 30px 0 24px 34px; overflow: hidden; isolation: isolate; background: #e9ece3; color: #24382e; }
.community-slide[data-tone="1"] { background: #e7e4f1; color: #403259; }
.community-slide[data-tone="2"] { background: #f4e5d5; color: #6b3b24; }
.community-slide::before { content: ''; position: absolute; z-index: -1; width: 380px; height: 380px; border: 1px solid currentColor; border-radius: 50%; opacity: .1; right: -90px; top: -150px; box-shadow: 0 0 0 42px #ffffff40, 0 0 0 85px #ffffff20; }
.community-slide-copy { min-width: 0; min-height: 0; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; padding-right: 18px; }
.community-slide-kicker { font-size: 9px; font-weight: 650; letter-spacing: 1.5px; line-height: 1.8; }
.community-slide h2 { margin-top: 18px; font-size: clamp(26px, 2.5vw, 32px); line-height: 1.25; letter-spacing: -1.2px; font-weight: 700; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.community-slide-description { margin-top: 12px; font-size: 13px; line-height: 1.7; opacity: .85; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.community-slide-author { margin-top: 12px; font-size: 11px; opacity: .75; overflow-wrap: anywhere; }
.community-slide-link { margin-top: auto; padding: 12px 18px; border-radius: 8px; background: #24382e; color: #fff; font-size: 12px; text-decoration: none; }
.community-slide[data-tone="1"] .community-slide-link { background: #403259; }
.community-slide[data-tone="2"] .community-slide-link { background: #6b3b24; }
.community-slide-visual { min-width: 0; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding: 20px 0 18px 8px; text-decoration: none; color: inherit; transform: rotate(-5deg) translateX(16px); }
.community-preview-label { font-size: 8px; letter-spacing: 2px; margin: 0 0 10px 8px; opacity: .7; }
.community-slide-visual .directory-card-cover { aspect-ratio: 8 / 5; border: 6px solid #ffffffd9; border-radius: 12px; box-shadow: 0 18px 35px #263b3026; background: #ffffff90; }
.community-slide-visual .directory-cover-placeholder { color: #5c635e; }
.community-slide-visual .directory-card-cover[data-device="phone"] { width: 170px; height: 280px; aspect-ratio: auto; align-self: center; background: #f6f5f2; }
.community-slide-visual .directory-card-cover[data-device="phone"] img { inset: 0; height: 100%; }
.community-carousel-controls { display: flex; align-items: center; min-height: 54px; padding: 8px 18px 8px 30px; gap: 10px; background: #ffffff60; }
.community-carousel-caption { font-size: 10px; opacity: .7; margin-right: auto; }
#community-dots { display: flex; align-items: center; gap: 2px; }
.community-carousel-controls button { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #24382e26; border-radius: 50%; background: transparent; color: #24382e; font-size: 15px; cursor: pointer; }
.community-carousel-controls .community-dot { width: 22px; height: 30px; border: 0; border-radius: 0; }
.community-dot::after { content: ''; width: 5px; height: 5px; border-radius: 6px; background: #24382e40; }
.community-dot[aria-pressed="true"]::after { width: 18px; background: #24382e; }
#community-slide-count { font-size: 10px; font-variant-numeric: tabular-nums; margin-inline: 5px; }
.community-sidebar { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.community-create-story { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 17px; padding: 24px; border-radius: 16px; color: #5a2a16; background: #f5c5a7; text-decoration: none; }
.community-story-label { font-size: 9px; letter-spacing: 2px; font-weight: 600; }
.community-create-story strong { font-size: 22px; line-height: 1.5; letter-spacing: -.6px; z-index: 1; }
.community-story-link { display: flex; align-items: center; gap: 32px; font-size: 12px; z-index: 1; }
.community-story-link > span { font-size: 21px; }
.community-story-art { position: absolute; bottom: -38px; right: -16px; color: #e88953; font-size: 150px; line-height: 1; transform: rotate(12deg); opacity: .5; }
.community-latest { flex: 1; padding: 16px 20px 10px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.community-latest-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.community-latest-heading h2 { font-size: 13px; font-weight: 650; }
.community-latest-heading > span { font-size: 8px; letter-spacing: 1px; color: var(--text-faint); }
.community-latest-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; color: var(--text); text-decoration: none; }
.community-latest-item + .community-latest-item { border-top: 1px solid var(--border); }
.community-latest-number { color: var(--accent); font-size: 12px; font-variant-numeric: tabular-nums; }
.community-latest-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.community-latest-copy strong { font-size: 12px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.community-latest-copy small { font-size: 10px; color: var(--text-muted); }
.community-latest-arrow { margin-left: auto; font-size: 14px; color: var(--text-faint); }
#community-featured :is(a, button):focus-visible, #community-carousel:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (hover: hover) {
    .community-slide-link:hover { filter: brightness(1.2); }
    .community-latest-item:hover strong { color: var(--accent); }
    .community-carousel-controls button:hover { background: #ffffff80; }
    .community-create-story:hover .community-story-link { text-decoration: underline; text-underline-offset: 4px; }
}
@media (prefers-reduced-motion: no-preference) {
    .community-slide { animation: community-slide-in .35s ease both; }
    @keyframes community-slide-in { from { opacity: .4; transform: translateY(5px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 1100px) {
    #community-featured { grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; }
    .community-slide { padding-left: 24px; }
    .community-slide h2 { font-size: 28px; }
    .community-create-story { padding: 22px 20px; }
    .community-create-story strong { font-size: 20px; }
    .community-slide-visual .directory-card-cover[data-device="phone"] { width: 135px; height: 260px; }
}
@media (max-width: 850px) {
    #community-featured { grid-template-columns: minmax(0, 1fr); }
    .community-sidebar { display: grid; grid-template-columns: 1fr 1fr; }
    .community-slide { min-height: 330px; }
}
@media (max-width: 600px) {
    #community-featured { gap: 12px; margin-bottom: 28px; }
    #community-carousel { border-radius: 14px; }
    .community-slide { height: auto; min-height: 0; padding: 24px 22px 18px; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; }
    .community-slide-copy { padding-right: 0; }
    .community-slide-kicker { font-size: 8px; }
    .community-slide h2 { margin-top: 16px; font-size: 28px; min-height: 70px; }
    .community-slide-description { margin-top: 10px; font-size: 12px; -webkit-line-clamp: 2; min-height: 46px; }
    .community-slide-author { margin-top: 10px; font-size: 10px; }
    .community-slide-link { margin-top: 16px; padding: 10px 16px; }
    .community-slide-visual { height: 174px; padding: 18px 0 0; transform: rotate(-4deg) translateX(18px); }
    .community-preview-label { display: none; }
    .community-slide-visual .directory-card-cover { aspect-ratio: auto; height: 150px; flex-shrink: 0; border-width: 4px; }
    .community-slide-visual .directory-card-cover[data-device="phone"] { height: 154px; width: 90px; }
    .community-carousel-controls { padding: 8px 12px; gap: 5px; }
    .community-carousel-caption { font-size: 9px; }
    .community-carousel-controls button { width: 32px; height: 32px; }
    .community-carousel-controls .community-dot { width: 16px; }
    .community-dot[aria-pressed="true"]::after { width: 12px; }
    #community-slide-count { margin-inline: 2px; font-size: 9px; }
    .community-sidebar { display: block; }
    .community-create-story { padding: 18px 20px; gap: 10px; }
    .community-create-story strong { font-size: 19px; }
    .community-create-story strong br { display: none; }
    .community-story-label { font-size: 8px; }
    .community-story-link { gap: 16px; font-size: 11px; }
    .community-story-art { bottom: -45px; }
    .community-latest { display: none; }
}

/* Independent loading states for conversation history and the embedded app. */
.pane-loading { color: var(--text-muted); text-align: center; line-height: 1.8; }
.pane-loading::before {
    content: ''; display: block; width: 24px; height: 24px; margin: 0 auto 14px;
    border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
    animation: pane-loading-spin .85s linear infinite;
}
#chat-messages > .chat-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; margin: 0; padding: 24px; font-size: 13px; }
#preview-stage.frame-loading #preview-device { visibility: hidden; }
#preview-stage.frame-loading #preview-empty { position: absolute; inset: 0; z-index: 1; height: fit-content; }
@keyframes pane-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pane-loading::before { animation: none; } }
