@font-face {
    font-family: 'Public Sans';
    src: url('fonts/PublicSans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Public Sans';
    src: url('fonts/PublicSans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-SemiBoldItalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'IBM Plex Mono';
    src: url('fonts/IBMPlexMono-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Public Sans', sans-serif;
    background: #000;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
    margin-block: 50px;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Instant tooltip */
#tooltip {
    position: fixed;
    z-index: 10000;
    background: #222;
    color: #ccc;
    font-size: 11px;
    font-family: 'Public Sans', sans-serif;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #444;
    white-space: pre-line;
    max-width: 280px;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    display: none;
}

#container {
    display: flex;
    height: 100%;
    width: 100%;
}

#editor-container {
    flex: 0 0 34%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 320px;
    /* Below #ai-chat (z:11) so chat header dropdowns paint above the editor; below #canvas-container (z:3). */
    position: relative;
    z-index: 1;
}

.splitter {
    flex: 0 0 4px;
    background: #0a0a0a;
    cursor: col-resize;
    position: relative;
    z-index: 10;
}

.splitter:hover {
    background: #2d2d2d;
}

.splitter.dragging {
    background: #013566;
}

body.resizing {
    cursor: col-resize;
    user-select: none;
}

body.resizing iframe,
body.resizing #editor,
body.resizing #canvas-container {
    pointer-events: none;
}

#ai-chat {
    flex: 0 0 33%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    /* Above #editor-container (z:1), splitters (z:10), and #canvas-container (z:3) so model/settings
     * dropdowns are not covered when they extend past the chat column. Global overlays
     * (.notification z:10000, #tooltip, etc.) remain on top. */
    position: relative;
    z-index: 11;
}

#chat-header {
    background: #000;
    padding: 10px 4px 0 10px;
    color: #d1d1d1;
    font-family: 'Public Sans', sans-serif;
    font-size: 14px;
    min-height: 50px;
    flex-shrink: 0;
    /* Approximate height to match toolbar if possible, or let it be natural */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    overflow-x: hidden;
    overflow-y: hidden;
}

.credit-low-banner {
    flex-shrink: 0;
    padding: 8px 12px;
    font-family: 'Public Sans', sans-serif;
    font-size: 13px;
    line-height: 1.35;
    color: #e8c96a;
    background: #2a2210;
    border-bottom: 1px solid #4a3d18;
    box-sizing: border-box;
}

.credit-low-banner[hidden] {
    display: none !important;
}

.credit-low-banner .credit-low-banner-link {
    color: #f0d78a;
    text-decoration: underline;
    cursor: pointer;
}

.credit-low-banner .credit-low-banner-link:hover {
    color: #fff;
}

/* Model picker, toggles, conversation — scroll horizontally when needed; logo stays in #omega-menu. */
#chat-header-controls,
#toolbar-controls {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
}

#omega-menu {
    position: relative;
    padding-right: 8px;
    flex-shrink: 0;
}

#omega-menu-btn {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border: none;
    background: none;
    color: #d1d1d1;
    cursor: pointer;
    user-select: none;
    font-size: inherit;
}

#omega-menu-btn:hover {
    color: #fff;
}

#omega-menu-btn img {
    width: 24px;
    height: 24px;
    display: block;
    filter: invert(1);
}

#omega-menu-btn h1 {
    margin-left: 6px;
}

.omega-menu-caret {
    margin-left: 4px;
    color: #666;
    font-size: 10px;
    line-height: 1;
}

#omega-menu-dropdown {
    display: none;
    position: fixed;
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    z-index: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    overflow-y: auto;
    max-height: calc(100vh - 48px);
    min-width: 160px;
    padding: 0;
    font-family: 'Public Sans', sans-serif;
}

#omega-menu-dropdown.open {
    display: block;
}

.omega-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    user-select: none;
}

.omega-menu-item:hover {
    background: #222;
    color: #e0e0e0;
}

button.omega-menu-item {
    width: 100%;
    border: none;
    background: none;
    text-align: left;
    font-family: inherit;
}

.omega-menu-item.selected {
    color: #e0e0e0;
}

#chat-header h1 {
    margin-left: 6px;
    font-size: 17px;
    font-weight: normal;
}

#toolbar h1 {
    margin-left: 6px;
    margin-right: 8px;
    font-size: 17px;
    font-weight: normal;
    flex-shrink: 0;
}

#model-dropdown,
#conversation-dropdown {
    margin-left: 2px;
    position: relative;
    flex-shrink: 0;
}

#conversation-dropdown {
    margin-left: 8px;
}

#model-dropdown-btn,
#conversation-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    font-family: 'Public Sans', sans-serif;
    user-select: none;
    white-space: nowrap;
    min-width: 130px;
    max-width: 220px;
}

#model-dropdown-btn:hover,
#conversation-dropdown-btn:hover {
    border-color: #444;
    color: #d1d1d1;
}

#conversation-dd-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-dd-icon {
    width: 11px;
    height: 11px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.model-dd-icon[data-type="code"] {
    color: #6a9a78;
}

.model-dd-icon[data-type="image"] {
    color: #6688bb;
}

#model-dd-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-dd-caret {
    color: #555;
    font-size: 10px;
    flex-shrink: 0;
}

#model-dd-menu,
#conversation-dd-menu {
    display: none;
    position: fixed;
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    z-index: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    /* Two-row flex layout so the header stays pinned and only the body
     * scrolls. flex-direction: column + min-height: 0 on the body lets
     * overflow-y: auto kick in inside the bounded max-height. */
    max-height: calc(100vh - 48px);
    min-width: 220px;
    padding: 0;
    font-family: 'Public Sans', sans-serif;
    flex-direction: column;
}

#model-dd-menu.open {
    display: flex;
}

#conversation-dd-menu.open {
    display: block;
}

.model-menu-header {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding: 6px 6px 6px;
    border-bottom: 1px solid #2a2a2a;
}

.model-menu-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 4px 0;
}

.model-menu-type-header {
    color: #666;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 10px 12px 2px;
}

.model-menu-type-header:first-child {
    padding-top: 4px;
}

.model-menu-vendor-header {
    color: #808080;
    font-size: 10px;
    padding: 4px 12px 1px;
    letter-spacing: 0.02em;
}

.model-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    user-select: none;
}

.model-menu-item:hover {
    background: #222;
    color: #e0e0e0;
}

.model-menu-item.selected {
    color: #e0e0e0;
}

.model-icon-wrap {
    position: relative;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-check-circle {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid #555;
    display: none;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #999;
}

.model-menu-item:hover .model-check-circle,
.model-check-circle.locked {
    display: flex;
}

/* Selected row gets the blue check. Single-mode = the current model;
 * multi-mode = every member of selectedModels (kept in sync by
 * updateMultiSelectUI). One class for both. */
.model-menu-item.selected .model-check-circle {
    display: flex;
    border-color: #4488ee;
    background: #4488ee;
    color: #fff;
}

/* Hover indicator: a 2px white stroke around the check circle. Same
 * indicator regardless of whether the click would add or remove — the
 * fill underneath (blue for selected, dark for unselected) shows the
 * current state, the white stroke just highlights the click target.
 *
 * Single mode: only the icon column triggers the indicator, because row
 * click and icon click do different things (make-current vs add-to-multi).
 * Multi mode: row click and icon click both toggle membership, so the
 * .multi-mode rule extends the indicator to the whole row. */
.model-menu-item .model-icon-wrap:hover .model-check-circle,
#model-dd-menu.multi-mode .model-menu-item:hover .model-check-circle {
    border: 1px solid #ffffff;
}

/* Locked child tab — show lock on selected item, dim others */
.model-check-circle.locked {
    display: flex;
    border-color: #555;
    background: #1a1a1a;
    color: #666;
}

.model-menu-item.selected .model-check-circle.locked {
    border-color: #666;
    color: #999;
}

.model-menu-lock-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 10px;
    color: #666;
    border-bottom: 1px solid #2a2a2a;
}

.model-menu-lock-banner span {
    flex: 1;
}

.model-menu-unlock-btn {
    flex: 0 !important;
    color: #4488ee;
    cursor: pointer;
    white-space: nowrap;
}

.model-menu-unlock-btn:hover {
    color: #77aaff;
}

.model-menu-icon {
    width: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.model-menu-icon[data-type="code"] {
    color: #6a9a78;
}

.model-menu-icon[data-type="image"] {
    color: #6688bb;
}

.model-menu-icon[data-type="video"] {
    color: #7a66aa;
}

.model-menu-icon[data-type="audio"] {
    color: #aa7755;
}

.model-menu-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.model-caps {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
    align-items: center;
}

.model-price-tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 9px;
    color: #808080;
    flex-shrink: 0;
    width: 26px;
    text-align: center;
    cursor: default;
}

.model-cap {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3a3a3a;
}

.model-cap.native   { color: #4a9936; }
.model-cap.fallback { color: #9a7f1a; }
.model-cap.out-native { color: #3a74bb; }

.model-menu-separator {
    height: 1px;
    background: #2a2a2a;
    margin: 4px 0;
}

.model-menu-btn {
    flex: 1 1 auto;
    background: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 11px;
    padding: 5px 10px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.model-menu-btn:hover {
    background: #222;
    border-color: #444;
    color: #fff;
}

.model-menu-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    color: #888;
    background: #1a1a1a;
    border-color: #2d2d2d;
}

#chat-body {
    flex-grow: 1;
    position: relative;
    background: #000;
    overflow-y: auto;
    padding: 10px;
    color: #d1d1d1;
    font-family: 'Public Sans', sans-serif;
    font-size: 14px;
}

.chat-body-loading {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
}

.chat-body-loading[hidden] {
    display: none !important;
}

.chat-body-loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-radius: 12px;
    background: #141414;
    border: 1px solid #2d2d2d;
    color: #d1d1d1;
    font-size: 14px;
}

.chat-body-loading-spinner {
    width: 28px;
    height: 28px;
    border: 2px solid #333;
    border-top-color: #8ab4f8;
    border-radius: 50%;
    animation: chat-body-loading-spin 0.75s linear infinite;
}

.chat-body-loading-text {
    font-family: 'Public Sans', sans-serif;
}

@keyframes chat-body-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

#chat-footer {
    background: #000;
    padding: 10px;
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

#chat-input-wrapper {
    flex-grow: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#chat-input {
    flex-grow: 1;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 14px;
    color: #d1d1d1;
    padding: 14px;
    font-family: 'Public Sans', sans-serif;
    font-size: 14px;
    resize: none;
    height: 100px;
    outline: none;
}

#chat-image-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    max-width: 100px;
    max-height: 108px;
    z-index: 10;
    border-radius: 8px;
    border: 1px solid #4b4b4b;
}

#chat-input:focus {
    border-color: #013566;
}

#toolbar {
    background: #000;
    /* top, right, bottom, left */
    padding: 10px 4px 0 10px;
    color: #d1d1d1;
    font-family: 'Public Sans', sans-serif;
    font-size: 14px;
    min-height: 50px;
    /* Approximate height to match toolbar if possible, or let it be natural */
    box-sizing: border-box;
    display: flex;
    align-items: center;
    overflow-x: hidden;
    overflow-y: hidden;
    flex-shrink: 0;
}

#toolbar > img {
    width: 24px;
    height: 24px;
    display: block;
    flex-shrink: 0;
}

#examples {
    margin-left: 4px;
    padding-right: 10px;
    background: #000;
    color: #d1d1d1;
    border: none;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    height: 100%;
}

#error-wrapper {
    height: 140px;
    display: flex;
    background: #000;
    box-sizing: border-box;
    position: relative;
}

#error-output {
    flex-grow: 1;
    height: 100%;
    background: #000;
    color: #cb4c4c;
    border: none;
    resize: none;
    padding: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    box-sizing: border-box;
    outline: none;
}

#canvas-container {
    flex: 1 1 auto;
    min-width: 320px;
    min-height: 0;
    position: relative;
    /* Below #ai-chat (z:11); above #editor-container (z:1). */
    z-index: 3;
    overflow: hidden;
    /* This is a hack to get our nice-looking inset to play nicely with the canvas */
    border: 10px solid #000;
    border-radius: 0px;
    background: #000;
}

#canvas-container > canvas {
    border-radius: 14px;
}

#canvas-container:fullscreen {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
}

.notification {
    display: none;
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px;
    font-size: 14px;
    color: #d1d1d1;
    border-radius: 14px;
    z-index: 1000;
    font-family: 'Public Sans', sans-serif;
    transform: translateY(-150%);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

#instructions {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #d1d1d1;
    font-family: 'Public Sans', sans-serif;
    font-size: 14px;
    pointer-events: none;
    user-select: none;
    text-shadow: 1px 1px 2px black;
}

.btn-regular {
    background: #171717;
    color: #d1d1d1;
    padding: 8px 10px;
    cursor: pointer;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    border-radius: 8px;
    outline: none;
}

.btn-regular:hover {
    background: #2d2d2d;
    color: #fff;
}

.btn-icon {
    background: #171717;
    color: #d1d1d1;
    padding: 10px 10px;
    cursor: pointer;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    border-radius: 8px;
    outline: none;
}

.btn-icon img {
    display: block;
    width: 13px;
    height: 13px;
}

.btn-icon:hover {
    background: #2d2d2d;
    color: #fff;
}

.btn-icon.active {
    outline: 1px solid #ffff00;
}

.btn-light {
    background: #1e1e1e;
    color: #d1d1d1;
    padding: 8px 10px;
    cursor: pointer;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    border-radius: 8px;
    outline: none;
}

.btn-light:hover {
    background: #2d2d2d;
    color: #fff;
}

.btn-switch-container {
    display: flex;
    margin-right: 0;
}

.btn-switch-l {
    background: #171717;
    color: #d1d1d1;
    padding: 8px 10px;
    cursor: pointer;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    border-radius: 8px 0 0 8px;
    outline: none;
}

.btn-switch-l.selected {
    background: #2d2d2d;
    color: #fff;
}

.btn-switch-l:hover {
    background: #2d2d2d;
    color: #fff;
}

.btn-switch-r {
    background: #171717;
    color: #d1d1d1;
    padding: 8px 10px;
    cursor: pointer;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    border-radius: 0 8px 8px 0;
    outline: none;
}

.btn-switch-r.selected {
    background: #2d2d2d;
    color: #fff;
}

.btn-switch-r:hover {
    background: #2d2d2d;
    color: #fff;
}

/* Inline-error hint: when the inactive tab has a pending diagnostic, glow
   its label red so the user knows where to look. */
.btn-switch-l.has-error,
.btn-switch-r.has-error {
    color: #f48771;
    box-shadow: inset 0 0 0 1px #f48771;
}

#help-menu {
    position: relative;
    flex-shrink: 0;
    margin-left: 8px;
}

#btn-help {
    background: #171717;
    color: #d1d1d1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
}

#btn-help:hover {
    background: #2d2d2d;
    color: #fff;
}

#help-menu-dropdown {
    display: none;
    position: fixed;
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    z-index: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    min-width: 180px;
    padding: 4px 0;
    font-family: 'Vercetti', sans-serif;
}

#help-menu-dropdown.open {
    display: block;
}

/* Reusable card-style panel with header/body — used for the model chooser
 * (see #prefs-panel further down for the legacy implementation), the inline
 * Language Guide overlay, and the About modal. The cosmetic class is
 * placement-agnostic; pair it with one of the .app-panel-* placement
 * variants below. */
.app-panel {
    background: #171717;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    font-family: 'Vercetti', sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-panel-header {
    color: #d1d1d1;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d2d2d;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
    user-select: none;
}

.app-panel-header .panel-close {
    display: block;
}

.app-panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    color: #d1d1d1;
}

.app-panel[hidden] {
    display: none;
}

/* Placement: anchored inside a positioned ancestor (e.g. #canvas-container).
 * Centered horizontally and stretched vertically with a 20px inset, capped to
 * a readable width. Sits above #canvas-controls (z-index 100). */
.app-panel-canvas {
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: min(640px, calc(100% - 40px));
    z-index: 200;
}

/* Placement: right-anchored variant — useful when the overlay should sit
 * beside the graphics rather than over the center. */
.app-panel-canvas.right {
    left: auto;
    right: 10px;
    transform: none;
}

/* Placement: left-anchored variant. */
.app-panel-canvas.left {
    left: 10px;
    right: auto;
    transform: none;
}

/* Placement: centered modal — wrap in .app-modal-overlay for the backdrop. */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 510;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.app-panel-modal {
    max-width: 90vw;
    max-height: 90vh;
}

/* Language Guide panel — inline doc viewer with comfortable padding. */
#language-guide-panel .app-panel-body {
    padding: 18px 22px 28px;
}

/* About modal — small centered card with a single line of body copy. */
#about-panel {
    width: 360px;
}

#about-panel .app-panel-body {
    padding: 28px 24px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
    color: #c8c8c8;
}

#about-panel .about-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Vercetti', sans-serif;
    font-size: 22px;
    color: #e8e8e8;
    margin-bottom: 14px;
}

#about-panel .about-title img {
    filter: invert(1);
}

#about-panel #about-default-view p {
    margin: 0;
}

#about-panel #about-default-view .about-doc-link {
    font-size: 12px;
}

/* The first doc-link cluster (privacy / EULA / notices) gets breathing room
 * above to separate from the Gradient Control Laboratories line; the
 * remaining links sit tight together. */
#about-panel #about-default-view .about-doc-link-first {
    margin-top: 28px;
}

#about-panel a {
    color: #6699cc;
    text-decoration: none;
}

#about-panel a:hover {
    text-decoration: underline;
}

/* Doc viewer — switches the modal to a wider, left-aligned reader. The
 * default body styles (centered, 360px) are overridden while the doc view
 * is showing. */
#about-panel:has(#about-doc-view:not([hidden])) {
    width: min(560px, 90vw);
}

#about-doc-view {
    text-align: left;
    padding: 4px 0 8px;
}

#about-doc-view .about-back-row {
    margin: 0 0 12px;
    font-size: 12px;
}

#about-doc-content {
    font-size: 13px;
}

#canvas-controls {
    position: absolute;
    margin-top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
    pointer-events: none;
}

#canvas-controls > * {
    pointer-events: auto;
    cursor: default;
}

#canvas-left-btns {
    position: absolute;
    margin: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
}


#chat-input-side-btns {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: flex-start;
    padding-top: 2px;
}

.chat-side-btn {
    width: 30px;
    height: 30px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    flex-shrink: 0;
}

.chat-side-btn:hover {
    border-color: #444;
    color: #bbb;
}

.chat-side-btn.recording {
    border-color: #883333;
    color: #cc5555;
}

.thumb-warn-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 24px;
    line-height: 1;
    color: #e0b030;
    text-shadow: 0 0 6px #000, 0 0 3px #000;
    background: rgba(0,0,0,0.55);
    border-radius: 4px;
    padding: 1px 3px;
    pointer-events: auto;
    z-index: 3;
    user-select: none;
    cursor: default;
}

.media-settings-warn-badge {
    color: #e0b030;
    font-size: 12px;
    line-height: 1;
    margin-left: 4px;
    user-select: none;
}

#field-panel,
#stl-bounds-panel,
#animation-panel,
#mesh-import-panel,
#color-picker-panel {
    background: #171717;
    border-radius: 8px;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
}

#field-panel-header,
#stl-bounds-header,
#animation-panel-header,
#mesh-import-header,
#color-picker-header {
    color: #d1d1d1;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

#field-panel-header:hover,
#stl-bounds-header:hover,
#animation-panel-header:hover,
#mesh-import-header:hover,
#color-picker-header:hover {
    background: #2d2d2d;
    color: #fff;
}

#field-panel.open #field-panel-header,
#stl-bounds-panel.open #stl-bounds-header,
#animation-panel.open #animation-panel-header,
#mesh-import-panel.open #mesh-import-header,
#color-picker-panel.open #color-picker-header {
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #bababa;
    cursor: default;
    background: transparent;
}

#field-panel.open #field-panel-header:hover,
#stl-bounds-panel.open #stl-bounds-header:hover,
#animation-panel.open #animation-panel-header:hover,
#mesh-import-panel.open #mesh-import-header:hover,
#color-picker-panel.open #color-picker-header:hover {
    background: transparent;
    color: #bababa;
}

.panel-close {
    display: none;
    cursor: pointer;
    color: #666;
    font-size: 13px;
    line-height: 1;
    padding: 0 2px;
}

.panel-close:hover {
    color: #fff;
}

#field-panel.open .panel-close,
#stl-bounds-panel.open .panel-close,
#animation-panel.open .panel-close,
#mesh-import-panel.open .panel-close,
#color-picker-panel.open .panel-close {
    display: block;
}

.panel-body {
    display: none;
    padding: 0 10px 8px 10px;
    color: #d1d1d1;
}

#field-panel.open .panel-body,
#stl-bounds-panel.open .panel-body,
#animation-panel.open .panel-body,
#mesh-import-panel.open .panel-body,
#color-picker-panel.open .panel-body {
    display: block;
}

.mesh-drop-zone {
    border: 1px dashed #444;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 6px;
    transition: border-color 0.15s, background 0.15s;
}
.mesh-drop-zone:hover,
.mesh-drop-zone.dragover {
    border-color: #888;
    background: rgba(255,255,255,0.03);
}
.mesh-upload-label {
    cursor: pointer;
    color: #888;
    font-size: 12px;
}
#mesh-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mesh-list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    background: #1e1e1e;
    border-radius: 4px;
    font-size: 11px;
}
.mesh-list-item .mesh-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #d1d1d1;
    font-size: 12px;
}
.mesh-list-item .mesh-delete {
    cursor: pointer;
    color: #666;
    font-size: 13px;
    padding: 0 2px;
}
.mesh-list-item .mesh-delete:hover {
    color: #f44;
}
.mesh-hint {
    font-size: 11px;
    color: #8a8a8a;
    margin-top: 10px;
    line-height: 1.4;
    max-width: 230px;
    word-wrap: break-word;
}
.mesh-hint code {
    color: #aaa;
    background: #1e1e1e;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.4;
}

.export-mode-switch {
    display: flex;
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
    background: #111;
}

.export-mode-option {
    flex: 1;
    padding: 8px 10px;
    text-align: center;
    cursor: pointer;
    color: #848484;
    background: #171717;
    border-right: 1px solid #111;
    user-select: none;
}

.export-mode-option:last-child {
    border-right: none;
}

.export-mode-option:hover {
    background: #232323;
    color: #d1d1d1;
}

.export-mode-option.selected {
    background: #2d2d2d;
    color: #fff;
}

.export-mode-note {
    margin-bottom: 10px;
    color: #8a8a8a;
    font-size: 11px;
    line-height: 1.4;
    max-width: 230px;
}

.export-mode-note code {
    color: #aaa;
    background: #1e1e1e;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 10px;
}

#stl-sdf-controls.hidden {
    display: none;
}

#animation-time-input {
    color: #d1d1d1;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    width: 64px;
    text-align: right;
    padding: 3px 4px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    outline: none;
    -moz-appearance: textfield;
}

#animation-time-input::-webkit-outer-spin-button,
#animation-time-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

#animation-time-input:not([readonly]) {
    border-color: #888;
    background: #252525;
}

.anim-unit {
    color: #888;
    font-size: 12px;
    margin-left: -4px;
}

.anim-btns {
    display: flex;
    gap: 6px;
}

.anim-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
    font-size: 14px;
    line-height: 1;
}

.anim-glyph {
    position: relative;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.checkbox-row-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-panel-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.field-panel-row label {
    color: #888;
    font-size: 12px;
    min-width: 40px;
}

.field-panel-row input[type="checkbox"] {
    margin: 0 0 0 2px;
    cursor: pointer;
}


.field-panel-row input[type="range"] {
    flex: 1;
    accent-color: #d1d1d1;
    height: 5px;
    cursor: pointer;
}

.field-panel-label {
    color: #d1d1d1;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    width: 42px;
    text-align: center;
    padding: 3px 4px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    cursor: text;
    overflow: hidden;
    white-space: nowrap;
}

.field-panel-label:focus {
    border-color: #013566;
    outline: none;
}

#btn-fix-error {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
}

/* Report Bug sits directly below Fix Error in the error pane and is shown
 * and hidden together with it via error.js. */
#btn-report-bug {
    display: none;
    position: absolute;
    top: 46px;
    right: 10px;
}

#media-settings-wrapper {
    position: relative;
    margin-left: 8px;
    margin-right: 8px;
    flex-shrink: 0;
}

#media-settings-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    cursor: pointer;
    color: #888;
    font-size: 11px;
    font-family: 'Public Sans', sans-serif;
    user-select: none;
    white-space: nowrap;
}

#media-settings-btn:hover {
    border-color: #444;
    color: #d1d1d1;
}

#media-settings-menu {
    display: none;
    /* fixed (not absolute) so the menu escapes #chat-header's overflow:hidden
       clip. Position is computed at open time from the button's rect — same
       approach as #model-dd-menu. */
    position: fixed;
    background: #171717;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    z-index: 600;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    padding: 0;
    font-family: 'Public Sans', sans-serif;
}

#media-settings-menu.open {
    display: flex;
}

.media-menu-col {
    min-width: 130px;
    padding: 6px 0;
}

.media-menu-col + .media-menu-col {
    border-left: 1px solid #2d2d2d;
}

.media-menu-col-title {
    color: #999;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 12px 6px;
    white-space: nowrap;
}

.media-menu-section {
    color: #666;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 6px 12px 2px;
}

.media-menu-section:first-child {
    padding-top: 2px;
}

.media-menu-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    cursor: pointer;
    color: #bbb;
    font-size: 11px;
    white-space: nowrap;
}

.media-menu-item:hover {
    background: #252525;
    color: #eee;
}

.media-menu-item.selected {
    color: #fff;
}

.media-menu-check {
    width: 12px;
    text-align: center;
    font-size: 10px;
    color: #6a9a78;
}

#btn-send-code {
    display: flex;
    align-items: center;
    gap: 5px;
}

#btn-new-conversation {
    margin-left: 8px;
}

#btn-send-code.active {
    color: #5a8a5a;
}

#btn-send-code:not(.active) {
    color: #8a5050;
}

#btn-send-code-cb {
    width: 10px;
    height: 10px;
    border: 1px solid currentColor;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 9px;
    line-height: 1;
}

#btn-send-code.active #btn-send-code-cb::after {
    content: '✓';
}

/* Web Search button — two CSS-mask icons sitting side-by-side. Globe on
 * the left, shield on the right; whichever is currently lit shows the
 * privacy posture of the next request:
 *   - Default (web search off): shield is green (ZDR preserved), globe
 *     is dim.
 *   - Active (web search on):   globe is green (matches the Code button's
 *     active-text-tint), shield is dim (ZDR suppressed for the turn).
 * Picking one over the other reads at a glance without needing to read
 * the tooltip. */
#btn-web-search {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 8px;
    flex-shrink: 0;
    /* Inherit .btn-regular's 8px 10px padding so the height lines up
     * with #btn-send-code and #btn-new-conversation in the chat header. */
}

#btn-web-search .globe-icon,
#btn-web-search .shield-icon {
    -webkit-mask-position: center;
            mask-position: center;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    transition: background-color 150ms ease;
}

#btn-web-search .globe-icon {
    width: 14px;
    height: 14px;
    background-color: #888;
    -webkit-mask-image: url('icons/globe.svg');
            mask-image: url('icons/globe.svg');
    -webkit-mask-size: 14px 14px;
            mask-size: 14px 14px;
}

#btn-web-search .shield-icon {
    width: 12px;
    height: 12px;
    background-color: #4a9936;
    -webkit-mask-image: url('icons/shield.svg');
            mask-image: url('icons/shield.svg');
    -webkit-mask-size: 12px 12px;
            mask-size: 12px 12px;
}

#btn-web-search.active .globe-icon {
    background-color: #5a8a5a;
}

#btn-web-search.active .shield-icon {
    background-color: #9a7f1a;
    -webkit-mask-image: url('icons/shield-slash.svg');
            mask-image: url('icons/shield-slash.svg');
}

/* Soft-wrap toggle in the editor toolbar. Same shape as #btn-send-code;
 * active tint matches its green-on-active convention so the two buttons
 * read as a consistent family of mode toggles. */
#btn-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    /* First right-aligned element in the toolbar; pushes itself and the
     * segmented tab switcher that follows over to the right edge. */
    margin-left: 8px;
    margin-right: 8px;
}

#btn-wrap.active    { color: #5a8a5a; }
#btn-wrap:not(.active) { color: var(--text-muted); }

/* Icon sprite pattern for icons that need to follow the surrounding text
 * color (the default <img src> pattern bakes the SVG's color; use this
 * instead when the icon is part of a button whose color changes with
 * state). Each .icon-FOO rule just sets the mask-image + size. */
.icon-mask {
    display: inline-block;
    background-color: currentColor;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}
.icon-mask.icon-wrap {
    width: 12px;
    height: 12px;
    -webkit-mask-image: url(icons/wrap.svg);
    mask-image: url(icons/wrap.svg);
}


.chat-separator {
    border-bottom: 1px dashed #444;
    margin: 15px 0;
    width: 100%;
}

.chat-message {
    padding: 9px 12px;
    margin: 15px 0;
    border-radius: 14px;
    font-size: 14px;
    line-height: 20px;
    max-width: 80%;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.chat-msg-gsl-actions {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-msg-gsl-use {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    background: #1e1e1e;
    color: #bdbdbd;
    cursor: pointer;
    font-family: inherit;
}

.chat-msg-gsl-use:hover {
    color: #eaeaea;
    border-color: #555;
}

.chat-msg-gsl-use:disabled {
    opacity: 0.45;
    cursor: default;
}

.chat-msg-gsl-only {
    padding-top: 6px;
}

.chat-meta {
    align-self: flex-start;
    font-size: 0.75em;
    color: #808080;
    margin: 3px 0 12px 4px;
    font-family: 'IBM Plex Mono', monospace;
}

.multi-status-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.multi-status-icon {
    display: flex;
    align-items: center;
    width: 11px;
    flex-shrink: 0;
}

@keyframes status-spin {
    to { transform: rotate(360deg); }
}
.status-spin {
    animation: status-spin 0.9s linear infinite;
    transform-origin: 5.5px 5.5px;
}

.multi-jump-btn {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #555;
    flex-shrink: 0;
}

.multi-jump-btn:hover {
    color: #aaa;
}

/* Multi-model in-window panel */
.multi-panel {
    display: flex;
    flex-direction: row;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    margin: 4px 0 8px;
    background: #111;
    min-height: 80px;
}

.multi-tab-bar {
    display: flex;
    flex-direction: column;
    width: 160px;
    flex-shrink: 0;
    background: #161616;
    border-right: 1px solid #2a2a2a;
    padding: 4px 0;
}

.multi-tab {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 10px 6px;
    cursor: pointer;
    color: #666;
    font-size: 11px;
    user-select: none;
    border-left: 2px solid transparent;
}

.multi-tab:hover {
    color: #bbb;
    background: #1e1e1e;
}

.multi-tab.active {
    color: #ddd;
    background: #111;
    border-left-color: #4488ee;
}

.multi-tab-top {
    display: flex;
    align-items: center;
    gap: 4px;
}

.multi-tab-vendor {
    flex: 1;
    color: #555;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-tab.active .multi-tab-vendor {
    color: #888;
}

.multi-tab-name {
    font-size: 11px;
    color: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 15px; /* align under vendor text, past icon */
}

.multi-tab-label {
    font-size: 10px;
    color: #555;
    padding-left: 15px;
}

.multi-tab.active .multi-tab-label {
    color: #888;
}

.multi-tab-open {
    display: flex;
    align-items: center;
    color: #444;
    cursor: pointer;
    flex-shrink: 0;
}

.multi-tab-open:hover {
    color: #aaa;
}

.multi-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.multi-model-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.multi-model-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    flex: 1;
}

.multi-model-input {
    resize: none;
    background: #1a1a1a;
    border: none;
    border-top: 1px solid #2a2a2a;
    color: #ccc;
    font-family: inherit;
    font-size: 12px;
    padding: 8px 10px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.multi-model-input::placeholder {
    color: #444;
}

.multi-model-input:focus {
    background: #1e1e1e;
}

.chat-message.user {
    align-self: flex-end;
    background-color: #013566;
    color: #d1d1d1;
    margin-left: auto;
}

.chat-message.agent {
    align-self: flex-start;
    background-color: #1e1e1e;
    color: #d1d1d1;
    margin-right: auto;
}

.chat-message.error {
    align-self: flex-start;
    background-color: #333;
    color: #ff5555;
    margin-right: auto;
}

.chat-image {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
}

.chat-video {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
}

.chat-audio {
    display: block;
    width: 100%;
    max-width: 320px;
    margin-top: 4px;
}

#chat-image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.chat-input-thumb-wrap {
    position: relative;
    padding: 4px;
    border-radius: 7px;
    background: rgba(255,255,255,0.05);
}

.thumb-actions {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(0,0,0,0.6);
    border-radius: 7px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.chat-input-thumb-wrap:hover .thumb-actions {
    opacity: 1;
    pointer-events: auto;
}

.thumb-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ddd;
}

.thumb-btn:hover {
    background: rgba(255,255,255,0.22);
}

.thumb-remove:hover {
    background: rgba(160,50,50,0.7);
}

.thumb-frame-btn {
    position: absolute;
    top: 6px;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    z-index: 2;
}

.thumb-frame-btn::before {
    content: '';
    width: 11px;
    height: 11px;
    background-color: rgba(255,255,255,0.45);
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    transition: background-color 0.15s;
}

.thumb-frame-btn:hover { background: rgba(0,0,0,0.8); }
.thumb-frame-btn:hover::before { background-color: #fff; }

.thumb-frame-btn.active { background: rgba(0,0,0,0.85); }
.thumb-frame-btn.active::before { background-color: #4af; }

.thumb-frame-first { left: 6px; }
.thumb-frame-last  { right: 6px; }

.thumb-frame-first::before {
    -webkit-mask-image: url('icons/first-frame.svg');
    mask-image: url('icons/first-frame.svg');
}

.thumb-frame-last::before {
    -webkit-mask-image: url('icons/last-frame.svg');
    mask-image: url('icons/last-frame.svg');
}

.chat-input-thumb {
    display: block;
    max-width: 120px;
    max-height: 120px;
    min-width: 60px;
    width: auto;
    height: auto;
    border-radius: 4px;
}

video.chat-input-thumb {
    min-width: unset;
}

.chat-video-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    pointer-events: none;
}

.chat-bubble-thumb {
    display: block;
    margin-top: 6px;
    max-width: 120px;
    border-radius: 6px;
    opacity: 0.85;
    margin-left: auto;
    cursor: zoom-in;
}

video.chat-bubble-thumb {
    cursor: default;
    max-width: 200px;
}

#chat-input-wrapper.drag-over #chat-input {
    border-color: #555;
    background: #222;
}

.chat-pdf-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 72px;
    height: 72px;
    color: #aa7744;
}

.chat-pdf-name {
    font-size: 9px;
    color: #888;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-family: 'IBM Plex Mono', monospace;
}

.chat-audio-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 56px;
    height: 56px;
    color: #557799;
}

.chat-pdf-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(170, 119, 68, 0.12);
    border: 1px solid rgba(170, 119, 68, 0.25);
    border-radius: 6px;
    color: #aa7744;
    font-size: 11px;
    font-family: 'IBM Plex Mono', monospace;
}

#image-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

#image-lightbox.open {
    display: flex;
}

#image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

#image-lightbox video {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    display: none;
}

#image-lightbox.video-mode img    { display: none; }
#image-lightbox.video-mode video  { display: block; }

#image-lightbox-close {
    position: fixed;
    top: 18px;
    right: 24px;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    user-select: none;
    opacity: 0.8;
}

#image-lightbox-close:hover {
    opacity: 1;
}


.stl-row-loose {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.stl-row-loose label {
    color: #888;
    font-size: 12px;
    min-width: 28px;
}

.stl-axis-labels {
    margin-bottom: 2px;
}

.stl-axis-label {
    width: 36px;
    color: #666;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    padding-left: 4px;
}

.stl-row-loose input[type="number"] {
    width: 36px;
    background: #1e1e1e;
    color: #d1d1d1;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    padding: 3px 4px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    text-align: center;
    outline: none;
    -moz-appearance: textfield;
}

.stl-row-loose input[type="number"]::-webkit-inner-spin-button,
.stl-row-loose input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stl-row-loose input[type="number"]:focus {
    border-color: #013566;
}

.stl-row-loose input[type="range"] {
    flex: 1;
    accent-color: #d1d1d1;
    height: 5px;
    cursor: pointer;
}

#stl-algorithm {
    flex: 1;
    padding: 8px 5px;
    background: transparent;
    color: #d1d1d1;
    border: none;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

#stl-depth-label {
    color: #d1d1d1;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    width: 36px;
    text-align: center;
    padding: 3px 4px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    cursor: text;
    overflow: hidden;
    white-space: nowrap;
}

#stl-depth-label:focus {
    border-color: #013566;
    outline: none;
}

#stl-scale-label {
    color: #d1d1d1;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    width: 36px;
    text-align: center;
    padding: 3px 4px;
    background: #1e1e1e;
    border: 1px solid #2d2d2d;
    border-radius: 4px;
    cursor: text;
    overflow: hidden;
    white-space: nowrap;
}

#stl-scale-label:focus {
    border-color: #013566;
    outline: none;
}

.btn-menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d2d2d;
    border-radius: 4px;
    cursor: pointer;
    color: #888;
    font-size: 14px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.btn-menu-icon img {
    width: 11px;
    height: 11px;
    display: block;
}

.btn-menu-icon:hover {
    color: #d1d1d1;
    background: #3d3d3d;
}

.btn-menu-icon.active {
    color: #ffff00;
    background: #3d3d3d;
}

#stl-voxel-info {
    color: #888;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    text-align: right;
    margin-bottom: 4px;
}

#btn-export-stl {
    margin-top: 8px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

#color-picker-panel {
    display: none;
}

#color-picker-panel.open {
    min-width: 180px;
}

#color-picker-panel.visible {
    display: block;
}

#color-picker-panel.open .panel-body {
    max-height: 260px;
    overflow-y: auto;
    padding: 0 10px 8px 10px;
}

#palette-strip {
    display: flex;
    gap: 2px;
    margin-bottom: 10px;
}

#palette-popup {
    position: fixed;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    width: 220px;
}

#palette-popup.visible {
    display: block;
}

#palette-popup-params {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.palette-param-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.palette-param-swatch {
    width: 100%;
    height: 32px;
    border-radius: 3px;
    border: none;
    padding: 0;
    cursor: pointer;
}

.palette-param-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.palette-param-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.palette-param-label {
    font-family: 'Public Sans', sans-serif;
    font-size: 9px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#palette-popup-presets {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.palette-preset {
    border-radius: 3px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
}

.palette-preset:hover {
    border-color: #555;
}

.palette-preset.selected {
    border-color: #fff;
}

.palette-preset canvas {
    display: block;
    width: 100%;
    height: 16px;
}

#palette-strip .palette-swatch {
    flex: 1;
    height: 12px;
    border-radius: 2px;
}


.color-picker-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 10px 0;
}

.color-picker-row label {
    color: #d1d1d1;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    transition: color 0.15s;
}

.color-picker-row.selected label {
    color: #ffff00;
}

.color-picker-row.selected input[type="color"] {
    outline: 2px solid #ffff00;
    outline-offset: 1px;
}

.color-picker-row input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 4px;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border: none;
    padding: 0;
    border-radius: 4px;
}

.color-picker-row input[type="color"]::-moz-color-swatch {
    border: none;
    padding: 0;
    border-radius: 4px;
}

.color-picker-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}
/* Audio panel header styling is with other panel headers above */

/* Preferences overlay + panel */
#prefs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

#prefs-overlay.open {
    display: flex;
}

#prefs-panel {
    background: #171717;
    border-radius: 8px;
    font-family: 'Public Sans', sans-serif;
    font-size: 12px;
    width: 67vw;
    height: 67vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

#btn-prefs-close {
    display: block;
}

#prefs-panel-header {
    color: #d1d1d1;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2d2d2d;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
}

#prefs-panel-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#prefs-list-col {
    width: 45%;
    border-right: 1px solid #2d2d2d;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

#prefs-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
}

#prefs-search-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

#prefs-search {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #bbb;
    font-size: 11px;
    font-family: 'Public Sans', sans-serif;
    padding: 5px 8px;
    outline: none;
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

#prefs-search:focus {
    border-color: #555;
}

#prefs-type-btns {
    display: flex;
    gap: 4px;
}

.prefs-btn-icon {
    display: flex;
}

.prefs-type-btn {
    flex: 1;
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #808080;
    font-size: 10px;
    font-family: 'Public Sans', sans-serif;
    padding: 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.prefs-type-btn:hover {
    border-color: #444;
    color: #999;
}

.prefs-type-btn.active {
    background: #222;
    border-color: #444;
    color: #d1d1d1;
}

#prefs-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 12px;
}

#prefs-detail {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#prefs-detail-placeholder {
    color: #444;
    font-size: 12px;
    margin-top: 4px;
}

#prefs-detail-name {
    font-size: 16px;
    color: #e0e0e0;
    margin-bottom: 6px;
    line-height: 1.3;
}

#prefs-detail-id {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #555;
    margin-bottom: 16px;
}

#prefs-detail-desc {
    font-size: 12px;
    color: #888;
    line-height: 1.7;
    white-space: pre-wrap;
}

.prefs-type-header {
    color: #666;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 12px 14px 4px;
}

.prefs-type-header:first-child {
    padding-top: 4px;
}

.prefs-vendor-header {
    color: #aaa;
    font-size: 11px;
    padding: 6px 14px 2px;
    letter-spacing: 0.02em;
}

.prefs-model-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    cursor: pointer;
    color: #bbb;
    user-select: none;
}

.prefs-model-row:hover {
    background: #222;
    color: #e0e0e0;
}

.prefs-model-row.selected {
    background: #1e1e1e;
    color: #fff;
}

.prefs-model-row input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #d1d1d1;
}

.prefs-model-name {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prefs-type-icon {
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prefs-type-icon[data-type="code"] {
    color: #6a9a78;
}

.prefs-type-icon[data-type="image"] {
    color: #6688bb;
}

.prefs-type-icon[data-type="video"] {
    color: #7a66aa;
}

.prefs-type-icon[data-type="audio"] {
    color: #aa7755;
}

.prefs-model-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #808080;
    flex-shrink: 0;
    width: 52px;
    text-align: right;
}

.prefs-model-price {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    color: #808080;
    flex-shrink: 0;
    width: 36px;
    text-align: center;
    cursor: default;
}

#prefs-count {
    font-size: 10px;
    color: #808080;
    flex-shrink: 0;
    width: 9ch;
    text-align: right;
    white-space: nowrap;
}

.prefs-loading {
    font-size: 12px;
    color: #555;
    padding: 12px 14px;
}

.prefs-ellipsis-row {
    padding: 4px 14px 4px 34px;
    font-size: 11px;
    color: #4a4a4a;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    user-select: none;
}

.prefs-ellipsis-row:hover {
    color: #888;
}

.prefs-newer-row {
    padding: 4px 14px 4px 34px;
    font-size: 11px;
    color: #3a5a7a;
    cursor: pointer;
    font-family: 'IBM Plex Mono', monospace;
    user-select: none;
}

.prefs-newer-row:hover {
    color: #6699cc;
}

.model-caps-sep {
    width: 1px;
    height: 10px;
    background: #333;
    margin: 0 2px;
    flex-shrink: 0;
}

/* Zero Data Retention badge — always rendered so rows line up across the
 * column. The shield shape is applied via CSS mask so background-color
 * controls the visible color: muted gray by default (no ZDR endpoint),
 * vivid green when .zdr is present (mirrors .model-cap.native). */
.model-zdr {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    background-color: #3a3a3a;
    -webkit-mask: url('icons/shield.svg') center/11px 11px no-repeat;
            mask: url('icons/shield.svg') center/11px 11px no-repeat;
}

.model-zdr.zdr {
    background-color: #4a9936;
}

/* When Web Search is on, ZDR is suppressed for the turn. Swap the green
 * shield-with-check for an orange shield-with-slash so the user sees that
 * the privacy posture for the next request differs from what the static
 * shield indicator would suggest. The slash extending past the shield
 * outline reads as "disabled" at small sizes, where a globe-inside reads
 * as a busy blob. The non-ZDR (gray) shields don't need to change —
 * they were already not promising ZDR. */
body.web-search-on .model-zdr.zdr {
    background-color: #9a7f1a;
    -webkit-mask-image: url('icons/shield-slash.svg');
            mask-image: url('icons/shield-slash.svg');
}

