/* --- Змінні --- */
    :root {
      --sidebar-width: 260px;
      --header-height: 70px;

      --col-bg-sidebar: #ffffff;
      --col-text-sidebar: #1f2937;
      --col-text-sidebar-muted: #6b7280;
      --col-border-sidebar: #e5e7eb;
      --col-bg-sidebar-hover: rgba(0, 0, 0, 0.05);

      --col-bg-main: #f3f4f6;        /* Світло-сірий */
      --col-bg-white: #ffffff;

      --col-accent: #3b82f6;         /* Синій бренд */
      --col-accent-hover: #2563eb;
      --col-danger: #ef4444;         /* Червоний Proof */
      --col-danger-hover: #dc2626;

      --col-text-main: #1f2937;
      --col-text-muted: #9ca3af;
      --col-border: #e5e7eb;

      --col-highlight-main: rgba(136, 190, 213, 0.78);
      --col-highlight-secondary: #e3f2fd;
      --col-highlight-success: rgba(34, 197, 94, 0.15);

      /* Successor Tooltip & Hover */
      --col-hover-bg: #e8f4fd;
      --col-tooltip-bg: #2c3e50;
      --col-tooltip-text: #ffffff;
    }

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

    body {
      font-family: 'Inter', sans-serif;
      background-color: var(--col-bg-main);
      color: var(--col-text-main);
      display: flex;
      height: 100vh;
      overflow: hidden;
    }

    /* --- 1. Sidebar --- */
    .sidebar {
      width: var(--sidebar-width);
      background-color: var(--col-bg-sidebar);
      color: var(--col-text-sidebar);
      display: flex;
      flex-direction: column;
      padding: 24px 16px;
      flex-shrink: 0;
      border-right: 1px solid var(--col-border-sidebar);
    }

    .sidebar-header {
      display: flex;
      flex-direction: column;
      margin-bottom: 18px; /* Increased from 8px to be less cramped */
    }

    .logo {
      font-size: 18px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 28px; /* Distance from Logo to Languages */
      padding: 0 10px;
      color: var(--col-text-sidebar);
      cursor: pointer;
    }

    .languages-group {
      margin-bottom: 20px !important; /* Increased distance from Languages to Editor Settings */
    }

    .editor-settings-group {
      margin-bottom: 0 !important; /* Remove bottom margin to let sidebar-header control distance to System */
    }

    .logo-icon {
      width: 32px;
      height: 32px;
      background: linear-gradient(135deg, var(--col-accent), #60a5fa);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
    }

    .menu-group { margin-bottom: 24px; }
    .menu-title {
      font-size: 11px;
      text-transform: uppercase;
      color: var(--col-text-sidebar-muted);
      font-weight: 600;
      margin-bottom: 8px;
      padding-left: 12px;
      letter-spacing: 0.05em;
    }

    .sidebar-sub-header {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--col-text-sidebar-muted);
      padding: 6px 16px 2px 12px;
      opacity: 0.8;
    }

    .nav-link {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      color: var(--col-text-sidebar);
      text-decoration: none;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      transition: all 0.2s;
      margin-bottom: 4px;
    }

    .nav-link:hover { background-color: var(--col-bg-sidebar-hover); color: var(--col-text-sidebar); }
    .nav-link.active { background-color: var(--col-accent); color: white; }
    .nav-link i { font-size: 18px; opacity: 0.8; }

    /* --- 2. Main Layout --- */
    .main-wrapper {
      flex-grow: 1;
      display: flex;
      flex-direction: column;
    }

    /* --- 3. Header Removed --- */
    .top-header {
      display: none !important;
    }

    .header-left { display: none !important; }

    .header-title {
      font-weight: 600;
      font-size: 16px;
      color: var(--col-text-main);
    }

    /* Стилізований Dropdown */
    .custom-select {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border: 1px solid var(--col-border);
      border-radius: 8px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      transition: 0.2s;
    }
    .custom-select:hover { border-color: var(--col-accent); background-color: #f9fafb; }
    
    body.dark-mode .custom-select:hover { background-color: rgba(255,255,255,0.05); }

    .header-right { display: none !important; }

    /* Перемикач мов (Segmented Control) */
    .lang-switcher {
      background-color: #f3f4f6;
      padding: 4px;
      border-radius: 10px;
      display: flex;
      gap: 4px;
      border: 1px solid transparent;
      transition: all 0.3s ease;
      width: 100%;
      flex-shrink: 0; /* Prevent shrinking */
    }

    .lang-opt {
      flex: 1;
      text-align: center;
      padding: 6px 0;
      font-size: 11px;
      font-weight: 600;
      border-radius: 7px;
      cursor: pointer;
      color: #6b7280;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      user-select: none;
      white-space: nowrap; /* Prevent text wrapping */
      min-width: 40px; /* Ensure a minimum width */
    }

    .lang-opt:hover:not(.active) {
      color: #374151;
      background-color: rgba(0, 0, 0, 0.05);
    }

    .lang-opt.active {
      background-color: white;
      color: var(--col-danger);
      box-shadow: 0 2px 4px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
    }

    /* Dark Mode for lang-switcher */
    body.dark-mode .lang-switcher {
      background-color: #1e293b;
      border-color: #334155;
    }

    body.dark-mode .lang-opt {
      color: #9ca3af;
    }

    body.dark-mode .lang-opt:hover:not(.active) {
      color: #f3f4f6;
      background-color: rgba(255, 255, 255, 0.05);
    }

    body.dark-mode .lang-opt.active {
      background-color: #334155;
      color: white;
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    }

    /* Перемикач теми */
    .theme-toggle {
      width: 44px;
      height: 24px;
      background-color: #e5e7eb;
      border-radius: 12px;
      position: relative;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 4px;
      color: #6b7280;
      font-size: 12px;
      flex-shrink: 0;
    }

    .theme-toggle::after {
      content: '';
      position: absolute;
      width: 18px;
      height: 18px;
      background: white;
      border-radius: 50%;
      top: 3px;
      left: 3px;
      transition: 0.3s;
      box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    }
    
    body.dark-mode .theme-toggle { background-color: #334155; }
    body.dark-mode .theme-toggle::after { left: 23px; background: #1f2937; }

    /* Кнопки */
    .btn {
      height: 40px;
      padding: 0 20px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      border: none;
      display: flex;
      align-items: center;
      gap: 8px;
      transition: 0.2s;
    }

    .btn-primary {
      background-color: var(--col-danger);
      color: white;
      box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
    }
    .btn-primary:hover { background-color: var(--col-danger-hover); transform: translateY(-1px); }

    .btn-secondary {
      background-color: white;
      border: 1px solid var(--col-border);
      color: var(--col-text-main);
    }
    .btn-secondary:hover { background-color: #f9fafb; border-color: #d1d5db; }

    /* Mobile Menu Button (Floating) */
    .mobile-menu-btn {
      position: fixed;
      top: 15px;
      left: 30px;
      width: 44px;
      height: 44px;
      background: white;
      border: 1px solid var(--col-border);
      border-radius: 10px;
      display: none; /* Hidden by default on desktop */
      align-items: center;
      justify-content: center;
      z-index: 1500;
      cursor: pointer;
      color: var(--col-text-main);
      box-shadow: 0 2px 8px rgba(0,0,0,0.1);
      transition: all 0.2s ease;
    }

    body.dark-mode .mobile-menu-btn {
      background: var(--col-bg-sidebar);
      border-color: var(--col-border);
    }

    .mobile-menu-btn i {
      font-size: 24px;
    }

    /* --- 4. Content Area --- */
    .content-area {
      flex-grow: 1;
      padding: 10px 32px 24px 32px; /* Reduced top padding from 24px */
      display: flex;
      flex-direction: column;
    }

    /* Adjust Proof button position when sidebar is on the right */
    body.sb-right #enter {
      right: calc(var(--sidebar-width) + 30px) !important;
    }

    /* Adjust Proof button position when sidebar is at the bottom */
    body.sb-bottom #enter {
      bottom: 180px !important; /* Increased distance from bottom */
    }

    .editor-card {
      background: white;
      border-radius: 12px;
      border: 1px solid var(--col-border);
      flex-grow: 1;
      display: flex;
      overflow: hidden;
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .line-gutters {
      width: 48px;
      background-color: #fafafa;
      border-right: 1px solid var(--col-border);
      display: flex;
      flex-direction: column;
      align-items: center;
      padding-top: 24px;
      color: #d1d5db;
      font-family: 'JetBrains Mono', monospace;
      font-size: 14px;
      user-select: none;
    }

    .code-area {
      flex-grow: 1;
      padding: 24px;
      outline: none;
      border: none;
      resize: none;
      font-family: 'JetBrains Mono', monospace;
      font-size: 15px;
      line-height: 1.6;
      color: #374151;
    }

    /* --- HELP MODAL MODERNIZATION --- */
    .helpModal {
        background-color: rgba(0, 0, 0, 0.6); /* Darker backdrop */
        backdrop-filter: blur(4px);
        display: none; /* Managed by JS */
        align-items: center;
        justify-content: center;
        z-index: 99999;
    }

    .help {
        background: white;
        width: 90%;
        max-width: 900px;
        height: 80vh;
        max-height: 800px;
        border-radius: 16px;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 0; /* Reset padding */
        position: relative;
    }

    /* Header */
    .help-header {
        padding: 20px 30px;
        border-bottom: 1px solid var(--col-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #f9fafb;
    }

    .help-title {
        font-size: 20px;
        font-weight: 600;
        color: var(--col-text-main);
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .closeHelp, .closeLatex, .closeLayout {
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--col-text-muted);
        transition: all 0.2s;
        padding: 8px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .closeHelp i, .closeLatex i, .closeLayout i {
        font-size: 24px !important;
        line-height: 1;
    }

    .closeHelp:hover, .closeLatex:hover, .closeLayout:hover {
        color: var(--col-danger);
        background: rgba(239, 68, 68, 0.1);
        transform: rotate(90deg);
    }

    /* Navigation */
    .helpNavbar {
        display: flex;
        padding: 0 30px;
        border-bottom: 1px solid var(--col-border);
        gap: 20px;
        background: white;
        margin: 0;
    }

    .helpNavbarItem {
        padding: 15px 0;
        font-size: 14px;
        font-weight: 500;
        color: var(--col-text-muted);
        cursor: pointer;
        position: relative;
        transition: color 0.2s;
        font-family: 'Inter', sans-serif; /* Override Times New Roman */
    }

    .helpNavbarItem:hover {
        color: var(--col-text-main);
    }

    .helpNavbarItem.active {
        color: var(--col-accent);
    }

    .helpNavbarItem.active::after {
        content: '';
        position: absolute;
        bottom: -1px;
        left: 0;
        width: 100%;
        height: 2px;
        background: var(--col-accent);
    }

    /* Content Area */
    #info, #latexInfo {
        padding: 30px;
        overflow-y: auto;
        flex-grow: 1;
        font-family: 'Inter', sans-serif;
    }

    #latexInfo {
        font-family: 'JetBrains Mono', monospace;
        font-size: 15px;
        line-height: 1.7;
        white-space: pre-wrap;
        color: var(--col-text-main);
    }

    /* Footer */
    .help-footer {
        padding: 20px 30px;
        border-top: 1px solid var(--col-border);
        background: #f9fafb;
        flex-shrink: 0;
    }

    .help-footer .btn {
        width: 100%;
        height: 48px;
        font-size: 16px;
        font-weight: 600;
        letter-spacing: 0.01em;
        justify-content: center;
    }

    /* Help Items (Cards) */
    .help-item-card {
        background: white;
        border: 1px solid var(--col-border);
        border-radius: 12px;
        padding: 20px;
        margin-bottom: 16px;
        display: flex;
        gap: 20px;
        align-items: flex-start;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .help-item-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
        border-color: var(--col-accent);
    }

    .help-icon {
        width: 48px;
        height: 48px;
        background: #eff6ff;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--col-accent);
        font-size: 24px;
        flex-shrink: 0;
    }

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

    .help-item-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--col-text-main);
        margin-bottom: 4px; /* Reduced margin */
        display: block;
    }

    .help-item-subtitle {
        font-family: 'JetBrains Mono', monospace;
        font-size: 13px;
        color: var(--col-accent);
        background: #f8fafc; /* Very light bg */
        border: 1px solid var(--col-border);
        border-radius: 6px;
        padding: 6px 10px;
        margin-bottom: 8px;
        display: inline-block; /* Inline-block allows fit-content */
        width: fit-content;
        max-width: 100%;
        white-space: pre-wrap; /* Handle newlines/spaces correctly */
    }
    
    body.dark-mode .help-item-subtitle {
        background: rgba(59, 130, 246, 0.1);
        color: #60a5fa;
        border-color: rgba(59, 130, 246, 0.2);
    }

    .help-item-desc {
        font-size: 14px;
        color: var(--col-text-muted);
        line-height: 1.5;
        margin: 0;
    }

    /* Modern Tables */
    .help-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 24px;
        font-size: 14px;
        border-radius: 8px;
        overflow: hidden;
        border: 1px solid var(--col-border);
    }

    .help-table th {
        text-align: left;
        padding: 12px 16px;
        background: #f9fafb;
        color: var(--col-text-muted);
        font-weight: 500;
        border-bottom: 1px solid var(--col-border);
    }

    .help-table td {
        padding: 12px 16px;
        border-bottom: 1px solid var(--col-border);
        color: var(--col-text-main);
    }

    .help-table code {
        background: #f3f4f6;
        padding: 4px 6px;
        border-radius: 4px;
        font-family: 'JetBrains Mono', monospace;
        font-size: 12px;
        color: #db2777; /* Pinkish for code */
    }

    .section-header {
        font-size: 18px;
        font-weight: 600;
        color: var(--col-text-main);
        margin: 30px 0 16px 0;
    }
    .section-header:first-child {
        margin-top: 0;
    }

    /* Dark Mode Support */
    body.dark-mode .help {
        background: var(--col-bg-white);
    }

    body.dark-mode .help-header,
    body.dark-mode .helpNavbar,
    body.dark-mode .help-footer {
        background: var(--col-bg-white);
        border-bottom-color: var(--col-border);
        border-top-color: var(--col-border);
    }

    body.dark-mode .help-title,
    body.dark-mode .help-item-title,
    body.dark-mode .section-header {
        color: var(--col-text-main);
    }

    body.dark-mode .helpNavbarItem {
        color: var(--col-text-muted);
    }
    body.dark-mode .helpNavbarItem:hover {
        color: var(--col-text-main);
    }
    body.dark-mode .helpNavbarItem.active {
        color: var(--col-accent);
    }

    body.dark-mode .help-item-card {
        background: var(--col-bg-main); /* Slightly darker card */
        border-color: var(--col-border);
    }
    body.dark-mode .help-item-card:hover {
        border-color: var(--col-accent);
    }

    body.dark-mode .help-icon {
        background: rgba(59, 130, 246, 0.1);
    }

    body.dark-mode .help-table {
        border-color: var(--col-border);
    }
    body.dark-mode .help-table th {
        background: var(--col-bg-main);
        border-bottom-color: var(--col-border);
        color: var(--col-text-muted);
    }
    body.dark-mode .help-table td {
        border-bottom-color: var(--col-border);
        color: var(--col-text-main);
    }
    body.dark-mode .help-table code {
        background: rgba(255,255,255,0.1);
        color: #f472b6;
    }

/* --- CRITICAL LAYOUT OVERRIDES (MIGRATED FROM INDEX.HTML) --- */
    html, body {
      width: 100% !important;
      height: 100% !important;
      margin: 0 !important;
      padding: 0 !important;
      overflow: hidden !important; /* Design relies on internal scrolling */
    }

    body {
      display: flex !important;
      flex-direction: row !important; /* Sidebar layout requires row */
      align-items: stretch !important; /* Fix 'center' from style.css */
      background-color: var(--col-bg-main) !important;
      font-family: 'Inter', sans-serif !important; /* Override global font */
    }

    /* Reset global font pollution from style.css */
    * {
      font-family: inherit;
    }

    /* Ensure icons and specific elements can use their own fonts */
    .ri-text, .ri-arrow-down-s-line, .ri-play-fill, .ri-sun-fill, .ri-moon-clear-line, .ri-refresh-line, [class^="ri-"] {
      font-family: 'remixicon' !important;
    }

    /* Sidebar fix */
    .sidebar {
      height: 100% !important;
      overflow-y: auto !important;
    }

    /* Main Wrapper fix - min-width: 0 is CRITICAL for flex children to shrink */
    .main-wrapper {
      flex-grow: 1 !important;
      width: auto !important;
      min-width: 0 !important;
      height: 100% !important;
      overflow: hidden !important;
      display: flex !important;
      flex-direction: column !important;
    }

    /* Top Header fix */
    .top-header {
      flex-shrink: 0 !important;
      width: 100% !important;
      box-sizing: border-box !important;
    }

    /* Content Area fix */
    .content-area {
      flex-grow: 1 !important;
      padding: 24px 32px !important;
      overflow-y: auto !important;
      overflow-x: hidden !important;
      width: 100% !important;
      box-sizing: border-box !important;
      margin: 0 !important; /* Override style.css margin-top */
    }

    /* Examples Modal - Polished Design */
    .modal-examples-overlay {
      display: none;
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(15, 23, 42, 0.6);
      z-index: 10000;
      justify-content: center;
      align-items: center;
      backdrop-filter: blur(8px);
      transition: all 0.3s ease;
      opacity: 0;
    }

    .modal-examples-overlay.show {
      display: flex;
      opacity: 1;
    }

    .examples-modal-content {
      background: white;
      width: 95%;
      max-width: 550px;
      height: 800px; /* Increased fixed height */
      max-height: 90vh;
      border-radius: 24px;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
      overflow: hidden;
      transform: translateY(20px);
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .modal-examples-overlay.show .examples-modal-content {
      transform: translateY(0);
    }

    .examples-modal-header {
      padding: 24px 30px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #f1f5f9;
    }

    .examples-modal-header h2 {
      margin: 0;
      font-size: 22px;
      font-weight: 700;
      color: #0f172a;
      letter-spacing: -0.025em;
    }

    .close-btn {
      background: #f1f5f9;
      border: none;
      width: 36px;
      height: 36px;
      border-radius: 18px;
      font-size: 20px;
      cursor: pointer;
      color: #64748b;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    .close-btn:hover {
      background: #e2e8f0;
      color: #0f172a;
      transform: rotate(90deg);
    }

    .examples-tabs {
      display: flex;
      padding: 12px 20px;
      background: #f8fafc;
      gap: 8px;
      border-bottom: 1px solid #f1f5f9;
      justify-content: center;
    }

    .example-tab-btn {
      padding: 10px 20px;
      border: 1px solid transparent;
      background: transparent;
      border-radius: 12px;
      cursor: pointer;
      font-weight: 600;
      font-size: 14px;
      color: #64748b;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .example-tab-btn:hover:not(.active) {
      background: #f1f5f9;
      color: #334155;
    }

    .example-tab-btn.active {
      background: white;
      color: var(--col-accent);
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
      border-color: #f1f5f9;
    }

    .example-list-container {
      flex-grow: 1;
      overflow-y: auto;
      padding: 20px 30px;
      display: grid;
      gap: 12px;
      scrollbar-width: thin;
      scrollbar-color: #cbd5e1 transparent;
    }

    .example-list-container::-webkit-scrollbar {
      width: 6px;
    }

    .example-list-container::-webkit-scrollbar-thumb {
      background-color: #cbd5e1;
      border-radius: 10px;
    }

    .example-item {
      padding: 18px;
      border: 1px solid #f1f5f9;
      border-radius: 16px;
      cursor: pointer;
      transition: all 0.2s ease;
      background: white;
      position: relative;
      display: flex;
      flex-direction: column;
    }

    .example-item:hover {
      border-color: var(--col-accent);
      background: #f0f9ff;
      transform: scale(1.02);
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    }

    .example-label {
      font-weight: 700;
      font-size: 15px;
      margin-bottom: 8px;
      color: #334155;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .example-label::before {
      content: '';
      width: 8px;
      height: 8px;
      background: var(--col-accent);
      border-radius: 2px;
    }

    .example-category-filters {
      display: flex;
      justify-content: center;
      gap: 10px;
      padding: 15px 30px 10px 30px;
      background: #f8fafc;
      flex-wrap: wrap;
      border-bottom: 1px solid #f1f5f9;
    }

    .category-chip {
      padding: 6px 14px;
      background: white;
      border: 1px solid #e2e8f0;
      border-radius: 20px;
      font-size: 12px;
      font-weight: 600;
      color: #64748b;
      cursor: pointer;
      transition: all 0.2s;
      user-select: none;
    }

    .category-chip:hover {
      border-color: var(--col-accent);
      color: var(--col-accent);
    }

    .category-chip.active {
      background: var(--col-accent);
      color: white;
      border-color: var(--col-accent);
      box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.2);
    }

    body.dark-mode .example-category-filters {
      background: #0f172a;
      border-bottom-color: #334155;
    }

    body.dark-mode .category-chip {
      background: #1e293b;
      border-color: #334155;
      color: #94a3b8;
    }

    body.dark-mode .category-chip.active {
      background: var(--col-accent);
      color: white;
    }

    /* Examples Modal Mobile Responsive */
    @media (max-width: 768px) {
      .examples-modal-content {
        width: 95%;
        height: auto;
        max-height: 85vh;
        border-radius: 16px;
      }

      .examples-modal-header {
        padding: 16px 20px;
      }

      .examples-tabs {
        padding: 8px 12px;
        flex-wrap: wrap;
      }

      .example-tab-btn {
        padding: 8px 14px;
        font-size: 13px;
        flex: 1;
        min-width: 80px;
        text-align: center;
      }

      .example-list-container {
        padding: 16px;
      }

      .example-item {
        padding: 14px;
      }

      .example-label {
        font-size: 14px;
      }

      .example-value {
        font-size: 12px;
      }
    }

    .example-value {
      font-family: 'JetBrains Mono', 'Fira Code', monospace;
      font-size: 15px;
      color: #64748b;
      background: #f8fafc;
      padding: 12px;
      border-radius: 10px;
      border: 1px solid #f1f5f9;
      line-height: 1.5;
      white-space: pre-wrap;
    }

    .example-item:hover .example-value {
      background: white;
      border-color: #bae6fd;
      color: #0369a1;
    }

    /* Dark Mode Polished */
    body.dark-mode .examples-modal-content {
      background: #1e293b;
      border: 1px solid #334155;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    }

    body.dark-mode .examples-modal-header {
      border-bottom-color: #334155;
    }

    body.dark-mode .examples-modal-header h2 {
      color: #f1f5f9;
    }

    body.dark-mode .close-btn {
      background: #334155;
      color: #94a3b8;
    }

    body.dark-mode .close-btn:hover {
      background: #475569;
      color: #f1f5f9;
    }

    body.dark-mode .examples-tabs {
      background: #0f172a;
      border-bottom-color: #334155;
    }

    body.dark-mode .example-tab-btn.active {
      background: #1e293b;
      border-color: #334155;
      color: #38bdf8;
    }

    body.dark-mode .example-item {
      background: #0f172a;
      border-color: #334155;
    }

    body.dark-mode .example-item:hover {
      border-color: #38bdf8;
      background: #1e293b;
    }

    body.dark-mode .example-label {
      color: #e2e8f0;
    }

    body.dark-mode .example-value {
      background: #020617;
      border-color: #1e293b;
      color: #94a3b8;
    }

    body.dark-mode .example-item:hover .example-value {
      background: #1e293b;
      color: #38bdf8;
      border-color: #0c4a6e;
    }
    #proof-container {
      display: flex !important; /* Override style.css display:none */
      flex-direction: column !important;
      background: white !important;
      border: 1px solid var(--col-border) !important;
      border-radius: 12px !important;
      padding: 0 !important; /* Reset padding to handle controls overlay */
      position: relative;
    }

    #proof-container.proof-fullscreen {
      position: fixed !important;
      top: 0;
      left: 0;
      width: 100vw !important;
      height: 100vh !important;
      max-height: none !important;
      z-index: 9999;
      border-radius: 0 !important;
      border: none !important;
    }

    .fullscreen-btn {
      background: white;
      border: 1px solid var(--col-border);
      border-radius: 8px;
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--col-text-main);
      box-shadow: 0 2px 5px rgba(0,0,0,0.05);
      transition: all 0.2s ease;
    }

    .fullscreen-btn:hover {
      background: var(--col-bg-secondary);
      color: var(--col-accent);
      border-color: var(--col-accent);
    }
    
    body.dark-mode .fullscreen-btn {
      background: var(--col-bg-sidebar);
      border-color: var(--col-border);
    }

    /* Download Dropdown Menu */
    .download-menu {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: white;
      border: 1px solid var(--col-border);
      border-radius: 10px;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
      display: none; /* Hidden by default */
      flex-direction: column;
      min-width: 140px;
      overflow: hidden;
      z-index: 100;
      padding: 4px;
    }

    .download-menu.show {
      display: flex;
      animation: dropdownFade 0.2s ease-out;
    }

    @keyframes dropdownFade {
      from { opacity: 0; transform: translateY(-10px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .download-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border: none;
      background: transparent;
      color: var(--col-text-main);
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      border-radius: 6px;
      transition: all 0.2s;
      text-align: left;
      width: 100%;
    }

    .download-item:hover:not(:disabled) {
      background-color: var(--col-bg-secondary);
      color: var(--col-accent);
    }

    .download-item:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      color: #9ca3af;
    }

    .download-item i {
      font-size: 18px;
    }

    body.dark-mode .download-menu {
      background: var(--col-bg-sidebar);
      border-color: var(--col-border);
    }

    body.dark-mode .download-item:hover:not(:disabled) {
      background-color: rgba(255, 255, 255, 0.05);
    }
    
    #proof-container {
      box-shadow: none !important;
      padding: 15px !important;
      box-sizing: border-box !important;
      height: 100% !important;
      min-width: 0 !important;
      min-height: 0 !important;
    }

    #proof {
      display: flex !important;
      flex-direction: column !important;
      align-items: center !important;
      justify-content: flex-start !important; /* Stabilize vertical positioning */
      width: fit-content !important;
      min-width: 100% !important;
      min-height: 100% !important;
      padding: 50px !important;
      box-sizing: border-box !important;
    }

    /* Fix Editor Container */
    #enterFormula .editorPanel {
      width: 100% !important;
      height: auto !important; /* Let flex grow handle it */
      flex-grow: 1;
      min-height: 200px; /* Ensure some height */
      margin: 0 !important;
      padding: 0 !important;
      display: flex !important;
    }

    #editor {
      width: 100% !important;
      height: 100% !important;
    }

    /* Fix buttons that might inherit bad styles */
    button {
      font-family: 'Inter', sans-serif !important;
    }

    /* Compatibility fixes */
    .hidden-compatibility {
      display: none;
    }

    /* Dropdown styling for sidebar integration */
    .dropdown-content-sidebar {
      list-style: none;
      padding-left: 20px;
      margin-top: 5px;
      display: none;
    }

    .dropdown-content-sidebar.show {
      display: block;
    }

    .dropdown-content-sidebar li {
      color: var(--col-text-sidebar-muted);
      cursor: pointer;
      padding: 5px 0;
      font-size: 13px;
      background: transparent !important; /* Override style.css */
      text-align: left !important;
      width: 100% !important;
    }

    .dropdown-content-sidebar li:hover {
      color: var(--col-text-sidebar);
      background: var(--col-bg-sidebar-hover) !important;
    }

    /* Font options */
    .font-options-dropdown {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      background: white;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      width: 100%;
      z-index: 100;
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .font-option {
      padding: 8px 12px;
      font-size: 13px;
      color: #374151;
      cursor: pointer;
    }

    .font-option:hover {
      background: #f3f4f6;
    }

    /* Editor card specific overrides */
    .editor-card {
      display: flex;
      flex-direction: row; /* Ensure gutters and editor are side-by-side */
    }

    /* Proof controls positioning */
    .proof-controls {
      position: absolute;
      bottom: 10px;
      right: 10px;
      display: flex;
      gap: 5px;
      z-index: 1000;
    }

    /* Hide old elements that might pop up */
    #menu, .allBtn, .returnMain {
      display: none !important;
    }

    /* Ensure modals are on top and centered */
    .helpModal {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: rgba(0, 0, 0, 0.5);
      display: none; /* Controlled by JS */
      align-items: center;
      justify-content: center;
      z-index: 99999 !important;
    }

    .help {
      margin: 0 !important; /* Remove any auto margins that might offset centering */
      max-height: 90vh;
      overflow-y: auto;
    }

    /* Utility class for hiding elements */
    .hidden {
      display: none !important;
    }

    /* Layout Splitter */
    .layout-divider {
      width: 12px;
      cursor: col-resize;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      transition: background-color 0.2s;
    }

    /* Horizontal Splitter Overrides */
    #proof-split-layout.h-top .layout-divider,
    #proof-split-layout.h-bottom .layout-divider {
      width: 100% !important;
      height: 12px !important;
      cursor: row-resize !important;
    }
    #proof-split-layout.h-top .layout-divider::after,
    #proof-split-layout.h-bottom .layout-divider::after {
      width: 100% !important;
      height: 4px !important;
    }

    #proof-split-layout.v-right { flex-direction: row-reverse !important; }
    #proof-split-layout.h-top { flex-direction: column !important; }
    #proof-split-layout.h-bottom { flex-direction: column-reverse !important; }

    /* Ensure panels stretch to full width/height depending on mode but allow JS to override basis */
    #proof-split-layout.v-left #proof-tools,
    #proof-split-layout.v-right #proof-tools,
    #proof-split-layout.v-left #proof-container,
    #proof-split-layout.v-right #proof-container {
      height: 100%;
      flex-grow: 0;
      flex-shrink: 1; /* Allow shrinking */
      min-width: 0; /* Prevent content from forcing minimum width */
    }

    #proof-split-layout.h-top #proof-tools,
    #proof-split-layout.h-bottom #proof-tools,
    #proof-split-layout.h-top #proof-container,
    #proof-split-layout.h-bottom #proof-container {
      width: 100%;
      flex-grow: 0;
      flex-shrink: 1; /* Allow shrinking */
      min-height: 0; /* Prevent content from forcing minimum height */
    }

    /* One panel must grow to fill the remaining space */
    #proof-split-layout #proof-container {
      flex-grow: 1 !important;
      flex-basis: 0 !important;
    }

    /* Default sizes (50/50 split via flex-basis) */
    #proof-split-layout.v-left #proof-tools, 
    #proof-split-layout.v-right #proof-tools { 
      flex-basis: calc(50% - 6px); 
    }

    #proof-split-layout.h-top #proof-tools, 
    #proof-split-layout.h-bottom #proof-tools { 
      flex-basis: calc(50% - 6px); 
    }

    /* Layout Modal Styles - Compact */
    .layout-options-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
      padding: 12px 20px;
    }
    .layout-option-card {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 10px;
      border: 2px solid var(--col-border);
      border-radius: 10px;
      transition: all 0.2s;
      background: var(--col-bg-white);
    }
    .layout-option-card:hover { border-color: var(--col-accent); background: rgba(59, 130, 246, 0.05); }
    .layout-option-card:has(input:checked) { border-color: var(--col-accent); background: rgba(59, 130, 246, 0.1); }
    .layout-option-card input { display: none; }
    .layout-option-card span { font-size: 13px; font-weight: 500; color: var(--col-text-main); }

    .layout-preview {
      width: 90px;
      height: 60px;
      background: #f3f4f6;
      border-radius: 4px;
      display: flex;
      gap: 3px;
      padding: 4px;
      border: 1px solid var(--col-border);
      overflow: hidden;
    }
    .preview-tools { background: var(--col-accent); border-radius: 3px; opacity: 0.7; }
    .preview-proof { background: white; border: 1px solid #d1d5db; border-radius: 3px; }

    .layout-preview.v-left .preview-tools { width: 50%; height: 100%; }
    .layout-preview.v-left .preview-proof { width: 50%; height: 100%; }

    .layout-preview.v-right { flex-direction: row-reverse; }
    .layout-preview.v-right .preview-tools { width: 50%; height: 100%; }
    .layout-preview.v-right .preview-proof { width: 50%; height: 100%; }

    .layout-preview.h-top { flex-direction: column; }
    .layout-preview.h-top .preview-tools { width: 100%; height: 50%; }
    .layout-preview.h-top .preview-proof { width: 100%; height: 50%; }

    .layout-preview.h-bottom { flex-direction: column-reverse; }
    .layout-preview.h-bottom .preview-tools { width: 100%; height: 50%; }
    .layout-preview.h-bottom .preview-proof { width: 100%; height: 50%; }

    /* --- SIDEBAR PLACEMENT --- */
    body.sb-left { flex-direction: row !important; }
    body.sb-right { flex-direction: row-reverse !important; }
    body.sb-top { flex-direction: column !important; }
    body.sb-bottom { flex-direction: column-reverse !important; }

    /* Horizontal Sidebar Styles - Column/Grid Layout */
    body.sb-top .sidebar, body.sb-bottom .sidebar {
      width: 100% !important;
      height: auto !important;
      min-height: 100px !important;
      flex-direction: row !important;
      flex-wrap: wrap !important;
      padding: 10px 15px !important; /* Reduced padding */
      border-right: none !important;
      align-items: flex-start !important;
      justify-content: flex-start !important;
      gap: 0 10px; /* Reduced gap between columns from 15px to 10px */
      z-index: 1000;
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    body.sb-top .sidebar { border-bottom: 1px solid var(--col-border-sidebar) !important; }
    body.sb-bottom .sidebar { border-top: 1px solid var(--col-border-sidebar) !important; }

    /* Logo adjustment */
    body.sb-top .sidebar .logo, body.sb-bottom .sidebar .logo {
      margin-bottom: 8px !important;
      padding-left: 0 !important;
      margin-right: 0px; /* Reset as it's now in a vertical column */
      flex-shrink: 0;
      width: 100% !important;
    }

    /* Column/Header adjustment */
    body.sb-top .sidebar .sidebar-header, body.sb-bottom .sidebar .sidebar-header {
      margin-bottom: 0px !important;
      margin-right: 15px;
      min-width: 160px;
      padding-left: 12px; /* Added spacing from left edge */
    }
    /* Groups as Columns */
    body.sb-top .sidebar .menu-group, body.sb-bottom .sidebar .menu-group { 
      display: flex !important; 
      flex-direction: column !important;
      margin-bottom: 5px !important; 
      gap: 2px; 
      align-items: flex-start !important;
      padding: 0 8px; /* Reduced padding from 12px to 8px */
      border-left: 1px solid var(--col-border-sidebar);
      min-width: 80px; /* Reduced min-width from 100px */
    }
    body.sb-top .sidebar .menu-group:first-of-type, body.sb-bottom .sidebar .menu-group:first-of-type { border-left: none; padding-left: 0; }
    
    /* Horizontal mode (Top/Bottom) overrides for Languages & Editor Settings */
    body.sb-top .sidebar .languages-group, 
    body.sb-bottom .sidebar .languages-group,
    body.sb-top .sidebar .editor-settings-group,
    body.sb-bottom .sidebar .editor-settings-group {
        border-left: none !important;
        padding-left: 0 !important;
        margin-left: 0; /* Reset negative margin */
        min-width: 140px;
        flex-shrink: 0;
    }
    
    body.sb-top .sidebar .languages-group .menu-title,
    body.sb-bottom .sidebar .languages-group .menu-title,
    body.sb-top .sidebar .editor-settings-group .menu-title,
    body.sb-bottom .sidebar .editor-settings-group .menu-title {
        display: none !important;
    }

    body.sb-top .sidebar .languages-group .sidebar-settings-group,
    body.sb-bottom .sidebar .languages-group .sidebar-settings-group,
    body.sb-top .sidebar .editor-settings-group .sidebar-settings-group,
    body.sb-bottom .sidebar .editor-settings-group .sidebar-settings-group {
        padding: 0 !important;
        margin-bottom: 8px;
    }

    /* Support group alignment in horizontal mode */
    body.sb-top .sidebar .menu-group:last-of-type, body.sb-bottom .sidebar .menu-group:last-of-type {
      margin-top: 0 !important;
    }
    
    /* Restore Titles */
    body.sb-top .sidebar .menu-title, body.sb-bottom .sidebar .menu-title { 
        display: block !important; 
        font-size: 10px !important;
        margin-bottom: 6px !important;
        opacity: 0.8;
    }
    
    body.sb-top .sidebar .nav-link, body.sb-bottom .sidebar .nav-link { 
      margin-bottom: 0 !important; 
      white-space: nowrap; 
      padding: 4px 8px !important;
      font-size: 13px !important;
      width: 100%;
    }

    body.sb-right .sidebar { border-right: none !important; border-left: 1px solid var(--col-border-sidebar) !important; }

    /* Sidebar Previews in Modal */
    .layout-preview.sb-left { flex-direction: row; }
    .layout-preview.sb-left .preview-sidebar { width: 25%; height: 100%; background: var(--col-accent); opacity: 0.6; border-radius: 2px; }
    .layout-preview.sb-left .preview-main { width: 75%; height: 100%; background: #e5e7eb; border-radius: 2px; }

    .layout-preview.sb-right { flex-direction: row-reverse; }
    .layout-preview.sb-right .preview-sidebar { width: 25%; height: 100%; background: var(--col-accent); opacity: 0.6; border-radius: 2px; }
    .layout-preview.sb-right .preview-main { width: 75%; height: 100%; background: #e5e7eb; border-radius: 2px; }

    .layout-preview.sb-top { flex-direction: column; }
    .layout-preview.sb-top .preview-sidebar { width: 100%; height: 25%; background: var(--col-accent); opacity: 0.6; border-radius: 2px; }
    .layout-preview.sb-top .preview-main { width: 100%; height: 75%; background: #e5e7eb; border-radius: 2px; }

    .layout-preview.sb-bottom { flex-direction: column-reverse; }
    .layout-preview.sb-bottom .preview-sidebar { width: 100%; height: 25%; background: var(--col-accent); opacity: 0.6; border-radius: 2px; }
    .layout-preview.sb-bottom .preview-main { width: 100%; height: 75%; background: #e5e7eb; border-radius: 2px; }

    /* Support Grid - 1 column default (Vertical), 2 columns for horizontal */
    .support-links-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 4px;
      width: 100%;
    }
    
    body.sb-top .support-links-grid, body.sb-bottom .support-links-grid {
      grid-template-columns: 1fr 1fr;
    }
    
    /* Live Control Grid - Same logic as Support */
    .live-control-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 4px;
      width: 100%;
    }
    
    body.sb-top .live-control-grid, body.sb-bottom .live-control-grid {
      grid-template-columns: repeat(3, 1fr);
      width: auto;
      min-width: 300px; /* Increased for 3 columns */
    }

    /* Force nav-links in grid to be compact */
    body.sb-top .live-control-grid .nav-link, body.sb-bottom .live-control-grid .nav-link,
    body.sb-top .support-links-grid .nav-link, body.sb-bottom .support-links-grid .nav-link {
        padding: 6px 8px !important;
        font-size: 12px !important;
    }

    /* Logic Level grouping logic */
    .logic-mode-radios {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Vertical mode (Default) */
    .sidebar-settings-group-horizontal {
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Horizontal mode (Top/Bottom) */
    body.sb-top .sidebar-settings-group-horizontal, body.sb-bottom .sidebar-settings-group-horizontal {
        flex-direction: row !important;
        gap: 20px !important;
        align-items: flex-start !important;
    }
    
    body.sb-top .sidebar-settings-group-horizontal .sidebar-sub-settings, 
    body.sb-bottom .sidebar-settings-group-horizontal .sidebar-sub-settings {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }

    /* In narrow vertical sidebar, allow text wrapping */
    .support-links-grid .nav-link {
      height: auto !important;
      min-height: 40px;
    }

    .layout-divider::after {
      content: '';
      width: 4px;
      height: 100%;
      background-color: #e5e7eb;
      border-radius: 2px;
      transition: background-color 0.2s;
    }

    .layout-divider:hover::after, .layout-divider.active::after {
      background-color: var(--col-accent);
    }

    /* Modern Tabs Styling Override */
    .containerTabs {
      width: 100% !important;
      margin: 0 !important;
      font-family: 'Inter', sans-serif !important;
    }

    .box {
      box-shadow: none !important;
      border: 1px solid var(--col-border);
      border-radius: 8px;
    }

    .tab-list {
      border-bottom: 1px solid var(--col-border);
    }

    .tab-list::before {
      background-color: var(--col-accent) !important;
      height: 2px !important;
      bottom: -1px !important;
    }

    .tab-trigger {
      font-size: 14px !important;
      font-weight: 500 !important;
      color: var(--col-text-main) !important;
      padding: 12px 0 !important;
    }

    .button-container button {
      font-family: 'Times New Roman', serif !important; /* Keep logic symbols in serif */
      font-size: 22px !important;
      background: white !important;
      border: 1px solid var(--col-border) !important;
      border-radius: 8px !important;
      margin: 0 !important; /* Gap handles spacing */
      padding: 8px 16px !important;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
      max-width: 100% !important;
      flex: 1 1 auto !important; /* Grow to fill gaps, shrink if needed */
      min-width: max-content !important; /* Ensure text is visible */
      height: auto !important;
    }

    #button-container {
      display: flex !important;
      flex-direction: row !important;
      flex-wrap: wrap !important;
      gap: 10px !important;
      justify-content: center !important;
      width: 100% !important;
    }

    .button-container button:hover {
      background: #f9fafb !important;
      border-color: var(--col-accent) !important;
      color: var(--col-accent) !important;
    }

    /* OVERRIDE style.css MEDIA QUERIES for small screens */
    @media (max-width: 700px) {
      .content {
        margin-top: 0 !important;
        width: 100% !important;
      }

      .editorPanel {
        width: 100% !important;
      }

      body {
        width: 100% !important;
        overflow-x: hidden !important;
      }
    }

    /* --- DARK MODE VARIABLES --- */
    body.dark-mode {
        --col-bg-main: #0f172a;      /* Slate 900 */
        --col-bg-white: #1e293b;     /* Slate 800 */
        --col-text-main: #f3f4f6;    /* Gray 100 */
        --col-text-muted: #9ca3af;   /* Gray 400 */
        --col-border: #334155;       /* Slate 700 */

        --col-bg-sidebar: #111827;
        --col-text-sidebar: #cbd5e1;
        --col-text-sidebar-muted: #6b7280;
        --col-border-sidebar: #1f2937;
        --col-bg-sidebar-hover: rgba(255, 255, 255, 0.1);

        --col-highlight-main: rgba(59, 130, 246, 0.45);
        --col-highlight-secondary: rgba(59, 130, 246, 0.3);
        --col-highlight-success: rgba(34, 197, 94, 0.25);

        /* Successor Tooltip & Hover Dark Mode */
        --col-hover-bg: rgba(59, 130, 246, 0.2);
        --col-tooltip-bg: #1e293b;
        --col-tooltip-text: #f3f4f6;
    }

    /* Hover effect for proof text elements */
    #proofText.successor-hover {
        background-color: var(--col-hover-bg) !important;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 123, 191, 0.2);
        transition: background-color 0.2s ease;
        cursor: help;
    }

    /* Dark Mode Specific Overrides */
    body.dark-mode .top-header {
        background-color: var(--col-bg-white) !important;
        border-bottom-color: var(--col-border) !important;
    }

    body.dark-mode .custom-select select {
        color: var(--col-text-main) !important;
    }

    body.dark-mode .custom-select i {
        color: var(--col-text-main) !important;
    }

    /* Buttons in Dark Mode */
    body.dark-mode .btn-secondary,
    body.dark-mode .button-container button {
        background-color: var(--col-bg-white) !important;
        border-color: var(--col-border) !important;
        color: var(--col-text-main) !important;
    }
    body.dark-mode .btn-secondary:hover,
    body.dark-mode .button-container button:hover {
        background-color: #334155 !important;
    }

    /* D3 Tree Dark Mode */
    body.dark-mode .node circle {
        fill: var(--col-bg-white) !important;
        stroke: none !important;
    }
    body.dark-mode .node text {
        fill: var(--col-text-main) !important;
    }
    body.dark-mode .link {
        stroke: #64748b !important; /* Slate 500 */
    }

    /* Layout Divider */
    body.dark-mode .layout-divider::after {
        background-color: #475569;
    }

    /* Theme Toggle Animation state */
    .theme-toggle.dark::after {
        left: 22px; /* Move circle to right */
        background-color: #1f2937; /* Dark circle */
    }

    /* Hypotheses borders */
    body.dark-mode .hypotheses-block {
        border-color: var(--col-border);
    }

    /* Font dropdown */
    body.dark-mode .font-size-select {
        color: var(--col-text-main) !important;
    }
    body.dark-mode .custom-select {
        border-color: var(--col-border) !important;
    }
    body.dark-mode .custom-select:hover {
        background-color: #334155 !important;
        border-color: var(--col-accent) !important;
    }
    body.dark-mode .custom-select select option {
        background-color: var(--col-bg-white);
        color: var(--col-text-main);
    }

    /* General containers in Dark Mode */
    body.dark-mode #proof-container,
    body.dark-mode #hypotheses-container,
    body.dark-mode .proof-menu,
    body.dark-mode .editor-card,
    body.dark-mode .box {
        background-color: var(--col-bg-white) !important;
        border-color: var(--col-border) !important;
        color: var(--col-text-main) !important;
    }

    body.dark-mode .help,
    body.dark-mode #latexCode {
        background-color: var(--col-bg-white) !important;
        color: var(--col-text-main) !important;
    }

    body.dark-mode .helpNavbarItem {
        color: var(--col-text-main) !important;
    }

    body.dark-mode #proof label {
        color: var(--col-text-main) !important;
    }

    body.dark-mode #fitchHeader {
        color: var(--col-text-main) !important;
        border-bottom-color: var(--col-border) !important;
    }

    body.dark-mode .fitch_branch {
        border-left-color: var(--col-border) !important;
    }

    body.dark-mode .gamma-context {
        color: var(--col-text-muted) !important;
    }

    /* Scrollbars */
    body.dark-mode ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }
    body.dark-mode ::-webkit-scrollbar-track {
        background: var(--col-bg-main);
    }
    body.dark-mode ::-webkit-scrollbar-thumb {
        background: var(--col-border);
        border-radius: 5px;
    }
    body.dark-mode ::-webkit-scrollbar-thumb:hover {
        background: #475569;
    }
    /* --- START SCREEN --- */
    body.logic-vl-mode .quantifier-rule {
      display: none !important;
    }
    .hide-axioms-tab label[for="tab3"],
    .hide-axioms-tab #sb-axiom {
      display: none !important;
    }

    /* Sidebar Settings Styling */
    .sidebar-settings-group {
      padding: 4px 12px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .sidebar-radio, .sidebar-checkbox {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 4px 0;
      color: var(--col-text-sidebar);
      font-size: 14px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s;
      position: relative;
    }

    .sidebar-radio:hover, .sidebar-checkbox:hover {
      color: var(--col-text-sidebar);
      opacity: 0.8;
    }

    .sidebar-radio input, .sidebar-checkbox input {
      position: absolute;
      opacity: 0;
      cursor: pointer;
    }

    .custom-radio {
      width: 18px;
      height: 18px;
      border: 2px solid var(--col-text-sidebar-muted);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      flex-shrink: 0;
    }

    .sidebar-radio input:checked ~ .custom-radio {
      border-color: var(--col-accent);
    }

    .sidebar-radio input:checked ~ .custom-radio::after {
      content: '';
      width: 10px;
      height: 10px;
      background: var(--col-accent);
      border-radius: 50%;
    }

    .custom-checkbox {
      width: 18px;
      height: 18px;
      border: 2px solid var(--col-text-sidebar-muted);
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
      flex-shrink: 0;
    }

    .sidebar-checkbox input:checked ~ .custom-checkbox {
      background: var(--col-accent);
      border-color: var(--col-accent);
    }

    .sidebar-checkbox input:checked ~ .custom-checkbox::after {
      content: '';
      width: 4px;
      height: 8px;
      border: solid white;
      border-width: 0 2px 2px 0;
      transform: rotate(45deg);
      margin-bottom: 2px;
    }

    .sidebar-radio input:checked ~ span[data-i18n],
    .sidebar-checkbox input:checked ~ span[data-i18n] {
      color: var(--col-text-sidebar);
    }

    .sidebar-sub-settings {
      margin-top: 2px;
      padding-left: 15px;
      border-left: 2px solid var(--col-border-sidebar);
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-left: 8px;
    }

    #start-screen {
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background-color: var(--col-bg-main);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      transition: opacity 0.4s ease, visibility 0.4s ease;
      font-family: 'Inter', sans-serif;
    }
    #start-screen.hidden {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }

    .start-container {
      background: white;
      border: 1px solid var(--col-border);
      border-radius: 12px;
      padding: 40px;
      width: 95%;
      max-width: 1000px;
      box-shadow: 0 10px 25px rgba(0,0,0,0.05);
      display: flex;
      flex-direction: column;
      gap: 30px;
    }

    body.dark-mode .start-container {
      background: var(--col-bg-white);
      border-color: var(--col-border);
      color: var(--col-text-main);
    }

    .start-header {
      text-align: center;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }

    .start-top-row {
      display: flex;
      align-items: center;
      width: 100%;
      margin-bottom: -10px;
    }

    .start-controls {
      display: flex;
      align-items: center;
      gap: 15px;
      flex-shrink: 0;
    }

    .start-controls .lang-switcher {
      width: 160px; /* Force consistent width on start screen */
    }

    @media (max-width: 600px) {
      .start-top-row {
        justify-content: center;
        margin-bottom: 10px;
      }
      .start-header h1 {
        margin-top: 0 !important;
      }
    }

    .start-header h1 {
      margin: 0 0 10px 0;
      font-size: 28px;
      color: var(--col-text-main);
    }
    .start-header p {
      margin: 0;
      color: var(--col-text-muted);
      font-size: 15px;
    }

    .start-sections {
      display: grid;
      grid-template-columns: 1.2fr 1fr 1fr;
      gap: 25px;
    }

    @media (max-width: 900px) {
      .start-sections {
        grid-template-columns: 1fr;
        gap: 30px;
      }
      .start-container {
        padding: 25px;
        margin: 20px;
        height: 90vh;
        overflow-y: auto;
      }
    }

    .start-section {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .start-section h3 {
      margin: 0 0 5px 0;
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--col-text-muted);
      border-bottom: 1px solid var(--col-border);
      padding-bottom: 6px;
      text-align: left;
    }

    .radio-card {
      display: block;
      position: relative;
      cursor: pointer;
      padding: 12px;
      border: 2px solid var(--col-border);
      border-radius: 10px;
      transition: all 0.2s;
      background: #fdfdfd;
    }

    body.dark-mode .radio-card {
      background: rgba(255,255,255,0.02);
    }

    .radio-card:hover {
      border-color: var(--col-accent);
      background: #f9fafb;
    }

    .radio-card input {
      position: absolute;
      opacity: 0;
    }

    .radio-card input:checked + .card-content {
      /* Optional: style for checked state */
    }

    .radio-card:has(input:checked) {
      border-color: var(--col-accent);
      background: rgba(59, 130, 246, 0.04);
      box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1);
    }

    body.dark-mode .radio-card:has(input:checked) {
      background: rgba(59, 130, 246, 0.1);
    }

    .card-content {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .card-title {
      font-weight: 600;
      font-size: 15px;
      color: var(--col-text-main);
    }

    .card-desc {
      font-size: 12px;
      color: var(--col-text-muted);
      line-height: 1.4;
    }

    /* Compact Styles */
    .compact-grid {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .compact-row {
      display: flex;
      gap: 10px;
    }

    .compact-row .radio-card {
      flex: 1;
      padding: 10px;
      text-align: center;
    }

    .compact-row .card-title {
      font-size: 13px;
    }

    .checkbox-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
      padding: 5px 0;
    }

    .checkbox-item {
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      padding: 10px 12px;
      border: 1px solid var(--col-border);
      border-radius: 8px;
      font-size: 14px;
      transition: 0.2s;
    }

    .checkbox-item:hover {
      background: rgba(59, 130, 246, 0.05);
      border-color: var(--col-accent);
    }

    body.dark-mode .checkbox-item:hover {
      background: var(--col-bg-sidebar);
      border-color: var(--col-accent);
      color: white;
    }

    .checkbox-item:hover span[data-i18n] {
      color: inherit;
    }

    body.dark-mode .checkbox-item:hover span[data-i18n] {
      color: white !important;
    }

    .checkbox-item.disabled {
      opacity: 0.5;
      cursor: not-allowed;
      background: #f3f4f6;
      border-color: var(--col-border);
      filter: grayscale(1);
      pointer-events: none;
    }

    body.dark-mode .checkbox-item.disabled {
      background: rgba(255,255,255,0.05);
      border-color: var(--col-border);
    }

    .checkbox-item input {
      width: 16px;
      height: 16px;
      cursor: pointer;
    }

    .start-footer {
      padding-top: 10px;
      border-top: 1px solid var(--col-border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .start-btn {
      background: var(--col-accent);
      color: white;
      border: none;
      padding: 14px 40px;
      border-radius: 10px;
      font-weight: 600;
      font-size: 16px;
      cursor: pointer;
      transition: all 0.2s;
      box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    }

    /* --- Mobile Responsive (768px) --- */
    @media (max-width: 768px) {
      .mobile-menu-btn {
        display: flex !important;
      }

      #mobile-menu-btn {
        display: flex !important;
      }

      .layout-settings-trigger {
        display: none !important;
      }

      .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        z-index: 2000;
        transition: transform 0.3s ease;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
        border-right: 1px solid var(--col-border);
      }

      .sidebar.open {
        transform: translateX(280px);
      }

      /* Mobile styles for Proof button - Move to LEFT to avoid Monaco keyboard button */
      #enter {
        bottom: 40px !important;
        left: 40px !important;
        right: auto !important; /* Reset right position */
        height: 50px !important;
        padding: 0 20px !important;
        font-size: 16px !important;
        box-shadow: 0 8px 15px -3px rgba(239, 68, 68, 0.5) !important;
      }

      /* Ensure sidebar-specific positions don't override mobile left alignment */
      body.sb-right #enter,
      body.sb-bottom #enter {
        left: 40px !important;
        right: auto !important;
        bottom: 40px !important;
      }

      .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1999;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
      }

      .mobile-overlay.active {
        display: block;
        opacity: 1;
      }

      .top-header {
        padding: 0 16px !important;
      }

      .header-right .btn-primary {
        padding: 8px 12px !important;
        font-size: 13px !important;
      }
      
      .header-right .btn-primary i {
        display: none;
      }

      /* Help Modal Mobile Fix */
      .helpNavbar {
        flex-wrap: wrap !important;
        padding: 10px 20px !important;
        gap: 5px 15px !important;
        justify-content: center !important;
        overflow-x: visible !important;
      }

      .helpNavbarItem {
        white-space: nowrap !important;
        padding: 8px 0 !important;
        font-size: 13px !important;
      }

      .helpModal .help {
        width: 95% !important;
        max-height: 90vh !important;
      }

      /* Proof Layout Mobile Fix (Tree on top, Tools below) */
      #proof-split-layout {
        flex-direction: column-reverse !important;
        overflow-y: auto !important;
        gap: 20px;
        height: auto !important;
      }

      #proof-tools, #proof-container {
        width: 100% !important;
        flex-basis: auto !important;
        flex-shrink: 0 !important;
        min-height: 350px !important;
        max-height: 500px !important;
      }

      #proof-layout-divider {
        display: none !important;
      }
    }
