:root {
    /* Modern Slate/Blue Theme */
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #64748b;
    --accent-color: #f43f5e;
    --success-color: #22c55e;
    --border-color: #334155;
    --nav-height: 48px;
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Missing Variables Fix */
    --text-primary: var(--text-color);
    --text-secondary: var(--text-muted);
    --accent-primary: var(--primary-color);
    --accent-secondary: #60a5fa;
    /* Lighter blue */
    --success: var(--success-color);
}

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

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}


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

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.no-scroll {
    overflow: hidden;
    /* Prevent body scroll only on specific pages */
}

/* Ensure links and other text elements inherit color or use variables */
a {
    color: var(--primary-color);
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-color);
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.5rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: block;
    /* Default to block for content */
}

.container-fluid {
    width: 100%;
    padding: 0 1.5rem;
    display: block;
    /* Default to block for content */
}

.practice-main {
    padding: 0 0.5rem !important;
    height: calc(100vh - var(--nav-height));
    overflow: hidden;
}

/* Navbar specific container overrides */
.navbar .container,
.navbar .container-fluid {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    /* Ensure full height of navbar */
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 40px;
    /* Bigger logo */
    width: auto;
    object-fit: contain;
}

.logo-img-placeholder {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    /* Prepare for border */
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.hamburger span {
    width: 100%;
    height: 3px;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

/* Mobile Menu Active State */
.nav-links.active {
    display: flex;
}

/* Hamburger Animation */
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Hero Section */
.hero-section {
    min-height: calc(100vh - 70px);
    /* Allow dynamic growth but start large */
    display: flex;
    flex-direction: column;
    /* Better control */
    align-items: center;
    /* justify-content: center; Removed to manually position higher */
    justify-content: flex-start;
    text-align: center;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    padding-top: 0;
    /* Reduced from 2rem to 0 to move logo up */
    padding-bottom: 4rem;
}

.hero-container {
    max-width: 800px;
    padding: 1rem;
}

.hero-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 0.5rem;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    line-height: 1.6;
}

.hero-section .hero-btn {
    display: inline-flex;
    font-size: 1.25rem;
    padding: 1rem 2.5rem;
    border-radius: 999px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

/* Views */
.view-section {
    display: block;
    animation: fadeIn 0.3s ease;
}

.view-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.success {
    color: var(--success-color);
}

.stat-value.warning {
    color: var(--warning-color);
}

.progress-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.progress-bar-bg.large {
    height: 12px;
    margin: 1.5rem 0 1rem;
}

.progress-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* About */
.about-content {
    padding: 2rem;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
}

.about-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--accent-primary);
}

.about-content ul {
    padding-left: 1.5rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

/* Dashboard */
.dashboard-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.dashboard-container.wide {
    max-width: 1400px;
}

.dashboard-header {
    text-align: center;
    padding: 3rem 0;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

/* Tabs */
.tabs-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: var(--font-main);
    font-weight: 500;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.tab-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #0f172a;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
}

.case-select-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    position: relative;
    padding-right: 1.5rem;
    /* Space for X */
}

/* ... existing active ... */

.delete-case-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    border-radius: 50%;
    display: none;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.case-select-btn:hover .delete-case-btn {
    display: flex;
}

.delete-case-btn:hover {
    transform: scale(1.1);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Grid */
.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding-bottom: 4rem;
    justify-content: center;
    /* Center grid items */
}

.pattern-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
}

.pattern-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
}

.pattern-card.hidden {
    display: none;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.badge {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.6rem;
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.02);
}

.file-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.mark-done-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.mark-done-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.mark-done-toggle.done {
    background: var(--success);
    border-color: var(--success);
    color: #0f172a;
}

.file-icon.done {
    color: var(--success);
}

/* Cool Lines - Visual Connectors */
.patterns-grid {
    position: relative;
}

.pattern-card {
    position: relative;
    z-index: 1;
}

.pattern-card::after {
    display: none;
}

.pattern-card:last-child::after {
    display: none;
}

/* Hide connectors on mobile or when grid wraps */
@media (max-width: 1000px) {
    .pattern-card::after {
        display: none;
    }
}

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

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

/* Practice View */
.practice-container {
    display: flex;
    flex-direction: column;
    /* Stack header and editor */
    flex: 1;
    gap: 0;
    height: 100%;
    overflow: hidden;
    padding: 0;
}

.left-panel {
    flex: 0 0 35%;
    /* Start with 35% width */
    min-width: 250px;
    max-width: 60%;
}

.right-panel {
    flex: 1;
    /* Take remaining space */
    min-width: 400px;
}

.gutter {
    width: 8px;
    /* Wider hit area */
    background: #1e293b;
    /* Visible color (card-bg) */
    border-left: 1px solid #334155;
    border-right: 1px solid #334155;
    cursor: col-resize;
    z-index: 100;
    /* Ensure on top */
    transition: background 0.1s;
    /* Blend top/bottom */
    margin-top: 1px;
    margin-bottom: 1px;
    flex-shrink: 0;
}

.gutter:hover,
.gutter.active {
    background: var(--primary-color);
}

.practice-header {
    flex-shrink: 0;
    /* Don't shrink header */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    /* Unsquished */
    border-bottom: none;
    /* Seamless with panels */
    margin-bottom: 4px;
    /* Tiny margin */
}

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

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    /* Elegant size */
}

.separator {
    color: var(--border-color);
    /* Faint separator */
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
}

.breadcrumbs .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.breadcrumbs .back-link:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateX(-2px);
}

.breadcrumbs .current-file {
    color: var(--text-primary);
    font-weight: 600;
}

.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.2s, opacity 0.2s, background 0.2s, color 0.2s, border-color 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn.primary {
    background: var(--accent-primary);
    color: #0f172a;
}

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

.btn.success {
    background: var(--success);
    color: #0f172a;
}

.btn.success.outline {
    background: transparent;
    border: 1px solid var(--success);
    color: var(--success);
}

.btn.text {
    background: transparent;
    color: var(--text-secondary);
}

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

.btn.small {
    padding: 0.4rem 0.8rem;
    /* Bigger padding */
    font-size: 0.9rem;
    /* Bigger font */
}

.btn.large {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

/* Editor Layout */
.editor-layout {
    display: flex;
    flex-direction: row;
    flex: 1;
    /* Take remaining vertical space */
    gap: 0;
    /* No gap (handled by gutter) */
    padding-bottom: 0;
    height: 100%;
    overflow: hidden;
    min-height: 0;
}

.panel {
    flex: 1;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    height: 100%;
    /* Ensure panel takes full height */
}

.panel.hidden {
    display: none;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.save-status {
    color: var(--success-color);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.panel-header {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.panel-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-viewer-container {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 0.5rem;
    overflow: hidden;
    /* Prevent scroll on container */
    min-height: 0;
    /* Critical for nested flex scrolling */
}

.editor-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Critical */
}

.reference-editor-wrapper {
    height: 100%;
    flex: 1;
    overflow: hidden;
    transition: filter 0.3s;
}

.blurred-content {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

.code-viewer-container pre,
.editor-container .CodeMirror {
    width: 100%;
    height: 100%;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: transparent;
    color: var(--text-primary);
    border: none;
}

.code-viewer-container pre {
    padding: 1rem;
    overflow: auto;
}

/* CodeMirror Customization */
.CodeMirror {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    height: 100% !important;
}

.CodeMirror-gutters {
    background: var(--card-bg) !important;
    border-right: 1px solid var(--border-color) !important;
}

.blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    transition: opacity 0.3s;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s;
}

.modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-body {
    padding: 1.5rem;
    color: var(--text-secondary);
}

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

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

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

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

.overlay-content {
    text-align: center;
    color: var(--text-secondary);
}

.lock-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Start Practice Hero */
.start-practice-hero {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5));
}

.hero-content {
    max-width: 400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.hero-content h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.hero-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

#practice-editor-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
}

#practice-editor-wrapper.hidden {
    display: none;
}

/* Console */
.console-container {
    height: 150px;
    border-top: 1px solid var(--border-color);
    background: #000;
    display: flex;
    flex-direction: column;
}

.console-header {
    padding: 0.25rem 1rem;
    background: #111;
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-output {
    flex: 1;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    overflow-y: auto;
    color: #ccc;
    white-space: pre-wrap;
}

.console-output .error {
    color: #ef4444;
}

.console-output .success {
    color: #4ade80;
}

/* Parrot Meter */
.parrot-meter-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    margin-right: 1rem;
    min-width: 200px;
}

.parrot-meter-container.hidden {
    display: none;
}

.parrot-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.parrot-bar-bg {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.parrot-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-secondary), var(--accent-primary));
    width: 0%;
    transition: width 0.5s ease-out;
}

.parrot-score {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 0.9rem;
    min-width: 3ch;
    text-align: right;
}

/* Mobile Actions Header */
.mobile-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    margin-bottom: 0;
}

.mobile-actions-header .parrot-meter-container {
    flex: 1;
    margin-right: 0.5rem;
    margin-bottom: 0;
    min-width: 0;
    /* Allow shrinking */
}

.mobile-actions-header .parrot-label {
    display: none;
    /* Save space */
}

.mobile-btn-group {
    display: flex;
    gap: 0.5rem;
}

.mobile-btn-group .btn {
    padding: 0.4rem;
    /* Compact buttons */
}

/* Force Markdown Code Box Sizing Fix */
.markdown-mode .panel.left-panel {
    display: block !important;
    /* Stop flex layout from stretching children */
    overflow-y: auto !important;
    /* Allow panel itself to scroll */
}

/* Ensure header stays at top */
.markdown-mode .panel.left-panel .panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg);
}

.markdown-body {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
}

.markdown-body pre {
    height: auto !important;
    min-height: 20px !important;
    max-height: none !important;
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
    background: #1e1e1e !important;
}

.markdown-body pre code {
    white-space: pre !important;
    overflow-x: auto !important;
    height: auto !important;
    display: block !important;
}

.code-viewer-container {
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
    /* Disable flex item behavior */
}

/* Mobile Responsiveness */
/* Mobile Responsiveness */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .container {
        padding: 0 1rem;
    }

    .practice-main {
        height: auto !important;
        overflow: auto !important;
        padding-bottom: 2rem !important;
    }

    /* Navbar Mobile */
    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-links a {
        padding: 1rem;
        text-align: center;
        width: 100%;
    }

    .logo-text {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    /* Hero Section Mobile Fixes */
    .hero-section {
        height: auto;
        min-height: 80vh;
        padding-top: 1rem;
        /* Reduced from 4rem to 1rem for mobile */
        /* Push content down */
        padding-bottom: 4rem;
    }

    .hero-logo {
        max-width: 150px;
        /* Smaller logo on mobile */
    }

    @media (max-width: 768px) {
        .start-practice-hero .hero-content {
            padding: 1.5rem;
        }

        .start-practice-hero h3 {
            font-size: 1.5rem;
        }
    }


    /* Practice View Mobile Scrolling Fix */
    .practice-container {
        height: auto;
        overflow: visible;
        min-height: calc(100vh - var(--nav-height));
    }

    .editor-layout {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }

    .panel {
        height: 80vh;
        /* Explicit height for flex children to fill */
        overflow: hidden;
        margin-bottom: 2rem;
        display: flex;
        flex-direction: column;
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .left-panel,
    .right-panel {
        max-width: 100% !important;
        flex: none !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .gutter,
    .gutter-vertical {
        display: none !important;
    }

    .code-viewer-container,
    .editor-container {
        flex: 1;
        /* Fill the panel */
        height: 100%;
        min-height: 0;
        /* Allow shrinking if needed */
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }

    .CodeMirror {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Ensure body scrolls */
    body.practice-mode {
        overflow: auto;
    }

    .practice-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .parrot-meter-container {
        width: 100%;
        margin-right: 0;
        margin-bottom: 0.5rem;
        order: -1;
    }

    .breadcrumbs {
        font-size: 0.9rem;
        flex-wrap: wrap;
    }

    /* Allow markdown to expand page on mobile */
    .markdown-body {
        height: auto !important;
        overflow: visible !important;
    }
}

/* Run Only Mode Utilities */
.run-only-mode .tab-group {
    display: none !important;
}

.run-only-mode #submit-btn {
    display: none !important;
}

.run-only-mode #run-btn {
    /* Make Run button primary in run-only mode */
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.run-only-mode #run-btn:hover {
    background-color: var(--primary-hover);
}

.run-only-mode #tab-testcase {
    display: none !important;
}

.run-only-mode #tab-output {
    display: flex !important;
    flex-direction: column;
}

/* Markdown Styles */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.6;
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    color: var(--text-primary);
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.markdown-body p {
    margin-bottom: 1em;
}

.markdown-body pre {
    background-color: #1e293b;
    /* Darker slate */
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    border: 1px solid #334155;
    margin-bottom: 1em;
}

.markdown-body code {
    font-family: 'Fira Code', monospace;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.9em;
}

/* Markdown Mode (Single Pane) */
.editor-layout.markdown-mode .left-panel {
    flex: 1;
    max-width: 100%;
    width: 100%;
    border-right: none;
}

.editor-layout.markdown-mode .gutter {
    display: none;
}

.editor-layout.markdown-mode .right-panel {
    display: none;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    color: #e2e8f0;
}

/* Footer Actions */
.footer-actions {
    display: flex;
    justify-content: center;
    margin-top: 4rem;
    margin-bottom: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

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

.btn.danger.outline {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.btn.danger.outline:hover {
    background: rgba(244, 63, 94, 0.1);
}

/* Practice Layout - Split Panel */
.practice-interface {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.top-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 100px;
}

.gutter-vertical {
    height: 8px;
    background: #1e293b;
    border-top: 1px solid #334155;
    border-bottom: 1px solid #334155;
    cursor: row-resize;
    z-index: 100;
    transition: background 0.1s;
    flex-shrink: 0;
}

.gutter-vertical:hover,
.gutter-vertical.active {
    background: var(--primary-color);
}

/* Collapsible Console */
/* Collapsible Console Footer Redesign */
.bottom-section {
    height: 250px;
    min-height: 48px;
    /* Footer height */
    max-height: 80%;
    display: flex;
    flex-direction: column;
    /* background: var(--card-bg); */
    background: #0f172a;
    /* Match footer to avoid discoloration */
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    /* Pop out effect */
}

.bottom-section.collapsed {
    height: auto !important;
    /* Match new footer height */
    overflow: hidden;
}

.console-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Hidden when collapsed via parent height */
}

/* Footer Bar */
.console-footer-bar {
    height: auto;
    /* Allow growth */
    min-height: 56px;
    /* Taller */
    background: #0f172a;
    /* Darker stripe */
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    flex-shrink: 0;
}

.console-toggle-trigger {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.console-toggle-trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.console-footer-actions {
    display: flex;
    gap: 0.75rem;
}

/* Tabs Nav in Content */
.tabs-nav-row {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Chevron Rotation */
.chevron {
    display: inline-block;
    transition: transform 0.3s;
}

.bottom-section:not(.collapsed) .chevron {
    transform: rotate(180deg);
    /* Point down when expanded */
}

/* Ensure content is hidden strictly when collapsed to perform better */
.bottom-section.collapsed .console-content-wrapper {
    display: none;
}

/* Legacy tabs-header removed */

.tab-btn-bottom {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-weight: 500;
}

.tab-btn-bottom:hover {
    color: var(--text-primary);
}

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

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

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

/* Test Case Tab */
#tab-testcase {
    flex-direction: column;
    padding: 0;
}

/* Output Tab */
#tab-output {
    background: #000;
}

#console-output {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
}

.console-actions-overlay {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    z-index: 10;
}

/* Hide original console container styles if they conflict */
.console-container {
    display: none !important;
}

/* Supported Languages */
.supported-languages {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    z-index: 10;
    /* animation: fadeIn 0.5s ease 0.2s backwards; */
}

.supported-languages p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.language-icons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 0.5rem;
}

.language-icons img {
    height: 64px;
    /* Larger */
    width: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    /* Nice shadow */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy pop */
    opacity: 1;
    /* Fully visible */
}

.language-icons img:hover {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 10px 15px rgba(59, 130, 246, 0.4));
    /* Glow color */
}

/* Mode Toggle Switch */
.mode-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    border-right: 1px solid var(--border-color);
    margin-right: 0.5rem;
}

.mode-toggle .toggle-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: none;
}

@media (min-width: 1200px) {
    .mode-toggle .toggle-label {
        display: block;
    }
}

.toggle-switch {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
}

.toggle-switch input {
    display: none;
}

.toggle-switch label {
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
    user-select: none;
}

.toggle-switch label:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-switch input:checked+label {
    background: var(--accent-primary);
    color: #0f172a;
    font-weight: 600;
}

/* Zen Mode Styling */
body.zen-mode .navbar,
body.zen-mode .practice-header,
body.zen-mode .left-panel,
body.zen-mode .gutter,
body.zen-mode .gutter-vertical,
body.zen-mode .mobile-actions-header {
    display: none !important;
}

body.zen-mode .practice-main {
    height: 100vh;
    padding: 0 !important;
}

body.zen-mode .editor-layout {
    height: 100vh;
    width: 100vw;
}

body.zen-mode .panel.right-panel {
    width: 100% !important;
    height: 100% !important;
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

body.zen-mode .practice-interface {
    height: 100%;
    display: flex;
    flex-direction: column;
}

body.zen-mode .top-section {
    flex: 1;
}

/* Hide specific header elements in Zen Mode */
body.zen-mode .parrot-meter-container,
body.zen-mode .save-status,
body.zen-mode #reset-btn,
body.zen-mode #zen-mode-toggle,
body.zen-mode .mode-toggle {
    display: none !important;
}

/* Floating Exit Button */
.floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: transform 0.2s, opacity 0.2s;
}

.floating-btn:hover {
    transform: translateY(-2px);
}

/* Algorithm Page Centering */
.centered-container {
    display: block;
    /* Removed flex to stop vertical stretching */
    width: 100%;
}

.centered-content {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Fix: Force full width for Markdown Panel so centering works */
/* Fix: Force full width for Markdown Panel so centering works */
.markdown-mode .panel.left-panel {
    width: 90% !important;
    max-width: 900px !important;
    flex: 0 1 auto !important;
    margin: 0 auto !important;
}

/* Fix: Remove top spacing gap in markdown content */
.markdown-body> :first-child {
    margin-top: 0 !important;
}

/* Ensure code blocks are clean */
.markdown-body pre {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
/* Vendor Overrides */

/* Fix for KaTeX Double Rendering */
.katex-mathml {
    clip: rect(1px, 1px, 1px, 1px);
    height: 1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.katex-html {
    display: inline-block;
}
