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

:root {
    /* Dark Theme (Default) */
    --vscode-bg: #0a0a0a;
    --vscode-sidebar: #151515;
    --vscode-editor: #0a0a0a;
    --vscode-line-bg: #1a1a1a;
    --vscode-border: #262626;

    /* Green Color Palette - Matching Landing Page */
    --primary: #00ff88;
    --primary-hover: #00cc6a;
    --success: #00ff88;
    --success-hover: #00cc6a;
    --danger: #ff4444;
    --warning: #ffaa00;
    --accent: #00ff88;
    --accent-dark: #00cc6a;

    --text-primary: #fafafa;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;

    --border-color: #262626;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --header-height: 64px;
    --layout-gap: 12px;
    --panel-radius: 8px;

    /* Performance optimization */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* Light Theme */
[data-theme="light"] {
    --vscode-bg: #fafafa;
    --vscode-sidebar: #f5f5f5;
    --vscode-editor: #ffffff;
    --vscode-line-bg: #f0f0f0;
    --vscode-border: #e0e0e0;

    --primary: #00cc6a;
    --primary-hover: #00b35c;
    --success: #00cc6a;
    --success-hover: #00b35c;
    --danger: #dc2626;
    --warning: #ca8a04;
    --accent: #00cc6a;
    --accent-dark: #00b35c;

    --text-primary: #0a0a0a;
    --text-secondary: #606060;
    --text-muted: #808080;

    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Base Styles */
body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, sans-serif;
    background: var(--vscode-bg);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    transition:
        background-color var(--transition-slow),
        color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
header {
    background: var(--vscode-sidebar);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition:
        background-color var(--transition-slow),
        border-color var(--transition-slow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 0.75rem;
    min-height: var(--header-height);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right {
    gap: 6px;
}

.header-center {
    flex: 1;
    text-align: center;
}

/* Logo */
.logo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    transition: color var(--transition-slow);
    user-select: none;
}

.logo-mobile {
    display: none;
}

.logo-highlight {
    color: var(--primary);
    transition: color var(--transition-slow);
}

/* Header settings icon spin */
#settings-header-btn:hover svg {
    animation: settings-spin 0.6s ease;
}

@keyframes settings-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(90deg);
    }
}

/* Button Base Styles - Optimized */
.btn,
.icon-btn,
.demo-dropdown,
.save-indicator,
.theme-toggle {
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    cursor: pointer;
    background: var(--vscode-sidebar);
    color: var(--text-primary);
}

/* Header icon buttons — more subtle */
.header-right .icon-btn,
.header-right .theme-toggle {
    border-color: transparent;
    background: transparent;
}

.btn {
    padding: 0 16px;
    gap: 8px;
}

.btn svg {
    width: 18px;
    height: 18px;
}

/* Button Variants */
.btn-primary {
    background: var(--primary);
    color: #0a0a0a;
    border-color: var(--primary);
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

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

.btn-secondary {
    background: var(--vscode-sidebar);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
}

.btn-home,
.btn-success {
    background: var(--primary);
    color: #0a0a0a;
    border-color: var(--primary);
    font-weight: 700;
}

.btn-home:hover,
.btn-success:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Icon Buttons */
.icon-btn {
    width: 38px;
    height: 38px;
    padding: 0;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    padding: 0;
}

.theme-toggle:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

/* Demo Selector */
.demo-selector {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.demo-selector label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    transition: color var(--transition-slow);
}

.demo-dropdown {
    padding: 0 12px;
    min-width: 180px;
    cursor: pointer;
}

.demo-dropdown:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.demo-dropdown:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.15);
}

/* Save Indicator */
.save-indicator {
    padding: 0 12px;
    gap: 6px;
    font-size: 0.8125rem;
    cursor: default;
}

.save-indicator.saved {
    background: rgba(0, 255, 136, 0.12);
    border-color: rgba(0, 255, 136, 0.3);
    color: var(--success);
}

[data-theme="light"] .save-indicator.saved {
    background: rgba(0, 204, 106, 0.1);
    border-color: rgba(0, 204, 106, 0.3);
}

.save-indicator svg {
    width: 14px;
    height: 14px;
}

/* Light Theme Borders */
[data-theme="light"] header,
[data-theme="light"] .panel-header,
[data-theme="light"] .editor-footer,
[data-theme="light"] #editor-wrapper,
[data-theme="light"] #terminal-wrapper {
    border-width: 2px;
}

/* Workspace */
#workspace {
    display: flex;
    height: calc(100vh - var(--header-height));
    gap: var(--layout-gap);
    padding: var(--layout-gap);
    overflow: hidden;
    background: var(--vscode-bg);
}

/* Panels */
#editor-wrapper,
#terminal-wrapper {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    background: var(--vscode-editor);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    box-shadow: var(--shadow);
    transition: border-color var(--transition-fast);
    position: relative;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

#editor-wrapper {
    flex-grow: 1.2;
}

#terminal-wrapper {
    flex-grow: 1.25;
}

#editor-wrapper.active {
    border-color: var(--primary);
}

#terminal-wrapper.terminal-active {
    border-color: var(--success);
}

/* Fullscreen */
.fullscreen {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 1000;
    flex: none !important;
    border: none !important;
    border-radius: 0 !important;
}

.hidden {
    display: none !important;
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--vscode-sidebar);
    border-bottom: 1px solid var(--border-color);
    min-height: 44px;
    flex-shrink: 0;
    transition:
        background-color var(--transition-slow),
        border-color var(--transition-slow);
}

.panel-header:has(.file-tabs) {
    padding: 0;
    padding-right: 8px;
}

.panel-header:not(:has(.file-tabs)) {
    padding: 10px 14px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color var(--transition-slow);
}

.panel-icon {
    width: 16px;
    height: 16px;
    color: var(--primary);
    transition: color var(--transition-slow);
}

.panel-actions {
    display: flex;
    gap: 6px;
}

/* Panel Action Buttons */
.panel-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 10px;
    height: 32px;
    background: var(--vscode-line-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.panel-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.panel-action-btn:hover {
    background: var(--vscode-sidebar);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

#clear-btn:hover {
    background: rgba(255, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.vertical-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}

.font-controls {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    background: var(--vscode-line-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0;
}

.font-size-display {
    padding: 0 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 32px;
    text-align: center;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.font-controls .panel-action-btn {
    border-radius: 0;
    padding: 0 8px;
    width: 28px;
    height: 30px;
    /* Match container height */
    border: none;
    background: transparent;
}

.font-controls .panel-action-btn:hover {
    background: var(--vscode-sidebar);
    color: var(--primary);
    z-index: 1;
}

.font-controls .panel-action-btn:first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}

.font-controls .panel-action-btn:last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

#fullscreen-editor-btn:hover,
#fullscreen-terminal-btn:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--primary);
    color: var(--primary);
}

/* CodeMirror Editor Container */
#editor {
    flex: 1;
    width: 100%;
    font-size: 14px;
    background: var(--vscode-editor) !important;
    overflow: hidden;
    position: relative;
}

/* CodeMirror 6 Root */
.cm-editor {
    height: 100%;
    background: var(--vscode-editor) !important;
    font-family: "JetBrains Mono", "Fira Code", monospace;
}

.cm-editor .cm-scroller {
    overflow: auto;
    font-family: inherit;
}

.cm-editor .cm-content {
    caret-color: var(--primary);
}

.cm-editor .cm-cursor {
    border-left-color: var(--primary);
}

/* Gutter */
.cm-editor .cm-gutters {
    background: var(--vscode-sidebar);
    color: var(--text-secondary);
    border-right: 1px solid var(--border-color);
}

.cm-editor .cm-activeLineGutter {
    background: var(--vscode-line-bg);
}

/* Active Line */
.cm-editor .cm-activeLine {
    background: var(--vscode-line-bg);
}

/* Selection */
.cm-editor .cm-selectionBackground,
.cm-editor.cm-focused .cm-selectionBackground,
::selection {
    background: rgba(0, 255, 136, 0.15) !important;
}

[data-theme="light"] .cm-editor .cm-selectionBackground,
[data-theme="light"] .cm-editor.cm-focused .cm-selectionBackground {
    background: rgba(0, 204, 106, 0.2) !important;
}

/* Matching Brackets */
.cm-editor .cm-matchingBracket {
    background: rgba(0, 255, 136, 0.25);
    outline: 1px solid rgba(0, 255, 136, 0.4);
}

/* Light theme gutter overrides */
[data-theme="light"] .cm-editor .cm-gutters {
    background: var(--vscode-sidebar);
    color: var(--text-secondary);
}

[data-theme="light"] .cm-editor .cm-activeLineGutter {
    background: var(--vscode-line-bg);
}

/* CodeMirror focused state */
.cm-editor.cm-focused {
    outline: none;
}

/* Scrollbar styling for CodeMirror */
.cm-editor .cm-scroller::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.cm-editor .cm-scroller::-webkit-scrollbar-track {
    background: transparent;
}

.cm-editor .cm-scroller::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.cm-editor .cm-scroller::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Tooltip / autocomplete panel */
.cm-tooltip {
    background: var(--vscode-sidebar) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.cm-tooltip-autocomplete ul li {
    padding: 4px 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8125rem;
}

.cm-tooltip-autocomplete ul li[aria-selected] {
    background: rgba(0, 255, 136, 0.15);
    color: var(--text-primary);
}

[data-theme="light"] .cm-tooltip {
    background: var(--vscode-sidebar) !important;
    border-color: var(--border-color) !important;
}

[data-theme="light"] .cm-tooltip-autocomplete ul li[aria-selected] {
    background: rgba(0, 204, 106, 0.15);
}

/* Editor Footer */
.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: var(--vscode-sidebar);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-muted);
    min-height: 32px;
    flex-shrink: 0;
    transition:
        background-color var(--transition-slow),
        border-color var(--transition-slow);
}

.editor-mode {
    padding: 4px 10px;
    background: var(--primary);
    color: #0a0a0a;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.7rem;
    transition: background-color var(--transition-slow);
}

/* Terminal/Canvas */
#dos-iframe {
    width: 100%;
    height: 100%;
    background: #000;
    cursor: pointer;
    display: block;
    border: 0;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.terminal-canvas-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#terminal-wrapper.fullscreen #dos-iframe {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    transform: scale(1.2) !important;
}

/* Keyboard Blocker - Toast Mode */
.keyboard-blocker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    align-items: flex-start;
    /* Align to top */
    justify-content: center;
    /* Center horizontally */
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    padding-top: 30px;
    /* Space from top */
}

.keyboard-blocker.active {
    opacity: 1;
    pointer-events: all;
    cursor: pointer;
    /* Show pointer to indicate clickable */
}

.blocker-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    /* Larger padding */
    background: rgba(21, 21, 21, 0.9);
    /* Semi-transparent dark bg */
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    /* Larger pill shape */
    font-weight: 500;
    font-size: 0.95rem;
    /* Larger text */
    color: var(--text-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all var(--transition-normal);
    transform: translateY(-10px);
    /* Initial slide from top */
}

.keyboard-blocker.active .blocker-message {
    transform: translateY(0);
}

.blocker-message:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.blocker-message svg {
    width: 20px;
    /* Larger icon */
    height: 20px;
    color: var(--primary);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--vscode-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 136, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: color var(--transition-slow);
}

.loading-progress {
    width: 280px;
    height: 3px;
    background: rgba(128, 128, 128, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.loading-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width var(--transition-normal);
}

/* Output Panel */
#output-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: var(--vscode-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transform: translateY(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        transform 0.3s ease,
        opacity 0.3s ease,
        visibility 0.3s ease;
}

#output-panel.visible {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#output-panel.expanded {
    height: 100%;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--vscode-sidebar);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    gap: 10px;
}

.output-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--danger);
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.output-title svg {
    flex-shrink: 0;
}

.output-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Copy Error Button - Matches Compile & Run button style, solid red */
.copy-error-btn {
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 0.8125rem;
    font-weight: 700;
    background: var(--danger);
    color: #fff;
    border: 1px solid var(--danger);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-error-btn:hover {
    background: #e03b3b;
    border-color: #e03b3b;
    transform: translateY(-1px);
}

.copy-error-btn:active {
    transform: translateY(0);
}

.copy-error-btn.copied {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.copy-error-btn svg {
    width: 14px;
    height: 14px;
}

.expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.expand-btn:hover {
    background: var(--vscode-line-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.expand-btn svg {
    width: 13px;
    height: 13px;
    transition: transform var(--transition-fast);
}

.expand-btn.expanded svg {
    transform: rotate(180deg);
}

.output-content {
    flex: 1;
    padding: 12px 16px;
    font-family: "JetBrains Mono", "Consolas", monospace;
    font-size: 0.8125rem;
    line-height: 1.7;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
    background: var(--vscode-bg);
}

.output-content::-webkit-scrollbar {
    width: 5px;
}

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

.output-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.output-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.output-error {
    color: var(--danger);
    font-weight: 500;
}

.output-success {
    color: var(--success);
}

#terminal-wrapper.has-panel .terminal-canvas-wrap {
    height: 50%;
    flex: 0 0 50%;
}

/* Progress Bar */
.progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-color);
    z-index: 1000;
}

.progress-bar.hidden {
    display: none;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width var(--transition-normal);
}

.progress-fill.indeterminate {
    width: 30%;
    animation: progress-slide 1s ease-in-out infinite;
}

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

    100% {
        transform: translateX(400%);
    }
}

/* Status Message */
.status-message {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--primary);
    color: #0a0a0a;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    animation: fade-in var(--transition-normal);
}

.status-message.hidden {
    display: none;
}

.status-message.error {
    background: var(--danger);
    color: white;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

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

/* Sidebar Container */
.sidebar-container {
    display: flex;
    flex-shrink: 0;
    height: 100%;
    gap: 0;
}

/* Activity Bar — Always visible on desktop */
.activity-bar {
    width: 48px;
    min-width: 48px;
    background: var(--vscode-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    flex-shrink: 0;
    gap: 2px;
    margin-right: 8px;
    transition:
        background-color var(--transition-slow),
        border-color var(--transition-slow);
    position: relative;
}

/* Top icons group */
.activity-bar-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

/* Bottom icons group — pushed to bottom */
.activity-bar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    margin-top: auto;
    padding-top: 4px;
    border-top: 1px solid var(--border-color);
}

/* Separator between icon groups */
.activity-bar-separator {
    width: 24px;
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.activity-bar-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-fast);
    position: relative;
}

.activity-bar-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .activity-bar-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.activity-bar-btn.active {
    color: var(--primary);
    background: rgba(0, 255, 136, 0.08);
}

[data-theme="light"] .activity-bar-btn.active {
    background: rgba(0, 204, 106, 0.1);
}

.activity-bar-btn.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.activity-bar-btn svg {
    width: 22px;
    height: 22px;
    transition: transform var(--transition-fast);
}

.activity-bar-btn:hover svg {
    transform: scale(1.08);
}

/* Settings icon spin on hover */
#settings-activity-btn:hover svg {
    animation: settings-spin 0.6s ease;
}

/* Sidebar */
#sidebar {
    width: 232px;
    min-width: 232px;
    background: var(--vscode-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--panel-radius);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition:
        width var(--transition-slow),
        min-width var(--transition-slow),
        opacity var(--transition-slow),
        margin var(--transition-slow);
    z-index: 90;
    overflow: hidden;
    overflow-y: auto;
    min-height: 0;
}

#sidebar.collapsed {
    width: 0;
    min-width: 0;
    border: none;
    opacity: 0;
}

/* Sidebar Header */
.sidebar-header {
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    min-height: 40px;
    background: var(--vscode-sidebar);
}

.sidebar-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-header-left>span {
    color: var(--primary);
}

/* Sidebar Header Buttons */
.sidebar-collapse-btn,
.sidebar-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.sidebar-collapse-btn:hover,
.sidebar-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

[data-theme="light"] .sidebar-collapse-btn:hover,
[data-theme="light"] .sidebar-action-btn:hover {
    background: rgba(0, 0, 0, 0.08);
}

.sidebar-collapse-btn svg,
.sidebar-action-btn svg {
    width: 16px;
    height: 16px;
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Explorer Actions (New File) */
.explorer-actions {
    display: flex;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.explorer-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--vscode-line-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.explorer-action-btn svg {
    width: 16px;
    height: 16px;
}

/* File Explorer */
.file-explorer {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.file-explorer::-webkit-scrollbar {
    width: 6px;
}

.file-explorer::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.file-explorer::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--vscode-bg);
}

.files-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.files-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* File List */
.file-list-flat {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 6px 0;
}

/* File Item */
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    border-left: 2px solid transparent;
    margin: 0;
    transition: all var(--transition-fast);
    position: relative;
}

.file-item:hover {
    background: var(--vscode-line-bg);
    color: var(--text-primary);
}

.file-item.active {
    background: rgba(0, 255, 136, 0.1);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

[data-theme="light"] .file-item.active {
    background: rgba(0, 204, 106, 0.1);
}

.file-item .file-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 1.5;
    transition:
        transform var(--transition-fast),
        color var(--transition-fast);
}

.file-item .file-icon.icon-cpp {
    color: #519aba;
}

.file-item .file-icon.icon-header {
    color: #a074c4;
}

.file-item .file-icon.icon-text {
    color: #8b949e;
}

.file-item .file-icon.icon-default {
    color: #7d8590;
}

.file-item:hover .file-icon {
    transform: scale(1.05);
}

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

.file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
    min-width: 0;
    /* Ensure text truncation works in flex item */
}

.file-item.active .file-name {
    font-weight: 500;
}

/* File Actions - Always Visible */
.file-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 1;
    /* Always visible */
    margin-left: auto;
    padding-left: 8px;
}

.file-action-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    flex-shrink: 0;
}

.file-action-btn svg {
    width: 13px;
    height: 13px;
}

.file-action-btn:hover {
    background: var(--vscode-line-bg);
    color: var(--text-primary);
}

.file-download-btn:hover {
    background: rgba(0, 255, 136, 0.12);
    color: var(--primary);
}

.file-delete-btn:hover {
    background: rgba(255, 68, 68, 0.12);
    color: var(--danger);
}

/* Cloud Promo — minimal centered layout */
.cloud-promo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px 24px;
    text-align: center;
    gap: 16px;
}

.cloud-promo-icon {
    width: 44px;
    height: 44px;
    color: var(--primary);
    opacity: 0.7;
}

.cloud-promo-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 200px;
}

.auth-hint {
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.6;
    letter-spacing: 0.02em;
}

/* Auth Section */
.auth-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border-top: none;
    margin-top: 0;
    width: 100%;
    max-width: 220px;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    background: #ffffff;
    color: #1f1f1f;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.google-btn:hover {
    background: #f8faff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}

.google-icon {
    width: 18px;
    height: 18px;
}

/* User Profile */
.user-profile {
    padding: 10px;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.user-profile-btn:hover {
    background: var(--vscode-line-bg);
    border-color: var(--border-color);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0a0a0a;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile-dropdown {
    position: absolute;
    bottom: 100%;
    left: 10px;
    right: 10px;
    background: var(--vscode-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow);
    padding: 4px;
    display: none;
    z-index: 100;
}

.user-profile-dropdown.open {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--vscode-line-bg);
    color: var(--text-primary);
}

.dropdown-item.danger:hover {
    background: rgba(255, 68, 68, 0.1);
    color: var(--danger);
}

.dropdown-item svg {
    width: 15px;
    height: 15px;
}

/* File Tabs */
.file-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.file-tabs::-webkit-scrollbar {
    display: none;
}

.file-tab {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 14px;
    height: 40px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--vscode-sidebar);
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
    min-width: 110px;
}

.file-tab:hover {
    background: var(--vscode-line-bg);
    color: var(--text-primary);
}

.file-tab.active {
    background: var(--vscode-editor);
    color: var(--text-primary);
}

.file-tab.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.file-tab svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.file-tab-name {
    font-family: "JetBrains Mono", monospace;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-tab-close {
    width: 17px;
    height: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    opacity: 0;
    transition: all var(--transition-fast);
    margin-left: 3px;
}

.file-tab:hover .file-tab-close {
    opacity: 0.5;
}

.file-tab-close:hover {
    background: rgba(255, 68, 68, 0.15);
    color: var(--danger);
    opacity: 1 !important;
}

.file-tab-close svg {
    width: 11px;
    height: 11px;
}

/* Editor Loading Overlay */
.editor-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--vscode-editor);
    z-index: 50;
    transition:
        opacity var(--transition-normal),
        visibility var(--transition-normal);
}

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

.editor-loading-spinner {
    width: 42px;
    height: 42px;
    border: 3px solid rgba(0, 255, 136, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.editor-loading-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    padding: 14px;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    width: min(400px, 100%);
    background: var(--vscode-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.modal-body label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.modal-body input {
    height: 36px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--vscode-editor);
    color: var(--text-primary);
    padding: 0 10px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.875rem;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.12);
}

.modal-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 7px;
    justify-content: flex-end;
}

/* ============================================================
   SETTINGS PANEL
   ============================================================ */
.settings-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    overflow-y: auto;
    gap: 0;
}

.settings-panel::-webkit-scrollbar {
    width: 8px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    border: 2px solid var(--vscode-sidebar);
}

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

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

.settings-section {
    padding: 12px 16px;
    border-bottom: 1px solid transparent;
}

.settings-section:not(:last-child) {
    margin-bottom: 4px;
}

.settings-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.settings-section-title svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Theme Dropdown */
.settings-select {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    background: var(--vscode-editor);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23a0a0a0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.settings-select:hover {
    border-color: var(--text-muted);
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary);
}

.settings-select option {
    background: var(--vscode-editor);
    color: var(--text-primary);
    padding: 8px;
}

[data-theme="light"] .settings-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%23606060'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}

/* Font Size Control */
.settings-font-size-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-stepper-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vscode-editor);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.settings-stepper-btn:hover {
    background: var(--vscode-line-bg);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.settings-stepper-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 20px;
    text-align: center;
    font-family: "JetBrains Mono", monospace;
    background: var(--vscode-editor);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
}

/* Range Slider */
.settings-range {
    flex: 1 1 auto;
    min-width: 0;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin: 0 4px;
}

.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition:
        transform var(--transition-fast),
        box-shadow var(--transition-fast);
}

.settings-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.15);
}

[data-theme="light"] .settings-range::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px rgba(0, 204, 106, 0.15);
}

.settings-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
    transition: transform var(--transition-fast);
}

.settings-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Toggle Group */
.settings-toggle-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin: 0 -8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition-fast);
}

.settings-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .settings-toggle:hover {
    background: rgba(0, 0, 0, 0.03);
}

.settings-toggle-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.settings-toggle:hover .settings-toggle-label {
    color: var(--text-primary);
}

/* Clean UI Switch (IDE Style) */
.settings-switch {
    position: relative;
    width: 32px;
    height: 18px;
    flex-shrink: 0;
}

.settings-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.settings-switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.settings-switch-slider::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-primary);
    transition: all cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.settings-switch input:checked+.settings-switch-slider {
    background: var(--primary);
}

.settings-switch input:checked+.settings-switch-slider::before {
    transform: translateY(-50%) translateX(14px);
    background: #ffffff;
}

[data-theme="light"] .settings-switch input:checked+.settings-switch-slider::before {
    background: #ffffff;
}

/* Reset Button */
.settings-reset-btn {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
}

.settings-reset-btn svg {
    width: 14px;
    height: 14px;
}

.settings-reset-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

[data-theme="light"] .settings-reset-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* ============================================================
   MOBILE TAB BAR — hidden on desktop, shown ≤768px
   ============================================================ */
.mobile-tab-bar {
    display: none;
    /* hidden on desktop */
}

.mobile-menu-shortcuts {
    display: none;
}

/* ============================================================
   TABLET ( ≤1024px )
   ============================================================ */
@media (max-width: 1024px) {
    .header-content {
        padding: 0.6rem 1rem;
        gap: 0.6rem;
    }

    .logo {
        font-size: 0.9rem;
    }

    .demo-dropdown {
        min-width: 150px;
    }
}

/* ============================================================
   MOBILE ( ≤768px ) — Full-screen tabbed layout
   ============================================================ */
@media (max-width: 768px) {

    /* ---- CSS Variables ---- */
    :root {
        --header-height: 56px;
        --tab-bar-height: 50px;
    }

    /* ---- Header ---- */
    header {
        border-bottom: none;
        box-shadow: none;
    }

    .header-content {
        flex-wrap: nowrap;
        padding: 8px 10px;
        gap: 8px;
        min-height: var(--header-height);
        background: var(--vscode-sidebar);
    }

    .header-left {
        order: 1;
        gap: 8px;
        flex: 0 0 auto;
    }

    .header-center {
        display: none;
    }

    .header-right {
        order: 2;
        gap: 8px;
        flex: 0 0 auto;
    }

    /* Run button is the center anchor action */
    #run-btn {
        order: 3;
        flex: 1 1 0;
        width: 100%;
        height: 40px;
        font-size: 0.9rem;
        border-radius: 10px;
        letter-spacing: 0.01em;
        justify-content: center;
        min-width: 0;
    }

    #run-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Hide desktop-only elements */
    .demo-selector,
    #status-message,
    .save-indicator,
    .editor-mode,
    .logo-full,
    #theme-toggle {
        display: none !important;
    }

    .logo-mobile {
        display: none !important;
    }

    .header-left .btn-text-desktop,
    .header-right .btn-text-desktop,
    .header-left .btn-text:not(.btn-text-mobile),
    .header-right .btn-text:not(.btn-text-mobile) {
        display: none !important;
    }

    #sidebar-toggle .btn-text-mobile {
        display: none !important;
    }

    #back-btn .btn-text-mobile {
        display: none !important;
    }

    #run-btn .btn-text-mobile {
        display: inline !important;
        font-weight: 700;
    }

    #run-btn .btn-text-desktop {
        display: none !important;
    }

    #save-btn,
    #settings-header-btn {
        display: inline-flex !important;
        width: 40px !important;
        height: 40px;
        padding: 0 !important;
        justify-content: center;
        align-items: center;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: var(--vscode-line-bg);
        color: var(--text-primary);
    }

    #save-btn svg,
    #settings-header-btn svg {
        width: 18px;
        height: 18px;
    }

    #save-btn .btn-text,
    #settings-header-btn .btn-text {
        display: none !important;
    }

    #sidebar-toggle {
        display: inline-flex !important;
        width: 40px !important;
        height: 40px;
        padding: 0 !important;
        justify-content: center;
        align-items: center;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: var(--vscode-line-bg);
        color: var(--text-primary);
    }

    #back-btn {
        display: inline-flex !important;
        width: 40px !important;
        height: 40px;
        padding: 0 !important;
        justify-content: center;
        align-items: center;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        background: var(--vscode-line-bg);
        color: var(--text-primary);
    }

    #sidebar-toggle svg,
    #back-btn svg {
        width: 18px;
        height: 18px;
    }

    #sidebar-toggle:hover,
    #back-btn:hover,
    #save-btn:hover,
    #settings-header-btn:hover {
        background: var(--vscode-sidebar);
        border-color: var(--text-primary);
    }

    .mobile-tab-bar {
        display: flex !important;
        align-items: center;
        gap: 6px;
        height: var(--tab-bar-height);
        padding: 6px 10px;
        background: var(--vscode-sidebar);
        border-bottom: none;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        position: sticky;
        top: var(--header-height);
        z-index: 99;
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        height: 36px;
        background: var(--vscode-line-bg);
        border: 1px solid transparent;
        border-radius: 0px;
        color: var(--text-muted);
        font-size: 0.78rem;
        font-weight: 600;
        cursor: pointer;
        transition: all var(--transition-fast);
        position: relative;
    }

    .mobile-tab svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }

    .mobile-tab.active {
        background: rgba(0, 255, 136, 0.16);
        border-color: rgba(0, 255, 136, 0.45);
        color: #d4ffe9;
    }

    [data-theme="light"] .mobile-tab.active {
        background: rgba(0, 204, 106, 0.14);
        border-color: rgba(0, 204, 106, 0.4);
        color: var(--primary);
    }

    .mobile-tab.active::after {
        display: none;
    }

    .mobile-tab:not(.active):hover {
        background: var(--vscode-line-bg);
        color: var(--text-secondary);
    }

    /* ---- Workspace — occupies remaining height ---- */
    #workspace {
        flex-direction: column;
        height: calc(100vh - var(--header-height) - var(--tab-bar-height));
        gap: 0;
        padding: 6px 0 0;
        overflow: hidden;
    }

    /* Hide activity bar on mobile */
    .activity-bar {
        display: none;
    }

    /* Keep header visible when panels go fullscreen so Run button is accessible */
    .fullscreen {
        top: calc(var(--header-height) + var(--tab-bar-height)) !important;
        height: calc(100vh - var(--header-height) - var(--tab-bar-height)) !important;
    }

    /* ---- Tab Panels: show/hide ---- */
    #editor-wrapper,
    #terminal-wrapper {
        border-radius: 0;
        border: none;
        border-bottom: 1px solid var(--border-color);
        box-shadow: none;
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        display: flex !important;
    }

    body:not(.mobile-tab-output):not(.mobile-tab-explorer) #editor-wrapper {
        display: flex !important;
    }

    body:not(.mobile-tab-output):not(.mobile-tab-explorer) #terminal-wrapper {
        display: none !important;
    }

    body.mobile-tab-output #editor-wrapper {
        display: none !important;
    }

    body.mobile-tab-output #terminal-wrapper {
        display: flex !important;
    }

    body.mobile-tab-explorer #editor-wrapper,
    body.mobile-tab-explorer #terminal-wrapper,
    body:has(#sidebar.open) #editor-wrapper,
    body:has(#sidebar.open) #terminal-wrapper {
        display: none !important;
    }

    body.mobile-tab-explorer .sidebar-container,
    body:has(#sidebar.open) .sidebar-container {
        display: flex !important;
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        height: 100% !important;
        z-index: 10;
        transform: none !important;
        width: 100%;
    }

    body.mobile-tab-explorer #sidebar,
    body:has(#sidebar.open) #sidebar {
        width: 100% !important;
        transform: translateX(0) !important;
        box-shadow: none !important;
    }

    /* ---- Sidebar (off-canvas drawer) ---- */
    .sidebar-container {
        display: none;
    }

    #sidebar {
        width: 100%;
        height: 100%;
        box-shadow: none;
        transform: translateX(0);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

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

    #sidebar.collapsed {
        transform: translateX(0);
    }

    .sidebar-collapse-btn {
        display: none;
    }

    /* #sidebar-toggle is shown on mobile */

    .mobile-menu-shortcuts {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 10px 12px;
        border-bottom: 1px solid var(--border-color);
        background: var(--vscode-line-bg);
    }

    .mobile-menu-btn {
        height: 36px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        background: var(--vscode-sidebar);
        color: var(--text-secondary);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 0.74rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-menu-btn svg {
        width: 14px;
        height: 14px;
    }

    .mobile-menu-btn:hover {
        color: var(--primary);
        border-color: var(--primary);
    }

    /* Sidebar overlay */
    .sidebar-overlay {
        display: none !important;
    }

    /* Auth section */
    .auth-section {
        padding: 12px;
        flex-shrink: 0;
    }

    .google-btn {
        padding: 12px 16px;
        font-size: 0.875rem;
    }

    /* ---- Panel headers / actions ---- */
    .panel-header {
        padding: 8px 10px;
    }

    .panel-title {
        font-size: 0.75rem;
    }

    .panel-icon {
        width: 14px;
        height: 14px;
    }

    .panel-action-btn span {
        display: none;
    }

    .panel-action-btn {
        width: 36px;
        height: 36px;
        padding: 0;
    }

    .panel-action-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Show fullscreen buttons on mobile since we use split view */
    #fullscreen-editor-btn,
    #fullscreen-terminal-btn {
        display: inline-flex;
    }

    /* Editor footer */
    .editor-footer {
        padding: 5px 10px;
        font-size: 0.7rem;
    }

    /* Loading overlay */
    .loading-progress {
        width: 220px;
    }

    .loading-text {
        font-size: 0.8125rem;
    }

    .blocker-message {
        padding: 10px 14px;
        font-size: 0.8125rem;
    }

    .blocker-message svg {
        width: 17px;
        height: 17px;
    }

    /* File tabs */
    .file-tab {
        min-width: 90px;
        padding: 0 10px;
        font-size: 0.75rem;
    }

    .file-tab svg {
        width: 13px;
        height: 13px;
    }

    /* Error panel mobile */
    #output-panel {
        height: 60%;
    }

    .output-header {
        padding: 8px 10px;
    }

    .output-title {
        font-size: 0.75rem;
    }

    .copy-error-btn {
        height: 28px;
        padding: 0 10px;
        font-size: 0.75rem;
    }

    #copy-btn-text {
        display: none;
    }

    .expand-btn {
        width: 28px;
        height: 28px;
    }

    .output-content {
        padding: 10px 12px;
        font-size: 0.75rem;
        line-height: 1.6;
    }
}

/* ============================================================
   VERY SMALL SCREENS ( ≤480px )
   ============================================================ */
@media (max-width: 480px) {
    .header-content {
        padding: 0.4rem;
    }

    .logo {
        font-size: 0.75rem;
    }

    .btn,
    .icon-btn,
    .theme-toggle {
        height: 32px;
    }

    .icon-btn,
    .theme-toggle {
        width: 32px;
    }

    #workspace {
        height: calc(100vh - var(--header-height, 90px) - var(--tab-bar-height, 44px));
    }

    #output-panel {
        height: 65%;
    }

    .mobile-tab {
        font-size: 0.75rem;
    }

    .mobile-tab svg {
        width: 14px;
        height: 14px;
    }
}

/* ============================================================
   LANDSCAPE ON MOBILE
   ============================================================ */
@media (max-width: 768px) and (orientation: landscape) {
    :root {
        --header-height: 50px;
        --tab-bar-height: 38px;
    }

    .header-content {
        padding: 0.3rem 0.5rem;
    }

    #run-btn {
        order: 2;
        flex: 1 1 auto;
        width: auto;
        height: 32px;
        font-size: 0.8rem;
    }

    .mobile-tab-bar {
        height: var(--tab-bar-height);
        padding: 4px 10px;
    }

    .mobile-tab {
        height: 28px;
    }
}

/* ============================================================
   PERFORMANCE / REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {

    header,
    .sidebar-container,
    #terminal-wrapper,
    .mobile-tab-bar {
        display: none !important;
    }

    #editor-wrapper {
        border: none !important;
        box-shadow: none !important;
    }
}