@import "./progress-bar.css";
@import "./chat/chat.css";
@import "./export-panel.css";
@import "./mesh-import.css";

#ai-chat { --chat-basis: 280px; }

/* Chat panel styles — shared by every app frontend (served from common/web).
 * Companion to chat/chat.js. Each app keeps its own #ai-chat width via
 * --chat-basis, and its own send-code button variant, in its stylesheet. */

/* 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;
}

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

@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;
}

button:not(:disabled),
[role="button"]:not([aria-disabled="true"]),
.btn-regular,
.btn-icon {
    cursor: pointer;
}

#projects-page {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    flex-direction: column;
    color: #e6e6e6;
    background: #0b0b0b;
}

#projects-page.is-hidden {
    display: none;
}

.projects-header {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 42px;
    border-bottom: 1px solid #242424;
    background: #0e0e0e;
}

.projects-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

#projects-storage-mode {
    color: #777;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.projects-brand h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.projects-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 30px 42px 64px;
}

.projects-section {
    max-width: 1500px;
    margin: 0 auto 38px;
}

.projects-section h2 {
    margin: 0 0 14px;
    color: #aaa;
    font-size: 13px;
    font-weight: 500;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 22px 18px;
}

.project-create-grid {
    grid-template-columns: repeat(2, minmax(240px, 330px));
}

.project-card {
    min-width: 0;
    padding: 0;
    border: 1px solid #292929;
    border-radius: 10px;
    color: #dedede;
    background: #141414;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.project-card:hover {
    border-color: #555;
    background: #191919;
    transform: translateY(-2px);
}

.project-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    display: grid;
    place-items: center;
    border-bottom: 1px solid #292929;
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
    background-size: 24px 24px;
}

.project-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.project-thumb-placeholder {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid #3a3a3a;
    border-radius: 14px;
    color: #777;
    font-size: 23px;
}

.project-card-label {
    display: block;
    padding: 11px 12px 12px;
    overflow: hidden;
    font: 12px 'IBM Plex Mono', monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-create-card {
    min-height: 92px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border-style: dashed;
}

.project-create-icon {
    width: 42px;
    height: 42px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #013566;
    font-size: 24px;
}

.project-create-card strong,
.project-create-card small {
    display: block;
}

.project-create-card strong {
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
}

.project-create-card small {
    color: #777;
    font-size: 11px;
}

.projects-empty {
    min-height: 108px;
    display: grid;
    place-items: center;
    grid-column: 1 / -1;
    border: 1px dashed #2a2a2a;
    border-radius: 10px;
    color: #666;
    font-size: 12px;
}

.project-create-panel {
    width: min(430px, calc(100vw - 32px));
    border: 1px solid #343434;
    border-radius: 12px;
    color: #ddd;
    background: #141414;
    box-shadow: 0 24px 80px rgba(0,0,0,.65);
    overflow: hidden;
}

.project-create-panel.tree-mode {
    width: min(900px, calc(100vw - 32px));
}

.project-create-panel.tree-mode .project-create-body {
    max-height: min(620px, calc(100vh - 190px));
    overflow-y: auto;
}

#project-create-overlay {
    z-index: 900;
}

.project-create-header,
.project-create-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
}

.project-create-header {
    border-bottom: 1px solid #292929;
}

.project-create-header h2 {
    margin: 3px 0 0;
    font-size: 18px;
    font-weight: 500;
}

#project-create-eyebrow {
    color: #777;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

#btn-project-create-close {
    border: 0;
    color: #777;
    background: transparent;
    cursor: pointer;
}

.project-create-body {
    display: grid;
    gap: 17px;
    padding: 20px;
}

.project-create-body label {
    display: grid;
    gap: 7px;
    color: #aaa;
    font-size: 12px;
}

.project-create-body label[hidden] {
    display: none;
}

.project-create-body label span {
    display: flex;
    justify-content: space-between;
}

.project-create-body em,
.project-create-body small {
    color: #666;
    font-size: 10px;
    font-style: normal;
}

.project-create-body input {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #363636;
    border-radius: 6px;
    padding: 10px;
    color: #eee;
    background: #0d0d0d;
    font: 12px 'IBM Plex Mono', monospace;
}

.project-create-body input:focus {
    border-color: #356da0;
    outline: none;
}

#project-create-tree-fields {
    display: grid;
    gap: 10px;
}

#project-create-tree-fields[hidden] {
    display: none;
}

.project-tree-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    color: #aaa;
    font-size: 12px;
}

.project-tree-heading small {
    text-align: right;
}

.project-tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 12px;
}

.project-tree-rows {
    display: grid;
    gap: 6px;
}

.project-tree-rows-empty {
    padding: 13px;
    border: 1px dashed #2a2a2a;
    border-radius: 7px;
    color: #666;
    font-size: 11px;
    text-align: center;
}

.project-tree-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #292929;
    border-radius: 7px;
    background: #111;
}

.project-tree-row-order,
.project-branch-order {
    width: 22px;
    height: 22px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #013566;
    font: 11px 'IBM Plex Mono', monospace;
}

.project-tree-row-id {
    min-width: 120px;
    flex: 1;
    overflow: hidden;
    font: 11px 'IBM Plex Mono', monospace;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-create-body .project-tree-row-count {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
}

.project-create-body .project-tree-row-count input {
    width: 58px;
    padding: 6px;
    text-align: center;
}

.project-tree-row-actions {
    display: flex;
    gap: 4px;
}

.project-tree-row-actions button {
    border: 1px solid #353535;
    border-radius: 5px;
    padding: 6px 8px;
    color: #aaa;
    background: #1a1a1a;
    font: 10px 'Public Sans', sans-serif;
}

.project-tree-row-actions button:disabled {
    opacity: .35;
}

.project-branch-choice {
    position: relative;
}

.project-branch-choice.selected {
    border-color: #356da0;
}

.project-branch-choice.missing {
    border-style: dashed;
    opacity: .6;
}

.project-branch-select {
    width: 100%;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    text-align: left;
}

.project-branch-order {
    position: absolute;
    top: 8px;
    left: 8px;
}

#project-create-error {
    min-height: 15px;
    color: #ff8a7a;
    font-size: 11px;
}

.project-create-actions {
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid #292929;
}

.project-create-actions button,
#workspace-nav button {
    border: 1px solid #353535;
    border-radius: 7px;
    padding: 8px 12px;
    color: #bbb;
    background: #1a1a1a;
    cursor: pointer;
    font: 12px 'Public Sans', sans-serif;
}

#btn-project-create-submit {
    border-color: #174d7f;
    color: #fff;
    background: #013566;
}

.project-create-actions button:disabled,
#btn-project-create-close:disabled {
    cursor: default;
    opacity: .45;
}

#workspace-nav {
    position: absolute;
    bottom: 10px;
    left: 50%;
    z-index: 105;
    display: flex;
    gap: 5px;
    padding: 4px;
    border-radius: 10px;
    background: #171717;
    transform: translateX(-50%);
    backdrop-filter: blur(10px);
}

#viewer-status-bar {
    position: absolute;
    right: 10px;
    bottom: 10px;
    z-index: 105;
    display: flex;
    align-items: center;
    gap: 6px;
}

#viewer-status-bar .sync-status-container,
#viewer-status-bar #ws-status-badge {
    margin: 0;
}

#viewer-status-bar #btn-sync-cloud {
    padding: 5px 9px;
}

#workspace-nav button {
    border-color: transparent;
    padding: 6px 10px;
    background: transparent;
}

#workspace-nav button:hover,
#workspace-nav button.active {
    color: #fff;
    background: #292929;
}

#ai-chat.is-collapsed,
#editor-container.is-collapsed,
#ai-chat.is-collapsed + .splitter,
#editor-container.is-collapsed + .splitter {
    display: none;
}

@media (max-width: 700px) {
    .projects-header { padding: 0 20px; }
    .projects-scroll { padding: 24px 20px 48px; }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .project-create-grid { grid-template-columns: 1fr; }
    #projects-storage-mode { display: none; }
}

/* 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;
}


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

#editor-container {
    flex: 0 0 320px;
    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;
}



.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;
}


#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;
}


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



























































#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: 10px 13px;
    border: 1px solid #333;
    font-size: 12px;
    color: #d1d1d1;
    border-radius: 9px;
    z-index: 1000;
    font-family: 'Public Sans', sans-serif;
    transform: translateY(-150%);
    opacity: 0;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

#progress-bars {
    position: fixed;
    bottom: 58px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.progress-row {
    width: 290px;
    padding: 10px 12px;
    border: 1px solid #303030;
    border-radius: 9px;
    color: #c5c5c5;
    background: rgba(23, 23, 23, 0.94);
    font-family: 'Public Sans', sans-serif;
    font-size: 11px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(10px);
}

.progress-label {
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-eta {
    color: #777;
    font-size: 10px;
    margin-bottom: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 12px;
}

.progress-track {
    height: 3px;
    background: #303030;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #426b91;
    border-radius: 2px;
    transition: width 0.15s ease-out;
}

.progress-row.indeterminate .progress-fill {
    width: 40%;
    animation: progress-indeterminate 1.4s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

#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;
}

.editor-tab-container {
    display: flex;
    margin-right: 0;
}

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

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

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

.btn-switch:first-child {
    border-radius: 8px 0 0 8px;
}

.btn-switch:last-child {
    border-radius: 0 8px 8px 0;
}

.btn-switch:only-child {
    border-radius: 8px;
}

/* Inline-error hint: when the inactive tab has a pending diagnostic, glow
   its label red so the user knows where to look. */
.btn-switch.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;
}

/* Section header inside a menu dropdown — same vertical rhythm as
 * .omega-menu-item but inert (no hover, no pointer). Used by the
 * "Libraries" label above the per-library submenu items. */
.omega-menu-header {
    display: flex;
    align-items: center;
    padding: 5px 12px;
    color: #888;
    font-size: 11px;
    user-select: none;
    cursor: default;
}

/* Indented child of a menu header — picks up .omega-menu-item styling
 * and shifts left padding so the relationship reads as a sub-list. */
.omega-menu-submenu-item {
    padding-left: 24px;
}

#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;
    align-items: flex-start;
    gap: 6px;
}

.resolution-controls {
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
    background: #171717;
}

.resolution-btn {
    min-width: 28px;
    padding: 5px 4px;
    border: 0;
    border-radius: 6px;
    color: #888;
    background: transparent;
    font: 11px 'Public Sans', sans-serif;
}

.resolution-btn:hover {
    color: #fff;
}

.resolution-btn.active {
    color: #fff;
    background: #3a3a3a;
}

#transform-align-panel,
#central-sprue-panel {
    position: absolute;
    top: 10px;
    left: 58px;
    z-index: 110;
    width: 190px;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #171717;
    color: #d1d1d1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    font: 12px 'Public Sans', sans-serif;
}

#transform-align-panel[hidden],
#central-sprue-panel[hidden],
#transform-align-axes[hidden],
#transform-align-center[hidden] {
    display: none;
}

.transform-align-title {
    margin-bottom: 7px;
    color: #bababa;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#transform-align-status {
    min-height: 32px;
    margin-bottom: 8px;
    line-height: 1.35;
}

#transform-align-panel button,
#central-sprue-panel button {
    border: 1px solid #353535;
    border-radius: 7px;
    background: #1a1a1a;
    color: #bbb;
    padding: 7px 10px;
    cursor: pointer;
    font: 12px 'Public Sans', sans-serif;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

#transform-align-panel button:hover:not(:disabled),
#central-sprue-panel button:hover:not(:disabled) {
    border-color: #555;
    background: #272727;
    color: #fff;
}

#transform-align-panel button:focus-visible,
#central-sprue-panel button:focus-visible {
    border-color: #356da0;
    outline: none;
}

#transform-align-panel #transform-align-center,
#central-sprue-panel #central-sprue-add {
    border-color: #174d7f;
    background: #013566;
    color: #fff;
}

#transform-align-panel #transform-align-center:hover,
#central-sprue-panel #central-sprue-add:hover:not(:disabled) {
    border-color: #356da0;
    background: #174d7f;
}

#transform-align-center {
    width: 100%;
    margin-bottom: 7px;
}

#transform-align-axes > span {
    display: block;
    margin-bottom: 5px;
    color: #888;
}

.transform-align-axis-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 7px;
}

.transform-align-axis-grid button[data-axis$="x"] { color: #df5d61; }
.transform-align-axis-grid button[data-axis$="y"] { color: #5bd572; }
.transform-align-axis-grid button[data-axis$="z"] { color: #63a9e9; }

#transform-align-cancel {
    width: 100%;
}

#central-sprue-panel {
    width: 250px;
}

.central-sprue-width-row {
    display: grid;
    grid-template-columns: 42px 1fr 75px;
    align-items: center;
    gap: 7px;
}

.central-sprue-width-row span {
    color: #888;
    white-space: nowrap;
}

.central-sprue-scale {
    display: flex;
    justify-content: space-between;
    margin: 2px 82px 10px 49px;
    color: #777;
    font-size: 9px;
}

.central-sprue-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.central-sprue-actions button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.central-sprue-actions button {
    flex: 1;
}

/* ── Casting simulation panel ── */

#casting-panel {
    position: absolute;
    top: 10px;
    left: 58px;
    z-index: 110;
    width: 218px;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    background: #171717;
    color: #d1d1d1;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
    font: 12px 'Public Sans', sans-serif;
}

#casting-panel[hidden],
#casting-results[hidden] {
    display: none;
}

.casting-title {
    position: relative;
    margin-bottom: 8px;
    color: #bababa;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

.casting-row label {
    flex: 0 0 52px;
    color: #888;
}

.casting-row select {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid #3b3b3b;
    border-radius: 5px;
    background: #252525;
    color: #d1d1d1;
    padding: 3px 4px;
    font: 11px 'Public Sans', sans-serif;
}

#casting-panel button {
    width: 100%;
    margin-top: 2px;
    border: 1px solid #3b3b3b;
    border-radius: 5px;
    background: #252525;
    color: #d1d1d1;
    padding: 5px 8px;
    cursor: pointer;
}

#casting-panel button:hover:not(:disabled) {
    background: #333;
    color: #fff;
}

#casting-panel button:disabled {
    opacity: 0.55;
    cursor: default;
}

#casting-status {
    margin-top: 7px;
    line-height: 1.35;
    color: #9a9a9a;
    font-size: 11px;
}

#casting-results {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid #2c2c2c;
}

/* Legend ramp. The gradient itself is set inline per field, generated from the
   same stops as gsl_castingColor() in viewer.js so the two cannot drift. */
#casting-legend .casting-ramp {
    height: 9px;
    border-radius: 3px;
}

#casting-legend .casting-threshold {
    margin-top: 3px;
    color: #e08a5a;
    font-size: 10px;
}

#casting-legend .casting-range {
    display: flex;
    justify-content: space-between;
    margin-top: 3px;
    color: #888;
    font-size: 10px;
}

#casting-summary {
    margin-top: 7px;
    color: #7f7f7f;
    font-size: 10px;
    line-height: 1.45;
}








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

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

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

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

#scene-panel.open #scene-panel-header:hover,
#field-panel.open #field-panel-header:hover,
#stl-bounds-panel.open #stl-bounds-header:hover,
#mesh-import-panel.open #mesh-import-header:hover,
#color-picker-panel.open #color-picker-header:hover,
#slider-panel.open #slider-panel-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;
}

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

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

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

#documents-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 900;
    width: 300px;
    max-width: min(86vw, 340px);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #111;
    border-right: 1px solid #2a2a2a;
    box-shadow: 14px 0 34px rgba(0,0,0,0.45);
    transform: translateX(-102%);
    transition: transform 0.18s ease;
    font-family: 'Public Sans', sans-serif;
}

#documents-sidebar.open {
    transform: translateX(0);
}

#documents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 14px;
    color: #d8d8d8;
    border-bottom: 1px solid #262626;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#documents-header .panel-close {
    display: block;
}

#documents-body {
    padding: 12px;
    overflow-y: auto;
    color: #d1d1d1;
}

#document-fields {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

#document-fields label {
    display: grid;
    gap: 4px;
    color: #888;
    font-size: 11px;
}

#document-fields input {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
    border-radius: 5px;
    padding: 7px 8px;
    font: 12px 'IBM Plex Mono', monospace;
}

#document-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

#document-actions button,
#btn-document-import-mesh {
    border: 1px solid #333;
    border-radius: 5px;
    background: #1d1d1d;
    color: #d8d8d8;
    padding: 7px 9px;
    font-size: 12px;
    cursor: pointer;
}

#document-actions button:hover,
#btn-document-import-mesh:hover {
    border-color: #555;
    background: #272727;
    color: #fff;
}

#document-actions button:disabled {
    border-color: #222;
    background: #151515;
    color: #555;
    cursor: not-allowed;
}

#btn-document-import-mesh {
    width: 100%;
    margin-bottom: 8px;
}

.mesh-import-status {
    min-height: 16px;
    margin: 0 0 12px;
    color: #8a8a8a;
    font-size: 11px;
    line-height: 1.35;
    word-wrap: break-word;
}

.mesh-import-status.error {
    color: #ff8a7a;
}

#document-kind {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    margin-bottom: 10px;
    border: 1px solid #333;
    border-radius: 5px;
    overflow: hidden;
}

.document-kind-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    background: #1a1a1a;
    color: #9a9a9a;
    padding: 7px 6px;
    font-size: 12px;
    cursor: pointer;
}

.document-kind-icon {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    opacity: 0.85;
}

.document-kind-option + .document-kind-option {
    border-left: 1px solid #333;
}

.document-kind-option:hover {
    background: #232323;
    color: #d8d8d8;
}

.document-kind-option.active {
    background: #2c2c2c;
    color: #fff;
}

.documents-list-title {
    margin: 12px 0 7px;
    color: #8f8f8f;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.documents-list-title:first-of-type {
    margin-top: 2px;
}

.documents-list {
    display: grid;
    gap: 6px;
}

.document-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    border: 1px solid #2d2d2d;
    border-left: 3px solid #555;
    border-radius: 4px;
    background: #141414;
    color: #d4d4d4;
    padding: 9px 10px;
    text-align: left;
    font: 12px 'IBM Plex Mono', monospace;
    cursor: pointer;
}

.document-list-item:hover,
.document-list-item.active {
    border-color: #555;
    border-left-color: #9a9a9a;
    background: #202020;
}

.document-empty {
    color: #777;
    font-size: 12px;
    padding: 8px 2px;
}

/* Drag-and-drop zone overlays — each column shows what dropping there does, so
 * the active target is unambiguous: attach (left) vs. load GSL (middle) vs.
 * import a mesh (right; that overlay is in the shared mesh-import.css). */
#editor-container.editor-dragover::after {
    content: "";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 16px;
    background: rgba(30, 100, 200, 0.12);
    border: 2px dashed rgba(120, 180, 255, 0.8);
    color: #cfe3ff;
    font: 600 16px 'Public Sans', sans-serif;
    pointer-events: none;
    z-index: 5;
}

#editor-container.editor-dragover::after { content: "Drop a .gsl file to load it"; }

/* Slider rows: name on the left, range + numeric input on the right.
 * The numeric input accepts values outside [min, max] so the user can
 * type a precise value; the range visually clamps but doesn't lose the
 * typed value. */
.slider-row {
    /* 22px control cell sits between the name and the range slider —
       animated rows host the play/pause toggle there, static rows host
       an invisible spacer — so the toggle eats into the parameter
       name's space rather than the slider's, and every row's range /
       number column lines up across the panel. */
    display: grid;
    grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1.4fr) 56px;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}
.slider-row .slider-play-btn {
    background: transparent;
    border: 1px solid #2a2a2a;
    border-radius: 3px;
    color: #d1d1d1;
    font-size: 11px;
    line-height: 1;
    padding: 1px 0;
    width: 22px;
    height: 18px;
    cursor: pointer;
}
.slider-row .slider-play-btn:hover {
    border-color: #4488ee;
    color: #ffffff;
}

/* Transport cluster below the Time slider: the .anim-btn flex-grow
   rule spreads rewind / play-pause / fast-forward across the row, and
   the end-time number input on the right lines up with the per-slider
   value column. */
#anim-controls-row .anim-btns {
    flex: 1;
}

/* Inside the Parameters panel, widen the field-panel-label number
   inputs (Time, end-time) to match the slider grid's 56px value
   column so anim rows align with slider rows. box-sizing makes the
   declared width inclusive of padding + border, so the input fits
   the grid cell exactly. */
#slider-panel .field-panel-label,
.central-sprue-width-row .field-panel-label {
    box-sizing: border-box;
    width: 56px;
    text-align: right;
    padding: 3px 6px;
}
.slider-row .slider-label {
    color: #d1d1d1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.slider-row input[type="range"],
.central-sprue-width-row input[type="range"] {
    width: 100%;
    accent-color: #4488ee;
}
/* Number inputs across the Parameters panel — slider rows, Time row,
   and end-time — share the .field-panel-label look. Hide the native
   spin buttons (Chromium + Firefox) so the right-aligned monospace
   number stays clean. */
#slider-panel input[type="number"],
.central-sprue-width-row input[type="number"] {
    -moz-appearance: textfield;
}
#slider-panel input[type="number"]::-webkit-outer-spin-button,
#slider-panel input[type="number"]::-webkit-inner-spin-button,
.central-sprue-width-row input[type="number"]::-webkit-outer-spin-button,
.central-sprue-width-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mesh-hint {
    font-size: 11px;
    color: #8a8a8a;
    margin-top: 10px;
    line-height: 1.4;
    word-wrap: break-word;
}
.mesh-hint code {
    color: #aaa;
    background: #1e1e1e;
    padding: 1px 3px;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.4;
}
/* Alternate mesh() placement forms, listed under the first line. */
.mesh-hint-form {
    display: block;
    padding-left: 2.5em;
    margin-top: 2px;
}


#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-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;
}

#canvas-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    background: transparent;
    cursor: pointer;
}

#canvas-container input[type="range"]::-webkit-slider-runnable-track {
    height: 3px;
    border-radius: 999px;
    background: #3a3a3a;
}

#canvas-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    margin-top: -4.5px;
    border: 2px solid #d1d1d1;
    border-radius: 50%;
    background: #171717;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

#canvas-container input[type="range"]::-moz-range-track {
    height: 3px;
    border-radius: 999px;
    background: #3a3a3a;
}

#canvas-container input[type="range"]::-moz-range-thumb {
    width: 8px;
    height: 8px;
    border: 2px solid #d1d1d1;
    border-radius: 50%;
    background: #171717;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
}

#canvas-container input[type="range"]:focus-visible {
    outline: none;
}

#canvas-container input[type="range"]:focus-visible::-webkit-slider-thumb {
    border-color: #fff;
    box-shadow: 0 0 0 3px rgba(53, 109, 160, 0.35);
}

#canvas-container input[type="range"]:disabled {
    cursor: default;
    opacity: 0.4;
}

#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;
}




























/* 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);
}























































.thmub-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;
}



























.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,
#scene-bbox-info,
#scene-grid-info {
    color: #888;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    text-align: right;
    margin-bottom: 4px;
}

#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;
}

















































.sync-status-container {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: #ccc;
    padding: 3px 8px;
    border-radius: 12px;
    background: #171717;
    border: 1px solid #333;
}
.sync-status-saved,
.sync-status-offline {
    color: #999;
}
.sync-status-synced {
    color: #8ca895;
}
.sync-status-changes,
.sync-status-syncing {
    color: #8ca9c4;
}
.sync-status-conflict {
    color: #c5a96e;
    cursor: pointer;
}
.sync-status-failed {
    color: #c98b86;
}
.sync-status-icon-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 5px;
}
.sync-status-saved .sync-status-icon-dot,
.sync-status-offline .sync-status-icon-dot {
    background: #777;
}
.sync-status-synced .sync-status-icon-dot {
    background: #678474;
}
.sync-status-changes .sync-status-icon-dot,
.sync-status-syncing .sync-status-icon-dot {
    background: #5d7d9b;
}
.sync-status-conflict .sync-status-icon-dot {
    background: #9a7f4b;
}
.sync-status-failed .sync-status-icon-dot {
    background: #995d59;
}
.sync-status-syncing .sync-status-icon-dot {
    animation: ws-pulse 1.2s infinite ease-in-out;
}
.conflict-dialog {
    width: min(460px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid #383838;
    border-radius: 12px;
    color: #ddd;
    background: #171717;
    box-shadow: 0 24px 80px rgba(0,0,0,.65);
}
.conflict-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #2d2d2d;
}
.conflict-panel-header span {
    color: #777;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.conflict-panel-header h2 {
    margin: 4px 0 0;
    font-size: 17px;
    font-weight: 500;
}
.conflict-panel-close {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #999;
}
.conflict-panel-close:hover {
    color: #fff;
}
.conflict-panel-body {
    padding: 20px;
    font-size: 12px;
}
.conflict-item {
    display: grid;
    gap: 14px;
}
.conflict-item-title {
    padding: 10px;
    border: 1px solid #303030;
    border-radius: 6px;
    color: #ccc;
    background: #111;
    font: 11px 'IBM Plex Mono', monospace;
    word-break: break-all;
}
.conflict-item-details {
    color: #888;
    font-size: 11px;
    line-height: 1.4;
}
.conflict-item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.conflict-btn {
    padding: 8px 11px;
    font-size: 12px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #eee;
    cursor: pointer;
    text-align: center;
}
.conflict-btn:hover {
    background: #3a3a3a;
    color: #fff;
}
.conflict-btn-overwrite {
    border-color: #4b6680;
    color: #dbe8f3;
    background: #24394c;
}
.conflict-btn-overwrite:hover {
    background: #2d4a63;
}

/* WebSocket Connection Status Badge */
#ws-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    user-select: none;
    transition: all 0.2s ease;
    margin-right: 6px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a3a3a3;
}

#ws-status-badge .ws-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

#ws-status-badge.ws-status-online .ws-status-dot {
    background-color: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

#ws-status-badge.ws-status-online {
    color: #a3a3a3;
}

#ws-status-badge.ws-status-connecting .ws-status-dot {
    background-color: #eab308;
    box-shadow: 0 0 6px rgba(234, 179, 8, 0.5);
    animation: ws-pulse 1.2s infinite ease-in-out;
}

#ws-status-badge.ws-status-connecting {
    color: #eab308;
    border-color: rgba(234, 179, 8, 0.3);
}

#ws-status-badge.ws-status-offline {
    color: #f87171;
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    cursor: pointer;
}

#ws-status-badge.ws-status-offline:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

#ws-status-badge.ws-status-offline .ws-status-dot {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

@keyframes ws-pulse {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Operation Conflict Confirmation Modal */
.webdm-conflict-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    font-family: inherit;
    user-select: none;
}

.webdm-conflict-modal {
    width: 420px;
    max-width: 90vw;
    background-color: #1e222b;
    border: 1px solid rgba(0, 255, 128, 0.4);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    padding: 24px;
    box-sizing: border-box;
    color: #e2e8f0;
}

.webdm-conflict-modal h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #55efc4;
}

.webdm-conflict-modal p {
    margin: 0 0 20px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #cbd5e1;
}

.webdm-conflict-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.webdm-conflict-modal-btn-keep {
    padding: 8px 16px;
    background-color: transparent;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 150ms ease;
}

.webdm-conflict-modal-btn-keep:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.webdm-conflict-modal-btn-cancel {
    padding: 8px 16px;
    background-color: #e17055;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background-color 150ms ease;
}

.webdm-conflict-modal-btn-cancel:hover {
    background-color: #d63031;
}
