/* Design tokens imported from tokens.css (generated from tokens.json) */
@import url('tokens.css');

/* Additional CSS variable overrides not in tokens */
:root {
    /* Font family fallbacks (tokens only has primary font) */
    --font-families-mono: 'IBM Plex Mono', 'Courier New', Courier, monospace;
    --font-families-sans:
        'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    /* Disable trackpad swipe navigation gestures */
    overscroll-behavior-x: none;
    overscroll-behavior-y: none;
}

body {
    font-family:
        'IBM Plex Sans',
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        sans-serif;
    background-color: var(--background-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    letter-spacing: 0.02em;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

/* Material Symbols */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 1.2em;
    display: inline-block;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0em;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    vertical-align: middle;
}

/* Keyboard shortcut style */
kbd {
    display: inline-block;
    padding: 2px 6px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--border-primary);
    white-space: nowrap;
    vertical-align: baseline;
}

kbd + kbd {
    margin-left: 2px;
}

.view-title-shortcut .material-symbols-outlined {
    top: -1px;
    position: relative;
}

.material-symbols-outlined + .material-symbols-outlined {
    margin-left: -0.12em;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-loading);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#loading-animation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.loading-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.loading-status {
    position: fixed;
    top: 50%;
    left: 0;
    right: 0;
    margin-top: 150px;
    text-align: center;
    font-family: var(--font-families-mono);
    font-size: 18px;
    color: var(--text-muted);
    z-index: 2;
}

.loading-status.ready {
    color: var(--accent-green);
    font-weight: bold;
}

.loading-logo {
    font-family: 'EB Garamond', serif;
    font-size: 90px;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1;
    position: relative;
    top: -50px;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Toolbar styles */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--background-tertiary);
    border-bottom: 2px solid var(--border-primary);
    padding: 12px 20px;
    padding-left: 9px;
    padding-right: 9px;
    height: 50px;
    flex-shrink: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
}

.app-name {
    font-family: var(--font-families-mono);
    font-size: 24px;
    font-weight: 400;
    position: relative;
    left: 4px;
    top: -1px;
    margin: 0;
    letter-spacing: 0.5px;
    word-spacing: -8px;
}

.toolbar-center {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-label {
    font-size: 16px;
    user-select: none;
    cursor: default;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: var(--border-secondary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-cyan);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-cyan);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-button {
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    color: var(--button-text);
    padding: 6px 16px;
    border-radius: 4px;
    font-family: var(--font-families-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar-button:hover:not(:disabled) {
    border-color: var(--accent-cyan);
    background-color: var(--button-hover-bg);
    color: var(--accent-cyan);
}

.toolbar-button:active:not(:disabled) {
    transform: translateY(1px);
}

.toolbar-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.update-button {
    background-color: transparent;
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    vertical-align: middle;
}

.update-button:hover {
    background-color: var(--accent-orange);
    color: var(--background-primary);
}

.update-button .material-symbols-rounded {
    font-size: 18px;
}

.release-notes-link {
    color: var(--accent-orange);
    text-decoration: none;
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font-families-mono);
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    vertical-align: middle;
}

.release-notes-link:hover {
    background-color: rgba(255, 153, 51, 0.1);
    text-decoration: underline;
}

.font-dropdown-container {
    position: relative;
    display: flex;
    align-items: center;
}

.file-dirty-indicator {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--accent-red);
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.file-dirty-indicator.visible {
    opacity: 1;
}

.fonts-dropdown {
    background-color: var(--button-bg);
    border: 1px solid var(--button-border);
    color: var(--button-text);
    padding: 6px 12px 6px 28px;
    border-radius: 4px;
    font-family: var(--font-families-mono);
    font-size: 13px;
    cursor: pointer;
    min-width: 200px;
    transition: all 0.2s ease;
}

.fonts-dropdown:hover {
    border-color: var(--accent-cyan);
    background-color: var(--button-hover-bg);
}

.fonts-dropdown:focus {
    outline: none;
    border-color: var(--accent-magenta);
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.3);
}

.fonts-dropdown option {
    background-color: var(--button-bg);
    color: var(--button-text);
}

.container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 50px);
    width: 100vw;
}

.top-row {
    display: flex;
    flex: 1.61;
    /* 63% of total height */
    min-height: 200px; /* Primary view (editor) minimum */
}

.bottom-row {
    display: flex;
    flex: 1;
    /* 37% of total height */
    min-height: 24px; /* Secondary views can collapse to title bar */
}

.view {
    background-color: var(--background-secondary);
    border: 1px solid var(--border-primary);
    overflow: hidden;
    min-width: 100px;
    min-height: 24px; /* Title bar height - allows secondary views to collapse */
    flex: 1;
    position: relative;
    color: var(--text-secondary);
    transition:
        background-color 0.2s ease,
        color 0.2s ease;
    display: flex;
    flex-direction: column;
}

/* Primary view (editor) - larger minimum size */
.view.view-editor {
    min-width: 200px;
    min-height: 200px;
}

/* Secondary views - can collapse to title bar only */
.view:not(.view-editor) {
    min-height: 24px;
}

/* Font info view special case - collapses to width instead of height */
.view-fontinfo {
    min-width: 24px;
    min-height: 100px;
}

.view.focused {
    background-color: var(--background-primary);
    color: var(--text-primary);
}

/* Collapsed secondary views (height collapsed to title bar) */
.view:not(.view-editor).collapsed {
    overflow: hidden;
}

.view:not(.view-editor).collapsed .view-content,
.view:not(.view-editor).collapsed #console-container,
.view:not(.view-editor).collapsed #script-editor,
.view:not(.view-editor).collapsed #ai-chat-container,
.view:not(.view-editor).collapsed #file-browser {
    display: none;
}

/* Hide non-essential title bar elements when collapsed */
.view:not(.view-editor).collapsed .view-title-bar .view-title-button,
.view:not(.view-editor).collapsed .view-title-bar .ai-context-toggle,
.view:not(.view-editor).collapsed .view-title-bar .ai-info-button,
.view:not(.view-editor).collapsed .view-title-bar .editor-plugins-toggle {
    display: none;
}

/* Font info view - rotated title bar when collapsed to minimum width */
.view-fontinfo.collapsed-width {
    overflow: hidden;
}

.view-fontinfo.collapsed-width .view-content {
    display: none;
}

.view-fontinfo.collapsed-width .view-title-bar {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    height: 100%;
    width: 24px;
    border-bottom: none;
    border-right: 1px solid var(--border-primary);
    padding: 8px 0 0 0;
    justify-content: flex-end; /* Align to top when rotated (flex-end because of 180deg rotation) */
}

.view-fontinfo.collapsed-width .view-title-bar .view-title-left {
    flex-direction: row; /* Keep title and shortcut on same line */
    gap: 6px;
    white-space: nowrap;
}

.view-fontinfo.collapsed-width .view-title-bar .view-title-button,
.view-fontinfo.collapsed-width .view-title-bar .ai-info-button {
    display: none;
}

/* View Title Bar */
.view-title-bar {
    height: 24px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0 8px;
    border-bottom: 1px solid var(--border-primary);
    font-family: var(--font-families-mono);
    font-size: 11px;
    background-color: inherit;
    flex-shrink: 0;
    box-sizing: border-box;
}

.view-title-left {
    display: flex;
    align-items: center;
    gap: 6px;
}

.view-title-name {
    color: inherit;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 10px;
}

.view-title-shortcut {
    color: var(--text-faint);
    font-size: 10px;
}

/* Hide button shortcuts in view title bars when view is not focused */
.view:not(.focused) .view-title-button .ai-button-shortcut {
    display: none;
}

/* Hide button shortcuts in view title bars when view is not focused (inline shortcuts) */
.view:not(.focused) .view-title-button span[style*='opacity'] {
    display: none;
}

/* Keep console clear shortcut always visible (global shortcut) */
.console-clear-shortcut {
    display: inline !important;
}

/* Content containers for views with text content */
.view-content {
    margin: 20px;
    margin-left: 15px;
    margin-top: 2px;
    margin-bottom: 10px;
    overflow: auto;
    flex: 1;
}

.view-files .view-content {
    margin: 12px;
    margin-top: 2px;
}

/* Hide scrollbar for view-content */
.view-content::-webkit-scrollbar {
    width: 0;
    display: none;
}

.view-content::-webkit-scrollbar-track {
    background: transparent;
}

.view-content::-webkit-scrollbar-thumb {
    background: transparent;
}

.view-content h3 {
    color: inherit;
    margin-bottom: 10px;
    font-weight: 500;
}

.view-content p {
    line-height: 1.6;
    color: inherit;
}

/* Divider styles */
.divider {
    background-color: var(--border-primary);
    position: relative;
    transition: background-color 0.2s ease;
}

.divider:hover {
    background-color: var(--border-secondary);
}

.divider.active {
    background-color: var(--border-active);
}

.vertical-divider {
    width: 4px;
    cursor: col-resize;
    min-height: 100%;
    flex: 0 0 4px;
    /* Fixed size, no growing or shrinking */
}

.horizontal-divider {
    height: 4px;
    cursor: row-resize;
    width: 100%;
    min-width: 100%;
    flex: 0 0 4px;
    /* Fixed size, no growing or shrinking */
}

/* View specific colors for better distinction - Cyberpunk style */
.view-fontinfo {
    border-left: 4px solid var(--view-fontinfo);
    flex: 1;
}

.view-editor {
    border-left: 4px solid var(--view-editor);
    flex: 2;
}

.view-files {
    border-left: 4px solid var(--view-files);
}

.view-console {
    border-left: 4px solid var(--view-console);
}

.view-scripts {
    border-left: 4px solid var(--view-scripts);
}

.view-assistant {
    border-left: 4px solid var(--view-assistant);
}

/* View Title Button */
.view-title-button {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary) !important;
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.view-title-button:hover {
    background-color: var(--input-bg);
    border-left-color: var(--text-secondary);
}

/* Auto-run button - default (inactive) state */
.view-title-button.auto-run {
    background-color: transparent;
    border-color: var(--border-primary);
    color: var(--text-primary) !important;
}

/* Auto-run button - disabled in script context - Dark Theme */
:root:not([data-theme='light']) .view-title-button.auto-run.disabled-in-script {
    background-color: transparent;
    border-color: var(--autorun-disabled-border);
    color: var(--autorun-disabled-text) !important;
}

/* Auto-run button - disabled in script context - Light Theme */
:root[data-theme='light'] .view-title-button.auto-run.disabled-in-script {
    background-color: transparent;
    border-color: var(--autorun-disabled-border);
    color: var(--autorun-disabled-text) !important;
}

/* Auto-run button - active state in dark theme */
:root:not([data-theme='light']) .view-title-button.auto-run.active {
    background-color: var(--autorun-active-bg);
    border-color: var(--autorun-active-bg);
    color: var(--autorun-active-text) !important;
}

:root:not([data-theme='light'])
    .view-assistant.focused
    .view-title-button.auto-run.active {
    background-color: var(--autorun-active-focused-bg);
    border-color: var(--autorun-active-focused-bg);
    color: var(--autorun-active-text) !important;
}

/* Auto-run button - active state in light theme */
:root[data-theme='light'] .view-title-button.auto-run.active {
    background-color: var(--autorun-active-bg);
    border-color: var(--autorun-active-bg);
    color: var(--autorun-active-text) !important;
}

:root[data-theme='light']
    .view-assistant.focused
    .view-title-button.auto-run.active {
    background-color: var(--autorun-active-focused-bg);
    border-color: var(--autorun-active-focused-bg);
    color: var(--autorun-active-focused-text) !important;
}

/* AI Context Buttons - Font Context - Dark Theme */
:root:not([data-theme='light']) .ai-context-btn.font-context.active {
    background-color: var(--font-context-bg);
    border-color: var(--font-context-bg);
    color: var(--font-context-text);
}

:root:not([data-theme='light'])
    .view-assistant.focused
    .ai-context-btn.font-context.active {
    background-color: var(--font-context-focused-bg);
    border-color: var(--font-context-focused-bg);
    color: var(--font-context-focused-text);
}

/* AI Context Buttons - Font Context - Light Theme */
:root[data-theme='light'] .ai-context-btn.font-context.active {
    background-color: var(--font-context-bg);
    border-color: var(--font-context-bg);
    color: var(--font-context-text);
}

:root[data-theme='light']
    .view-assistant.focused
    .ai-context-btn.font-context.active {
    background-color: var(--font-context-focused-bg);
    border-color: var(--font-context-focused-bg);
    color: var(--font-context-focused-text);
}

/* AI Context Buttons - Script Context - Dark Theme */
:root:not([data-theme='light']) .ai-context-btn.script-context.active {
    background-color: var(--script-context-bg);
    border-color: var(--script-context-bg);
    color: var(--script-context-text);
}

:root:not([data-theme='light'])
    .view-assistant.focused
    .ai-context-btn.script-context.active {
    background-color: var(--script-context-focused-bg);
    border-color: var(--script-context-focused-bg);
    color: var(--script-context-focused-text);
}

/* AI Context Buttons - Script Context - Light Theme */
:root[data-theme='light'] .ai-context-btn.script-context.active {
    background-color: var(--script-context-bg);
    border-color: var(--script-context-bg);
    color: var(--script-context-text);
}

:root[data-theme='light']
    .view-assistant.focused
    .ai-context-btn.script-context.active {
    background-color: var(--script-context-focused-bg);
    border-color: var(--script-context-focused-bg);
    color: var(--script-context-focused-text);
}

/* AI Context Buttons - Inactive state (no background) */
.ai-context-btn:not(.active) {
    background-color: transparent;
    border-color: var(--border-primary);
    color: var(--text-primary) !important;
}

/* AI Context Label & Prompt Prefix - Font Context - Dark Theme */
:root:not([data-theme='light']) #ai-context-label.font-context,
:root:not([data-theme='light']) #ai-prompt-prefix.font-context {
    background-color: var(--font-context-bg);
    color: var(--font-context-text);
}

:root:not([data-theme='light'])
    .view-assistant.focused
    #ai-context-label.font-context,
:root:not([data-theme='light'])
    .view-assistant.focused
    #ai-prompt-prefix.font-context {
    background-color: var(--font-context-focused-bg);
    color: var(--font-context-focused-text);
}

/* AI Context Label & Prompt Prefix - Font Context - Light Theme */
:root[data-theme='light'] #ai-context-label.font-context,
:root[data-theme='light'] #ai-prompt-prefix.font-context {
    background-color: var(--font-context-bg);
    color: var(--font-context-text);
}

:root[data-theme='light']
    .view-assistant.focused
    #ai-context-label.font-context,
:root[data-theme='light']
    .view-assistant.focused
    #ai-prompt-prefix.font-context {
    background-color: var(--font-context-focused-bg);
    color: var(--font-context-focused-text);
}

/* AI Context Label & Prompt Prefix - Script Context - Dark Theme */
:root:not([data-theme='light']) #ai-context-label.script-context,
:root:not([data-theme='light']) #ai-prompt-prefix.script-context {
    background-color: var(--script-context-bg);
    color: var(--script-context-text);
}

:root:not([data-theme='light'])
    .view-assistant.focused
    #ai-context-label.script-context,
:root:not([data-theme='light'])
    .view-assistant.focused
    #ai-prompt-prefix.script-context {
    background-color: var(--script-context-focused-bg);
    color: var(--script-context-focused-text);
}

/* AI Context Label & Prompt Prefix - Script Context - Light Theme */
:root[data-theme='light'] #ai-context-label.script-context,
:root[data-theme='light'] #ai-prompt-prefix.script-context {
    background-color: var(--script-context-bg);
    color: var(--script-context-text);
}

:root[data-theme='light']
    .view-assistant.focused
    #ai-context-label.script-context,
:root[data-theme='light']
    .view-assistant.focused
    #ai-prompt-prefix.script-context {
    background-color: var(--script-context-focused-bg);
    color: var(--script-context-focused-text);
}

/* AI Context Label */
.ai-context-label {
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    margin-left: auto;
    margin-right: 8px;
    display: flex;
    align-items: center;
}

/* AI Context Toggle */
.ai-context-toggle {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-right: 4px solid var(--border-primary);
    height: 100%;
    margin-left: auto;
}

.ai-context-btn {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.ai-context-btn:hover:not(.active) {
    background-color: var(--input-bg);
    border-left-color: var(--text-primary);
}

/* Editor Plugins Toggle */
.editor-plugins-toggle {
    display: flex;
    align-items: stretch;
    gap: 0;
    /* border-right: 4px solid var(--border-primary); */
    height: 100%;
    margin-left: auto;
    position: relative;
}

.editor-plugins-dropdown-btn {
    background-color: transparent;
    border: none;
    border-left: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 0 8px;
    border-radius: 0;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    font-weight: normal;
    transition: all 0.2s ease;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 3px;
}

.editor-plugins-dropdown-btn:hover {
    background-color: var(--input-bg);
    border-left-color: var(--text-primary);
}

.editor-plugins-dropdown-btn .material-symbols-outlined {
    font-size: 14px;
}

.editor-plugins-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-right: none;
    min-width: 300px;
    overflow-y: auto;
    z-index: 1000;
    font-family: var(--font-families-sans);
}

.editor-plugins-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    transition: background-color 0.15s ease;
}

.editor-plugins-dropdown-item:last-child {
    border-bottom: none;
    /* padding-bottom: 0px; */
}

.editor-plugins-dropdown-item:hover {
    background-color: var(--input-bg);
}

.editor-plugins-dropdown-item:has(+ .plugin-ui-elements) {
    border-bottom: none;
}

/* Plugin tags use the general tag-button style */
.editor-plugins-dropdown-item .plugin-tag {
    /* Inherits from .tag-button via class in HTML */
}

.editor-plugins-dropdown-item .plugin-name {
    margin-left: 8px;
    /* Inherits from .tag-description */
}

.editor-plugins-dropdown-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-faint);
    font-family: var(--font-families-mono);
    font-size: 10px;
}

/* Plugin UI Elements */
.plugin-ui-elements {
    padding: 2px 12px 11px 20px;
    border-bottom: 1px solid var(--border-primary);
}

.plugin-ui-slider {
    display: grid;
    grid-template-columns: 70px 1fr 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-slider:last-child {
    margin-bottom: 0;
}

.plugin-ui-label {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-secondary);
}

/* Shared slider styles for both plugin UI and axes sliders */
.plugin-ui-slider input[type='range'],
.editor-axis-slider {
    width: 100%;
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.plugin-ui-slider input[type='range']::-webkit-slider-runnable-track,
.editor-axis-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: linear-gradient(
        to right,
        var(--text-secondary) 0%,
        var(--text-secondary) var(--value-percent, 50%),
        var(--border-primary) var(--value-percent, 50%),
        var(--border-primary) 100%
    );
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-moz-range-track,
.editor-axis-slider::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--border-primary);
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-moz-range-progress,
.editor-axis-slider::-moz-range-progress {
    height: 4px;
    background: var(--text-secondary);
    border-radius: 2px;
}

.plugin-ui-slider input[type='range']::-webkit-slider-thumb,
.editor-axis-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    margin-top: -4px;
}

.plugin-ui-slider input[type='range']::-moz-range-thumb,
.editor-axis-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.plugin-ui-value {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-primary);
    width: 40px;
    text-align: right;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 2px;
    padding: 1px 3px;
    outline: none;
    transition: all 0.15s ease;
}

.plugin-ui-value:hover {
    border-color: var(--border-secondary);
    background: var(--background-secondary);
}

.plugin-ui-value:focus {
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

/* Text Field */
.plugin-ui-textfield {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-textfield:last-child {
    margin-bottom: 0;
}

.plugin-ui-text-input {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-primary);
    background: var(--background-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 2px;
    padding: 4px 6px;
    outline: none;
    transition: all 0.15s ease;
}

.plugin-ui-text-input:hover {
    border-color: var(--border-secondary);
}

.plugin-ui-text-input:focus {
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

/* Checkbox */
.plugin-ui-checkbox {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-checkbox:last-child {
    margin-bottom: 0;
}

.plugin-ui-checkbox-input {
    width: 14px;
    height: 14px;
    cursor: pointer;
    margin: 0;
    filter: saturate(0);
}

/* Radio Group */
.plugin-ui-radio-group {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-radio-group:last-child {
    margin-bottom: 0;
}

.plugin-ui-radio-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.plugin-ui-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-secondary);
}

.plugin-ui-radio-input {
    width: 12px;
    height: 12px;
    cursor: pointer;
    margin: 0;
    filter: saturate(0);
}

/* Color Picker */
.plugin-ui-color {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.plugin-ui-color:last-child {
    margin-bottom: 0;
}

.plugin-ui-color-input {
    width: 50px;
    height: 24px;
    border: 1px solid var(--border-primary);
    border-radius: 2px;
    cursor: pointer;
    padding: 0;
    background: transparent;
}

.plugin-ui-color-input:hover {
    border-color: var(--border-secondary);
}

/* AI Info Button */
.ai-info-button {
    margin-left: 0px;
    background-color: transparent;
    border: none;
    color: var(--accent-blue);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    height: auto;
}

.ai-info-button:hover {
    color: var(--accent-cyan);
}

.ai-info-button .material-symbols-outlined {
    font-size: 18px;
}

/* AI Info Popup Specific Styles */
.ai-info-section {
    margin-bottom: 24px;
}

.ai-info-section:last-child {
    margin-bottom: 0;
}

.ai-info-section h4 {
    color: var(--accent-green);
}

.ai-info-note {
    font-size: 11px;
    color: var(--text-subtle);
    font-style: italic;
    margin-top: 4px;
}

.ai-examples {
    margin-top: 12px;
}

.ai-example-text {
    color: var(--text-secondary);
    font-style: italic;
}

/* Matplotlib plot modal */
.matplotlib-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.matplotlib-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.matplotlib-modal-content {
    background-color: var(--modal-bg);
    border: 2px solid var(--border-tertiary);
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
}

.matplotlib-modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.matplotlib-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--accent-green);
}

.matplotlib-modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.matplotlib-modal-close:hover {
    color: var(--text-primary);
}

.matplotlib-modal-body {
    padding: 16px;
    overflow: auto;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matplotlib-modal-body canvas,
.matplotlib-modal-body matplotlib-figure {
    max-width: 100%;
    max-height: calc(95vh - 80px);
    object-fit: contain;
}

.matplotlib-modal-body matplotlib-figure {
    display: block;
}

.ai-info-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--accent-green);
    font-weight: 600;
}

.ai-info-section p {
    margin: 8px 0;
    line-height: 1.6;
}

.ai-info-section ul {
    margin: 12px 0;
    padding-left: 20px;
}

.ai-info-section li {
    margin: 8px 0;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ai-info-icon {
    font-size: 18px !important;
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-info-note {
    font-size: 11px;
    color: var(--text-subtle);
    font-style: italic;
    margin-top: 8px;
}

.ai-examples {
    margin-top: 12px;
}

/* Script Editor */
/* Ace Editor Container */
#script-editor {
    width: 100%;
    height: 100%;
    position: relative;
    flex: 1;
}

/* Ace Editor customizations */
#script-editor .ace_editor {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
}

#script-editor .ace_line {
    line-height: 1.6;
}

#script-editor .ace_gutter {
    background-color: transparent;
}

/* Background color based on view focus state */
.view-scripts.focused #script-editor {
    background-color: var(--background-primary);
}

.view-scripts:not(.focused) #script-editor {
    background-color: var(--background-secondary);
}

/* Cyberpunk Syntax Highlighting */
/* Keywords - Neon Magenta */
#script-editor .ace_keyword {
    color: #ff00ff !important;
    font-weight: bold;
}

/* Storage types (def, class, etc.) - Neon Cyan */
#script-editor .ace_storage {
    color: #00ffff !important;
    font-weight: bold;
}

/* Function names - Bright Yellow */
#script-editor .ace_entity.ace_name.ace_function,
#script-editor .ace_support.ace_function {
    color: #ffff00 !important;
}

/* Class names - Neon Green */
#script-editor .ace_entity.ace_name.ace_class,
#script-editor .ace_support.ace_class {
    color: #00ff00 !important;
    font-weight: bold;
}

/* Strings - Soft Pink/Magenta */
#script-editor .ace_string {
    color: #ff66ff !important;
}

/* Numbers - Bright Orange */
#script-editor .ace_constant.ace_numeric {
    color: #ff9933 !important;
}

/* Comments - Neutral Darker Gray */
#script-editor .ace_comment {
    color: #888888 !important;
    font-style: normal;
}

/* Variables - Light Cyan */
#script-editor .ace_variable {
    color: #66ffff !important;
}

/* Built-in functions - Electric Blue */
#script-editor .ace_support.ace_builtin {
    color: #3399ff !important;
}

/* Operators - Bright White */
#script-editor .ace_keyword.ace_operator {
    color: #ffffff !important;
    font-weight: normal;
}

/* Decorators - Neon Purple */
#script-editor .ace_meta.ace_tag,
#script-editor .ace_entity.ace_name.ace_tag {
    color: #9900ff !important;
}

/* Constants (True, False, None) - Hot Pink */
#script-editor .ace_constant.ace_language {
    color: #ff0099 !important;
    font-weight: bold;
}

/* Parameters - Light Yellow */
#script-editor .ace_variable.ace_parameter {
    color: #ffff99 !important;
}

/* Import statements - Cyan */
#script-editor .ace_keyword.ace_control.ace_import {
    color: #00ffff !important;
}

/* Self keyword - Magenta */
#script-editor .ace_variable.ace_language {
    color: #ff00ff !important;
    font-style: italic;
}

/* Line highlight - subtle cyberpunk glow */
#script-editor .ace_active-line {
    background-color: rgba(255, 0, 255, 0.08) !important;
}

/* Selection - cyberpunk purple */
#script-editor .ace_selection {
    background-color: rgba(153, 0, 255, 0.3) !important;
}

/* Cursor - bright cyan with custom width */
#script-editor .ace_cursor {
    color: var(--accent-cyan) !important;
    background-color: var(--accent-cyan) !important;
    /* Width and positioning are controlled by script-editor.js */
    /* Don't override width, top, or left to preserve JS customization */
}

/* Light theme cursor - dark color */
:root[data-theme='light'] #script-editor .ace_cursor {
    color: #1a1a1a !important;
    background-color: #1a1a1a !important;
}

/* Matching brackets - neon green */
#script-editor .ace_bracket {
    border: 1px solid var(--accent-green) !important;
    background-color: var(--ai-system-bg) !important;
}

/* Light theme syntax adjustments - ensure good contrast */
:root[data-theme='light'] #script-editor .ace_keyword {
    color: #b000b0 !important;
}

:root[data-theme='light'] #script-editor .ace_storage {
    color: #007777 !important;
}

:root[data-theme='light'] #script-editor .ace_string {
    color: #c000c0 !important;
}

:root[data-theme='light'] #script-editor .ace_comment {
    color: #666666 !important;
}

:root[data-theme='light'] #script-editor .ace_constant.ace_numeric {
    color: #cc6600 !important;
}

:root[data-theme='light'] #script-editor .ace_support.ace_builtin {
    color: #0052cc !important;
}

:root[data-theme='light'] #script-editor .ace_keyword.ace_operator {
    color: #333333 !important;
}

:root[data-theme='light'] #script-editor .ace_entity.ace_name.ace_function,
:root[data-theme='light'] #script-editor .ace_support.ace_function {
    color: #a0a000 !important;
}

:root[data-theme='light'] #script-editor .ace_entity.ace_name.ace_class,
:root[data-theme='light'] #script-editor .ace_support.ace_class {
    color: #009000 !important;
}

:root[data-theme='light'] #script-editor .ace_variable {
    color: #006666 !important;
}

:root[data-theme='light'] #script-editor .ace_meta.ace_tag,
:root[data-theme='light'] #script-editor .ace_entity.ace_name.ace_tag {
    color: #6600cc !important;
}

:root[data-theme='light'] #script-editor .ace_constant.ace_language {
    color: #cc0066 !important;
}

:root[data-theme='light'] #script-editor .ace_variable.ace_parameter {
    color: #996600 !important;
}

:root[data-theme='light'] #script-editor .ace_variable.ace_language {
    color: #b000b0 !important;
}

:root[data-theme='light'] #script-editor .ace_bracket {
    border-color: #009000 !important;
    background-color: rgba(0, 144, 0, 0.08) !important;
}

/* Official Pyodide Console Styles */

@supports (--css: variables) {
    .cmd,
    .cmd div,
    .cmd span,
    .terminal,
    .terminal-output > :not(.raw) a,
    .terminal-output > :not(.raw) div,
    .terminal-output > :not(.raw) span {
        font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
        font-family: var(--font-families-mono) !important;
        color: var(--text-primary) !important;
    }
}

.terminal .terminal-output > :not(.raw) .terminal-error,
.terminal .terminal-output > :not(.raw) .terminal-error * {
    color: var(--accent-red) !important;
}

#console-container {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--background-secondary);
    transition: background-color 0.2s ease;
}

.view.focused #console-container {
    background-color: var(--background-primary);
}

#console-container .terminal {
    --size: 1.2;
    --color: var(--text-tertiary);
    font-family: var(--font-families-mono) !important;
    background-color: transparent !important;
    height: 100% !important;
    border: none !important;
}

#console-container .terminal .terminal-output {
    color: var(--text-primary);
}

#console-container .terminal .cmd {
    background-color: transparent !important;
}

#console-container .terminal .cmd-prompt {
    color: var(--accent-red) !important;
    font-weight: bold;
}

.terminal-wrapper {
    margin-left: 4px;
}

#loading {
    display: inline-block;
    width: 30px;
    height: 30px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid var(--input-bg);
    border-radius: 50%;
    border-top-color: var(--accent-red);
    /* animation: spin 1s ease-in-out infinite; */
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .top-row,
    .bottom-row {
        flex-direction: column;
    }

    .vertical-divider {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }

    .horizontal-divider {
        display: none;
    }
}

/* Custom scrollbar */
.view::-webkit-scrollbar {
    width: 8px;
}

.view::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.view::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.view::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* File Browser Styles */
#refresh-files-btn {
    background: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    color: var(--background-primary);
    padding: 8px 16px;
    margin-bottom: 15px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
}

#refresh-files-btn:hover {
    background: var(--accent-magenta);
    border-color: var(--accent-magenta);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--input-bg);
}

#file-browser {
    height: 100%;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

#file-tree {
    font-family: var(--font-families-mono);
    font-size: 13px;
    line-height: 1.4;
}

.file-item {
    padding: 4px 0;
    cursor: pointer;
    border-radius: 3px;
    padding-left: 8px;
    margin: 1px 0;
    transition: background-color 0.2s ease;
}

.file-item:hover {
    background-color: var(--input-bg);
}

.file-item.directory {
    color: var(--accent-cyan);
    font-weight: 500;
}

.file-item.file {
    color: var(--text-primary);
}

.file-item.python-file {
    color: var(--accent-yellow);
}

.file-item .file-size {
    color: var(--text-secondary);
    font-size: 11px;
    margin-left: 10px;
}

.file-path {
    color: var(--accent-magenta);
    margin-bottom: 8px;
    font-weight: 500;
    padding-bottom: 0;
}

/* File Browser Toolbar */
.file-toolbar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 0;
    flex-wrap: wrap;
}

.file-action-btn {
    background: var(--button-bg);
    border: 1px solid var(--button-border);
    color: var(--button-text);
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.file-action-btn .material-symbols-outlined {
    font-size: 18px;
}

.file-action-btn:hover {
    background: var(--button-hover-bg);
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px var(--input-bg);
}

.file-action-btn:active {
    transform: translateY(0);
}

/* File Item Layout */
.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 3px;
    margin: 1px 0;
    transition: all 0.2s ease;
    position: relative;
}

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .open-font-btn {
    background: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    color: var(--background-primary);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-left: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 3px;
}

.file-item .open-font-btn .material-symbols-outlined {
    font-size: 16px;
}

.file-item .open-font-btn:hover {
    background: var(--accent-cyan);
    transform: scale(1.05);
    filter: brightness(1.2);
}

.file-item .delete-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--accent-red);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    margin-left: 4px;
    display: flex;
    align-items: center;
}

.file-item .delete-btn .material-symbols-outlined {
    font-size: 18px;
}

.file-item .download-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--accent-cyan);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    margin-left: 2px;
    display: flex;
    align-items: center;
}

.file-item .download-btn .material-symbols-outlined {
    font-size: 18px;
}

.file-item .delete-btn:hover {
    background: var(--ai-error-bg);
    border-color: var(--accent-red);
    transform: scale(1.1);
}

.file-item .download-btn:hover {
    background: var(--ai-result-bg);
    border-color: var(--accent-cyan);
    transform: scale(1.1);
}

/* Drag and Drop Styling */
#file-browser.drag-over {
    background-color: var(--input-bg);
    border: 2px dashed var(--accent-cyan);
    border-radius: 8px;
}

#file-browser.drag-over::after {
    content: 'upload_file';
    font-family: 'Material Symbols Outlined';
    font-size: 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: color-mix(in srgb, var(--background-primary) 80%, transparent);
    color: var(--accent-cyan);
    z-index: 10;
    font-weight: 400;
    pointer-events: none;
}

#file-browser.drag-over::before {
    content: 'Drop files here\ASupported: .babelfont, .glyphs, .vfj';
    white-space: pre;
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 50px));
    color: var(--accent-cyan);
    font-size: 16px;
    font-weight: 500;
    z-index: 11;
    pointer-events: none;
    line-height: 1.6;
}

/* AI Assistant Styles - Terminal Style */
.view-assistant .view-content {
    margin-left: 0;
    margin-right: 0;
}

.ai-info {
    background-color: transparent;
    border: none;
    padding: 0 15px;
    margin-bottom: 15px;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: calc(
        var(--size) * (16px / var(--pixel-density, 1)) + 1px /
            var(--pixel-density, 1)
    );
    color: var(--text-tertiary);
}

.ai-info p {
    margin: 8px 0;
}

.ai-info strong {
    color: var(--text-primary);
}

.ai-info ul {
    margin: 10px 0 10px 20px;
    padding: 0;
}

.ai-info li {
    margin: 6px 0;
    color: var(--text-tertiary);
}

.ai-info em {
    color: var(--text-muted);
    font-style: normal;
}

.ai-examples {
    margin: 8px 0;
}

#ai-chat-container {
    display: flex;
    flex-direction: column;
    margin-top: 7px;
}

/* AI Login Container */
#ai-login-container,
#ai-subscription-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
}

.ai-login-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 300px;
    gap: 12px;
}

.ai-login-icon {
    font-size: 32px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.ai-login-content h2 {
    margin: 0;
    font-size: calc(var(--size, 1) * (14px / var(--pixel-density, 1)));
    color: var(--text-primary);
    font-weight: 500;
}

.ai-login-content p {
    margin: 0;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    color: var(--text-secondary);
    line-height: 1.4;
}

.ai-login-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    font-weight: 600;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-login-button:hover {
    background: var(--button-hover);
    border-color: var(--border-hover);
}

.ai-login-button .material-symbols-outlined {
    font-size: 14px;
}

/* Reusable AI Assistant Button Styles */
.ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-family: var(--font-families-mono);
    font-size: 11px;
    font-weight: 600;
    background: var(--input-bg);
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.7);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-btn:hover {
    background: var(--background-hover);
}

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

.ai-btn .material-symbols-outlined {
    font-size: 14px;
}

.ai-btn-shortcut {
    font-family: var(--font-families-mono);
    font-size: 10px;
    color: var(--text-subtle);
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.ai-btn-shortcut .material-symbols-outlined {
    font-size: 12px;
}

/* Hide shortcuts when assistant view is not focused, but reserve space */
.view-assistant:not(.focused) .ai-message .ai-btn-shortcut {
    visibility: hidden;
}

/* Disable all button clicks when assistant view is not focused */
.view-assistant:not(.focused) button {
    pointer-events: none;
}

.ai-login-note {
    font-size: calc(var(--size, 1) * (11px / var(--pixel-density, 1)));
    color: var(--text-faint);
    font-style: italic;
}

#ai-button-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#ai-auto-run-indicator {
    color: var(--accent-green);
    font-style: italic;
    font-size: calc(var(--size, 1) * (11px / var(--pixel-density, 1)));
    font-family: var(--font-families-mono);
    display: flex;
    align-items: center;
    margin-left: 4px;
}

#ai-messages {
    flex: 0 1 auto;
    padding: 0;
    background-color: transparent;
    margin-bottom: 11px;
    display: none;
    font-family: var(--font-families-mono);
}

.ai-message {
    margin-bottom: 2px;
    padding: 12px 15px 17px 15px;
    border: none;
}

.ai-message-user {
    color: var(--text-tertiary);
    background-color: var(--ai-user-bg);
}

.ai-message-user .ai-message-header {
    color: var(--ai-user-text);
    font-weight: bold;
}

.ai-message-user .ai-message-content {
    font-family: 'IBM Plex Sans', sans-serif;
}

.ai-message-user .ai-message-content p {
    margin: 4px 0 !important;
    line-height: 1.4 !important;
}

.ai-message-user .ai-message-content p:first-child {
    margin-top: 0 !important;
}

.ai-message-user .ai-message-content p:last-child {
    margin-bottom: 0 !important;
}

.ai-message-assistant {
    color: var(--text-tertiary);
    background-color: var(--ai-assistant-bg);
}

.ai-message-assistant .ai-message-header {
    color: var(--ai-assistant-text);
    font-weight: bold;
}

.ai-message-system {
    color: var(--text-muted);
    background-color: var(--ai-system-bg);
}

.ai-message-error {
    color: var(--ai-error-text);
    background-color: var(--ai-error-bg);
}

.ai-message-error-fix {
    color: var(--text-primary);
    background-color: rgba(255, 165, 0, 0.2);
    animation: error-blink 0.4s ease-in-out 3;
}

@keyframes error-blink {
    0%,
    100% {
        background-color: rgba(255, 165, 0, 0.2);
    }

    50% {
        background-color: rgba(255, 165, 0, 0.5);
    }
}

/* Error blink for buttons */
.ai-context-btn.error-blink,
.view-title-button.error-blink {
    animation: button-error-blink 0.3s ease-in-out 2;
}

@keyframes button-error-blink {
    0%,
    100% {
        background-color: transparent;
        border-color: rgba(255, 165, 0, 0.3);
    }

    50% {
        background-color: rgba(255, 165, 0, 0.3);
        border-color: rgba(255, 165, 0, 0.8);
    }
}

.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(var(--size, 1) * (11px / var(--pixel-density, 1)));
    color: var(--text-subtle);
    font-style: italic;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-subtle);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.ai-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.ai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.ai-error-fix-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-error-fix-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
}

.ai-error-fix-text p {
    margin: 0 0 8px 0;
}

.ai-error-fix-text p:last-child {
    margin-bottom: 0;
}

.ai-fix-code-btn {
    align-self: flex-start;
}

.ai-reuse-prompt-container {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
}

.ai-copy-prompt-btn {
    margin-left: 8px;
}

.ai-message-output {
    color: var(--text-tertiary);
    background-color: var(--ai-assistant-bg);
}

.ai-message-output .ai-message-header {
    color: var(--ai-assistant-text);
    font-weight: bold;
}

.ai-message-header {
    font-weight: normal;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-message-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-context-tag {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: calc(var(--size, 1) * (10px / var(--pixel-density, 1)));
    font-weight: 600;
    font-family: var(--font-families-mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-context-tag-script {
    background-color: var(--view-scripts);
    color: var(--background-primary);
}

.ai-context-tag-font {
    background-color: var(--view-editor);
    color: var(--background-primary);
}

.ai-code-toggle-link {
    color: var(--text-muted);
    cursor: pointer;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    font-weight: normal;
    user-select: none;
}

.ai-code-toggle-link:hover {
    color: var(--text-tertiary);
}

.ai-message-content {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-tertiary);
}

.ai-message-content p {
    margin: 2px 0 !important;
    line-height: 1.4 !important;
    white-space: normal !important;
}

.ai-message-content p:first-child {
    margin-top: 0 !important;
}

.ai-message-content p:last-child {
    margin-bottom: 0 !important;
}

.ai-code {
    background-color: var(--code-bg);
    padding: 8px;
    overflow-x: auto;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    border: none;
    color: var(--text-tertiary);
}

.view-assistant:not(.focused) .ai-code {
    background-color: var(--background-secondary);
}

.ai-code code {
    color: var(--text-tertiary);
}

.ai-code-collapsible {
    margin-top: 4px;
}

.ai-output-with-code {
    display: flex;
    flex-direction: column;
}

.ai-output-with-code .ai-code {
    margin-bottom: 4px;
}

.ai-markdown-explanation {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    color: var(--text-tertiary);
    padding: 8px 0;
}

.ai-markdown-explanation h1,
.ai-markdown-explanation h2,
.ai-markdown-explanation h3 {
    font-family: var(--font-families-mono);
    color: var(--text-primary);
    margin: 12px 0 8px 0;
    font-weight: bold;
}

.ai-markdown-explanation h1 {
    font-size: calc(var(--size, 1) * (18px / var(--pixel-density, 1)));
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.ai-markdown-explanation h2 {
    font-size: calc(var(--size, 1) * (16px / var(--pixel-density, 1)));
}

.ai-markdown-explanation h3 {
    font-size: calc(var(--size, 1) * (14px / var(--pixel-density, 1)));
}

.ai-markdown-explanation strong {
    font-weight: bold;
    color: var(--text-primary);
}

.ai-markdown-explanation em {
    font-style: italic;
    color: var(--text-tertiary);
}

.ai-markdown-explanation code {
    font-family: var(--font-families-mono);
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-tertiary);
}

.ai-markdown-explanation a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-blue);
    transition: all 0.2s ease;
}

.ai-markdown-explanation a:hover {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.ai-markdown-explanation ul,
.ai-markdown-explanation ol {
    margin: 8px 0;
    padding-left: 24px;
}

.ai-markdown-explanation li {
    margin: 4px 0;
    list-style-position: outside;
}

.ai-markdown-explanation ul li {
    list-style-type: disc;
}

.ai-markdown-explanation ol li {
    list-style-type: decimal;
}

.ai-markdown-explanation p {
    margin: 8px 0;
}

.ai-markdown-explanation p:first-child {
    margin-top: 0;
}

.ai-markdown-explanation p:last-child {
    margin-bottom: 0;
}

.ai-markdown-explanation pre {
    background-color: var(--code-bg);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.ai-markdown-explanation pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--text-tertiary);
}

.ai-markdown-explanation blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

.ai-markdown-explanation hr {
    border: none;
    border-top: 1px solid var(--border-tertiary);
    margin: 16px 0;
}

.ai-markdown-explanation table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.ai-markdown-explanation th,
.ai-markdown-explanation td {
    border: 1px solid var(--border-tertiary);
    padding: 6px 12px;
    text-align: left;
}

.ai-markdown-explanation th {
    background-color: var(--input-bg);
    font-weight: bold;
}

.ai-python-output {
    background-color: var(--code-bg);
    padding: 8px;
    margin-top: 4px;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    color: var(--text-tertiary);
    white-space: pre-wrap;
    border-left: 2px solid var(--ai-assistant-text);
}

.ai-code.collapsed {
    display: none;
}

.ai-button-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Keep header button shortcuts visible */
.view-assistant:not(.focused) .view-title-bar .ai-button-shortcut {
    display: none;
}

#ai-input-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
    margin: 0 12px;
    /* Don't shrink when content grows */
}

#ai-prompt-label {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    color: var(--text-subtle);
    margin-bottom: 6px;
    font-style: italic;
}

#ai-context-label-line {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    color: var(--text-subtle);
    margin-bottom: 0;
    font-style: italic;
}

#ai-context-label {
    padding: 2px 6px;
    border-radius: 1px;
    font-style: normal;
    font-weight: 500;
}

#ai-prompt-prefix {
    font-weight: 500;
}

#ai-prompt-wrapper {
    position: relative;
    display: flex;
    align-items: flex-start;
}

#ai-prompt-prefix {
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    pointer-events: none;
    user-select: none;
    flex-shrink: 0;
    padding: 2px 6px;
    border-radius: 1px;
    font-style: normal;
    font-weight: 500;
}

#ai-prompt {
    padding: 0;
    background-color: var(--input-bg);
    border: none;
    border-radius: 0;
    color: var(--text-tertiary);
    caret-color: transparent;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    min-height: 0;
    max-height: calc(
        var(--size, 1) * (12px / var(--pixel-density, 1)) * 1.6 * 6
    );
    resize: none;
    letter-spacing: 0;
    line-height: 1.6;
    flex: 1;
    overflow-y: auto;
    padding-left: 2px;
}

#ai-prompt::placeholder {
    color: var(--text-faint);
}

#ai-prompt:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}

#ai-send-btn {
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-subtle);
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    font-weight: normal;
    font-style: italic;
    cursor: pointer;
    text-align: left;
    margin-top: 0px;
    margin-left: 2px;
}

#ai-send-btn:hover {
    color: var(--text-muted);
}

#ai-send-btn:active {
    color: var(--text-tertiary);
}

#ai-send-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* AI Messages Scrollbar */
#ai-messages::-webkit-scrollbar {
    width: 0;
    display: none;
}

#ai-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ai-messages::-webkit-scrollbar-thumb {
    background: transparent;
}

#ai-messages::-webkit-scrollbar-thumb:hover {
    background: transparent;
}

/* Diff Review Modal */
.diff-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(0 0 0 / 34%);
    backdrop-filter: blur(4px);
}

.diff-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.diff-modal-content {
    background-color: var(--background-primary);
    border: 2px solid var(--border-tertiary);
    width: 90%;
    max-width: 1400px;
    height: 85%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.diff-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--background-tertiary);
}

.diff-modal-header h2 {
    margin: 0;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (16px / var(--pixel-density, 1)));
    font-weight: bold;
    color: var(--text-tertiary);
}

.diff-modal-close {
    background: transparent;
    border: 1px solid var(--border-tertiary);
    color: var(--text-muted);
    font-size: 24px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    font-family: var(--font-families-mono);
    line-height: 1;
}

.diff-modal-close:hover {
    background: var(--input-bg);
    border-color: var(--text-muted);
}

.diff-modal-body {
    flex: 1;
    overflow: auto;
    padding: 16px;
    background-color: var(--background-secondary);
}

/* Settings Panel */
.settings-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    position: relative;
}

.settings-button:hover {
    background: var(--input-bg);
    color: var(--text-primary);
}

.settings-button .material-symbols-outlined {
    font-size: 24px;
}

/* Memory notification indicator on settings button */
.settings-memory-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.settings-memory-indicator.warning {
    background-color: var(--accent-yellow);
}

.settings-memory-indicator.critical {
    background-color: var(--accent-red);
    animation: pulse-indicator 1s ease-in-out infinite;
}

@keyframes pulse-indicator {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.settings-panel {
    position: fixed;
    top: 51px;
    right: -350px;
    width: 350px;
    height: calc(100vh - 50px);
    background-color: var(--background-secondary);
    border-left: 3px solid var(--border-primary);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    right: 0;
}

.settings-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-item {
    margin-bottom: 16px;
}

.settings-item-label {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    font-weight: 500;
}

.settings-item-description {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-primary);
    padding: 10px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 500;
}

.theme-option:hover {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.theme-option.active {
    background-color: var(--background-active);
    color: var(--text-primary);
    border-color: var(--border-secondary);
}

.theme-option .material-symbols-outlined {
    font-size: 18px;
}

/* Volume Control in Settings */
.volume-control-settings {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-icon {
    font-size: 20px;
    color: var(--text-secondary);
    user-select: none;
}

.volume-icon.material-symbols-rounded {
    font-variation-settings:
        'FILL' 1,
        'wght' 400,
        'GRAD' 0,
        'opsz' 24;
}

.volume-slider-settings {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    background: var(--border-secondary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-slider-settings::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-cyan);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider-settings::-webkit-slider-thumb:hover {
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    transform: scale(1.1);
}

.volume-slider-settings::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent-cyan);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider-settings::-moz-range-thumb:hover {
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    transform: scale(1.1);
}

.volume-value {
    font-family: var(--font-families-mono);
    font-size: 13px;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
    font-weight: 500;
}

/* Memory Display in Settings */
.memory-display-settings {
    display: flex;
    align-items: center;
    gap: 12px;
}

.memory-bar-container {
    flex: 1;
    height: 8px;
    background-color: var(--background-primary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    overflow: hidden;
}

.memory-bar {
    height: 100%;
    transition:
        width 0.3s ease,
        background-color 0.3s ease;
    background-color: var(--accent-green);
}

.memory-bar.warning {
    background-color: var(--accent-yellow);
}

.memory-bar.critical {
    background-color: var(--accent-red);
}

.memory-percentage {
    font-family: var(--font-families-mono);
    font-size: 13px;
    color: var(--text-primary);
    min-width: 45px;
    text-align: right;
    font-weight: 600;
}

.memory-details {
    font-family: var(--font-families-mono);
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}

/* Info Icon Button (Reusable) */
.info-icon-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    opacity: 0.7;
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
    vertical-align: middle;
}

.info-icon-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.info-icon-btn .material-symbols-outlined {
    font-size: 16px;
}

/* Info Popup (Reusable Component) */
.info-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-overlay);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.info-popup {
    background-color: var(--modal-bg);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.info-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-primary);
    background-color: var(--background-secondary);
}

.info-popup-header h3 {
    margin: 0;
    font-family: var(--font-families-mono);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.info-popup-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition:
        color 0.2s ease,
        transform 0.2s ease;
    border-radius: 4px;
}

.info-popup-close:hover {
    color: var(--text-primary);
    background-color: var(--background-hover);
    transform: scale(1.1);
}

.info-popup-close .material-symbols-outlined {
    font-size: 20px;
}

.info-popup-content {
    padding: 20px;
    overflow-y: auto;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.info-popup-content h4 {
    margin: 16px 0 8px 0;
    font-family: var(--font-families-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.info-popup-content h4:first-child {
    margin-top: 0;
}

.info-popup-content p {
    margin: 0 0 12px 0;
}

.info-popup-content ul {
    margin: 8px 0 12px 0;
    padding-left: 24px;
}

.info-popup-content li {
    margin: 6px 0;
}

.info-popup-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.info-popup-content .info-highlight {
    background-color: var(--input-bg);
    border-left: 3px solid var(--accent-blue);
    padding: 12px;
    margin: 12px 0;
    border-radius: 4px;
}

.info-popup-content::-webkit-scrollbar {
    width: 8px;
}

.info-popup-content::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.info-popup-content::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.info-popup-content::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Settings panel scrollbar */
.settings-panel-content::-webkit-scrollbar {
    width: 8px;
}

.settings-panel-content::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.settings-panel-content::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.settings-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.diff-explanation {
    margin-top: 24px;
    padding: 16px;
    background-color: var(--input-bg);
    border-top: 1px solid var(--border-tertiary);
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    line-height: 1.6;
    color: var(--text-tertiary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Apply same markdown styles to diff explanation */
.diff-explanation h1,
.diff-explanation h2,
.diff-explanation h3 {
    font-family: var(--font-families-mono);
    color: var(--text-primary);
    margin: 12px 0 8px 0;
    font-weight: bold;
}

.diff-explanation h1 {
    font-size: calc(var(--size, 1) * (18px / var(--pixel-density, 1)));
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 4px;
}

.diff-explanation h2 {
    font-size: calc(var(--size, 1) * (16px / var(--pixel-density, 1)));
}

.diff-explanation h3 {
    font-size: calc(var(--size, 1) * (14px / var(--pixel-density, 1)));
}

.diff-explanation strong {
    font-weight: bold;
    color: var(--text-primary);
}

.diff-explanation em {
    font-style: italic;
    color: var(--text-tertiary);
}

.diff-explanation code {
    font-family: var(--font-families-mono);
    background-color: var(--code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--text-tertiary);
}

.diff-explanation a {
    color: var(--accent-blue);
    text-decoration: none;
    border-bottom: 1px solid var(--accent-blue);
    transition: all 0.2s ease;
}

.diff-explanation a:hover {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.diff-explanation ul,
.diff-explanation ol {
    margin: 8px 0;
    padding-left: 24px;
}

.diff-explanation li {
    margin: 4px 0;
    list-style-position: outside;
}

.diff-explanation ul li {
    list-style-type: disc;
}

.diff-explanation ol li {
    list-style-type: decimal;
}

.diff-explanation p {
    margin: 8px 0;
}

.diff-explanation p:first-child {
    margin-top: 0;
}

.diff-explanation p:last-child {
    margin-bottom: 0;
}

.diff-explanation pre {
    background-color: var(--code-bg);
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.diff-explanation pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--text-tertiary);
}

.diff-explanation blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-muted);
    font-style: italic;
}

.diff-explanation hr {
    border: none;
    border-top: 1px solid var(--border-tertiary);
    margin: 16px 0;
}

.diff-explanation table {
    border-collapse: collapse;
    margin: 8px 0;
    width: 100%;
}

.diff-explanation th,
.diff-explanation td {
    border: 1px solid var(--border-tertiary);
    padding: 6px 12px;
    text-align: left;
}

.diff-explanation th {
    background-color: var(--input-bg);
    font-weight: bold;
}

.diff-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-tertiary);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: var(--background-tertiary);
}

.diff-modal-button {
    padding: 10px 24px;
    font-family: var(--font-families-mono);
    font-size: calc(var(--size, 1) * (12px / var(--pixel-density, 1)));
    border: 2px solid;
    background-color: var(--input-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: normal;
}

.diff-cancel-btn {
    border-color: var(--border-tertiary);
    color: var(--text-muted);
}

.diff-cancel-btn:hover {
    background-color: var(--input-bg);
    border-color: var(--text-subtle);
    color: var(--text-tertiary);
}

.diff-accept-btn {
    border-color: var(--accent-purple);
    color: var(--text-tertiary);
    background-color: var(--input-bg);
}

.diff-accept-btn:hover {
    background-color: var(--ai-assistant-bg);
    border-color: var(--accent-purple);
}

/* Override diff2html styles for dark theme */
#diff-container {
    --d2h-empty-placeholder-bg-color: none;
}

#diff-container,
#diff-container * {
    font-family: var(--font-families-mono) !important;
}

#diff-container .d2h-file-header {
    display: none !important;
}

#diff-container .d2h-code-line ins,
#diff-container .d2h-code-side-line ins {
    color: var(--text-primary) !important;
}

#diff-container .d2h-code-line del,
#diff-container .d2h-code-side-line del {
    color: var(--text-primary) !important;
}

/* Dark borders */
#diff-container * {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Dark scrollbars */
#diff-container ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
    background-color: var(--scrollbar-track);
}

#diff-container ::-webkit-scrollbar-track {
    background-color: var(--scrollbar-track);
}

#diff-container ::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 0;
}

#diff-container ::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb-hover);
}

#diff-container ::-webkit-scrollbar-corner {
    background-color: var(--scrollbar-track);
}

#diff-container .d2h-file-header {
    background-color: var(--background-primary);
    border-color: var(--border-tertiary);
}

#diff-container .d2h-file-diff {
    border-color: var(--border-tertiary);
}

#diff-container .d2h-code-side-linenumber,
#diff-container .d2h-code-linenumber {
    background-color: var(--background-tertiary);
    border-color: var(--border-primary);
    color: var(--text-faint);
    position: static !important;
}

#diff-container .d2h-ins {
    background-color: rgba(0, 255, 0, 0.15);
}

#diff-container .d2h-ins .d2h-code-side-linenumber,
#diff-container .d2h-ins .d2h-code-linenumber {
    background-color: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.3);
}

#diff-container .d2h-del {
    background-color: rgba(255, 0, 0, 0.15);
}

#diff-container .d2h-del .d2h-code-side-linenumber,
#diff-container .d2h-del .d2h-code-linenumber {
    background-color: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.3);
}

#diff-container .d2h-code-line {
    color: var(--text-tertiary);
}

#diff-container .d2h-info {
    background-color: var(--ai-user-bg);
    color: var(--ai-user-text);
}

/* ====================== */
/* Glyph Canvas Styles    */
/* ====================== */

#glyph-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#glyph-canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#glyph-text-input {
    font-family: var(--font-families-mono);
    background-color: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    transition: all 0.2s ease;
}

#glyph-text-input:focus {
    outline: none;
    border-color: var(--accent-magenta);
    box-shadow: 0 0 8px rgba(255, 0, 255, 0.3);
}

#glyph-text-input::placeholder {
    color: var(--text-muted);
}

/* Only apply to editor view when canvas is present */
.view-editor:has(#glyph-canvas-container) .view-content {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Breadcrumb pop animation */
@keyframes breadcrumb-pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

/* Glyph Editor Sidebar Styles */

/* Section headlines for both sidebars */
.editor-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* margin-top: 12px;
    margin-bottom: 6px; */
}

.editor-section-title:first-child {
    margin-top: 0px;
}

/* Masters/Layers list container (unified widget for both modes) */
.editor-layers-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0 -12px;
    /* Extend to edges of sidebar */
}

/* Individual master/layer item */
.editor-layer-item {
    padding: 5px 12px;
    border-radius: 0;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-primary);
    background-color: transparent;
    border-top: none;
    border-bottom: 1px solid var(--border-primary);
    border-left: none;
    border-right: none;
    transition: background-color 0.15s ease;
}

.editor-layer-item:first-child {
    border-top: 1px solid var(--border-primary);
}

/* Dark theme colors */
:root:not([data-theme='light']) .editor-layer-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 0.05);
}

:root:not([data-theme='light']) .editor-layer-item.selected {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Light theme colors */
:root[data-theme='light'] .editor-layer-item:hover:not(.selected) {
    background-color: rgba(255, 255, 255, 1);
}

:root[data-theme='light'] .editor-layer-item.selected {
    background-color: rgba(0, 0, 0, 0.075);
}

/* Inactive layer items (master without corresponding layer) */
.editor-layer-item.inactive {
    opacity: 0.4;
    cursor: default;
}

:root:not([data-theme='light']) .editor-layer-item.inactive:hover {
    background-color: transparent;
}

:root[data-theme='light'] .editor-layer-item.inactive:hover {
    background-color: transparent;
}

/* Master/Layer item content */
.master-item-name {
    font-family: var(--font-families-sans);
    font-size: 11px;
    color: var(--text-primary);
}

.master-item-location {
    font-family: var(--font-families-mono);
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Axis controls container */
.editor-axis-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.editor-axis-label-row {
    display: flex;
    align-items: center;
    font-size: 11px;
    margin-bottom: 4px;
}

.editor-axis-name {
    color: var(--text-primary);
    font-weight: 500;
}

.editor-axis-value {
    margin-left: auto;
}

.editor-axis-play-button {
    background: transparent;
    border: none;
    padding: 0;
    margin-left: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    opacity: 0.6;
    transition:
        opacity 0.15s ease,
        color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.editor-axis-play-button .material-symbols-rounded {
    font-size: 14px;
}

.editor-axis-play-button:hover {
    opacity: 1;
}

.editor-axis-play-button.playing {
    color: var(--accent-primary);
    opacity: 1;
}

.editor-axis-value {
    color: var(--text-secondary);
    font-family: var(--font-families-mono);
    font-size: 10px;
    background: transparent;
    border: 1px solid transparent;
    padding: 1px 3px;
    border-radius: 2px;
    text-align: right;
    width: 40px;
    transition: all 0.15s ease;
}

.editor-axis-value:hover {
    border-color: var(--border-secondary);
    background: var(--background-secondary);
}

.editor-axis-value:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--background-primary);
}

.editor-axis-slider {
    width: 100%;
}

/* Empty state message */
.editor-empty-message {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* General Tag Button Style (used by OpenType features and plugins) */
.tag-button {
    font-family: var(--font-families-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    min-width: 42px;
    text-align: center;
}

.tag-button:hover {
    background: var(--button-hover);
    border-color: var(--border-hover);
}

.tag-button.enabled {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.tag-button.enabled:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--border-hover);
}

/* Light theme adjustments */
:root[data-theme='light'] .tag-button.enabled {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-primary);
}

:root[data-theme='light'] .tag-button.enabled:hover {
    background: rgba(0, 0, 0, 0.12);
}

/* General Tag Description Style (used by OpenType features and plugins) */
.tag-description {
    opacity: 0.7;
    font-size: 11px;
    flex: 1;
    user-select: none;
}

.tag-description.custom-name {
    background: var(--background-custom-name-highlight);
    padding: 4px 6px;
    border-radius: 3px;
    margin-left: -2px;
}

/* OpenType Features Section */
.editor-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.feature-reset-button {
    background: var(--button-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.feature-reset-button:hover:not(:disabled) {
    background: var(--button-hover);
    border-color: var(--border-hover);
}

.feature-reset-button:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.editor-feature-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    padding: 2px 0;
}

/* OpenType feature tag buttons use the general tag-button style */
.editor-feature-tag-button {
    /* Inherits from .tag-button */
}

.editor-feature-description {
    /* Inherits from .tag-description */
}

/* Critical Error Overlay */
#critical-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.critical-error-content {
    background: var(--background-secondary);
    border: 2px solid var(--accent-red);
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(255, 51, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.critical-error-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.critical-error-title {
    color: var(--accent-red);
    font-size: 28px;
    font-weight: bold;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.critical-error-message {
    color: var(--text-primary);
    font-size: 16px;
    margin: 0 0 30px 0;
    line-height: 1.6;
}

.critical-error-instructions {
    background: rgba(255, 51, 0, 0.1);
    border: 1px solid var(--accent-red);
    border-radius: 8px;
    padding: 20px;
    margin: 0 0 20px 0;
}

.critical-error-instructions p {
    color: var(--text-primary);
    font-size: 14px;
    margin: 8px 0;
    line-height: 1.6;
}

.critical-error-instructions strong {
    color: var(--accent-red);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.critical-error-details {
    border-top: 1px solid var(--border-primary);
    padding-top: 20px;
    margin-top: 20px;
}

.critical-error-details p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 8px 0;
    line-height: 1.5;
}
