:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #4493e0;
    --success: #3fb950;
    --error: #f85149;
    --warning: #d29922;
    --border: #30363d;
    --border-hover: #484f58;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
}

[data-theme="light"] {
    --bg-primary: #f7f7f8;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --accent: #0a84ff;
    --accent-hover: #0666d0;
    --success: #0f7b5c;
    --error: #d92d20;
    --warning: #a16207;
    --border: #e6e7eb;
    --border-hover: #d4d6db;
}

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

html {
    overflow-x: hidden;
    width: 100%;
    overscroll-behavior: none; /* Disable pull-to-refresh */
}

body {
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, var(--font-mono);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    width: 100%;
    overscroll-behavior: none; /* Disable pull-to-refresh */
    touch-action: pan-x pan-y; /* Allow normal scrolling but prevent browser gestures */
    position: relative;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    max-height: 100vh;
    max-height: 100dvh;
}

# Icon helpers
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Status dots (replace emoji dots) */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background-color: var(--border); }
.dot.dot-on { background-color: var(--success); }
.dot.dot-idle { background-color: #9ca3af; }
.dot.dot-error { background-color: var(--error); }

/* Header styles removed - using tab-based interface */

/* Session Tabs Bar */
.session-tabs-bar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    min-height: 36px;
    position: relative;
    overflow: visible; /* Ensure dropdown can overflow */
}

.tabs-section {
    display: flex;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    overflow-y: visible; /* Allow dropdown to overflow vertically */
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.tabs-section::-webkit-scrollbar {
    height: 4px;
}

.tabs-section::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 2px;
}

.tabs-container {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
}

.session-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    max-width: 200px;
    position: relative;
    user-select: none;
}

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

.session-tab.active {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-bottom-color: var(--bg-primary);
}

.session-tab.dragging {
    opacity: 0.5;
}

.tab-content {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.tab-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.tab-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.tab-status.active {
    background-color: var(--success);
}

.tab-status.idle {
    background-color: #3b82f6;  /* Blue to indicate Claude likely finished */
    animation: idle-gentle-pulse 3s infinite;
}

.tab-status.disconnected {
    background-color: var(--error);
}

.tab-status.error {
    background-color: var(--error);
}

/* Pulse animation for active sessions */
.tab-status.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes idle-gentle-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* Unread indicator - changes status dot to blue */
.tab-status.unread {
    background-color: #3b82f6 !important;
    animation: unread-pulse 1.5s infinite;
}

@keyframes unread-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.session-tab.has-unread .tab-name {
    color: #3b82f6;
    font-weight: 600;
}

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

.tab-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    flex-shrink: 0;
}

.session-tab:hover .tab-close {
    opacity: 0.6;
}

.tab-close:hover {
    opacity: 1;
    background-color: var(--border);
}

.tab-name-input {
    width: 100%;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-hover);
    border-radius: 4px;
    padding: 2px 4px;
    outline: none;
}

.tab-new {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-left: 4px;
}

.tab-actions {
    position: relative;
    display: flex;
    gap: 6px;
    align-items: center;
}

.tab-tile {
  width: 28px; height: 28px; display:flex; align-items:center; justify-content:center;
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-secondary); cursor: pointer; transition: all .2s; flex-shrink: 0; margin-left: 4px;
}
.tab-tile:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.tab-tile[disabled] { opacity: .5; cursor: not-allowed; }

/* Global tabs are visible; panes can be enabled optionally */

.tab-new:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-settings {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: auto;
    flex-shrink: 0;
}

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

/* Tab Overflow Dropdown for Mobile */
.tab-overflow-wrapper {
    position: relative;
    display: none;
}

.tab-overflow-btn {
    width: auto;
    height: 28px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 4px;
}

.tab-overflow-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.tab-overflow-count {
    font-size: 12px;
    font-weight: 600;
}

.tab-overflow-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    max-width: 300px;
    z-index: 10000; /* Higher z-index to ensure it appears above everything */
    max-height: 400px;
    overflow-y: auto;
}

.tab-overflow-menu.active {
    display: block;
}

.overflow-tab-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border);
}

.overflow-tab-item:last-child {
    border-bottom: none;
}

.overflow-tab-item:hover {
    background-color: var(--bg-tertiary);
}

.overflow-tab-item.active {
    background-color: var(--bg-tertiary);
    color: var(--accent);
}

.overflow-tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.overflow-tab-close {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.overflow-tab-close:hover {
    background-color: var(--error);
    color: white;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    /* Overflow wrapper visibility is controlled by JavaScript */
}

/* Terminal Container */
.terminal-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.terminal-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}


/* Session Dropdown Styles - Hidden when using tabs */
.session-dropdown {
    position: relative;
    display: none; /* Hide dropdown when using tabs */
}

.session-btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-btn svg {
    opacity: 0.8;
}

.dropdown-arrow {
    transition: transform 0.2s;
}

.session-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 400px;
    z-index: 1000;
    display: none;
}

.session-dropdown-menu.active {
    display: block;
}

.session-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-dropdown-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.session-list {
    max-height: 300px;
    overflow-y: auto;
}

.session-item {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.session-item:hover {
    background-color: var(--bg-tertiary);
}

.session-item.active {
    background-color: var(--bg-tertiary);
    border-left: 3px solid var(--accent);
    padding-left: 13px;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.session-status {
    font-size: 10px;
}

.session-details {
    flex: 1;
}

.session-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.session-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

.session-folder {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.session-actions {
    display: flex;
    gap: 4px;
}

.no-sessions {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.session-dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-tertiary);
}

.btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover:not(:disabled) {
    background-color: var(--bg-secondary);
    border-color: var(--border-hover);
}

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

.btn-primary {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border);
}

.btn-danger {
    background-color: var(--error);
    color: white;
    border-color: var(--error);
}

.btn-danger:hover:not(:disabled) {
    background-color: #d73a49;
    border-color: #d73a49;
}

.btn-success {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    border-color: #059669;
}

.btn-danger-skip {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #8b0000;
    color: white;
    border: 2px solid #660000;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger-skip:hover {
    background-color: #a00000;
    border-color: #800000;
    box-shadow: 0 0 10px rgba(139, 0, 0, 0.5);
}

.btn-danger-skip svg {
    width: 24px;
    height: 24px;
}

.main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.terminal-container {
    flex: 1;
    position: relative;
    background-color: var(--bg-primary);
    width: 100%;
    overflow: hidden;
}

/* Context menu for tabs */
.pane-session-menu { position: absolute; z-index: 3000; min-width: 220px; background: var(--bg-secondary); border:1px solid var(--border); border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.35); padding:6px; }
.pane-session-item { padding:8px 10px; border-radius:6px; cursor:pointer; color: var(--text-primary); }
.pane-session-item.used { color: var(--text-secondary); }
.pane-session-item:hover { background: var(--bg-tertiary); }

/* Split View */
.split-container {
    flex: 1;
    display: flex;
    min-height: 0;
    position: relative;
}

.split-pane {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
    transition: border-color 0.2s ease;
}

.split-pane.split-active {
    border: 2px solid var(--accent);
}

.split-terminal-wrapper {
    flex: 1;
    min-height: 0;
  width: 100%;
    display: flex;
    flex-direction: column;
}

.split-left {
    width: 50%;
}

.split-right {
    width: 50%;
}

.split-divider {
    width: 6px;
  background: var(--border);
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

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

.split-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.split-close:hover {
    opacity: 1;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Drop zone for drag-to-split */
.split-drop-zone {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100px;
    background: rgba(88, 166, 255, 0.15);
    border: 2px dashed rgba(88, 166, 255, 0.5);
    border-radius: 8px;
    pointer-events: none;
    z-index: 100;
}

#terminal {
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.terminal-overlay {
    position: fixed; /* Cover the full app regardless of container visibility */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5000;
    background-color: rgba(13, 17, 23, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background-color: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-width: 520px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Inline Plan Panel */
.plan-inline-panel {
    position: relative;
    max-height: 40vh;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    z-index: 10;
}
.plan-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}
.plan-inline-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}
.plan-inline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.plan-inline-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}
.plan-inline-content {
    padding: 12px;
    overflow-y: auto;
    max-height: calc(40vh - 40px);
    font-size: 13px;
    line-height: 1.5;
}
.plan-inline-panel.collapsed .plan-inline-content {
    display: none;
}
.plan-inline-panel.collapsed .plan-inline-toggle svg {
    transform: rotate(180deg);
}

/* Settings Dropdown */
.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 100;
    padding: 12px;
}
.settings-dropdown .setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.settings-dropdown .setting-group:last-child {
    border-bottom: none;
}
.settings-dropdown label {
    font-size: 13px;
    color: var(--text-secondary);
}
.settings-dropdown select,
.settings-dropdown input[type="text"] {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 4px 8px;
    font-size: 12px;
}
.settings-dropdown input[type="range"] {
    width: 80px;
}

/* Error Banner */
.error-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--error, #dc3545);
    color: white;
    font-size: 13px;
    z-index: 50;
}
.error-banner-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

/* Start prompt panel */
.start-prompt-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    z-index: 15;
    background: var(--bg-primary, #0d1117);
}
.start-prompt-inner {
    text-align: center;
    padding: 24px;
}
.start-prompt-dir {
    font-size: 13px;
    color: var(--text-secondary, #8b949e);
    margin-bottom: 16px;
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}
.start-prompt-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.start-prompt-buttons .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* General setting group styles (for non-dropdown contexts) */
.setting-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.setting-group label {
    flex: 0 0 auto;
    width: 100px;
    font-weight: 500;
    font-size: 14px;
}

.setting-group input[type="range"] {
    flex: 1;
    height: 4px;
    background: var(--border);
    outline: none;
    border-radius: 2px;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    cursor: pointer;
    border-radius: 50%;
}

.setting-group select {
    flex: 1;
    padding: 6px 12px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
}

.setting-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

#fontSizeValue {
    flex: 0 0 auto;
    width: 40px;
    font-size: 12px;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Plan content styles (shared with inline panel) */
.plan-content {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    color: var(--text-primary);
}

.plan-content h2 {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 1rem 0;
}

.plan-content h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin: 0.8rem 0;
}

.plan-content ul,
.plan-content ol {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.plan-content li {
    margin: 0.3rem 0;
}

.plan-content code {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--accent);
}

.plan-content pre {
    background-color: var(--bg-tertiary);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.xterm .xterm-viewport {
    background-color: transparent !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.xterm .xterm-screen {
    background-color: transparent !important;
}

/* Fix xterm canvas width on mobile */
.xterm {
    width: 100%;
    height: 100%;
}

.xterm-screen canvas {
    max-width: 100%;
}

/* Fix scrollbar extending beyond viewport */
.xterm-viewport::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.xterm-viewport::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

.xterm-viewport::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

.xterm-viewport::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Mobile Menu Styles */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin: 0;
    border-radius: 4px;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
}

.hamburger-btn:hover {
    background-color: var(--bg-tertiary);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 3000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-menu.active {
    left: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.close-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-menu-btn {
    padding: 12px 16px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
}

.mobile-menu-btn:hover:not(:disabled) {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

.mobile-menu-btn.btn-danger {
    background-color: var(--error);
    color: white;
    border-color: var(--error);
}

.mobile-menu-btn.btn-danger:hover:not(:disabled) {
    background-color: #d73a49;
    border-color: #d73a49;
}

.desktop-only {
    display: block;
}

/* Ensure pre-formatted text and code blocks wrap properly */
pre, code {
    word-wrap: break-word;
    white-space: pre-wrap;
    overflow-wrap: break-word;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        flex-shrink: 0;
    }

    .desktop-only {
        display: none !important;
    }

    .header {
        padding: 8px 12px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 0;
        flex-shrink: 0;
        min-height: 44px;
    }

    .header-content {
        flex: 1;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        min-width: 0;
    }

    .header-info {
        display: flex;
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: flex-end;
    }

    .status {
        font-size: 11px;
        padding: 2px 6px;
        white-space: nowrap;
    }

    .working-dir {
        font-size: 11px;
        padding: 2px 6px;
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-controls {
        display: none;
    }

    .main {
        flex: 1;
        overflow: hidden;
    }

    .terminal-container {
        padding: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }

    #terminal {
        padding: 8px;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
    }

    /* Force xterm to respect mobile viewport */
    .xterm {
        width: 100% !important;
        height: 100% !important;
    }

    .xterm-viewport {
        width: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .xterm-screen {
        width: 100% !important;
    }

    .overlay-content {
        padding: 20px;
        max-width: 90%;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    .header {
        padding: 6px 8px;
        display: flex;
        flex-direction: row;
        align-items: center;
    }

    .hamburger-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }

    .header-info {
        gap: 6px;
    }

    .status {
        font-size: 10px;
        padding: 1px 4px;
    }

    .working-dir {
        font-size: 10px;
        padding: 1px 4px;
        max-width: 120px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    /* Extra terminal fixes for very small screens */
    #terminal {
        padding: 4px;
    }

    /* Adjust main container */
    .main {
        padding: 0;
        margin: 0;
    }

    body {
        overflow-x: hidden;
    }
}

/* Mode Switcher Styles */
.mode-switcher {
    position: fixed;
    bottom: 80px; /* Increased from 20px to avoid covering text input */
    right: 20px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    gap: 10px;
}

/* Show mode switcher on mobile devices */
@media (max-width: 1024px) and (hover: none) and (pointer: coarse),
       (max-width: 768px) {
    .mode-switcher {
        display: flex;
    }
}

.mode-switcher-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: 56px;
    height: 56px;
}

.mode-switcher-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

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

.mode-switcher-btn.switching {
    animation: modeSwitchPulse 0.3s ease;
}

@keyframes modeSwitchPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
        background-color: var(--accent);
    }
    100% {
        transform: scale(1);
    }
}

.mode-switcher-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--accent);
    flex-shrink: 0;
}

/* Add visual indicator for current mode */
.mode-switcher-btn[data-mode="chat"] {
    border-color: var(--success);
}

.mode-switcher-btn[data-mode="code"] {
    border-color: var(--accent);
}

.mode-switcher-btn[data-mode="plan"] {
    border-color: var(--warning);
}

/* Escape Button Styles */
.escape-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--error);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    width: 56px;
    height: 56px;
}

.escape-btn:hover {
    background-color: var(--bg-tertiary);
    border-color: #ff4444;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 68, 68, 0.2);
}

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

.escape-btn.pressed {
    animation: escapeBtnPress 0.2s ease;
}

@keyframes escapeBtnPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.9);
        background-color: var(--error);
    }
    100% {
        transform: scale(1);
    }
}

.escape-btn svg {
    width: 24px;
    height: 24px;
    stroke: var(--error);
    flex-shrink: 0;
}

/* Commands UI removed */
