/* Direction: Cybernetic Socratic Studio × Tech Precision | Mobile: Native-app bottom navigation & thumb-zone actions | Desktop: High-end IDE split workspace */

:root {
    --font-display: 'Space Grotesk', 'Syne', -apple-system, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* 60/30/10 Palette */
    --surface-base: #05070b;
    --surface-card: #0c1017;
    --surface-elevated: #131924;
    --surface-glass: rgba(12, 16, 23, 0.85);
    --surface-glass-heavy: rgba(7, 10, 15, 0.95);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(0, 240, 255, 0.25);
    --border-hover: rgba(0, 240, 255, 0.5);

    --text-primary: #f0f6fc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-faint: #334155;

    --accent-cyan: #00f0ff;
    --accent-cyan-glow: rgba(0, 240, 255, 0.2);
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.2);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.2);
    --accent-rose: #ff3366;
    --accent-rose-glow: rgba(255, 51, 102, 0.2);
    --accent-violet: #a855f7;
    --accent-violet-glow: rgba(168, 85, 247, 0.2);

    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-glow-cyan: 0 0 20px rgba(0, 240, 255, 0.15);
    --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Base & Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    color-scheme: dark;
    background-color: var(--surface-base);
}

body {
    background: radial-gradient(circle at 50% 0%, #0d1527 0%, var(--surface-base) 70%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Typography */
h1, h2, h3, .font-display {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    font-weight: 700;
}

.font-mono {
    font-family: var(--font-mono);
}

.text-fluid-h1 {
    font-size: clamp(1.4rem, 3.2vw, 2.1rem);
    line-height: 1.25;
}

/* Interactive Touch Targets (>=44px/48px) */
button, a, input, select {
    font-family: inherit;
    touch-action: manipulation;
}

.touch-btn {
    min-height: 40px;
    min-width: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all 0.2s var(--ease-spring);
    cursor: pointer;
    border: 1px solid transparent;
}

.touch-btn:active {
    transform: scale(0.96);
}

.touch-btn-primary {
    background: linear-gradient(135deg, #00f0ff 0%, #0077ff 100%);
    color: #030712;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 240, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.2);
}
.touch-btn-primary:hover {
    box-shadow: 0 6px 24px rgba(0, 240, 255, 0.5);
    filter: brightness(1.1);
}

.touch-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}
.touch-btn-success:hover {
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.45);
    filter: brightness(1.08);
}

.touch-btn-secondary {
    background: var(--surface-elevated);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}
.touch-btn-secondary:hover {
    border-color: var(--border-accent);
    background: #1a2232;
    color: var(--accent-cyan);
}

/* App Wrapper & Header */
.app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-header {
    height: 58px;
    background: var(--surface-glass-heavy);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 40;
    shrink: 0;
}

.brand-badge {
    position: relative;
}
.brand-badge::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    z-index: -1;
    opacity: 0.6;
    filter: blur(6px);
}

/* Custom Searchable Question Dropdown */
.q-dropdown-item {
    padding: 8px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    cursor: pointer;
    border: 1px solid transparent;
}
.q-dropdown-item:hover, .q-dropdown-item.focused {
    background: rgba(0, 240, 255, 0.08);
    color: #ffffff;
    border-color: rgba(0, 240, 255, 0.25);
    transform: translateX(2px);
}
.q-dropdown-item.active-selected {
    background: rgba(0, 240, 255, 0.12);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    font-weight: 600;
}

.q-filter-chip {
    background: rgba(19, 25, 36, 0.8);
    border-color: var(--border-subtle);
    color: var(--text-muted);
    transition: all 0.2s ease;
    cursor: pointer;
}
.q-filter-chip:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}
.q-filter-chip.active {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Mobile Nav Tabs */
.mobile-nav-tabs {
    display: flex;
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    scrollbar-width: none;
    shrink: 0;
    z-index: 30;
}
.mobile-nav-tabs::-webkit-scrollbar {
    display: none;
}
.mobile-nav-tab {
    flex: 1;
    min-width: 80px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: transparent;
    cursor: pointer;
}
.mobile-nav-tab.active {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
    background: rgba(0, 240, 255, 0.05);
}

/* Main Workspace Viewport */
.workspace-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-view-pane {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    background: var(--surface-base);
    padding: 16px 16px 84px 16px;
    display: none;
}
.mobile-view-pane.active-pane {
    display: block;
}

.mobile-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-glass-heavy);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6);
}

.gutter-divider {
    display: none;
}

/* Desktop Expansion */
@media (min-width: 768px) {
    .mobile-nav-tabs {
        display: none;
    }
    .mobile-bottom-bar {
        display: none;
    }

    .workspace-viewport {
        flex-direction: row;
        height: calc(100vh - 58px);
        height: calc(100dvh - 58px);
    }

    .gutter-divider {
        display: block;
        width: 6px;
        background: #0f172a;
        cursor: col-resize;
        transition: background 0.2s, box-shadow 0.2s;
        z-index: 25;
        position: relative;
        flex-shrink: 0;
    }
    .gutter-divider:hover, .gutter-divider.dragging {
        background: var(--accent-cyan);
        box-shadow: var(--shadow-glow-cyan);
    }

    .pane-left {
        width: 46%;
        min-width: 360px;
        max-width: 75%;
        height: 100%;
        display: flex;
        flex-direction: column;
        background: var(--surface-card);
        border-right: 1px solid var(--border-subtle);
        overflow: hidden;
        position: relative;
    }

    .pane-right {
        flex: 1;
        min-width: 420px;
        height: 100%;
        display: flex;
        flex-direction: column;
        background: #11151c;
        overflow: hidden;
    }

    .desktop-tab-content {
        flex: 1;
        overflow-y: auto;
        padding: 24px;
        display: block;
    }

    .desktop-tab-content.hidden {
        display: none !important;
    }
}

/* Socratic Hint Cards */
.hint-tier-card {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--surface-card);
    transition: all 0.25s var(--ease-spring);
    overflow: hidden;
}

.hint-tier-card.unlocked {
    border-color: rgba(0, 240, 255, 0.35);
    background: linear-gradient(165deg, rgba(19, 25, 36, 0.95), rgba(9, 13, 20, 0.95));
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hint-tier-card.locked {
    background: rgba(12, 16, 23, 0.4);
    opacity: 0.75;
}
.hint-tier-card.locked:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.2);
}

@keyframes shimmerWave {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-shimmer {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.3) 25%, rgba(51, 65, 85, 0.6) 50%, rgba(30, 41, 59, 0.3) 75%);
    background-size: 200% 100%;
    animation: shimmerWave 1.8s infinite;
}

@keyframes neuralPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.neural-pulse-dot {
    animation: neuralPulse 2s infinite ease-in-out;
}

/* Badges */
.badge-easy {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-medium {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-hard {
    background: rgba(255, 51, 102, 0.15);
    color: #ff6b8b;
    border: 1px solid rgba(255, 51, 102, 0.3);
}

.badge-solved {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.badge-struggled {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.5);
}

.badge-attempted {
    background: rgba(0, 240, 255, 0.15);
    color: #00f0ff;
    border: 1px solid rgba(0, 240, 255, 0.35);
}

/* Problem Typography */
.problem-content {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #cbd5e1;
}

.problem-content h3 {
    font-family: var(--font-display);
    font-size: 1.1875rem;
    color: #f8fafc;
    margin: 1.25rem 0 0.5rem 0;
}

.problem-content h4 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #e2e8f0;
    margin: 1rem 0 0.35rem 0;
}

.problem-content p {
    margin-bottom: 0.85rem;
}

.problem-content code {
    background: #1e293b;
    padding: 0.2rem 0.45rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: #00f0ff;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.problem-content pre {
    background: #090d14;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: #f1f5f9;
    margin: 0.75rem 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.problem-content ul, .problem-content ol {
    padding-left: 1.5rem;
    margin-bottom: 0.85rem;
}

.problem-content li {
    margin-bottom: 0.35rem;
}

#pane-editor {
    flex: 1 1 0%;
    min-height: 0;
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #11151c;
}

#monaco-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: #11151c;
}

#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 99999;
}
