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

:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border-color: #30363d;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --color-primary: #40A944;
    --color-primary-dark: #2d7a33;
    --accent-green: #40A944;
    --accent-red: #f85149;
    --accent-purple: #a855f7;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fa;
    --bg-tertiary: #ffffff;
    --border-color: #d0d7de;
    --text-primary: #24292f;
    --text-secondary: #656d76;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}
.reading-container h1, .reading-container h2, .reading-container h3, .reading-container h4 {
    color: #2c2416;
    margin: 24px 0 16px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 16px;
}

.logo-heading-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 22px;
}

.menu-btn:hover {
    background: rgba(64, 169, 68, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Sidebar Panel */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1500;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-panel {
    position: fixed;
    top: 5px;
    left: -480px;
    width: 480px;
    height: calc(100vh - 10px);
    background: var(--bg-primary);
    z-index: 1501;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    overflow: hidden;
}

.sidebar-panel.active {
    left: 5px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-search {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.sidebar-search-input:focus {
    border-color: var(--color-primary);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-section {
    padding: 0 12px;
    margin-bottom: 16px;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    padding: 8px 12px;
    margin-bottom: 4px;
}

.problem-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: var(--text-primary);
    border: 1px solid transparent;
}

.problem-item:last-child {
    margin-bottom: 0;
}

.problem-item:hover {
    background: rgba(64, 169, 68, 0.08);
    border-color: rgba(64, 169, 68, 0.2);
}

.problem-item.active {
    background: rgba(64, 169, 68, 0.12);
    border-color: var(--color-primary);
}

.problem-item-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.problem-item.active .problem-item-number {
    background: var(--color-primary);
    color: white;
}

.problem-item-content {
    flex: 1;
    min-width: 0;
}

.problem-item-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.problem-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.problem-item-difficulty {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9px;
}

.problem-item-difficulty.easy {
    background: rgba(64, 169, 68, 0.15);
    color: #40A944;
}

.problem-item-difficulty.medium {
    background: rgba(255, 165, 0, 0.15);
    color: #e69500;
}

.problem-item-difficulty.hard {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.problem-item-category {
    color: var(--text-secondary);
}

.problem-item-status {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.problem-item-status.solved {
    color: #40A944;
}

.problem-item-status.attempted {
    color: #f59e0b;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.sidebar-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.sidebar-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primary);
}

.sidebar-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.sidebar-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.pagination-btn:hover:not(:disabled) {
    background: rgba(64, 169, 68, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

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

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

.pagination-info {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 8px;
}

.pagination-dots {
    color: var(--text-secondary);
    font-size: 12px;
}

.compile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: var(--color-primary);
}

.logo-desktop {
    display: block;
    height: 24px;
    width: auto;
}

.logo-mobile {
    display: none;
    height: 36px;
    width: auto;
}

@media (max-width: 600px) {
    .logo-desktop {
        display: none;
    }
    .logo-mobile {
        display: block;
    }
}

.header-scroll-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

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

.icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn.btn-ghost {
    background: transparent;
    border-color: var(--border-color);
}

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

[data-theme="dark"] .btn.btn-ghost {
    border-color: var(--color-primary);
}

[data-theme="dark"] .ai-input-area {
    background: #161b22 !important;
}

.btn-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 36px;
}

.dropdown-btn.dropdown-circle {
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border-radius: 6px;
    background: var(--color-primary);
    border: none;
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size:22px;
}

#theme-toggle-icon {
    font-size:18px;
}

.dropdown-btn.dropdown-circle:hover {
    background: var(--color-primary-dark);
}

.dropdown-btn.dropdown-circle .icon {
    width: 16px;
    height: 16px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    padding: 8px;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(64, 169, 68, 0.1);
    color: var(--color-primary);
}

.dropdown-item .icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.dropdown-item:hover .icon {
    opacity: 1;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.dropdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
}

.dropdown-overlay.active {
    display: block;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 48px);
}

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

.left-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 0px solid var(--border-color);
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
    border-left: 1px solid var(--border-color);
}

.resizer {
    width: 0px;
    background: transparent;
    cursor: col-resize;
    position: relative;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.resizer:hover, .resizer.resizing {
    background: transparent;
}

.resizer::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-secondary);
    transform: translateX(3px);
    background-image:
        radial-gradient(circle at 5px 5px, var(--text-secondary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 5px 12px, var(--text-secondary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 5px 19px, var(--text-secondary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 5px, var(--text-secondary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 12px, var(--text-secondary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 19px, var(--text-secondary) 1.5px, transparent 1.5px);
    background-repeat: no-repeat;
    opacity: 0.8;
    transition: all 0.15s ease;
    z-index: 1;
}

.resizer::after {
    content: '';
    position: absolute;
    width: 1px;
    height: 20px;
    background: var(--border-color);
    z-index: 2;
}

.resizer:hover::before, .resizer.resizing::before {
    opacity: 1;
    border-color: var(--color-primary);
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(circle at 5px 5px, var(--color-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 5px 12px, var(--color-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 5px 19px, var(--color-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 5px, var(--color-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 12px, var(--color-primary) 1.5px, transparent 1.5px),
        radial-gradient(circle at 13px 19px, var(--color-primary) 1.5px, transparent 1.5px);
}

.resizer:hover::after, .resizer.resizing::after {
    background: var(--color-primary);
}

.examples {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 21px;
    background: var(--bg-tertiary);
    border-bottom: 0px solid var(--border-color);
}

.examples-label {
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.examples-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    padding: 8px 0;
    margin: -8px 0;
}

.examples-buttons::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .examples {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .examples-label {
        font-size: 10px;
    }
    
    .example-btn {
        padding: 6px 12px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .ai-assistant-btn {
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .ai-assistant-btn span {
        display: none;
    }
}

.examples-label {
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.example-btn {
    background: #fffef8;
    color: #3d3522;
    border: 1px solid #e0d8c8;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.example-btn:hover {
    background: #f5f0e0;
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.15);
}

.example-btn.active-example {
    border: 1px solid var(--accent-green);
    background: rgba(64, 169, 68, 0.1);
    color: var(--accent-green);
    box-shadow: 0 2px 8px rgba(64, 169, 68, 0.2);
}

/* Left panel buttons (Problem/Solution) - green gradient when active */
.example-btn.left-panel-btn.active-left {
    border: none !important;
    background: linear-gradient(135deg, #40A944, #2d7a33) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.35);
    font-weight: 600;
}

.example-btn.left-panel-btn.active-left:hover {
    background: linear-gradient(135deg, #4ab84e, #359439);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(64, 169, 68, 0.4);
}

[data-theme="light"] .example-btn {
    background: #fffef8;
    border: 1px solid #e0d8c8;
    color: #3d3522;
}

[data-theme="dark"] .example-btn {
    background: #2d2a22;
    border: 1px solid #3d3522;
    color: #e8e0c8;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

[data-theme="dark"] .example-btn:hover {
    background: #3d3a32;
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.25);
}

.ai-assistant-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.ai-assistant-btn:hover {
    color: var(--color-primary);
}

.ai-assistant-btn svg {
    flex-shrink: 0;
}

.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0px;
    gap: 16px;
    overflow: hidden;
    min-height: 0;
}

.editor-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-group.code-editor {
    flex: 1;
    min-height: 0;
}

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

.editor-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.reading-container {
    flex: 1;
    border: 0px solid #d4c9a8;
    border-radius: 0px;
    overflow-y: auto;
    min-height: 200px;
    padding: 20px;
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    color: #3d3522;
    background: 
        linear-gradient(to bottom, rgba(255,255,252,0.95) 0%, rgba(255,253,245,0.98) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 24px,
            rgba(64,169,68,0.12) 24px,
            rgba(64,169,68,0.12) 25px
        );
    background-color: #fffef8;
    position: relative;
}

.reading-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    border-radius: 8px;
}

[data-theme="dark"] .reading-container {
    background: 
        linear-gradient(to bottom, rgba(62,58,48,0.95) 0%, rgba(52,48,38,0.98) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 24px,
            rgba(64,169,68,0.15) 24px,
            rgba(64,169,68,0.15) 25px
        );
    background-color: #2d2a22;
    color: #e8e0c8;
    box-shadow: 
        inset 0 0 30px rgba(0,0,0,0.2),
        inset 0 0 80px rgba(0,0,0,0.1),
        0 2px 8px rgba(0,0,0,0.3);
}



[data-theme="dark"] .reading-container h1,
[data-theme="dark"] .reading-container h2,
[data-theme="dark"] .reading-container h3,
[data-theme="dark"] .reading-container h4 {
    color: #f0e8d0;
}

.reading-container h1 { font-size: 28px; border-bottom: 2px solid #40A944; padding-bottom: 10px; }
.reading-container h2 { font-size: 24px; }
.reading-container h3 { font-size: 20px; }

.reading-container p {
    margin: 16px 0;
    text-align: justify;
}

.reading-container ul, .reading-container ol {
    margin: 16px 0;
    padding-left: 30px;
}

.reading-container li {
    margin: 8px 0;
}

.reading-container blockquote {
    border-left: 4px solid #40A944;
    margin: 20px 0;
    padding: 15px 20px;
    background: rgba(64,169,68,0.08);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #4a3f2c;
}

[data-theme="dark"] .reading-container blockquote {
    background: rgba(64,169,68,0.12);
    color: #d4c8a8;
}

.reading-container pre {
    background: rgba(139,119,80,0.12);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 14px;
    border: 1px solid rgba(139,119,80,0.2);
}

[data-theme="dark"] .reading-container pre {
    background: rgba(0,0,0,0.2);
    border-color: rgba(139,119,80,0.3);
}

.reading-container code {
    background: rgba(139,119,80,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
    color: #5c4a2a;
}

[data-theme="dark"] .reading-container code {
    background: rgba(139,119,80,0.2);
    color: #d4c8a8;
}

/* ============ Problem Statement Styles ============ */
.problem-statement {
    position: relative;
    background: transparent;
    padding: 5px 0 15px 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    margin-bottom: 10px;
}

.problem-seal {
    position: absolute;
    top: 5px;
    right: 0;
    width: 70px;
    height: 70px;
    border: 1px solid #40A944;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    transform: rotate(-15deg);
}

.problem-seal-label {
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #40A944;
    margin-bottom: 2px;
}

.problem-seal-stars {
    display: flex;
    gap: 1px;
}

.problem-seal-stars .star {
    font-size: 12px;
    color: #ddd;
}

.problem-seal-stars .star.filled {
    color: #FFB800;
}

.problem-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, #40A944, transparent) 1;
}

.problem-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.problem-header-title span {
     font-family: 'Roboto Slab', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #3d3522;
}

.problem-content {
    font-family: 'Crimson Text', serif;
    font-size: 18px;
    color: #4a4a4a;
    line-height: 1.9;
}

.problem-source {
    margin-top: 20px;
    font-family: 'Crimson Text', serif;
    font-size: 14px;
    color: #888;
    text-align: right;
    padding-right: 0;
}

.problem-source::before {
    content: '— ';
}

[data-theme="dark"] .problem-statement {
    background: transparent;
    box-shadow: none;
}

[data-theme="dark"] .problem-header {
    color: #f0e8d0;
}

[data-theme="dark"] .problem-content {
    color: #d4c8a8;
}

[data-theme="dark"] .problem-source {
    color: #888;
}

/* ============ Input & Output Section Styles ============ */
.io-wrapper {
    margin-bottom: 30px;
}

.io-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.io-heading h2 {
    margin: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    cursor: pointer;
    border-bottom: 0px solid rgba(64, 169, 68, 0.2);
    margin-bottom: 5px;
    flex-wrap: nowrap;
    gap: 10px;
}

.section-title {
    display: flex;
    align-items: center;
    white-space: nowrap;
    margin: 0;
    flex: 1;
}

.toggle-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40A944;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.toggle-icon:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .toggle-icon:hover {
    background: #2a2a2a;
}
.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.io-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40A944;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.io-toggle:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .io-toggle:hover {
    background: #2a2a2a;
}

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

.io-toggle.collapsed {
    transform: rotate(-90deg);
}

.io-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 10px 0 0 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 1000px;
    opacity: 1;
}
.io-section  h3{
    margin-top:5px !important;
}
.io-section.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.io-box {
    background: linear-gradient(145deg, #fffef8, #f8f4e8);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e0d8c8;
}

.io-header {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #e0d8c8;
}

.io-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.io-dot.red { background: #ff5f56; }
.io-dot.yellow { background: #ffbd2e; }
.io-dot.green { background: #27ca3f; }

.io-label {
    margin-left: 10px;
    color: #6b6355;
    font-family: 'Fira Code', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 12px;
}

.io-content {
    padding: 20px;
    font-family: 'Fira Code', 'SF Mono', Monaco, Consolas, monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.io-box.input .io-content {
    color: #2d7a33;
}

.io-box.output .io-content {
    color: #3b82f6;
}

[data-theme="dark"] .io-box {
    background: #000000;
    border-color: #333333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

[data-theme="dark"] .io-header {
    background: #1a1a1a;
    border-color: #333333;
}

[data-theme="dark"] .io-label {
    color: #888;
}

[data-theme="dark"] .io-box.input .io-content {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74,222,128,0.3);
}

[data-theme="dark"] .io-box.output .io-content {
    color: #60a5fa;
    text-shadow: 0 0 10px rgba(96,165,250,0.3);
}

.io-description {
    margin-top: 10px;
    padding: 15px 18px;
    background: rgba(64, 169, 68, 0.06);
    border-left: 3px solid #40A944;
    border-radius: 0 6px 6px 0;
}

.io-description p {
    margin: 0;
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 15px;
    line-height: 1.7;
    color: #4a4a4a;
}

.io-description strong {
    color: #2d7a33;
}

[data-theme="dark"] .io-description {
    background: rgba(64, 169, 68, 0.1);
}

[data-theme="dark"] .io-description p {
    color: #c8c0b0;
}

[data-theme="dark"] .io-description strong {
    color: #4ade80;
}

/* ============ Collapsible Section Styles ============ */
.collapsible-section {
    margin-bottom: 20px;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.collapsible-header:hover {
    opacity: 0.85;
}

.collapsible-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40A944;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.collapsible-toggle:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .collapsible-toggle:hover {
    background: #2a2a2a;
}

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

.collapsible-toggle.collapsed {
    transform: rotate(-90deg);
}

.collapsible-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

#solution-summary-content.collapsed {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    margin-bottom: 0 !important;
}

/* Master Toggle Button */
.master-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    margin-left: 10px;
}

.master-toggle-btn:hover {
    background: rgba(64, 169, 68, 0.1);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.master-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.master-toggle-btn svg.collapsed {
    transform: rotate(-90deg);
}

/* ============ Complexity Section Styles ============ */
.complexity-wrapper {
    margin: 30px 0;
}

.complexity-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.complexity-heading h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.complexity-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40A944;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.complexity-toggle:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .complexity-toggle:hover {
    background: #2a2a2a;
}

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

.complexity-toggle.collapsed {
    transform: rotate(-90deg);
}

.complexity-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0 0 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 2000px;
    opacity: 1;
}

.complexity-cards.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.complexity-card {
    width: 100%;
    background: linear-gradient(145deg, #fffef8, #f8f4e8);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e0d8c8;
    position: relative;
}

.complexity-card::before {
    display: none;
}

.complexity-card-header {
    padding: 20px 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.complexity-title {
    font-family: 'Crimson Text', serif;
    font-size: 14px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.complexity-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.complexity-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.complexity-card.time .complexity-icon {
    background: linear-gradient(135deg, rgba(64,169,68,0.15), rgba(64,169,68,0.05));
    color: #40A944;
}

.complexity-card.space .complexity-icon {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(59,130,246,0.05));
    color: #3b82f6;
}

.complexity-value {
    font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
    font-size: 28px;
    font-weight: 700;
}

.complexity-card.time .complexity-value {
    color: #40A944;
}

.complexity-card.space .complexity-value {
    color: #3b82f6;
}

.complexity-card-body {
    padding: 0 20px 20px;
}

.complexity-description {
    font-family: 'Crimson Text', serif;
    font-size: 15px;
    line-height: 1.7;
    color: #5a5a5a;
}

.complexity-highlight {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    font-weight: 600;
}

.complexity-card.time .complexity-highlight {
    background: rgba(64,169,68,0.1);
    color: #2d7a33;
}

.complexity-card.space .complexity-highlight {
    background: rgba(59,130,246,0.1);
    color: #2563eb;
}

.complexity-visual {
    margin-top: 15px;
    padding: 15px;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
}

.complexity-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.complexity-bar-label {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #888;
    width: 30px;
}

.complexity-bar {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.complexity-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

.complexity-card.time .complexity-bar-fill {
    background: linear-gradient(90deg, #40A944, #6dd670);
}

.complexity-card.space .complexity-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.complexity-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
}

.complexity-card.time .complexity-badge {
    background: rgba(64,169,68,0.1);
    color: #2d7a33;
}

.complexity-card.space .complexity-badge {
    background: rgba(59,130,246,0.1);
    color: #2563eb;
}

/* Dark mode complexity */
[data-theme="dark"] .complexity-card {
    background: linear-gradient(145deg, #2d2a22, #252218);
    border-color: #3d3522;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .complexity-description {
    color: #b8b0a0;
}

[data-theme="dark"] .complexity-visual {
    background: rgba(255,255,255,0.03);
}

[data-theme="dark"] .complexity-bar {
    background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .complexity-card.time .complexity-highlight {
    background: rgba(64,169,68,0.2);
    color: #6dd670;
}

[data-theme="dark"] .complexity-card.space .complexity-highlight {
    background: rgba(59,130,246,0.2);
    color: #60a5fa;
}

[data-theme="dark"] .complexity-card.time .complexity-badge {
    background: rgba(64,169,68,0.2);
    color: #6dd670;
}

[data-theme="dark"] .complexity-card.space .complexity-badge {
    background: rgba(59,130,246,0.2);
    color: #60a5fa;
}

/* Company Tags Section */
.company-tags-section {
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.company-tags-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.company-tags-header .icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.company-tags {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.company-tags::-webkit-scrollbar {
    display: none;
}

.company-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.company-tag:hover {
    border-color: var(--color-primary);
    background: rgba(64, 169, 68, 0.05);
}

.company-logo {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.company-logo.google {
    background: linear-gradient(135deg, #4285F4, #34A853, #FBBC05, #EA4335);
}

.company-logo.amazon {
    background: #FF9900;
    font-style: italic;
}

.company-logo.meta {
    background: linear-gradient(135deg, #0081FB, #00C6FF);
}

.company-logo.microsoft {
    background: linear-gradient(135deg, #F25022 25%, #7FBA00 25%, #7FBA00 50%, #00A4EF 50%, #00A4EF 75%, #FFB900 75%);
    font-size: 8px;
}

/* Related Problems Section */
.related-problems-wrapper {
    margin-top: 28px;
}

.related-problems-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 5px 0;
    user-select: none;
}

.related-problems-heading h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.related-problems-icon {
    width: 28px;
    height: 28px;
    opacity: 0.7;
}

/* Smart Actions Menu */
.smart-actions-menu {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 220px;
    padding: 6px;
    display: none;
}

.smart-actions-menu.visible {
    display: block;
}

.smart-actions-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 4px;
}

.smart-action-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
}

.smart-action-item:hover {
    background: rgba(64, 169, 68, 0.1);
}

.smart-action-item.selected {
    background: rgba(64, 169, 68, 0.15);
    border-left: 2px solid var(--color-primary);
}

.smart-action-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.smart-action-icon.fix { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.smart-action-icon.explain { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.smart-action-icon.tests { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.smart-action-icon.docs { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.smart-action-icon.optimize { background: rgba(249, 115, 22, 0.15); color: #f97316; }

.smart-action-content {
    flex: 1;
}

.smart-action-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.smart-action-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.smart-action-shortcut {
    font-size: 10px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* Smart Actions Result Panel */
.smart-actions-result {
    position: absolute;
    bottom: 60px;
    left: 10px;
    right: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
    display: none;
}

.smart-actions-result.visible {
    display: block;
}

.smart-actions-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.smart-actions-result-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
}

.smart-actions-result-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.smart-actions-result-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.smart-actions-result-content {
    padding: 16px;
    overflow-y: auto;
    max-height: 240px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
}

.smart-actions-result-content pre {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    margin: 10px 0;
}

.smart-actions-result-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.smart-actions-result-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.smart-actions-result-btn.primary {
    background: var(--color-primary);
    color: white;
    border: none;
}

.smart-actions-result-btn.primary:hover {
    background: var(--color-primary-dark);
}

.smart-actions-result-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.smart-actions-result-btn.secondary:hover {
    border-color: var(--color-primary);
}

@media (max-width: 768px) {
    .related-problems-icon {
        width: 18px;
        height: 18px;
    }
}

.related-problems-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #40A944;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

.related-problems-toggle:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .related-problems-toggle:hover {
    background: #2a2a2a;
}

.constraints-toggle:hover {
    background: linear-gradient(90deg, #f5f0e0, #ebe5d5);
}

[data-theme="dark"] .constraints-toggle:hover {
    background: #2a2a2a;
}

.constraints-list {
    overflow: hidden;
}

.constraints-list.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding: 0 16px !important;
}

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

.related-problems-toggle.collapsed {
    transform: rotate(-90deg);
}

.related-problems-list {
    background: #fffef8;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0 0 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.related-problems-list.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.related-problem-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid #90c695;
    transition: background 0.2s ease;
}

.related-problem-item:last-child {
    border-bottom: none;
}

/* Dark theme SVG visualization - use filter for inline SVG */
[data-theme="dark"] .visualize-svg-box {
    background: #1e1e1e !important;
}
[data-theme="dark"] .visualize-svg-box svg text[fill="#9CA3AF"],
[data-theme="dark"] .visualize-svg-box svg text[fill="#6B7280"],
[data-theme="dark"] .visualize-svg-box svg text[fill="gray"],
[data-theme="dark"] .visualize-svg-box svg text[fill="#1f2937"] {
    fill: #101011ff !important;
}

[data-theme="dark"] .visualize-svg-box svg {
    filter: invert(0.85) hue-rotate(180deg);
}
/* Target the Perfect Match Found box at the bottom */
.visualize-svg-box svg g[transform="translate(100, 410)"] rect {
    fill: #ffffffff !important;
}

/* Responsive SVG visualization */
.visualize-svg-box {
    position: relative;
    cursor: pointer;
}

.visualize-svg-box svg {
    width: 100%;
    height: auto;
    min-width: 0;
    max-width: 100%;
}

.visualize-svg-box .tap-hint {
    display: none;
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    pointer-events: none;
}

@media (max-width: 768px) {
    .visualize-svg-box .tap-hint {
        display: flex;
        align-items: center;
        gap: 6px;
    }
}

/* Fullscreen SVG overlay */
.svg-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.svg-fullscreen-overlay.active {
    display: flex;
}

.svg-fullscreen-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.svg-fullscreen-title {
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.svg-fullscreen-close {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.svg-fullscreen-close:hover {
    background: rgba(255,255,255,0.3);
}

.svg-fullscreen-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.svg-fullscreen-content svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

[data-theme="dark"] .svg-fullscreen-content svg {
    filter: invert(0.85) hue-rotate(180deg);
}

.svg-fullscreen-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.6);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-problem-item:hover {
    background: rgba(64, 169, 68, 0.08);
}

.related-problem-number {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 40px;
}

.related-problem-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.related-problem-difficulty {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.related-problem-difficulty.easy {
    background: rgba(64, 169, 68, 0.15);
    color: #40A944;
}

.related-problem-difficulty.medium {
    background: rgba(255, 165, 0, 0.15);
    color: #e69500;
}

.related-problem-difficulty.hard {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

[data-theme="dark"] .related-problems-list {
    background: #1a1a18;
}

/* Dark theme SVG visualization */
[data-theme="dark"] .visualize-svg-container {
    background: #1a1a1a;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#f9fbfd"] {
    fill: #1e1e1e;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#333"] {
    fill: #e0e0e0;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#666"] {
    fill: #999;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#fff"],
[data-theme="dark"] .visualize-svg-container svg path[fill="#fff"] {
    fill: #2d2d2d;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#ffecb3"] {
    fill: #4a3f00;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#e3f2fd"] {
    fill: #1a3a5c;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#fff3e0"] {
    fill: #4a2f00;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#f5f5f5"] {
    fill: #2a2a2a;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#c8e6c9"] {
    fill: #1a3d1c;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#1565c0"] {
    fill: #64b5f6;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#e65100"] {
    fill: #ffb74d;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#f57f17"] {
    fill: #ffd54f;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#2e7d32"],
[data-theme="dark"] .visualize-svg-container svg text[fill="#1b5e20"] {
    fill: #81c784;
}

[data-theme="dark"] .visualize-svg-container svg text[fill="#999"] {
    fill: #666;
}

[data-theme="dark"] .visualize-svg-container svg line[stroke="#ccc"],
[data-theme="dark"] .visualize-svg-container svg line[stroke="#eee"] {
    stroke: #444;
}

[data-theme="dark"] .visualize-svg-container svg rect[fill="#ddd"] {
    fill: #444;
}

[data-theme="dark"] .visualize-svg-container svg circle[fill="#333"] {
    fill: #888;
}

[data-theme="dark"] .visualize-svg-container svg rect[stroke="#333"],
[data-theme="dark"] .visualize-svg-container svg path[stroke="#333"] {
    stroke: #666;
}

/* Statistics in Problem Statement */
.problem-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, transparent, #40A944, transparent) 1;
}

.problem-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

[data-theme="dark"] .problem-header-title span {
    color: #f0e8d0;
}

.problem-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.section-title h2{
    margin-top: 0px !important;
}
.problem-tag {
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.problem-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.problem-tag.blue {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

.problem-tag.purple {
    background: rgba(168, 85, 247, 0.12);
    color: #9333ea;
}

.problem-tag.orange {
    background: rgba(249, 115, 22, 0.12);
    color: #ea580c;
}

.problem-tag.green {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

[data-theme="dark"] .problem-tag.blue {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

[data-theme="dark"] .problem-tag.purple {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

[data-theme="dark"] .problem-tag.orange {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

[data-theme="dark"] .problem-tag.green {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}
.stats-toggle-btn {
    background: none;
    border: 1px solid transparent;
    padding: 8px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.stats-toggle-btn:hover {
    background: rgba(64, 169, 68, 0.1);
    border-color: rgba(64, 169, 68, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.15);
}

.stats-toggle-btn.active {
    background: rgba(64, 169, 68, 0.1);
    border-color: rgba(64, 169, 68, 0.3);
}

.problem-stats-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 100;
    flex-shrink: 0;
}

.problem-stats-bar .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.problem-stats-bar .stat-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.problem-stats-bar .stat-icon.fire { color: #ef4444; }
.problem-stats-bar .stat-icon.time { color: #3b82f6; }
.problem-stats-bar .stat-icon.likes { color: #40A944; }
.problem-stats-bar .stat-icon.views { color: #6b7280; }

.problem-stats-bar .stat-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.problem-stats-bar .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.problem-stats {
    display: none;
}

.problem-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.problem-stats .stat-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.problem-stats .stat-icon.fire {
    color: #ef4444;
}

.problem-stats .stat-icon.time {
    color: #3b82f6;
}

.problem-stats .stat-icon.likes {
    color: #40A944;
}

.problem-stats .stat-content {
    display: flex;
    align-items: center;
    gap: 5px;
}

.problem-stats .stat-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.problem-stats .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* FORCE OVERLAY VISIBILITY */
#svg-fullscreen-overlay {
    z-index: 10000 !important; /* Ensure it's on top of everything */
}

#svg-fullscreen-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* FIX DARK MODE INVISIBILITY */
/* The SVG has a light background. In dark mode, your existing CSS inverts it 
   to black, which makes it disappear on the black overlay. This disables that filter. */
[data-theme="dark"] #svg-fullscreen-content svg {
    filter: none !important; 
    box-shadow: 0 0 30px rgba(0,0,0,0.5); /* Add shadow to separate from background */
}

@media (max-width: 600px) {
    .problem-stats {
        gap: 12px;
    }
    
    .problem-stats .stat-value {
        font-size: 12px;
    }
    
    .problem-stats .stat-label {
        font-size: 11px;
    }
}

/* Clickable Like Icon Styles */
.stat-icon.clickable-icon {
    cursor: pointer;
    transition: all 0.3s ease;
}

.stat-icon.clickable-icon:hover {
    transform: scale(1.2);
    filter: brightness(1.2);
}

.stat-icon.clickable-icon:active {
    transform: scale(1.1);
}

.stat-icon.clickable-icon.liking {
    animation: pulse 0.6s ease-in-out infinite;
}

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

.stat-icon.clickable-icon.liked {
    animation: likeSuccess 0.6s ease;
}

@keyframes likeSuccess {
    0% { transform: scale(1); }
    25% { transform: scale(1.3) rotate(-10deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    75% { transform: scale(1.3) rotate(-5deg); }
    100% { transform: scale(1.2); }
}

.stat-icon.liked {
    color: var(--accent-green);
    filter: brightness(1.3);
    transform: scale(1.2);
}


/* ============ Monaco Code Editor Styles ============ */
.code-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f5f5f5;
    overflow: hidden;
    border: none;
}
[data-theme="dark"] .code-editor-container {
    background: #1e1e1e;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 15px;
    background: #f5f5f5;
    border-bottom: 0px solid #e0e0e0;
}

[data-theme="dark"] .editor-header {
    background: #252526;
    border-bottom-color: #333;
}

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

.editor-header-left .io-dot {
    flex-shrink: 0;
}

.editor-header-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    margin-left: 8px;
}
.editor-status-bar {
    position: absolute;
    bottom: 3px;
    left: 0;
    right: 3px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 12px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
    border-radius: 0 0 10px 10px;
}

[data-theme="dark"] .editor-status-bar {
    background: #252526;
    border-color: #333;
}
.editor-header-buttons::-webkit-scrollbar {
    display: none;
}

.editor-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .editor-header-left {
        display: none;
    }
    
    .io-header .io-dot {
        display: none;
    }
}
@media (max-width: 768px) {
    .editor-header {
        padding: 8px 10px;
    }
    
    .editor-header-left {
        gap: 6px;
    }
    
    .editor-header-buttons {
        gap: 6px;
    }
    
    .ai-btn span {
        display: none;
    }
    
    .ai-btn {
        padding: 5px 8px;
        min-width: 28px;
    }
    
    .run-btn span {
        display: none;
    }
    
    .run-btn {
        padding: 5px 10px;
    }
    
    .editor-header-right {
        gap: 6px;
    }
    
    /* Mobile heading font sizes */
    .problem-title {
        font-size: 28px !important;
    }
    
    .problem-title-icon {
        width: 28px;
        height: 28px;
    }
    
    .section-title {
        font-size: 18px !important;
    }
    
    .problem-seal {
        width: 55px;
        height: 55px;
        top: 0;
    }
    
    .seal-text {
        font-size: 6px;
    }
    
    .seal-stars {
        font-size: 10px;
    }
    
    .problem-meta {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .meta-item {
        font-size: 11px;
    }
    
    .problem-description {
        font-size: 15px;
        line-height: 1.7;
    }
    
    .problem-cite {
        font-size: 12px;
    }
    
    .reading-container {
        padding: 15px;
    }
    
    .io-label {
        font-size: 11px;
    }
    
    .io-content {
        font-size: 12px;
    }
}

/* Language Dropdown */
.lang-dropdown-container {
    position: relative;
}

.lang-dots-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-dots-btn:hover {
    background: rgba(240, 219, 79, 0.15);
}

[data-theme="dark"] .lang-dots-btn {
    background: transparent;
    border: none;
}

[data-theme="dark"] .lang-dots-btn:hover {
    background: rgba(240, 219, 79, 0.2);
}

.lang-letter {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

[data-theme="dark"] .lang-letter {
    color: #ccc;
}

.lang-dots-btn:hover .lang-letter {
    color: #b8860b;
}

[data-theme="dark"] .lang-dots-btn:hover .lang-letter {
    color: #f0db4f;
}

.lang-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.lang-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

[data-theme="dark"] .lang-dropdown-menu {
    background: #2d2d2d;
    border-color: #444;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.lang-dropdown-header {
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    background: #f8f8f8;
    border-bottom: 1px solid #e0e0e0;
}

[data-theme="dark"] .lang-dropdown-header {
    background: #252525;
    border-bottom-color: #444;
    color: #666;
}

.lang-dropdown-list {
    padding: 8px 0;
    max-height: 300px;
    overflow-y: auto;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.lang-option:hover {
    background: rgba(240, 219, 79, 0.15);
    border: 1px solid #f0db4f;
}

.lang-option.active {
    background: rgba(240, 219, 79, 0.2);
    color: #b8860b;
}

[data-theme="dark"] .lang-option {
    color: #ccc;
}

[data-theme="dark"] .lang-option:hover {
    background: rgba(240, 219, 79, 0.2);
    border: 1px solid #f0db4f;
}

[data-theme="dark"] .lang-option.active {
    background: rgba(240, 219, 79, 0.25);
    color: #f0db4f;
}

.lang-option svg:first-child {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.lang-option span {
    flex: 1;
}

.lang-option .check-icon {
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.lang-option.active .check-icon {
    opacity: 1;
}

.ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #555;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 28px;
    min-width: 28px;
    box-sizing: border-box;
}

.ai-btn:hover {
    background: rgba(64, 169, 68, 0.1);
    color: #40A944;
}

[data-theme="dark"] .ai-btn {
    background: transparent;
    border: none;
    color: #aaa;
}

[data-theme="dark"] .ai-btn:hover {
    background: rgba(64, 169, 68, 0.15);
    color: #40A944;
}

.run-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    background: #40A944;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 28px;
    box-sizing: border-box;
}

.run-btn:hover {
    background: #2d7a33;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(64, 169, 68, 0.3);
}

.monaco-wrapper {
    flex: 1;
    min-height: 200px;
    position: relative;
    margin: 0px 5px 5px 5px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

#monaco-editor {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}
.monaco-editor .line-numbers {
    color: #8a8a8a !important;
    font-weight: 400 !important;
    font-size: 13px !important;
    padding-right: 16px !important;
}

[data-theme="dark"] .monaco-editor .line-numbers {
    color: #6e6e6e !important;
}

/* Cleaner cursor line highlight */
.monaco-editor .current-line {
    background: rgba(0, 0, 0, 0.03) !important;
    border: none !important;
}

[data-theme="dark"] .monaco-editor .current-line {
    background: rgba(255, 255, 255, 0.03) !important;
}
/* Output Panel */
.output-panel {
    background: #ffffff;
    height: 200px;
    min-height: 80px;
    max-height: 500px;
    display: flex;
    flex-direction: column;
    position: relative;
    margin: 0 5px 5px 5px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

[data-theme="dark"] .output-panel {
    background: #1e1e1e;
    border-color: #444;
}

.output-resizer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
}

.output-resizer:hover,
.output-resizer.resizing {
    background: var(--color-primary);
    opacity: 0.5;
}

.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: #f5f5f5;
    border-bottom: 0px solid #e0e0e0;
}

[data-theme="dark"] .output-header {
    background: #252526;
    border-bottom-color: #333;
}

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

.output-label {
    margin-left: 10px;
    color: #666;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
}

[data-theme="dark"] .output-label {
    color: #888;
}

.clear-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.output-window-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.output-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.output-dot i {
    font-size: 6px !important;
    color: rgba(0, 0, 0, 0.4) !important;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-weight: 600;
    line-height: 1 !important;
}

.output-dot i.fa-sharp {
    font-size: 6px !important;
}

.output-window-controls:hover .output-dot i {
    opacity: 1;
}

.output-dot-close i {
    color: #990000;
}

.output-dot-minimize i {
    color: #7a5a00;
}

.output-dot-maximize i {
    color: #006400;
}

.output-dot:hover {
    opacity: 0.8;
}

.output-dot-close {
    background: #ff5f57;
}

.output-dot-minimize {
    background: #ffbd2e;
}

.output-dot-maximize {
    background: #28c940;
}

.output-panel.closed {
    display: none !important;
}

.output-panel.minimized {
    height: 40px !important;
    min-height: 40px !important;
}

.output-panel.minimized .output-tab-content {
    display: none !important;
}

.output-panel.minimized .output-resizer {
    display: none;
}

.output-panel.maximized {
    height: 80% !important;
    flex: none !important;
}

/* Close button disabled */

.output-tabs {
    display: flex;
    gap: 4px;
    margin-left: 0;
}

.output-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
}

.output-tab:hover {
    color: #555;
    background: rgba(0,0,0,0.05);
}

.output-tab.active {
    color: #40A944;
    background: var(--bg-primary);
    box-shadow: 0 -2px 0 #40A944 inset;
}

[data-theme="dark"] .output-tab {
    color: #666;
}

[data-theme="dark"] .output-tab:hover {
    color: #aaa;
    background: rgba(255,255,255,0.05);
}

[data-theme="dark"] .output-tab.active {
    color: #4ade80;
    background: var(--bg-primary);
    box-shadow: 0 -2px 0 #4ade80 inset;
}

.output-tab-content {
    display: none;
    flex: 1;
    overflow: hidden;
}

.output-tab-content.active {
    display: flex;
    flex-direction: column;
}

.output-content {
    flex: 1;
    padding: 12px 15px;
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-y: auto;
    color: #2d7a33;
}

[data-theme="dark"] .output-content {
    color: #4ade80;
}

.stdin-textarea {
    flex: 1;
    width: 100%;
    padding: 12px 15px;
    border: none;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.stdin-textarea::placeholder {
    color: #999;
}

[data-theme="dark"] .stdin-textarea {
    background: #1e1e1e;
}

.output-placeholder {
    color: #999;
    font-style: italic;
}

.output-error {
    color: #ef4444;
}

.output-success {
    color: #40A944;
}

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

.terminal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.terminal-controls {
    display: flex;
    gap: 6px;
}

.terminal-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-dot.close { background: #ff5f56; }
.terminal-dot.minimize { background: #ffbd2e; }
.terminal-dot.maximize { background: #27ca3f; }

.terminal-dot svg {
    width: 9px;
    height: 9px;
    opacity: 0.6;
}

.terminal-dot:hover svg {
    opacity: 1;
}

.terminal-output {
    flex: 1;
    padding: 16px;
    background: var(--bg-primary);
    color: var(--accent-green);
    font-family: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow-y: auto;
    white-space: pre-wrap;
}

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 11px;
    color: var(--text-secondary);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Terminal states */
.terminal-minimized {
    width: 50px !important;
    min-width: 50px !important;
    flex: none !important;
}

.terminal-minimized .terminal-output,
.terminal-minimized .status-bar,
.terminal-minimized .terminal-closed-message {
    display: none !important;
}

.terminal-minimized .terminal-title {
    display: none;
}

.terminal-minimized .terminal-header {
    flex-direction: column;
    height: auto;
    padding: 12px 8px;
    justify-content: flex-start;
}

.terminal-minimized .terminal-controls {
    flex-direction: column;
    gap: 8px;
}

.terminal-maximized {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: var(--bg-primary);
}

.terminal-closed .terminal-output,
.terminal-closed .status-bar {
    display: none;
}

.terminal-closed-message {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 0;
}

.terminal-closed .terminal-closed-message {
    display: flex;
}

/* AI Panel Chat Styles */
.ai-panel-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    text-align: left;
    padding: 0;
}

.ai-panel-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.ai-panel-message {
    margin-bottom: 16px;
}

.ai-panel-message.ai-msg {
    display: flex;
    gap: 12px;
}

.ai-panel-message.user-msg {
    display: flex;
    justify-content: flex-end;
}

.ai-panel-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #40A944, #2d7a33);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-panel-content {
    flex: 1;
}

.ai-panel-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 13px;
}

.ai-panel-text {
    color: var(--text-secondary);
    line-height: 1.6;
    background: var(--bg-tertiary);
    padding: 12px 14px;
    border-radius: 4px 12px 12px 12px;
    font-size: 14px;
    text-align: left;
}

.ai-panel-user-bubble {
    max-width: 85%;
    background: linear-gradient(135deg, #40A944, #2d7a33);
    color: white;
    padding: 12px 16px;
    border-radius: 12px 12px 4px 12px;
    line-height: 1.5;
    font-size: 14px;
}

.ai-panel-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(64, 169, 68, 0.08);
    border: 1px solid rgba(64, 169, 68, 0.2);
    border-radius: 12px;
    margin: 16px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-panel-suggestion:hover {
    background: rgba(64, 169, 68, 0.15);
    border-color: rgba(64, 169, 68, 0.4);
}

.ai-suggestion-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-suggestion-emoji {
    font-size: 24px;
}

.ai-suggestion-left strong {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
}

.ai-suggestion-left span {
    color: var(--text-secondary);
    font-size: 12px;
}

.ai-panel-suggestion svg {
    color: var(--color-primary);
    opacity: 0.6;
    transition: all 0.2s ease;
}

.ai-panel-suggestion:hover svg {
    opacity: 1;
    transform: translateX(3px);
}

.ai-panel-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.ai-panel-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-panel-textarea {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-panel-textarea:focus {
    border-color: var(--color-primary);
}

.ai-panel-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #40A944, #2d7a33);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-panel-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.3);
}

.ai-panel-hints {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.closed-icon {
    margin-bottom: 20px;
    color: var(--text-secondary);
    opacity: 0.6;
}

.closed-text {
    font-family: 'Great Vibes', cursive;
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.closed-hint {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Compilers Overlay */
.compilers-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.compilers-overlay.active {
    opacity: 1;
    visibility: visible;
}

.compilers-dialog {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
}

.compilers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.compilers-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compilers-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.compilers-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.compilers-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

.compilers-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
}

.compilers-content {
    padding: 20px 28px;
}

.compilers-search {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.search-input:focus {
    border-color: var(--color-primary);
}
/* Copilot-style Ghost Text & Status */
.copilot-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0,0,0,0.7);
    border-radius: 6px;
    font-size: 11px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    pointer-events: none;
}
.copilot-status.visible { opacity: 1; }
.copilot-status.loading { color: #f0db4f; }
.copilot-status.ready { color: #4ade80; }
.copilot-status .copilot-icon { animation: none; }
.copilot-status.loading .copilot-icon { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.tab-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 100;
}
/* Ghost text for Copilot suggestions */
.ghost-text-suggestion {
    color: #6e7681 !important;
    font-style: italic !important;
    opacity: 0.5 !important;
}
.tab-hint.visible { opacity: 1; }
.tab-hint kbd {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 10px;
}
/* Help Modal */
.help-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

.help-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.help-modal {
    background: var(--bg-primary);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.help-modal-overlay.active .help-modal {
    transform: scale(1) translateY(0);
}

.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.help-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
}

.help-modal-title svg {
    width: 24px;
    height: 24px;
}

.help-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.help-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.help-modal-content {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(85vh - 80px);
}

.help-section {
    margin-bottom: 24px;
}

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

.help-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.help-item:hover {
    border-color: var(--color-primary);
    background: rgba(64, 169, 68, 0.05);
}

.help-item:last-child {
    margin-bottom: 0;
}

.help-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.help-item-icon.blue { background: rgba(59, 130, 246, 0.15); }
.help-item-icon.red { background: rgba(239, 68, 68, 0.15); }
.help-item-icon.purple { background: rgba(168, 85, 247, 0.15); }
.help-item-icon.green { background: rgba(34, 197, 94, 0.15); }
.help-item-icon.orange { background: rgba(249, 115, 22, 0.15); }
.help-item-icon.yellow { background: rgba(234, 179, 8, 0.15); }
.help-item-icon.gray { background: rgba(107, 114, 128, 0.15); }

.help-item-content {
    flex: 1;
}

.help-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-item-title code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--color-primary);
}

.help-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
}

.help-shortcut kbd {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: var(--text-primary);
}

.help-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: rgba(64, 169, 68, 0.08);
    border-radius: 10px;
    border-left: 3px solid var(--color-primary);
    margin-top: 16px;
}

.help-tip-icon {
    font-size: 18px;
}

.help-tip-content {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
}

.help-tip-content strong {
    color: var(--color-primary);
}
.ai-btn i,
.btn i,
.dropdown-item i,
.output-tab i,
.clear-btn i,
.run-btn i {
    font-size: 14px;
    width: 16px;
    text-align: center;
}

.dropdown-btn.dropdown-circle i {
    font-size: 16px;
    color: white;
}

.ai-assistant-btn i {
    font-size: 18px;
}
/* AI Response Formatting */
.ai-response {
    font-size: 12px;
    line-height: 1.7;
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

.ai-response p,
.ai-response li,
.ai-response strong,
.ai-response em {
    font-size: 12px
}

.ai-response .ai-section {
    margin-top: 12px;
    margin-bottom: 4px;
    color: var(--color-primary);
    font-size: 12px;
}

.ai-response .ai-section:first-child {
    margin-top: 0;
}

.ai-response ul.ai-list {
    margin: 6px 0;
    padding-left: 18px;
}

.ai-response ul.ai-list li {
    margin: 3px 0;
    color: var(--text-secondary);
}

.ai-response pre.ai-code {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 10px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 12px;
}

.ai-response code.ai-inline {
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: #e06c75;
}

[data-theme="light"] .ai-response code.ai-inline {
    color: #d63384;
}

.ai-response strong {
    color: var(--text-primary);
}
/* AI Response List Styles */
.ai-response .ai-list {
    margin: 10px 0;
    padding-left: 0;
    list-style: none;
}

.ai-response .ai-list li {
    position: relative;
    padding: 6px 0 6px 20px;
    margin: 4px 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

.ai-response .ai-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
}

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

.ai-response .ai-section {
    border-bottom: 0px solid var(--border-color);
    padding-bottom: 4px;
}
/* AI Chat markdown horizontal rule */
#ai-panel-messages hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}

.ai-response .ai-section:first-child {
    margin-top: 0;
}
/* AI Response Alignment Fix */
#ai-panel-messages,
#ai-panel-messages * {
    text-align: left;
}

#ai-panel-messages .ai-response,
#ai-panel-messages .ai-response * {
    text-align: left;
}

/* Keep user messages right-aligned */
#ai-panel-messages > div:has(> div[style*="justify-content: flex-end"]) {
    text-align: right;
}
/* Editor Maximize/Minimize States */
.code-editor-container.editor-maximized {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    margin: 0;
    border-radius: 0;
    height: 100vh !important;
}

.code-editor-container.editor-maximized .monaco-wrapper {
    margin: 0;
    border-radius: 0;
    border: none;
}

.code-editor-container.editor-maximized .output-panel {
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
}

.code-editor-container.editor-maximized .editor-header {
    border-radius: 0;
}

/* Minimized State - Collapse to vertical strip */
.right-panel.editor-minimized {
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    flex: none !important;
    transition: width 0.3s ease;
    overflow: hidden;
}

.right-panel.editor-minimized .code-editor-container {
    height: 100%;
    width: 48px;
}

.right-panel.editor-minimized .monaco-wrapper {
    display: none;
}

.right-panel.editor-minimized .output-panel {
    display: none;
}

.right-panel.editor-minimized .editor-status-bar {
    display: none;
}

.right-panel.editor-minimized .editor-header {
    flex-direction: column;
    height: 100%;
    padding: 10px 4px;
    justify-content: flex-start;
    gap: 8px;
}

.right-panel.editor-minimized .editor-header-left {
    display: none;
}

.right-panel.editor-minimized .editor-header-right {
    flex-direction: column;
    gap: 12px;
}

.right-panel.editor-minimized .lang-dropdown-container {
    display: none;
}

.right-panel.editor-minimized .ai-btn {
    width: 32px;
    height: 32px;
}

.right-panel.editor-minimized .monaco-wrapper,
.right-panel.editor-minimized .output-panel,
.right-panel.editor-minimized .editor-status-bar,
.right-panel.editor-minimized .editor-header-buttons {
    display: none !important;
}

.right-panel.editor-minimized .editor-header {
    flex-direction: column;
    height: 100%;
    padding: 12px 8px;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    width: 48px;
}

.right-panel.editor-minimized .editor-header-right {
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.right-panel.editor-minimized .lang-dropdown-container,
.right-panel.editor-minimized #copy-code-btn {
    display: none !important;
}

.right-panel.editor-minimized .ai-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
}

/* Hide resizer when minimized */
.resizer.editor-minimized {
    display: none !important;
}

/* Expand left panel when editor is minimized */
.left-panel.editor-expanded {
    width: auto !important;
    flex: 1 !important;
    transition: flex 0.3s ease;
}

/* Expand left panel when editor is minimized */
.left-panel.editor-expanded {
    flex: 1 !important;
    transition: flex 0.3s ease;
}
/* Typing Indicator Animation */
@keyframes typingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-6px);
        opacity: 1;
    }
}
.lang-header-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 0px solid var(--border-color);
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-header-btn:hover {
     border: 1px solid var(--bg-primary);
    background: var(--bg-primary);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.lang-header-btn i:first-child {
    font-size: 14px;
}

.header-actions .lang-dropdown-container {
    position: relative;
}

.header-actions .lang-dropdown-menu {
    right: 0;
    top: calc(100% + 8px);
}

/* Typing dots container */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--color-primary, #40A944);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0s;
}
#copy-code-btn i, 
#minimize-editor-btn i,
#maximize-editor-btn i {
    font-size: 22px !important;
}
.editor-header .svg-inline--fa {
    height: 1.1em !important;
}
[data-theme="dark"] .stats-toggle-btn {
    color: #e8e0c8;
}

[data-theme="dark"] .stats-toggle-btn:hover {
    color: var(--color-primary);
}
/* AI Chat Panel Styling */
#terminal-closed-message {
    margin: 5px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

#terminal-closed-message > div {
    border-radius: 12px;
}

/* AI Chat messages container */
#ai-panel-messages {
    border-radius: 12px 12px 0 0;
}

#ai-input-area {
    border-radius: 0 0 12px 12px;
}
/* ChatGPT-style AI Input Box */
.ai-chatgpt-input-wrapper {
    padding: 10px;
    background: var(--bg-secondary);
    border-top: 0px solid var(--border-color);
}

.ai-chatgpt-input-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ai-chatgpt-input-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(64, 169, 68, 0.1);
}

.ai-chatgpt-textarea {
    flex: 1;
    min-height: 24px;
    max-height: 200px;
    padding: 4px 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    outline: none;
}

.ai-chatgpt-textarea::placeholder {
    color: var(--text-secondary);
}

.ai-chatgpt-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-primary);
    color: white;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chatgpt-send-btn:hover {
    background: var(--color-primary-dark);
    transform: scale(1.05);
}

.ai-chatgpt-disclaimer {
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 10px;
}

/* Test Cases Panel */
.test-cases-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.test-cases-overlay.active {
    opacity: 1;
    visibility: visible;
}

.test-cases-panel {
    position: fixed;
    top: 5px;
    right: -500px;
    width: 480px;
    height: calc(100vh - 10px);
    background: var(--bg-primary);
    z-index: 1999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    overflow: hidden;
}

.test-cases-panel.active {
    right: 5px;
}

.test-cases-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.test-cases-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
}

.test-cases-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: background 0.2s ease;
}

.test-cases-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.test-cases-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.test-cases-stats {
    display: flex;
    gap: 16px;
}

.test-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.test-stat.passed {
    color: #40A944;
}

.test-stat.failed {
    color: #ef4444;
}

.test-stat.pending {
    color: var(--text-secondary);
}

.test-cases-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.test-case-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.test-case-card:hover {
    border-color: var(--color-primary);
}

.test-case-card.passed {
    border-left: 4px solid #40A944;
}

.test-case-card.failed {
    border-left: 4px solid #ef4444;
}

.test-case-card.running {
    border-left: 4px solid #f59e0b;
}

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

.test-case-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
}

.test-case-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
}

.test-case-status.passed {
    background: rgba(64, 169, 68, 0.15);
    color: #40A944;
}

.test-case-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.test-case-status.running {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.test-case-status.pending {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.test-case-body {
    padding: 16px;
}

.test-case-section {
    margin-bottom: 12px;
}

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

.test-case-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.test-case-value {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.test-case-value.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.test-case-metrics {
    display: flex;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
    margin-top: 12px;
}

.test-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

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

.test-case-run-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.test-case-run-btn:hover {
    background: var(--color-primary-dark);
}

.test-case-run-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.test-cases-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.test-cases-footer-stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
}

.test-cases-footer-actions {
    display: flex;
    gap: 10px;
}

.run-all-tests-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.run-all-tests-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 169, 68, 0.3);
}

.run-all-tests-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.io-ex-box { background: #1e1e1e; border-radius: 12px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); }
.io-ex-header { background: #2d2d2d; padding: 12px 16px; display: flex; align-items: center; gap: 8px; }
.io-ex-dot { width: 12px; height: 12px; border-radius: 50%; }
.io-ex-dot.red { background: #ff5f56; }
.io-ex-dot.yellow { background: #ffbd2e; }
.io-ex-dot.green { background: #27c93f; }
.io-ex-title { margin-left: 12px; font-family: 'Fira Code', monospace; font-size: 12px; color: #888; }
.io-ex-body { padding: 20px; }

/* Code pre directly in io-ex-box (no io-ex-body wrapper) */
.io-ex-box > pre {
    background: transparent;
    border-radius: 0 0 12px 12px;
}
.io-ex-line { display: flex; margin-bottom: 12px; font-family: 'Fira Code', monospace; font-size: 13px; }
.io-ex-line:last-child { margin-bottom: 0; }
.io-ex-prompt { color: #4ade80; margin-right: 10px; flex-shrink: 0; }
.io-ex-label { color: #60a5fa; margin-right: 8px; flex-shrink: 0; }
.io-ex-value { color: #e5e5e5; }
.io-ex-output { border-radius: 6px; margin: 12px 0; }
.io-ex-output .io-ex-label { color: #4ade80; }
.io-ex-note { background: #252525; margin: 16px 0 0 0; padding: 14px; border-radius: 8px; border-left: 3px solid #f59e0b; }
.io-ex-note .io-ex-label { color: #f59e0b; }
.io-ex-note .io-ex-value { color: #a8a8a8; line-height: 1.6; }

/* Light Theme */
[data-theme="light"] .io-ex-box { background: #f8f9fa; border: 1px solid #e0d8c8; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
[data-theme="light"] .io-ex-header { background: #fef7e6; }
[data-theme="light"] .io-ex-body { background: #fffef7; }
[data-theme="light"] .io-ex-title { color: #666; }
[data-theme="light"] .io-ex-prompt { color: #2d7a33; }
[data-theme="light"] .io-ex-label { color: #2563eb; }
[data-theme="light"] .io-ex-value { color: #333; }
[data-theme="light"] .io-ex-output { background: #fffef7; }
[data-theme="light"] .io-ex-output .io-ex-label { color: #2d7a33; }
[data-theme="light"] .io-ex-note { background: #fff8e6; border-left-color: #f59e0b; }
[data-theme="light"] .io-ex-note .io-ex-label { color: #d97706; }
[data-theme="light"] .io-ex-note .io-ex-value { color: #555; }

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

.spin {
    animation: spin 1s linear infinite;
}
@media (max-width: 768px) {
    #terminal-closed-message .visualize-svg-box .tap-hint,
    #svg-fullscreen-overlay .fa-expand, .editor-status-bar,
    #svg-fullscreen-overlay .svg-inline--fa {
        display: none !important;
    }

    .main-workspace {
        flex-direction: column;
    }
    .left-panel {
        width: 100%;
        height: 60%;
    }
    .right-panel {
        height: 40%;
    }
    .resizer {
        display: none;
    }
    .ai-chat-dialog {
        width: 100%;
        right: -100%;
    }
}
/* Compact Editable Test Case Inputs */
.test-case-value.editable-inputs {
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.test-case-body {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 4px 8px;
    align-items: center;
}

.editable-param-row {
    display: contents;
}

.param-name {
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: right;
}

.param-equals {
    color: var(--text-secondary);
    font-family: 'Fira Code', monospace;
}

.param-value-input {
    flex: 1;
    padding: 6px 10px;
    margin: 2px;
    border: 0px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    font-size: 13px;
    outline: none;
}

.param-value-input:focus {
    background: var(--bg-secondary);
}

.param-value-input.input-error {
    border: 1px solid #ef4444 !important;
    background: rgba(239, 68, 68, 0.08);
}

.param-value-input.input-error::placeholder {
    color: #ef4444;
}

.param-error-hint {
    grid-column: 3;
    font-size: 11px;
    color: #ef4444;
    margin-top: -2px;
}

.test-case-metrics {
    grid-column: 1 / -1;
}

.expected-separator {
    grid-column: 1 / -1;
    border-top: 1px dashed var(--border-color);
    margin: 6px 0;
}

.test-case-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.test-case-delete-btn:hover:not(:disabled) {
    color: #ef4444;
}

.test-case-delete-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.add-test-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    margin-left: 10px;
}

.add-test-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
#terminal-container {
    margin: 15px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: 1px solid #FFC107;
}

#terminal-header {
    background: #fef7e6;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--accent-green);
}

#solution-code {
    margin: 0;
    padding: 20px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: auto;
    max-height: 400px;
    border-radius: 0;
}

#approaches-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #FFC107;
    table-layout: fixed;
}

#approaches-table th:nth-child(1),
#approaches-table td:nth-child(1) {
    width: 30%;
}

#approaches-table th:nth-child(2),
#approaches-table td:nth-child(2) {
    width: 15%;
}

#approaches-table th:nth-child(3),
#approaches-table td:nth-child(3) {
    width: 15%;
}

#approaches-table th:nth-child(4),
#approaches-table td:nth-child(4) {
    width: 40%;
}
/* Alternating row colors */
#approaches-table tbody tr:nth-child(odd) {
    background: rgba(64, 169, 68, 0.03);
}

#approaches-table tbody tr:nth-child(even) {
    background: transparent;
}

#approaches-table tbody tr:hover {
    background: rgba(64, 169, 68, 0.08) !important;
}

/* Dark mode alternating rows */
[data-theme="dark"] #approaches-table tbody tr:nth-child(odd) {
    background: rgba(64, 169, 68, 0.05);
}

[data-theme="dark"] #approaches-table tbody tr:nth-child(even) {
    background: transparent;
}

[data-theme="dark"] #approaches-table tbody tr:hover {
    background: rgba(64, 169, 68, 0.12) !important;
}

/* Dark mode overrides */
.dark-theme #terminal-container,
.dark-mode #terminal-container,
[data-theme="dark"] #terminal-container {
    border: 1px solid var(--border-color);
}

.dark-theme #terminal-header,
.dark-mode #terminal-header,
[data-theme="dark"] #terminal-header {
    background: var(--bg-tertiary);
}

.dark-theme #approaches-table,
.dark-mode #approaches-table,
[data-theme="dark"] #approaches-table {
    border: 1px solid var(--border-color);
}

.dark-theme #approaches-table thead tr,
.dark-mode #approaches-table thead tr,
[data-theme="dark"] #approaches-table thead tr {
    background: var(--bg-tertiary) !important;
}
/* Complexity Level Colors - Shared for Problem & Solution */
.complexity-card.excellent .complexity-value,
.complexity-card.good .complexity-value {
    color: #4CAF50;
}

.complexity-card.excellent .complexity-bar-fill,
.complexity-card.good .complexity-bar-fill {
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
}

.complexity-card.excellent .complexity-badge,
.complexity-card.good .complexity-badge {
    background: #e8f5e9;
    color: #2e7d32;
}

.complexity-card.medium .complexity-value {
    color: #FF9800;
}

.complexity-card.medium .complexity-bar-fill {
    background: linear-gradient(90deg, #FF9800, #FFB74D);
}

.complexity-card.medium .complexity-badge {
    background: #fff3e0;
    color: #e65100;
}

.complexity-card.bad .complexity-value {
    color: #f44336;
}

.complexity-card.bad .complexity-bar-fill {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

.complexity-card.bad .complexity-badge {
    background: #ffebee;
    color: #c62828;
}

/* Dark mode */
.dark-theme .complexity-card.excellent .complexity-badge,
.dark-mode .complexity-card.excellent .complexity-badge,
[data-theme="dark"] .complexity-card.excellent .complexity-badge,
.dark-theme .complexity-card.good .complexity-badge,
.dark-mode .complexity-card.good .complexity-badge,
[data-theme="dark"] .complexity-card.good .complexity-badge {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.dark-theme .complexity-card.medium .complexity-badge,
.dark-mode .complexity-card.medium .complexity-badge,
[data-theme="dark"] .complexity-card.medium .complexity-badge {
    background: rgba(255, 152, 0, 0.15);
    color: #ffb74d;
}

.dark-theme .complexity-card.bad .complexity-badge,
.dark-mode .complexity-card.bad .complexity-badge,
[data-theme="dark"] .complexity-card.bad .complexity-badge {
    background: rgba(244, 67, 54, 0.15);
    color: #ef5350;
}
/* Code Header */
.code-header {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
    overflow: visible;
    padding: 4px 0;
}

.code-header .section-title {
    flex-shrink: 0;
    margin: 0;
    padding-right: 10px;
}

.code-header .language-pills {
    margin: 0;
    padding: 8px 0 6px 0;
}

/* Language Pills */
.language-pills {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.language-pills::-webkit-scrollbar {
    display: none;
}

.lang-pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.lang-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.lang-pill.active {
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Language-specific colors */
.lang-pill[data-lang="c"] {
    border: 1px solid #A8B9CC;
}
.lang-pill[data-lang="c"].active {
    background: linear-gradient(135deg, #A8B9CC, #6E8CA0);
}

.lang-pill[data-lang="cpp"] {
    border: 1px solid #00599C;
}
.lang-pill[data-lang="cpp"].active {
    background: linear-gradient(135deg, #00599C, #004482);
}

.lang-pill[data-lang="java"] {
    border: 1px solid #ED8B00;
}
.lang-pill[data-lang="java"].active {
    background: linear-gradient(135deg, #ED8B00, #5382A1);
}

.lang-pill[data-lang="python"] {
    border: 1px solid #3776AB;
}
.lang-pill[data-lang="sql"] {
    border: 1px solid #3776AB;
}
.lang-pill[data-lang="python"].active {
    background: linear-gradient(135deg, #3776AB, #FFD43B);
}
.lang-pill[data-lang="sql"].active {
    background: linear-gradient(135deg, #3776AB, #FFD43B);
}

.lang-pill[data-lang="javascript"] {
    border: 1px solid #F7DF1E;
}
.lang-pill[data-lang="javascript"].active {
    background: linear-gradient(135deg, #F7DF1E, #323330);
    color: #323330;
}

.lang-pill[data-lang="go"] {
    border: 1px solid #00ADD8;
}
.lang-pill[data-lang="go"].active {
    background: linear-gradient(135deg, #00ADD8, #00758D);
}

/* Dark mode adjustments */
.dark-theme .lang-pill,
.dark-mode .lang-pill,
[data-theme="dark"] .lang-pill {
    background: var(--bg-secondary);
}

.dark-theme .lang-pill[data-lang="javascript"].active,
.dark-mode .lang-pill[data-lang="javascript"].active,
[data-theme="dark"] .lang-pill[data-lang="javascript"].active {
    color: #323330;
}
.code-header h2.section-title {
    width: auto;
    flex: none;
}
.examples-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.btn-group-left,
.btn-group-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-group-right {
    margin-right: 15px;
}
.row-tick {
    color: #4CAF50;
    font-weight: 600;
    margin-right: 4px;
}
.code-body {
    position: relative;
}

.copy-code-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 14px;
    z-index: 10;
    opacity: 0;
}

.code-body:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--accent-green);
}
/* Mobile responsiveness */
@media (max-width: 600px) {
    .code-header {
        gap: 12px;
    }
    
    .lang-pill {
        padding: 4px 10px;
        font-size: 11px;
    }
}
/* Tooltip styling for stats */
.stat-value[title] {
    cursor: help;
    position: relative;
}

.stat-value[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.stat-value[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
    z-index: 1000;
}

[data-theme="dark"] .stat-value[title]:hover::after {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
}

[data-theme="dark"] .stat-value[title]:hover::before {
    border-top-color: #1a1a1a;
}