:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-hover: #30363d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --accent-primary: #58a6ff;
    --accent-success: #238636;
    --accent-success-light: #3fb950;
    --accent-error: #f85149;
    --accent-warning: #d29922;
    --easy: #3fb950;
    --medium: #d29922;
    --hard: #f85149;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html, body {
    height: 100%;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
    transition: opacity 0.2s;
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    font-size: 20px;
}

.logo-text {
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.progress-summary {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.progress-bar {
    width: 100px;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-success-light);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Main Content */
.main {
    flex: 1;
    overflow: auto;
}

.view {
    min-height: 100%;
}

.view.hidden {
    display: none;
}

/* Hero Section */
.hero {
    padding: 48px 32px 32px;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Filters */
.filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.filter-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.filter-btn.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

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

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 0 32px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

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

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-label.easy { color: var(--easy); }
.stat-label.medium { color: var(--medium); }
.stat-label.hard { color: var(--hard); }

/* Problems List */
.problems-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px 48px;
}

.problem-card {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.problem-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--bg-hover);
    transform: translateX(4px);
}

.problem-card.solved {
    border-left: 3px solid var(--easy);
}

.problem-card.unsolved {
    border-left: 3px solid transparent;
}

.problem-status {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 14px;
}

.problem-status.solved::after {
    content: '✓';
    color: var(--easy);
    font-weight: bold;
}

.problem-status.unsolved::after {
    content: '○';
    color: var(--text-muted);
}

.problem-info-card {
    flex: 1;
}

.problem-title-card {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.problem-meta-card {
    font-size: 12px;
    color: var(--text-secondary);
}

.problem-difficulty-card {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.problem-difficulty-card.Easy {
    background: rgba(63, 185, 80, 0.15);
    color: var(--easy);
}

.problem-difficulty-card.Medium {
    background: rgba(210, 153, 34, 0.15);
    color: var(--medium);
}

.problem-difficulty-card.Hard {
    background: rgba(248, 81, 73, 0.15);
    color: var(--hard);
}

.problem-acceptance-card {
    width: 70px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Problem View Layout */
.problem-layout {
    display: flex;
    height: calc(100vh - 56px);
}

.problem-sidebar {
    width: 420px;
    min-width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.back-btn {
    margin: 16px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

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

.problem-info {
    padding: 0 20px 20px;
}

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

.problem-number {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.problem-difficulty {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.problem-difficulty.Easy {
    background: rgba(63, 185, 80, 0.15);
    color: var(--easy);
}

.problem-difficulty.Medium {
    background: rgba(210, 153, 34, 0.15);
    color: var(--medium);
}

.problem-difficulty.Hard {
    background: rgba(248, 81, 73, 0.15);
    color: var(--hard);
}

.problem-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.3;
}

.problem-meta {
    margin-bottom: 20px;
}

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

.problem-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.problem-description p {
    margin-bottom: 12px;
}

.problem-description code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.problem-description pre {
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 12px 0;
}

.problem-description pre code {
    background: transparent;
    padding: 0;
}

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

.example {
    margin-bottom: 16px;
}

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

.example-content {
    background: var(--bg-tertiary);
    border-radius: 6px;
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.example-line {
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.example-line:last-child {
    margin-bottom: 0;
}

.example-line strong {
    color: var(--text-primary);
}

.problem-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tag {
    padding: 4px 10px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.leetcode-link {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.leetcode-link:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

/* Editor Section */
.editor-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.editor-toolbar {
    height: 48px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

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

.lang-badge {
    padding: 4px 10px;
    background: rgba(88, 166, 255, 0.15);
    color: var(--accent-primary);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
}

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

.toolbar-btn {
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

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

.run-btn {
    padding: 6px 16px;
    background: var(--accent-success);
    border: 1px solid var(--accent-success);
    border-radius: 6px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.run-btn:hover {
    background: var(--accent-success-light);
    border-color: var(--accent-success-light);
}

.run-btn:active {
    transform: translateY(1px);
}

.run-icon {
    font-size: 10px;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
}

#monaco-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Console Section */
.console-section {
    height: 200px;
    min-height: 150px;
    max-height: 400px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

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

.console-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-console {
    padding: 2px 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: color 0.15s;
}

.clear-console:hover {
    color: var(--text-secondary);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
}

.console-line {
    margin-bottom: 4px;
    padding: 4px 0;
}

.console-line.log {
    color: var(--text-primary);
}

.console-line.error {
    color: var(--accent-error);
}

.console-line.success {
    color: var(--easy);
}

.console-line.warn {
    color: var(--accent-warning);
}

.console-line.info {
    color: var(--accent-primary);
}

.console-line.test-pass {
    color: var(--easy);
    padding-left: 16px;
    position: relative;
}

.console-line.test-pass::before {
    content: '✓';
    position: absolute;
    left: 0;
}

.console-line.test-fail {
    color: var(--accent-error);
    padding-left: 16px;
    position: relative;
}

.console-line.test-fail::before {
    content: '✗';
    position: absolute;
    left: 0;
}

.console-divider {
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

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

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

.loading-overlay span {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    z-index: 1001;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--easy);
}

.toast.error {
    border-color: var(--accent-error);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

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

/* Monaco Editor Customization */
.monaco-editor {
    padding-top: 8px;
}

/* Responsive */
@media (max-width: 900px) {
    .problem-layout {
        flex-direction: column;
    }
    
    .problem-sidebar {
        width: 100%;
        max-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .hero {
        padding: 32px 20px 24px;
    }
    
    .hero h1 {
        font-size: 24px;
    }
    
    .filters {
        padding: 0 20px 20px;
    }
    
    .problems-list {
        padding: 0 20px 32px;
    }
    
    .problem-card {
        padding: 12px 16px;
    }
    
    .problem-acceptance-card {
        display: none;
    }
}

/* Selection */
::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}
