@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ═══════════════════════════════════════════════════════════
   DESIGN SYSTEM — Premium Light Theme
   ═══════════════════════════════════════════════════════════ */
:root {
    /* Core palette */
    --bg-base: #f5f5f7;
    --bg-raised: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-input: #f8f8fa;
    --surface-glass: rgba(255, 255, 255, 0.78);

    /* Text */
    --ink: #111118;
    --ink-2: #555566;
    --ink-3: #8888a0;
    --ink-4: #b0b0c0;

    /* Accent */
    --accent: #111118;
    --accent-glow: rgba(108, 71, 255, 0.18);
    --accent-hover: #8260ff;
    --accent-soft: rgba(108, 71, 255, 0.08);

    /* Semantic */
    --green: #16a34a;
    --green-soft: #ecfdf3;
    --green-border: #bbf7d0;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --red-border: #fecaca;
    --orange: #ea580c;
    --orange-soft: #fff7ed;
    --blue: #2563eb;
    --blue-soft: #eff6ff;
    --purple: #7c3aed;
    --purple-soft: #f5f3ff;
    --cyan: #0891b2;
    --yellow: #ca8a04;
    --yellow-soft: #fefce8;

    /* Style colors */
    --color-procedural: #2563eb;
    --color-functional: #ea580c;
    --color-oop: #7c3aed;

    /* Lines & borders */
    --line: #e5e5ef;
    --line-strong: #d4d4de;

    /* Radii */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    /* Typography */
    --font: "Inter", -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", "Fira Code", monospace;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-card-hover: 0 8px 32px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-glow-accent: 0 0 24px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg-base);
    min-height: 100vh;
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient background */
.background-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 40% at 20% 0%, rgba(108, 71, 255, 0.05), transparent),
        radial-gradient(ellipse 50% 35% at 80% 5%, rgba(22, 163, 74, 0.04), transparent);
}

h1, h2, h3, h4 {
    font-family: var(--font);
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--ink);
    line-height: 1.2;
}

p { margin: 0; }

a {
    color: inherit;
    text-decoration: none;
}

::selection {
    background: rgba(108, 71, 255, 0.15);
}

/* ═══════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════ */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
    height: 56px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 25px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 10px;
    padding-top: 10px;
    background: linear-gradient(135deg, #111118, #1e1e2e);
    color: white;
    font-weight: 800;
    font-size: 15px;
    box-shadow: 0 2px 10px rgba(108, 71, 255, 0.25);
}

.brand-mark a {
    color: inherit;
    text-decoration: none;
}

.brand-text {
    font-size: 14px;
    color: var(--ink-2);
    font-weight: 500;
}

.nav-links {
    display: flex;
    gap: 2px;
    align-items: center;
}

.nav-links a,
.logout-btn {
    color: var(--ink-2);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    padding: 7px 14px;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--font);
}

.nav-links a:hover,
.logout-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--ink);
}

.nav-user {
    padding: 5px 12px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(108, 71, 255, 0.12);
}

/* ═══════════════════════════════════════════════════════════
   CONTAINER
   ═══════════════════════════════════════════════════════════ */
.container {
    padding: 28px 32px 48px;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeUp 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #111118, #111118);
    color: white;
    text-decoration: none;
    border: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    box-shadow: 0 2px 8px rgba(108, 71, 255, 0.2);
}

.btn:hover {
    background: linear-gradient(135deg, #111118, #1e1e2e);
    box-shadow: 0 4px 16px rgba(108, 71, 255, 0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: scale(0.97);
}

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

.btn.ghost {
    background: transparent;
    color: var(--ink-2);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn.ghost:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: var(--line-strong);
    color: var(--ink);
    box-shadow: none;
}

.btn-submit {
    background: linear-gradient(135deg, #16a34a, #15803d);
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.btn-submit:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.3);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--ink);
    border-color: var(--line-strong);
}

/* ═══════════════════════════════════════════════════════════
   TAGS
   ═══════════════════════════════════════════════════════════ */
.tag {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    background: var(--bg-base);
    color: var(--ink-2);
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.03em;
    border: 1px solid var(--line);
}

.tag-procedural {
    background: var(--blue-soft);
    color: var(--blue);
    border-color: #bfdbfe;
}

.tag-functional {
    background: var(--orange-soft);
    color: var(--orange);
    border-color: #fed7aa;
}

.tag-oop {
    background: var(--purple-soft);
    color: var(--purple);
    border-color: #ddd6fe;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD — HERO OVERVIEW
   ═══════════════════════════════════════════════════════════ */
.dashboard-overview {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: 20px;
    margin-bottom: 24px;
}

.hero-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

/* Main stats card */
.stats-main-card {
    background:
        radial-gradient(ellipse 60% 80% at 10% 30%, rgba(108, 71, 255, 0.06), transparent 50%),
        radial-gradient(ellipse 50% 60% at 90% 20%, rgba(22, 163, 74, 0.05), transparent 50%),
        radial-gradient(ellipse 40% 50% at 50% 90%, rgba(37, 99, 235, 0.04), transparent 50%),
        var(--bg-card);
    border-color: rgba(108, 71, 255, 0.1);
}

.stats-main-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(108, 71, 255, 0.4), rgba(22, 163, 74, 0.3), transparent);
}

.stats-heading h1 {
    font-size: 36px;
    margin-bottom: 8px;
    letter-spacing: -0.04em;
    font-weight: 800;
    background: linear-gradient(135deg, #111118 0%, #6c47ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-heading p {
    max-width: 72ch;
}

.muted {
    color: var(--ink-3);
}

/* KPI Grid */
.stats-main-grid {
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.kpi-card {
    background: var(--bg-base);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.25s ease;
}

.kpi-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-3);
    font-weight: 600;
}

.kpi-value {
    font-size: 28px;
    line-height: 1;
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Hero pills */
.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.hero-pill {
    padding: 5px 14px;
    border-radius: 999px;
    background: var(--bg-base);
    border: 1px solid var(--line);
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 500;
}

/* ─── Side card (Progress) ─────────────────────────────── */
.stats-side-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.stats-side-card h3 {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

/* ─── Progress Ring ────────────────────────────────────── */
.progress-ring {
    --progress: 0;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(
        var(--accent) calc(var(--progress) * 1%),
        var(--bg-base) 0
    );
    display: grid;
    place-items: center;
    position: relative;
    box-shadow: 0 0 30px var(--accent-glow), var(--shadow-card);
    animation: ringPulse 3s ease-in-out infinite;
}

.progress-ring::before {
    content: "";
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--line);
}

.progress-ring span {
    position: absolute;
    font-size: 26px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
}

@keyframes ringPulse {
    0%, 100% { box-shadow: 0 0 24px var(--accent-glow), var(--shadow-card); }
    50% { box-shadow: 0 0 40px var(--accent-glow), var(--shadow-card); }
}

/* ─── Style Stats Bars ─────────────────────────────────── */
.style-stats {
    display: grid;
    gap: 12px;
    width: 100%;
}

.style-stat-row {
    display: grid;
    gap: 6px;
}

.style-stat-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--ink-2);
    font-weight: 500;
}

.style-stat-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--bg-base);
    overflow: hidden;
    border: 1px solid var(--line);
}

.style-stat-bar span {
    display: block;
    width: var(--value);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #16a34a);
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── Auth promo card ──────────────────────────────────── */
.problem-auth-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
}

.problem-auth-card h2 {
    font-size: 18px;
}

.wide-auth {
    grid-column: 1 / -1;
    background:
        linear-gradient(135deg, rgba(108, 71, 255, 0.04), rgba(22, 163, 74, 0.03)),
        var(--bg-card);
    border-color: rgba(108, 71, 255, 0.12);
}

/* ═══════════════════════════════════════════════════════════
   FILTERS
   ═══════════════════════════════════════════════════════════ */
.problem-filters {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}

.filter-group {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: var(--shadow-card);
}

.filter-label {
    display: inline-block;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 10px;
    font-weight: 700;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
    color: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg-base);
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.filter-chip span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--ink-3);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
}

.filter-chip:hover {
    transform: translateY(-1px);
    border-color: var(--line-strong);
    background: var(--bg-card);
    color: var(--ink);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.filter-chip.active {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(108, 71, 255, 0.25);
}

.filter-chip.active span {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════
   PROBLEM CARDS GRID
   ═══════════════════════════════════════════════════════════ */
.problem-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.problem-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-card);
}

/* Colored top accent line */
.problem-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.problem-card.style-procedural::before {
    background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.problem-card.style-functional::before {
    background: linear-gradient(90deg, #ea580c, #fb923c);
}

.problem-card.style-oop::before {
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.problem-card:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-card-hover);
}

.problem-card:hover::before {
    height: 4px;
}

/* Solved card styling */
.problem-card.is-solved {
    border-color: var(--green-border);
    background: linear-gradient(180deg, #fafffe 0%, #ffffff 100%);
}

.problem-card.is-solved::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle at top right, rgba(22, 163, 74, 0.06), transparent 70%);
    pointer-events: none;
}

/* Card inner elements */
.problem-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.problem-id {
    color: var(--ink-3);
    font-size: 12px;
    font-family: var(--mono);
}

.problem-card h3 {
    font-size: 17px;
    line-height: 1.35;
    font-weight: 700;
}

.problem-link {
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.problem-link:hover {
    color: var(--accent);
}

.problem-preview {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-3);
    flex-grow: 1;
}

.problem-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

/* Status badges */
.state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.state-solved {
    background: var(--green-soft);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.state-solved::before {
    content: "✓";
    font-size: 10px;
}

.state-open {
    background: var(--bg-base);
    color: var(--ink-3);
    border: 1px solid var(--line);
}

.collection-pill {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--yellow-soft);
    border: 1px solid #fef08a;
    color: var(--yellow);
    font-size: 11px;
    font-weight: 600;
}

.table-empty {
    text-align: center;
    color: var(--ink-3);
    padding: 32px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--bg-card);
    grid-column: 1 / -1;
}

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

.status {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--line);
    color: var(--ink-3);
    width: fit-content;
}

.status-ok {
    color: var(--green);
    font-weight: 600;
}

.status-error {
    color: var(--red);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   TASK DETAIL PAGE
   ═══════════════════════════════════════════════════════════ */
.task-detail-page {
    max-width: 1280px;
}

.task-detail-top {
    margin-bottom: 24px;
}

.back-link {
    text-decoration: none;
    color: var(--ink-3);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
    transition: color 0.2s ease;
    font-weight: 500;
}

.back-link:hover {
    color: var(--accent);
}

.task-detail-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.task-detail-title-row h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.task-detail-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* ── Left: Description Panel ── */
.task-description-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.description {
    line-height: 1.7;
    color: var(--ink-2);
    font-size: 14px;
}

.task-rules {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    background: var(--bg-base);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-2);
    line-height: 1.5;
}

.rule-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--ink-3);
    background: rgba(0, 0, 0, 0.03);
    border-radius: 6px;
}

.rule-item code {
    font-family: var(--mono);
    font-size: 12px;
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
}

.task-examples h3 {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--ink-3);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.task-examples pre {
    background: var(--bg-base);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 12px;
    font-family: var(--mono);
    white-space: pre-wrap;
    margin: 0;
    color: var(--ink-2);
    line-height: 1.65;
}

/* ── Right: Editor Panel ── */
.editor-panel {
    position: sticky;
    top: 76px;
    align-self: start;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.editor-shell {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
    background: var(--bg-base);
}

.editor-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

.editor-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.file-pill {
    padding: 4px 12px;
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--ink);
    font-weight: 500;
    font-size: 12px;
    font-family: var(--mono);
    border: 1px solid var(--line);
}

.editor-badge {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 5px;
    color: var(--ink-3);
    font-weight: 500;
}

.draft-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    background: var(--yellow-soft);
    border-bottom: 1px solid #fef08a;
    font-size: 12px;
    color: var(--yellow);
    font-weight: 600;
}

.draft-actions {
    display: flex;
    gap: 6px;
}

.editor-body {
    padding: 0;
}

.code-editor {
    width: 100%;
    min-height: 360px;
    border: none;
    padding: 16px;
    font-family: var(--mono);
    font-size: 13px;
    background: #1e1e2e;
    color: #cdd6f4;
    resize: vertical;
}

/* ── CodeMirror — Dark editor inside light page ── */
.CodeMirror {
    height: auto;
    min-height: 380px;
    font-family: var(--mono);
    font-size: 13px;
    background: #1e1e2e;
    border-radius: 0;
    border: none;
    line-height: 1.65;
    color: #cdd6f4;
}

.CodeMirror-gutters {
    background: #1e1e2e;
    border-right: 1px solid rgba(255,255,255,0.06);
    padding-right: 4px;
}

.CodeMirror-linenumber {
    color: #45475a;
    font-size: 12px;
}

.CodeMirror-cursor {
    border-left: 2px solid #cba6f7;
}

.CodeMirror-selected {
    background: rgba(108, 71, 255, 0.2) !important;
}

.CodeMirror-activeline-background {
    background: rgba(255, 255, 255, 0.03);
}

/* Syntax colors (Catppuccin-inspired) */
.cm-s-default .cm-keyword {
    color: #cba6f7;
    font-weight: 500;
}

.cm-s-default .cm-def {
    color: #89b4fa;
}

.cm-s-default .cm-variable {
    color: #cdd6f4;
}

.cm-s-default .cm-variable-2 {
    color: #89dceb;
}

.cm-s-default .cm-string {
    color: #a6e3a1;
}

.cm-s-default .cm-string-2 {
    color: #94e2d5;
}

.cm-s-default .cm-number {
    color: #fab387;
}

.cm-s-default .cm-comment {
    color: #585b70;
    font-style: italic;
}

.cm-s-default .cm-operator {
    color: #89dceb;
}

.cm-s-default .cm-builtin {
    color: #f9e2af;
}

.cm-s-default .cm-property {
    color: #b4befe;
}

.editor-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--ink-4);
    background: var(--bg-base);
}

.editor-stat {
    white-space: nowrap;
}

.editor-stat.shortcut {
    margin-left: auto;
}

.editor-stat.shortcut + .editor-stat.shortcut {
    margin-left: 0;
}

/* Editor Hints (hidden container) */
.editor-hints {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   RESULTS
   ═══════════════════════════════════════════════════════════ */
.result-section {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
}

.result-section.result-ok {
    border-left: 4px solid var(--green);
    background: var(--green-soft);
    border-color: var(--green-border);
    border-left-color: var(--green);
}

.result-section.result-error {
    border-left: 4px solid var(--red);
    background: var(--red-soft);
    border-color: var(--red-border);
    border-left-color: var(--red);
}

.result-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
}

.result-status.ok {
    color: var(--green);
}

.result-status.error {
    color: var(--red);
}

.result-section pre {
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.03);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 12px;
    font-family: var(--mono);
    margin: 0;
    color: var(--ink-2);
}

.result-block {
    margin-top: 14px;
}

.result-block h4 {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-3);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
}

/* ═══════════════════════════════════════════════════════════
   AUTH
   ═══════════════════════════════════════════════════════════ */
.auth-card {
    max-width: 400px;
    margin: 40px auto;
    background: var(--bg-card);
    padding: 28px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-card);
}

.auth-card h1 {
    margin-bottom: 20px;
    font-size: 22px;
}

.auth-form p {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.auth-form label {
    font-size: 12px;
    color: var(--ink-3);
    font-weight: 600;
}

.auth-form input {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    font-size: 13px;
    font-family: var(--font);
    transition: all 0.2s ease;
    background: var(--bg-input);
    color: var(--ink);
}

.auth-form input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.auth-form .helptext {
    display: none;
}

.auth-form ul {
    display: none;
}

.auth-form li {
    font-size: 11px;
    color: var(--ink-4);
    line-height: 1.4;
}

.auth-card .muted {
    margin-top: 16px;
    font-size: 13px;
    text-align: center;
}

.auth-card .muted a {
    color: var(--accent);
    font-weight: 600;
}

.auth-card .muted a:hover {
    color: var(--accent-hover);
}

.auth-card .btn {
    width: 100%;
    margin-top: 4px;
}

/* Django form errors */
.auth-form .errorlist {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.auth-form .errorlist li {
    color: var(--red);
    font-size: 12px;
    padding: 0;
}

/* ═══════════════════════════════════════════════════════════
   DAY VIEW (legacy)
   ═══════════════════════════════════════════════════════════ */
.day-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.day-heading h1 {
    font-size: 28px;
    font-weight: 800;
}

.pill-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.pill {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--bg-base);
    border: 1px solid var(--line);
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 500;
}

.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.task-card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
}

.task-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.task-number {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════
   FOCUS STATES
   ═══════════════════════════════════════════════════════════ */
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.CodeMirror-focused {
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered card entrance */
.problem-card {
    animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.problem-card:nth-child(1) { animation-delay: 0.04s; }
.problem-card:nth-child(2) { animation-delay: 0.08s; }
.problem-card:nth-child(3) { animation-delay: 0.12s; }
.problem-card:nth-child(4) { animation-delay: 0.16s; }
.problem-card:nth-child(5) { animation-delay: 0.20s; }
.problem-card:nth-child(6) { animation-delay: 0.24s; }
.problem-card:nth-child(7) { animation-delay: 0.28s; }
.problem-card:nth-child(8) { animation-delay: 0.32s; }
.problem-card:nth-child(9) { animation-delay: 0.36s; }
.problem-card:nth-child(10) { animation-delay: 0.40s; }

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    .task-detail-grid {
        grid-template-columns: 1fr;
    }

    .editor-panel {
        position: static;
    }
}

@media (max-width: 1024px) {
    .dashboard-overview {
        grid-template-columns: 1fr;
    }

    .stats-main-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
        height: auto;
    }

    .container {
        padding: 20px 16px 48px;
    }

    .stats-heading h1 {
        font-size: 28px;
    }

    .stats-main-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-group {
        padding: 10px;
    }

    .problem-cards-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .task-detail-title-row h1 {
        font-size: 20px;
    }

    .progress-ring {
        width: 110px;
        height: 110px;
    }

    .progress-ring::before {
        width: 84px;
        height: 84px;
    }
}

@media (max-width: 480px) {
    .stats-main-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        gap: 6px;
    }

    .filter-chip {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* ═══════════════════════════════════════════════════════════
   AUTOCOMPLETE HINTS (IDE-like)
   ═══════════════════════════════════════════════════════════ */
.CodeMirror-hints {
    font-family: var(--mono);
    font-size: 12px;
    background: #1e1e2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.4);
    padding: 4px;
    max-height: 260px;
    overflow-y: auto;
    z-index: 200;
    list-style: none;
    margin: 0;
}

.CodeMirror-hints::-webkit-scrollbar {
    width: 5px;
}

.CodeMirror-hints::-webkit-scrollbar-track {
    background: transparent;
}

.CodeMirror-hints::-webkit-scrollbar-thumb {
    background: #45475a;
    border-radius: 999px;
}

.CodeMirror-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #cdd6f4;
    white-space: nowrap;
    transition: background 0.12s ease;
    margin: 0;
    line-height: 1.4;
}

.CodeMirror-hint:hover {
    background: rgba(255, 255, 255, 0.06);
}

li.CodeMirror-hint-active,
.CodeMirror-hint-active {
    background: var(--accent) !important;
    color: #ffffff !important;
}

/* Type badges */
.CodeMirror-hint::before {
    content: "•";
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font);
}

.hint-keyword::before {
    content: "K";
    background: rgba(203, 166, 247, 0.15);
    color: #cba6f7;
}

.hint-builtin::before {
    content: "B";
    background: rgba(137, 180, 250, 0.15);
    color: #89b4fa;
}

.hint-method::before {
    content: "M";
    background: rgba(166, 227, 161, 0.15);
    color: #a6e3a1;
}

.hint-function::before {
    content: "ƒ";
    background: rgba(249, 226, 175, 0.15);
    color: #f9e2af;
}

.hint-class::before {
    content: "C";
    background: rgba(245, 194, 231, 0.15);
    color: #f5c2e7;
}

.hint-variable::before {
    content: "V";
    background: rgba(250, 179, 135, 0.15);
    color: #fab387;
}

.hint-parameter::before {
    content: "P";
    background: rgba(180, 190, 254, 0.15);
    color: #b4befe;
}

.hint-other::before {
    content: "·";
    background: rgba(255, 255, 255, 0.06);
    color: #585b70;
}

/* Active state overrides */
li.CodeMirror-hint-active::before,
.CodeMirror-hint-active::before {
    opacity: 0.9;
}

/* ─── Snippet badge ────────────────────────────────────── */
.hint-snippet::before {
    content: "⇥";
    background: rgba(52, 211, 153, 0.15);
    color: #34d399;
    font-size: 9px;
}

/* ═══════════════════════════════════════════════════════════
   INLINE SYNTAX ERRORS
   ═══════════════════════════════════════════════════════════ */
.cm-error-line {
    background: rgba(220, 38, 38, 0.06) !important;
}

.cm-error-widget {
    font-family: var(--font);
    font-size: 11px;
    color: #dc2626;
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.08), transparent);
    border-left: 3px solid #dc2626;
    padding: 4px 10px;
    margin-top: 2px;
    border-radius: 0 4px 4px 0;
    animation: errorSlide 0.2s ease;
    font-weight: 500;
}

@keyframes errorSlide {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--ink-3);
}
