/* worldengine.css — World Engine editor styles (no layout framework).
   Extracted from goldenlayout-amia-theme.css; Golden Layout rules dropped. */

/* ── Interaction editor specific ─────────────────────────────────── */
.interaction-editor__workspace {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.interaction-editor__panel,
.we-editor__panel {
    position: absolute;
    overflow: hidden;
    display: none; /* Shown by GL bridge when bound */
}

.interaction-editor__panel--scrollable,
.we-editor__panel--scrollable {
    overflow-y: auto;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   World Engine Editor — Unified Layout
   ═══════════════════════════════════════════════════════════════════ */

.we-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    background: var(--bg-dark, #1c1b19);
    color: var(--text-primary, #d0ccc2);
    overflow: hidden;
}

/* ── Toolbar ─────────────────────────────────────────────────────── */
.we-editor__toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
    background: var(--bg-header, #3a3520);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    z-index: 10;
}

.we-editor__toolbar-brand {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--accent, #c9a84c);
    white-space: nowrap;
}

.we-editor__endpoint-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}
.we-editor__endpoint-selector label {
    font-size: 0.8rem;
    color: var(--text-secondary, #8a8477);
    margin-bottom: 0;
    white-space: nowrap;
}
.we-editor__endpoint-selector select {
    width: 180px;
    background: var(--bg-input, #33302a);
    border: 1px solid var(--border-subtle, #3e3a30);
    color: var(--text-primary, #d0ccc2);
    font-size: 0.8rem;
}

.we-editor__breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary, #8a8477);
}
.we-editor__breadcrumb-sep {
    opacity: 0.5;
}

.we-editor__toolbar-spacer {
    flex: 1;
}

/* ── Body (activity bar + list + editor) ─────────────────────────── */
.we-editor__body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Activity bar ────────────────────────────────────────────────── */
.we-editor__activity-bar {
    display: flex;
    flex-direction: column;
    width: 48px;
    min-width: 48px;
    background: var(--bg-dark, #1c1b19);
    border-right: 1px solid var(--border-subtle, #3e3a30);
    padding-top: 4px;
    overflow-y: auto;
    overflow-x: hidden;
}

.we-editor__activity-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #8a8477);
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    transition: color 150ms ease, background 150ms ease;
}
.we-editor__activity-btn:hover {
    color: var(--text-primary, #d0ccc2);
    background: var(--bg-input, #33302a);
}
.we-editor__activity-btn--active {
    color: var(--accent, #c9a84c);
}
.we-editor__activity-btn--active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--accent, #c9a84c);
    border-radius: 0 2px 2px 0;
}

/* ── List panel ──────────────────────────────────────────────────── */
.we-editor__list-panel {
    display: flex;
    flex-direction: column;
    width: 250px;
    min-width: 200px;
    max-width: 350px;
    background: var(--bg-card, #26241f);
    border-right: 1px solid var(--border-subtle, #3e3a30);
    overflow: hidden;
}

.we-editor__list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #d0ccc2);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
}
.we-editor__list-header .btn-link {
    color: var(--text-secondary, #8a8477);
    padding: 0;
    line-height: 1;
}

.we-editor__list-body {
    flex: 1;
    overflow-y: auto;
}

/* ── Editor area ─────────────────────────────────────────────────── */
.we-editor__editor-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ── Tab bar ─────────────────────────────────────────────────────── */
.we-editor__tab-bar {
    display: flex;
    align-items: stretch;
    height: 32px;
    min-height: 32px;
    background: var(--bg-dark, #1c1b19);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    overflow-x: auto;
    overflow-y: hidden;
}

.we-editor__tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    font-size: 0.8rem;
    color: var(--text-secondary, #8a8477);
    background: var(--bg-input, #33302a);
    border-right: 1px solid var(--border-subtle, #3e3a30);
    cursor: pointer;
    white-space: nowrap;
    transition: color 150ms ease, background 150ms ease;
}
.we-editor__tab:hover {
    color: var(--text-primary, #d0ccc2);
    background: var(--bg-card, #26241f);
}
.we-editor__tab--active {
    color: var(--text-primary, #d0ccc2);
    background: var(--bg-card, #26241f);
    border-bottom: 2px solid var(--accent, #c9a84c);
}
.we-editor__tab-title {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.we-editor__tab-dirty {
    color: var(--accent, #c9a84c);
    font-size: 0.6rem;
    margin-left: 2px;
}
.we-editor__tab-close {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary, #8a8477);
    padding: 0 2px;
    margin-left: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 150ms ease;
}
.we-editor__tab-close:hover {
    opacity: 1;
    color: var(--text-primary, #d0ccc2);
}

/* ── Welcome / empty state ───────────────────────────────────────── */
.we-editor__welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    opacity: 0.6;
}
.we-editor__welcome h2 {
    color: var(--accent, #c9a84c);
    margin-bottom: 0.5rem;
}

/* ── List panel search ───────────────────────────────────────────── */
.we-editor__list-search {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
}
.we-editor__list-search input {
    background: var(--bg-input, #33302a);
    border: 1px solid var(--border-subtle, #3e3a30);
    color: var(--text-primary, #d0ccc2);
    font-size: 0.8rem;
}
.we-editor__list-search input::placeholder {
    color: var(--text-secondary, #8a8477);
}
.we-editor__list-search input:focus {
    border-color: var(--accent, #c9a84c);
    box-shadow: 0 0 0 1px var(--accent, #c9a84c);
    outline: none;
}

/* ── List items ──────────────────────────────────────────────────── */
.we-editor__list-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 6px 10px;
    border: none;
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    background: transparent;
    color: var(--text-primary, #d0ccc2);
    text-align: left;
    cursor: pointer;
    transition: background 150ms ease;
}
.we-editor__list-item:hover {
    background: var(--bg-input, #33302a);
}
.we-editor__list-item-name {
    font-size: 0.82rem;
    line-height: 1.3;
}
.we-editor__list-item-key {
    font-size: 0.7rem;
    color: var(--text-secondary, #8a8477);
    opacity: 0.7;
}

.we-editor__list-load-more {
    display: block;
    width: 100%;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--accent, #c9a84c);
    font-size: 0.8rem;
    cursor: pointer;
    text-align: center;
    transition: background 150ms ease;
}
.we-editor__list-load-more:hover {
    background: var(--bg-input, #33302a);
}

/* ── Editor content area ─────────────────────────────────────────── */
.we-editor__content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
}

.we-editor__tab-loading,
.we-editor__tab-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-secondary, #8a8477);
    font-size: 0.9rem;
}
.we-editor__tab-error {
    color: var(--text-primary, #d0ccc2);
}

.we-editor__entity-editor {
    padding: 16px 24px;
    max-width: 900px;
    height: 100%;
    overflow-y: auto;
}

/* ── Entity form (property grid) ─────────────────────────────────── */
.we-entity-form {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.we-entity-form__field {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: background 100ms ease;
}
.we-entity-form__field:hover {
    background: var(--bg-input, #33302a);
}

.we-entity-form__field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary, #8a8477);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 2px;
    margin-bottom: 0;
}

.we-entity-form__field span {
    font-size: 0.85rem;
    color: var(--text-primary, #d0ccc2);
    word-break: break-word;
}

.we-entity-form__content-preview {
    font-size: 0.82rem;
    color: var(--text-primary, #d0ccc2);
    white-space: pre-wrap;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-input, #33302a);
    border-radius: 4px;
    border: 1px solid var(--border-subtle, #3e3a30);
}

/* ═══════════════════════════════════════════════════════════════════
   Region Graph — Golden Layout Integration
   ═══════════════════════════════════════════════════════════════════ */

/* "Open Region Graph" button in list panel */
.we-editor__list-graph-btn {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
}

/* Full graph wrapper — fills the entire editor area */
.we-editor__region-graph-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* Loading overlay in graph area */
.we-editor__region-graph-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-secondary, #a09882);
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(26, 24, 19, 0.8);
}

/* ── Region Graph Panel (Cytoscape + toolbar) ──────────────────── */

.we-rg-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-header, #1c1b19);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    flex-shrink: 0;
    min-height: 34px;
    overflow-x: auto;
}

.we-rg-toolbar__group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.we-rg-toolbar__divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle, #3e3a30);
    flex-shrink: 0;
}

.we-rg-toolbar__legend {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    flex-shrink: 1;
    min-width: 0;
}

.we-rg-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--text-secondary, #a09882);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.we-rg-legend-item:hover {
    color: var(--text-primary, #d0ccc2);
}

.we-rg-legend-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.we-rg-info-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 3px 10px;
    font-size: 0.75rem;
    color: var(--text-secondary, #a09882);
    background: var(--bg-surface, #201e1a);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    flex-shrink: 0;
}

/* Cytoscape container — must have explicit dimensions */
.we-rg-cytoscape {
    flex: 1;
    min-height: 0;
    width: 100%;
    background: #1a1a1a;
}

/* ── Region Properties Panel ──────────────────────────────────── */

.we-rg-props {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card, #26241f);
    overflow: hidden;
}

.we-rg-props__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    background: var(--bg-header, #1c1b19);
    flex-shrink: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #d0ccc2);
}

.we-rg-props__body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
}

.we-rg-props__footer {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--border-subtle, #3e3a30);
    flex-shrink: 0;
    justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════════
   Interaction Editor (embedded in World Engine Editor)
   ═══════════════════════════════════════════════════════════════ */

.we-editor__interaction-editor-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Toolbar */
.we-ie-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--bg-card, #1e1b16);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    flex-shrink: 0;
    height: 42px;
    min-height: 42px;
}

.we-ie-toolbar__title {
    margin: 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.we-ie-toolbar__group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.we-ie-toolbar__divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle, #3e3a30);
    flex-shrink: 0;
}

/* Layout area — positioned wrapper for GL root + panels */
.we-ie-layout-area {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Loading overlay */
.we-ie-loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-secondary, #a09882);
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(26, 24, 19, 0.8);
}



/* ═══════════════════════════════════════════════════════════════
   Codex Editor — Full panel takeover (mirrors Interaction Editor)
   ═══════════════════════════════════════════════════════════════ */

.we-editor__codex-editor-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Toolbar */
.we-ce-toolbar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--bg-card, #1e1b16);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
    flex-shrink: 0;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    overflow: hidden;
    width: 100%;
}

.we-ce-toolbar__title {
    margin: 0;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.we-ce-toolbar__divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle, #3e3a30);
    flex-shrink: 0;
}

/* Layout area — positioned wrapper for GL root + panels */
.we-ce-layout-area {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Loading overlay */
.we-ce-loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--text-secondary, #a09882);
    position: absolute;
    inset: 0;
    z-index: 5;
    background: rgba(26, 24, 19, 0.8);
}

/* ═══════════════════════════════════════════════════════════════════
   Deploy button & dialog
   ═══════════════════════════════════════════════════════════════════ */

.we-editor__toolbar-deploy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: 1px solid var(--accent, #c9a84c);
    border-radius: 4px;
    background: transparent;
    color: var(--accent, #c9a84c);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
    white-space: nowrap;
}
.we-editor__toolbar-deploy-btn:hover:not(:disabled) {
    background: var(--accent, #c9a84c);
    color: var(--bg-dark, #1c1b19);
}
.we-editor__toolbar-deploy-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Deploy dialog modal ─────────────────────────────────────────── */

.deploy-dialog__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
}

.deploy-dialog {
    background: var(--bg-card, #26241f);
    border: 1px solid var(--border-subtle, #3e3a30);
    border-radius: 8px;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.deploy-dialog__header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent, #c9a84c);
    background: var(--bg-header, #3a3520);
    border-bottom: 1px solid var(--border-subtle, #3e3a30);
}

.deploy-dialog__body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.deploy-dialog__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.deploy-dialog__field > label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #8a8477);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0;
}
.deploy-dialog__value {
    font-size: 0.85rem;
    color: var(--text-primary, #d0ccc2);
}
.deploy-dialog__entity-type {
    background: var(--bg-input, #33302a);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--accent, #c9a84c);
    margin-right: 6px;
}
.deploy-dialog__entity-key {
    font-family: monospace;
    color: var(--text-primary, #d0ccc2);
}

.deploy-dialog__dep-list {
    margin: 0;
    padding: 0 0 0 18px;
    font-size: 0.82rem;
    color: var(--text-secondary, #8a8477);
}
.deploy-dialog__dep-list li {
    margin-bottom: 2px;
}

.deploy-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
}

.deploy-dialog__inline-error {
    font-size: 0.82rem;
    color: #e06c5a;
    padding: 6px 10px;
    background: rgba(224, 108, 90, 0.1);
    border-radius: 4px;
}

/* ── Deploy results ──────────────────────────────────────────────── */

.deploy-dialog__results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.deploy-dialog__result-banner {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}
.deploy-dialog__result-banner--success {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
    border: 1px solid rgba(76, 175, 80, 0.3);
}
.deploy-dialog__result-banner--error {
    background: rgba(224, 108, 90, 0.15);
    color: #e06c5a;
    border: 1px solid rgba(224, 108, 90, 0.3);
}

.deploy-dialog__section {
    font-size: 0.82rem;
    color: var(--text-primary, #d0ccc2);
}
.deploy-dialog__section strong {
    color: var(--text-secondary, #8a8477);
}

.deploy-dialog__error-list {
    margin: 4px 0 0 18px;
    padding: 0;
    font-size: 0.78rem;
    color: #e06c5a;
}
.deploy-dialog__error-list li {
    margin-bottom: 2px;
}

/* World Engine editor extension framework */
.we-editor__list-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.we-editor__new-menu {
    position: relative;
}

.we-editor__new-menu-items {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1060;
    min-width: 130px;
    padding: 4px 0;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.we-editor__new-menu-items button {
    display: block;
    width: 100%;
    padding: 5px 12px;
    color: var(--text-primary);
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    background: none;
    border: 0;
}

.we-editor__new-menu-items button:hover {
    background: var(--bg-input, #33302a);
}

/* ── Entity editor form (CoinhouseEditor and kin) ─────────────────── */

.we-editor__entity-editor .form-group {
    margin-bottom: 12px;
}

.we-entity-form__stats {
    display: flex;
    gap: 20px;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.we-entity-form__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.we-entity-form__delete-confirm {
    margin-top: 16px;
    padding: 12px;
    border: 1px solid var(--danger, #e74c3c);
    border-radius: 8px;
}

/* ── Nested editor cards (IndustryEditor and kin) ─────────────────── */

.we-entity-form__card {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.we-entity-form__card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.flex-spacer {
    flex: 1;
}

.we-editor__entity-editor .form-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.we-editor__entity-editor .form-row > * {
    flex: 1;
    min-width: 0;
}

.we-editor__entity-editor h5 {
    font-size: 0.95rem;
    margin-bottom: 10px;
}

/* Persistent Glyph reference and independently scrolling source workspace. */
.glyph-source-editor { padding: 12px; min-width: 0; overflow: auto; container-type: inline-size; container-name: glyph-source; }
.glyph-source-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.glyph-source-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 26%); height: clamp(32rem, 68vh, 58rem); min-width: 0; }
.glyph-source-workspace--solo { grid-template-columns: minmax(0, 1fr); }
.glyph-source-code { min-width: 0; min-height: 0; overflow: hidden; }
.glyph-code-host, .glyph-code-host .cm-editor { height: 100%; }
.glyph-source-code > textarea { height: 100%; }
.glyph-code-host:empty { display: none; }
.glyph-reference { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--border-subtle, #8a8477); background: var(--bg-card, #26241f); color: var(--text-primary, #d0ccc2); }
.glyph-reference-header { padding: 10px; border-bottom: 1px solid var(--border-subtle, #8a8477); flex-shrink: 0; }
.glyph-reference-tabs { display: flex; flex-wrap: wrap; gap: 3px; margin: 8px 0; }
.glyph-reference button { color: var(--text-primary, #d0ccc2); }
.glyph-reference-tabs button, .glyph-reference-group, .glyph-reference-row, .glyph-reference-more { background: transparent; border: 0; text-align: left; cursor: pointer; padding: 6px 8px; }
.glyph-reference-tabs button { font-size: .8rem; border: 1px solid var(--border-subtle, #8a8477); border-radius: 4px; }
.glyph-reference button[aria-pressed="true"] { background: var(--bg-input, #33302a); box-shadow: inset 3px 0 var(--accent-gold, #c9a84c); }
.glyph-reference button:hover { background: var(--bg-input, #33302a); }
.glyph-reference button:focus-visible { outline: 2px solid var(--accent-gold, #c9a84c); outline-offset: -2px; }
.glyph-reference-context { display: flex; align-items: center; gap: 6px; font-size: .8rem; margin-top: 8px; }
.glyph-reference small { color: var(--text-secondary, #8a8477); font-size: .75rem; }
.glyph-reference-list { flex: 1 1 45%; min-height: 7rem; overflow: auto; padding: 4px; }
.glyph-reference-group { display: block; width: 100%; font-size: .8rem; font-weight: 600; }
.glyph-reference-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; width: 100%; padding-left: 14px; }
.glyph-reference-row code { color: inherit; font-size: .8rem; overflow-wrap: anywhere; }
.glyph-reference-unavailable { color: var(--text-secondary, #8a8477) !important; }
.glyph-reference-detail { flex: 0 1 48%; min-height: 5rem; overflow: auto; padding: 12px; border-top: 1px solid var(--border-subtle, #8a8477); font-size: .82rem; overflow-wrap: anywhere; }
.glyph-reference-detail h4 { font-size: .95rem; color: var(--accent-gold, #c9a84c); }
.glyph-reference-detail dl { margin-bottom: 10px; }
.glyph-reference-detail dt { color: var(--text-secondary, #8a8477); }
.glyph-reference-detail dd { margin: 0 0 6px; }
.glyph-reference-detail > small { display: block; margin-top: 5px; }
.glyph-reference-signature { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; color: var(--text-primary, #d0ccc2); background: var(--bg-input, #33302a); padding: 8px; }
.glyph-reference-deprecated { border-left: 3px solid var(--accent-gold, #c9a84c); padding-left: 8px; }
.glyph-reference-empty { padding: 12px; }
@media (max-width: 1100px) {
    .glyph-source-workspace { grid-template-columns: minmax(0, 1fr); height: auto; gap: 10px; }
    .glyph-source-code { height: 28rem; }
    .glyph-reference { height: 34rem; }
    .glyph-source-toolbar { flex-wrap: wrap; }
}
.glyph-reference-client-results { display: none; }
.glyph-reference--searching > .glyph-reference-client-results { display: block; }
.glyph-reference--searching > .glyph-reference-server-list { display: none; }
.glyph-reference-actions { flex-shrink: 0; padding: 8px 12px; border-top: 1px solid var(--border-subtle, #8a8477); }
.glyph-reference-actions small { display: block; margin-top: 5px; }

@container glyph-source (max-width: 1000px) {
    .glyph-source-workspace { grid-template-columns: minmax(0, 1fr); height: auto; gap: 10px; }
    .glyph-source-code { height: 28rem; }
    .glyph-reference { height: 34rem; }
}

/* Imported Lexicon prose is plain text; code and original sources keep their whitespace. */
.glyph-lexicon-reference { border-top: 1px solid var(--text-secondary, #8a8477); margin-top: 1rem; padding-top: .75rem; }
.glyph-lexicon-reference details { margin: .6rem 0; }
.glyph-lexicon-reference summary { cursor: pointer; color: var(--accent-gold, #c9a84c); }
.glyph-lexicon-reference pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
.glyph-documentation-tooltip { max-width: min(34rem, calc(100vw - 1rem)); max-height: min(25rem, 70vh); overflow: auto; padding: .75rem; font-size: .85rem; line-height: 1.45; background: var(--bg-card, #26241f); color: var(--text-primary, #d0ccc2); border: 1px solid var(--text-secondary, #8a8477); border-radius: .25rem; box-shadow: 0 .2rem .8rem #0006; }
.glyph-documentation-tooltip pre { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--accent-gold, #c9a84c); font-size: .8rem; margin: 0 0 .5rem; }
.glyph-documentation-tooltip p { margin: .5rem 0; }
.glyph-documentation-tooltip small { display: block; opacity: .85; }
.glyph-documentation-tooltip button { display: block; margin-top: .5rem; padding: .25rem .5rem; background: var(--bg-input, #33302a); color: var(--text-primary, #d0ccc2); border: 1px solid var(--accent-gold, #c9a84c); border-radius: .2rem; }
.glyph-reference-tooltip { position: fixed; z-index: 1100; }
