/* HCODX Compiler styles — extracted from compiler.html for cacheability. */
    :root {
      /* Light Theme (Default) - Eye-Comfortable & Readable */
      --bg-primary: #f8fafc;
      --bg-secondary: #ffffff;
      --bg-tertiary: #f1f5f9;
      --bg-elevated: #e2e8f0;
      --bg-glass: rgba(248, 250, 252, 0.92);

      --accent-primary: #4f46e5;
      --accent-secondary: #7c3aed;
      --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
      --accent-glow: rgba(79, 85, 229, 0.18);

      --text-primary: #0f172a;
      --text-secondary: #475569;
      --text-muted: #64748b;

      --success: #059669;
      --success-glow: rgba(5, 150, 105, 0.2);
      --error: #dc2626;
      --error-glow: rgba(220, 38, 38, 0.2);
      --warning: #b45309; /* amber-700 — 4.8:1 on light backgrounds (WCAG AA) */

      --border-subtle: rgba(100, 116, 139, 0.18);
      --border-default: rgba(100, 116, 139, 0.32);
      --border-focus: rgba(79, 85, 229, 0.5);

      --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.06);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.06);
      --shadow-glow: 0 0 20px var(--accent-glow);
      
      --radius-sm: 6px;
      --radius-md: 8px;
      --radius-lg: 12px;
      --radius-xl: 16px;
      
      --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
      --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
      --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Dark Theme Override */
    body.dark-theme {
      --bg-primary: #0b0f19;
      --bg-secondary: #0f172a;
      --bg-tertiary: #1e293b;
      --bg-elevated: #334155;
      --bg-glass: rgba(30, 41, 59, 0.85);

      --accent-primary: #6366f1;
      --accent-secondary: #8b5cf6;
      --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
      --accent-glow: rgba(99, 102, 241, 0.3);

      --text-primary: #f8fafc;
      --text-secondary: #94a3b8;
      --text-muted: #8b98ab; /* ≈5.6:1 on #0b0f19 (WCAG AA) */

      --success: #10b981;
      --success-glow: rgba(16, 185, 129, 0.3);
      --error: #ef4444;
      --error-glow: rgba(239, 68, 68, 0.3);
      --warning: #f59e0b;

      --border-subtle: rgba(148, 163, 184, 0.1);
      --border-default: rgba(148, 163, 184, 0.2);
      --border-focus: rgba(99, 102, 241, 0.5);

      --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
      --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
      --shadow-glow: 0 0 20px var(--accent-glow);
    }

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

    html {
      scroll-behavior: smooth;
    }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  line-height: 1.5;
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }

    /* Scrollbar Styling - Modern SaaS Standard */
    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    ::-webkit-scrollbar-track {
      background: transparent;
    }
    ::-webkit-scrollbar-thumb {
      background: var(--bg-elevated);
      border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
      background: var(--text-muted);
    }

  /* ── Top Navbar (seo-header redesign) ── */
    .seo-header {
      padding: 0 16px;
      height: 48px;
      border-bottom: 1px solid var(--border-subtle);
      background: var(--bg-secondary);
      backdrop-filter: blur(10px);
      position: relative;
      z-index: 10;
      flex-shrink: 0;
    }
    body.dark-theme .seo-header {
      background: rgba(15, 23, 42, 0.95);
    }
    .seo-header-inner {
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    /* Brand */
    .brand-top {
      display: flex;
      align-items: center;
      gap: 7px;
      min-width: 0;
      flex: 1;
      overflow: hidden;
    }
    .brand-top-name {
      font-size: 1rem;
      font-weight: 850;
      letter-spacing: -0.02em;
      background: var(--accent-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      flex-shrink: 0;
    }
    .brand-top-sep {
      color: var(--border-default);
      font-weight: 300;
      font-size: 1rem;
      flex-shrink: 0;
    }
    /* h1 title inline — truncates with ellipsis when space runs out */
    .brand-top-h1 {
      font-size: 0.77rem;
      font-weight: 500;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin: 0;
      line-height: 1;
      min-width: 0;   /* key: lets it shrink inside flex */
    }
    @media (max-width: 400px) {
      .brand-top-sep { display: none; }
    }

    /* Top nav buttons */
    .top-nav-btns {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-shrink: 0;
    }

    /* Blue Full IDE button */
    /* Info button (top nav variant) - defined after .btn below */

    /* Main Layout - Modern SaaS Grid */
    .main-container {
      display: flex;
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    /* Sidebar - Glassmorphism Effect */
    aside {
      width: 280px;
      background: var(--bg-glass);
      backdrop-filter: blur(12px);
      border-right: 1px solid var(--border-subtle);
      display: flex;
      flex-direction: column;
      position: relative;
      z-index: 20;
      transition: transform var(--transition-slow);
    }
 @media (min-width: 769px) {
      body.sidebar-collapsed aside {
        width: 0;
        min-width: 0;
        transform: translateX(-100%);
        border-right: none;
        overflow: hidden;
      }
    }
    .side-head {
      padding: 20px;
      border-bottom: 1px solid var(--border-subtle);
      background: var(--bg-tertiary);
    }
    body.dark-theme .side-head {
      background: rgba(30, 41, 59, 0.6);
    }

    .brand-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 16px;
    }

    .logo {
      font-size: 1.25rem;
      font-weight: 850;
      letter-spacing: -0.02em;
      background: var(--accent-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .pill {
      font-size: 0.65rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--accent-primary);
      background: rgba(99, 102, 241, 0.1);
      border: 1px solid rgba(99, 102, 241, 0.2);
      padding: 4px 10px;
      border-radius: 999px;
      white-space: nowrap;
    }

    .lang-count {
      font-size: 0.75rem;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .lang-count::before {
      content: '';
      width: 6px;
      height: 6px;
      background: var(--success);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--success);
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0%, 100% { opacity: 1; }
      50% { opacity: 0.5; }
    }

    .search-row {
      margin-top: 12px;
      position: relative;
    }

    #search {
      width: 100%;
      background: var(--bg-secondary);
      border: 1px solid var(--border-default);
      padding: 10px 12px 10px 36px;
      border-radius: var(--radius-md);
      color: var(--text-primary);
      font-size: 0.875rem;
      outline: none;
      transition: all var(--transition-fast);
    }
    #search::placeholder {
      color: var(--text-muted);
    }
    #search:focus {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 3px var(--accent-glow);
    }
    .search-row::before {
      content: '🔍';
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 0.875rem;
      opacity: 0.5;
    }

    .lang-scroll {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
      scrollbar-width: thin;
      scrollbar-color: var(--bg-elevated) transparent;
    }

    .lang-card {
      padding: 10px 14px;
      border-radius: var(--radius-md);
      cursor: pointer;
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.875rem;
      font-weight: 500;
      border: 1px solid transparent;
      background: transparent;
      transition: all var(--transition-fast);
      position: relative;
      overflow: hidden;
      /* Cards are real <a> links for SEO + keyboard access */
      color: inherit;
      text-decoration: none;
    }
    .lang-card::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 3px;
      background: var(--accent-primary);
      opacity: 0;
      transition: opacity var(--transition-fast);
    }
    .lang-card:hover {
      background: var(--bg-tertiary); /* theme token — visible in light AND dark mode */
      border-color: var(--border-default);
      transform: translateX(2px);
    }
    .lang-card:hover::before {
      opacity: 0.5;
    }
    .lang-card.active {
      background: rgba(99, 102, 241, 0.15);
      border-color: rgba(99, 102, 241, 0.3);
      color: var(--text-primary);
    }
    .lang-card.active::before {
      opacity: 1;
    }
    .v-tag {
      font-size: 0.65rem;
      font-weight: 600;
      padding: 2px 8px;
      background: var(--bg-tertiary); /* theme token — visible in light AND dark mode */
      border: 1px solid var(--border-subtle);
      border-radius: 999px;
      color: var(--text-secondary);
      transition: all var(--transition-fast);
    }
    .lang-card:hover .v-tag,
    .lang-card.active .v-tag {
      background: rgba(99, 102, 241, 0.2);
      border-color: rgba(99, 102, 241, 0.3);
      color: var(--accent-primary);
    }
    /* Main Content Area */
    main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      background: var(--bg-primary);
      position: relative;
    }

    /* Header - Editor toolbar */
    header {
      height: 56px;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      background: var(--bg-secondary);
      backdrop-filter: blur(8px);
      position: relative;
      z-index: 15;
      gap: 12px;
      flex-shrink: 0;
    }
    body.dark-theme header {
      background: rgba(11, 15, 25, 0.95);
    }

    .left-head {
      display: flex;
      align-items: center;
      gap: 16px;
      min-width: 0;
      flex: 1;
    }

    .burger {
      display: flex;
      border: 1px solid var(--border-default);
      background: var(--bg-secondary);
      color: var(--text-primary);
      border-radius: var(--radius-md);
      padding: 8px;
      cursor: pointer;
      transition: all var(--transition-fast);
    }
    .burger:hover {
      background: var(--bg-tertiary);
      border-color: var(--accent-primary);
    }

    #active-lang-label {
      font-weight: 600;
      font-size: 1rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--text-primary);
    }
    .sub {
      color: var(--text-muted);
      font-size: 0.75rem;
      margin-top: 2px;
      font-weight: 500;
    }
    .head-col {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
      align-items: center;
    }
/* desktop-btn: shown only on desktop (>768px) */
    .desktop-btn {
      display: none !important;
    }
    @media (min-width: 769px) {
      .desktop-btn { display: inline-flex !important; }
    }

    /* mobile-more: the ⋮ More overflow menu — shown at ALL widths.
       Secondary actions (fullscreen, copy, download, save, load sample)
       live here so the toolbar stays uncluttered on desktop too. */
    .mobile-more {
      display: inline-flex;
      position: relative;
    }
    /* Menu items that duplicate a visible desktop control (navbar theme/info/
       Full IDE, toolbar stdin + share) appear only in the mobile menu */
    @media (min-width: 769px) {
      .mobile-menu-only { display: none !important; }
    }

    .actions-dropdown {
      position: relative;
    }

    .actions-menu {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      min-width: 190px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-default);
      border-radius: var(--radius-md);
      box-shadow: var(--shadow-lg);
      padding: 8px;
      z-index: 40;
      display: none;
      flex-direction: column;
      gap: 4px;
    }

    .actions-menu.show {
      display: flex;
    }

    .menu-item {
      width: 100%;
      justify-content: flex-start;
      text-decoration: none;
      gap: 10px;
    }
    .menu-label {
      font-size: 0.82rem;
      font-weight: 500;
    }

    /* Theme icon button (desktop) */
    .btn-theme-icon {
      padding: 8px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-default);
      background: var(--bg-secondary);
      color: var(--text-secondary);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: all var(--transition-fast);
      flex-shrink: 0;
    }
    .btn-theme-icon:hover {
      background: var(--bg-tertiary);
      border-color: var(--accent-primary);
      color: var(--text-primary);
    }
    .btn {
      padding: 8px 14px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-default);
      font-weight: 500;
      cursor: pointer;
      font-size: 0.8rem;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: var(--bg-secondary);
      color: var(--text-secondary);
      transition: all var(--transition-fast);
      position: relative;
      overflow: hidden;
      white-space: nowrap;
    }
    .btn:hover {
      background: var(--bg-tertiary);
      border-color: var(--border-default);
      color: var(--text-primary);
      transform: translateY(-1px);
      box-shadow: var(--shadow-md);
    }
    .btn:active {
      transform: translateY(0);
    }
    .btn svg {
      width: 14px;
      height: 14px;
      opacity: 0.7;
      transition: opacity var(--transition-fast);
    }
    .btn:hover svg {
      opacity: 1;
    }

    .btn-run {
      /* Darker greens keep white text ≥4:1 contrast (WCAG) */
      background: linear-gradient(135deg, #059669 0%, #047857 100%);
      border-color: transparent;
      color: white;
      font-weight: 700;
      padding: 8px 18px;
      box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    }
    .btn-run:hover {
      background: linear-gradient(135deg, #047857 0%, #065f46 100%);
      border-color: transparent;
      box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
      color: white;
      transform: translateY(-1px);
    }
    .btn-run:disabled {
      opacity: 0.7;
      cursor: not-allowed;
      transform: none;
    }
    /* Running (stop) state */
    .btn-run.running {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
      box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
    }
    .btn-run.running:hover {
      background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
      box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
    }

    /* ── Blue Full IDE button — defined AFTER .btn so it always wins ── */
    .btn.btn-ide-blue {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      border-color: transparent;
      color: #ffffff;
      font-weight: 600;
      box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
      text-decoration: none;
    }
    .btn.btn-ide-blue:hover {
      background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
      border-color: transparent;
      color: #ffffff;
      box-shadow: 0 4px 16px rgba(59, 130, 246, 0.5);
      filter: none;
      transform: translateY(-1px);
    }

    /* ── Info top-nav button — defined AFTER .btn ── */
    .btn.btn-info-top {
      background: rgba(99, 102, 241, 0.08);
      border-color: rgba(99, 102, 241, 0.25);
      color: var(--accent-primary);
    }
    .btn.btn-info-top:hover {
      background: rgba(99, 102, 241, 0.16);
      border-color: rgba(99, 102, 241, 0.5);
      color: var(--accent-primary);
      box-shadow: none;
      transform: translateY(-1px);
    }

    /* ── Warn/Clear button ── */
    .btn.btn-warn {
      background: rgba(245, 158, 11, 0.08);
      border-color: rgba(245, 158, 11, 0.3);
      color: var(--warning);
    }
    .btn.btn-warn:hover {
      background: rgba(245, 158, 11, 0.16);
      border-color: rgba(245, 158, 11, 0.5);
      color: var(--warning);
      box-shadow: none;
    }

    /* Icon-only buttons: compact square, no text */
    .btn-icon-only {
      padding: 8px !important;
      min-width: 36px;
      width: 36px;
      justify-content: center;
    }

    /* ── Unsaved Changes Dialog ───────────────────────────────────────── */
    #unsaved-dialog-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 9999;
      align-items: center;
      justify-content: center;
    }
    #unsaved-dialog-overlay.visible {
      display: flex;
    }
    #unsaved-dialog {
      background: var(--bg-primary, #fff);
      border: 1px solid var(--border-default, #e2e8f0);
      border-radius: 10px;
      padding: 24px 28px;
      max-width: 360px;
      width: 90%;
      box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    }
    #unsaved-dialog h3 {
      margin: 0 0 8px;
      font-size: 15px;
      font-weight: 600;
      color: var(--text-primary, #1e293b);
    }
    #unsaved-dialog p {
      margin: 0 0 20px;
      font-size: 13px;
      color: var(--text-secondary, #64748b);
      line-height: 1.5;
    }
    #unsaved-dialog .dialog-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    #unsaved-dialog .dialog-actions .btn {
      font-size: 13px;
      padding: 7px 14px;
    }
    .btn-save-primary {
      background: var(--accent-primary, #3b82f6) !important;
      color: #fff !important;
      border-color: var(--accent-primary, #3b82f6) !important;
    }
    .btn-save-primary:hover { opacity: 0.88; }

    /* ── Restore Sample Dialog ───────────────────────────────────────────── */
    #restore-dialog-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.45);
      z-index: 9999;
      align-items: center;
      justify-content: center;
    }
    #restore-dialog-overlay.visible { display: flex; }
    #restore-dialog {
      background: var(--bg-primary, #fff);
      border: 1px solid var(--border-default, #e2e8f0);
      border-radius: 10px;
      padding: 24px 28px;
      max-width: 380px;
      width: 90%;
      box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    }
    #restore-dialog h3 {
      margin: 0 0 6px;
      font-size: 15px;
      font-weight: 600;
      color: var(--text-primary, #1e293b);
    }
    #restore-dialog p {
      margin: 0 0 20px;
      font-size: 13px;
      color: var(--text-secondary, #64748b);
      line-height: 1.5;
    }
    #restore-dialog .dialog-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      flex-wrap: wrap;
    }
    #restore-dialog .dialog-actions .btn { font-size: 13px; padding: 7px 14px; }

   .btn-toggle.active {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
      background: rgba(99, 102, 241, 0.12);
    }

    .fullscreen-active main {
      position: fixed;
      inset: 0;
      z-index: 9998;
      background: var(--bg-primary);
    }
.fullscreen-active aside {
      z-index: 10001;
    }

    .fullscreen-active #sidebar-backdrop {
      z-index: 10000 !important;
    }

    /* Run metadata (exit code + execution time) shown in the output header,
       so the output pane itself stays pure program output. */
    .output-head-right {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      margin-left: auto;
    }
    .run-stats {
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .run-stats.ok  { color: var(--success); }
    .run-stats.err { color: var(--error); }
    /* Only stderr / compile-error segments are colored inside the output pane */
    #output-text .out-err {
      color: var(--error);
      white-space: pre-wrap;
    }
    /* Workspace - Horizontal Split on Desktop (Editor Left, Output Right) */
    .workspace {
      display: flex;
      flex-direction: column; /* mobile: stacked; overridden to row on desktop */
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    /* ── Desktop: horizontal split (50/50, stable) ── */
    @media (min-width: 769px) {
      .workspace {
        flex-direction: row;
        overflow: hidden;
      }
      #editor-container {
        flex: 0 0 50%;          /* exact 50% initial split */
        min-width: 180px;
        max-width: none !important;
        height: 100% !important;
        min-height: 0;
        overflow: hidden;
      }
      .resize-handle {
        flex: 0 0 5px !important;
        width: 5px !important;
        height: 100% !important;
        min-width: 5px;
        cursor: col-resize !important;
        z-index: 10;
      }
      #output-panel {
        flex: 1 1 0 !important;  /* fills the remaining space — never collapses */
        min-width: 180px;
        width: auto !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        border-top: none !important;
        border-left: 2px solid var(--border-default);
        overflow: hidden;
      }
      /* editor-focus (split closed): hide output, expand editor to full */
      body.editor-focus #output-panel,
      body.editor-focus .resize-handle {
        display: none !important;
      }
      body.editor-focus #editor-container {
        flex: 1 1 100% !important;
        width: 100% !important;
      }
    }

    /* ── Mobile tab switcher ── */
    .mobile-tab-bar {
      display: none;
    }
    @media (max-width: 768px) {
      .mobile-tab-bar {
        display: flex;
        background: var(--bg-tertiary);
        border-bottom: 1px solid var(--border-default);
        flex-shrink: 0;
      }
      .mobile-tab {
        flex: 1;
        padding: 10px 8px;
        background: transparent;
        border: none;
        border-bottom: 2px solid transparent;
        color: var(--text-muted);
        font-size: 0.82rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        cursor: pointer;
        transition: all var(--transition-fast);
        font-family: 'Inter', system-ui, sans-serif;
      }
      .mobile-tab.active {
        color: var(--accent-primary);
        border-bottom-color: var(--accent-primary);
        background: rgba(79, 85, 229, 0.06);
      }
      .mobile-tab svg { width: 14px; height: 14px; }
      /* On mobile: show/hide panes via tab state */
      body.mobile-run-tab #editor-container { display: none !important; }
      body.mobile-run-tab #output-panel    { display: flex !important; flex-direction: column; height: 100% !important; max-height: 100% !important; min-height: 0; flex: 1 1 auto !important; }
      body:not(.mobile-run-tab) #output-panel { display: none !important; }
      body:not(.mobile-run-tab) #editor-container { display: flex !important; }
      .resize-handle { display: none !important; }
    }

    #editor-container {
      flex: 1;
      min-height: 0;
      position: relative;
      display: flex;
      flex-direction: column;
      background: var(--bg-secondary);
    }
    .CodeMirror {
      flex: 1;
      min-height: 0;
      height: auto !important;
      font-family: 'JetBrains Mono', ui-monospace, monospace;
      font-size: 14px;
      line-height: 1.6;
      background: transparent !important;
      padding: 16px 16px 16px 0 !important; /* left=0: gutters flush to container edge */
    }
    .CodeMirror-gutters {
      background: var(--bg-tertiary) !important;
      border-right: 1px solid var(--border-subtle) !important;
      padding-right: 10px;
      padding-left: 8px;
    }
    body.dark-theme .CodeMirror-gutters {
      background: rgba(30, 41, 59, 0.8) !important;
    }
    .CodeMirror-linenumber {
      color: var(--text-muted) !important;
      font-weight: 400;
    }

    /* Output Panel - base styles (mobile: stacked; desktop: overridden by media query) */
    #output-panel {
      width: 100%;
      height: 35%;
      min-height: 120px;
      max-height: 50%;
      background: var(--bg-secondary);
      border-top: 2px solid var(--border-default);
      border-left: none;
      display: flex;
      flex-direction: column;
      position: relative;
      flex-shrink: 0;
      overflow: hidden;
    }

    /* On mobile tab system: output must fill the full viewport height */
    @media (max-width: 768px) {
      body.mobile-run-tab #output-panel {
        height: 100% !important;
        max-height: 100% !important;
        min-height: 0 !important;
        border-top: none !important;
        flex: 1 1 auto !important;
      }
    }

    .output-head {
      padding: 10px 16px;
      background: var(--bg-tertiary);
      font-size: 0.7rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid var(--border-subtle);
      flex-shrink: 0;
      overflow: hidden; /* children truncate with ellipsis, never spill off-screen */
    }
    .output-title {
      white-space: nowrap; /* never wrap to two lines */
    }

    .badge {
      font-size: 0.7rem;
      font-weight: 500;
      border: 1px solid var(--border-default);
      padding: 3px 10px;
      border-radius: var(--radius-sm);
      background: var(--bg-secondary);
      color: var(--text-muted);
      white-space: nowrap;
      max-width: 185px;
      overflow: hidden;
      text-overflow: ellipsis;
      transition: all var(--transition-fast);
    }

    #output-text {
      flex: 1;
      padding: 16px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      color: var(--text-secondary);
      overflow: auto;
      white-space: pre-wrap;
      line-height: 1.6;
      background: var(--bg-primary);
    }

    /* Interactive Input Modal - Modern Overlay */
    .input-modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.8);
      backdrop-filter: blur(8px);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      opacity: 0;
      transition: opacity var(--transition-base);
      padding: 20px;
    }
    .input-modal-overlay.show {
      display: flex;
      opacity: 1;
    }

    .input-modal-box {
      background: var(--bg-secondary);
      border: 1px solid var(--border-default);
      border-radius: var(--radius-xl);
      width: 100%;
      max-width: 480px;
      max-height: 85vh;
      overflow: auto;
      box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
      animation: modalSlide var(--transition-slow);
      position: relative;
    }
    
    @keyframes modalSlide {
      from {
        transform: translateY(-20px) scale(0.98);
        opacity: 0;
      }
      to {
        transform: translateY(0) scale(1);
        opacity: 1;
      }
    }

    .modal-header {
      padding: 24px 24px 16px;
      border-bottom: 1px solid var(--border-subtle);
      background: linear-gradient(180deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
    }
    .modal-title {
      font-size: 1.125rem;
      font-weight: 600;
      color: var(--text-primary);
      margin: 0 0 4px 0;
    }
    .modal-subtitle {
      font-size: 0.875rem;
      color: var(--text-muted);
      margin: 0;
    }

    .modal-body {
      padding: 20px 24px;
    }

    .input-group {
      margin-bottom: 16px;
    }
    .input-group:last-child {
      margin-bottom: 0;
    }
    
    /* Enhanced input row styles for stdin modal */
    .input-row {
      margin-bottom: 16px;
    }
    .input-row:last-child {
      margin-bottom: 0;
    }
    
    .input-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.82rem;
      font-weight: 850;
      color: var(--accent-primary);
      margin-bottom: 8px;
      gap: 8px;
    }
    
    .input-hint {
      font-size: 0.72rem;
      color: var(--text-muted);
      font-weight: 400;
    }
    
    .var-badge {
      display: inline-block;
      font-size: 0.75rem;
      font-weight: 600;
      color: white;
      background: linear-gradient(135deg, #6366f1, #8b5cf6);
      padding: 3px 10px;
      border-radius: 999px;
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: 0.5px;
      box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    }
    .modal-input {
      width: 100%;
      background: var(--bg-primary);
      border: 1px solid var(--border-default);
      padding: 10px 14px;
      border-radius: var(--radius-md);
      color: var(--text-primary);
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.9rem;
      outline: none;
      transition: all var(--transition-fast);
    }
    .modal-input:focus {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 3px var(--accent-glow);
    }
    .modal-input::placeholder {
      color: var(--text-muted);
    }

    /* Textarea variant for single-box stdin input */
    .modal-textarea {
      width: 100%;
      min-height: 120px;
      max-height: 260px;
      resize: vertical;
      line-height: 1.65;
    }
    .stdin-info-row {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-top: 8px;
    }
    .stdin-info-row svg {
      flex-shrink: 0;
      opacity: 0.6;
    }

    /* === Interactive Terminal (Programiz-style inline input) === */
    #interactive-terminal {
      flex: 1;
      overflow-y: auto;
      padding: 16px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      background: var(--bg-primary);
      display: none;
      flex-direction: column;
    }
    .terminal-lines {
      display: flex;
      flex-direction: column;
      flex: 1;
      gap: 1px;
    }
    .terminal-output-line {
      color: var(--text-secondary);
      line-height: 1.65;
      white-space: pre-wrap;
      word-break: break-all;
      min-height: 1.65em;
    }
    .terminal-running-hint {
      color: var(--accent-primary);
      margin-bottom: 6px;
      font-size: 0.8em;
      opacity: 0.85;
    }
    .terminal-running-line {
      color: var(--success);
      margin-top: 4px;
    }
    .terminal-input-line {
      display: flex;
      align-items: baseline;
      line-height: 1.65;
      min-height: 1.65em;
    }
    .terminal-prompt-text {
      color: var(--accent-primary);
      white-space: pre;
      flex-shrink: 0;
      font-weight: 500;
    }
    .terminal-inline-input {
      background: transparent;
      border: none;
      outline: none;
      color: var(--text-primary);
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      flex: 1;
      min-width: 40px;
      caret-color: var(--accent-primary);
      padding: 0;
    }
    .terminal-inline-input:disabled {
      color: var(--success);
      cursor: default;
      -webkit-text-fill-color: var(--success);
    }
    /* ── Live interactive terminal (WebSocket streaming) ──────────────── */
    /* One flowing console: program output plus an INLINE input that sits
       right after the prompt, so "Enter your name: ▮" reads like a real TTY. */
    .lt-body {
      display: block;
      flex: 1;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text-secondary);
      line-height: 1.7;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
    }
    .lt-body .out-err {
      color: var(--error);
      white-space: pre-wrap;
    }
    /* Expected-inputs guidance shown at the top of every live session */
    .lt-hints {
      display: block;
      margin-bottom: 8px;
      padding: 6px 10px;
      border-left: 2px solid var(--accent-primary);
      background: var(--bg-tertiary);
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      color: var(--text-muted);
      font-size: 0.82em;
      font-style: italic;
      white-space: pre-wrap;
    }
    /* Typed input echo — distinct from program output so it's clear what the
       user entered vs. what the program printed. */
    .lt-echo {
      color: var(--accent-primary);
      font-weight: 600;
    }
    .lt-input {
      display: inline;
      min-width: 6ch;
      background: transparent;
      border: none;
      outline: none;
      padding: 0;
      color: var(--accent-primary);
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      caret-color: var(--accent-primary);
      vertical-align: baseline;
    }
    .lt-input::placeholder {
      color: var(--text-muted);
      font-weight: 400;
      font-style: italic;
      opacity: 0.8;
    }
    .lt-input:disabled {
      -webkit-text-fill-color: var(--text-muted);
      color: var(--text-muted);
      cursor: default;
    }
    .lt-exit {
      display: block;
      margin-top: 10px;
      font-size: 0.78em;
      font-weight: 600;
      opacity: 0.85;
      user-select: none;
    }
    .lt-exit.ok  { color: var(--success); }
    .lt-exit.err { color: var(--error); }

    .terminal-generic-wrapper {
      margin-top: 8px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .terminal-generic-textarea {
      width: 100%;
      min-height: 90px;
      max-height: 200px;
      background: var(--bg-tertiary); /* theme token — readable in light AND dark mode */
      border: 1px solid var(--border-default);
      border-radius: var(--radius-md);
      color: var(--text-primary);
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      padding: 10px 12px;
      resize: vertical;
      outline: none;
      line-height: 1.65;
    }
    .terminal-generic-textarea:focus {
      border-color: var(--accent-primary);
      box-shadow: 0 0 0 2px var(--accent-glow);
    }
    .terminal-generic-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
    }
    .terminal-hint {
      font-size: 0.72rem;
      color: var(--text-muted);
    }
    .terminal-hint kbd {
      background: var(--bg-elevated);
      border: 1px solid var(--border-default);
      border-radius: 4px;
      padding: 1px 5px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.7rem;
      color: var(--text-secondary);
    }
    .terminal-generic-btns {
      display: flex;
      gap: 8px;
    }
    .t-cancel-btn {
      background: transparent;
      border: 1px solid var(--border-default);
      border-radius: var(--radius-sm);
      color: var(--text-secondary);
      padding: 5px 14px;
      font-size: 0.8rem;
      cursor: pointer;
      font-family: 'Inter', sans-serif;
      transition: all var(--transition-fast);
    }
    .t-cancel-btn:hover {
      border-color: var(--error);
      color: var(--error);
    }
    .t-submit-btn {
      background: var(--accent-gradient);
      border: none;
      border-radius: var(--radius-sm);
      color: white;
      padding: 5px 16px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      font-family: 'Inter', sans-serif;
      transition: all var(--transition-fast);
      box-shadow: 0 2px 8px var(--accent-glow);
    }
    .t-submit-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px var(--accent-glow);
    }
    /* Hint items shown above textarea when prompts are detected in a loop */
    .terminal-hints-header {
      color: var(--accent-primary);
      font-size: 0.78em;
      margin-bottom: 3px;
      opacity: 0.9;
    }
    .terminal-hint-item {
      color: var(--text-secondary);
      font-size: 0.82em;
      padding-left: 8px;
      line-height: 1.55;
    }
    .terminal-hint-item .hint-loop-badge {
      display: inline-block;
      font-size: 0.7em;
      color: var(--warning);
      background: rgba(245,158,11,0.12);
      border: 1px solid rgba(245,158,11,0.3);
      border-radius: 4px;
      padding: 0 5px;
      margin-left: 6px;
      vertical-align: middle;
    }

    .modal-footer {
      padding: 16px 24px;
      border-top: 1px solid var(--border-subtle);
      display: flex;
      gap: 12px;
      justify-content: flex-end;
      background: var(--bg-tertiary); /* theme token — correct in light AND dark mode */
    }

    .modal-btn {
      padding: 10px 20px;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-default);
      font-weight: 500;
      cursor: pointer;
      font-size: 0.85rem;
      background: var(--bg-tertiary);
      color: var(--text-secondary);
      transition: all var(--transition-fast);
    }
    .modal-btn:hover {
      background: var(--bg-elevated);
      color: var(--text-primary);
      border-color: var(--border-default);
    }

    .modal-btn-primary {
      background: var(--accent-gradient);
      border-color: transparent;
      color: white;
      font-weight: 600;
      box-shadow: 0 4px 12px var(--accent-glow);
    }
    .modal-btn-primary:hover {
      box-shadow: 0 6px 16px var(--accent-glow);
      filter: brightness(1.1);
      color: white;
    }

    /* Toast Notification - Modern Floating Style */
    .toast {
      position: fixed;
      bottom: 24px;
      right: 24px;
      background: var(--bg-secondary);
      border: 1px solid var(--border-default);
      border-radius: var(--radius-lg);
      padding: 16px 20px;
      box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.4);
      z-index: 10000;
      opacity: 0;
      transform: translateY(20px) scale(0.95);
      transition: all var(--transition-slow);
      pointer-events: none;
      max-width: 360px;
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }
    .toast.show {
      opacity: 1;
      transform: translateY(0) scale(1);
      pointer-events: auto;
    }
    
    .toast-icon {
      width: 20px;
      height: 20px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 12px;
    }
    .toast-icon.success {
      background: var(--success);
      color: white;
      box-shadow: 0 0 12px var(--success-glow);
    }
    .toast-icon.error {
      background: var(--error);
      color: white;
      box-shadow: 0 0 12px var(--error-glow);
    }
    .toast-icon.warning {
      background: var(--warning);
      color: white;
    }
    
    .toast-content {
      flex: 1;
    }
    .toast-title {
      font-weight: 600;
      font-size: 0.9rem;
      color: var(--text-primary);
      margin-bottom: 2px;
    }
    .toast-msg {
      font-size: 0.8rem;
      color: var(--text-muted);
      line-height: 1.4;
    }

    /* Loader - Modern Spinner */
    .loader {
      display: none;
      width: 16px;
      height: 16px;
      border: 2px solid rgba(255, 255, 255, 0.2);
      border-top-color: white;
      border-radius: 50%;
      animation: spin 0.6s linear infinite;
    }
    @keyframes spin {
      to { transform: rotate(360deg); }
    }

    /* Status Indicator */
    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--success);
      display: inline-block;
      margin-right: 8px;
      box-shadow: 0 0 8px var(--success);
      animation: pulse 2s ease-in-out infinite;
      position: relative;
    }
    .status-dot::after {
      content: '';
      position: absolute;
      inset: -2px;
      border-radius: 50%;
      border: 1px solid var(--success);
      opacity: 0.3;
      animation: ripple 2s ease-out infinite;
    }
    .status-dot.offline {
      background: var(--error);
      box-shadow: 0 0 8px var(--error);
      animation: none;
    }
    .status-dot.offline::after {
      display: none;
    }
    
    @keyframes ripple {
      0% { transform: scale(1); opacity: 0.3; }
      100% { transform: scale(2); opacity: 0; }
    }

    /* File Tab Bar - VS Code Aesthetic */
    .file-tab-bar {
      display: flex;
      align-items: center;
      background: var(--bg-tertiary);
      border-bottom: 1px solid var(--border-subtle);
      padding: 0 8px;
      height: 36px;
      overflow-x: auto;
      scrollbar-width: none;
      flex-shrink: 0;
    }
    .file-tab-bar::-webkit-scrollbar { display: none; }
    .file-tab {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px 14px;
      font-size: 0.8rem;
      font-family: 'JetBrains Mono', monospace;
      color: var(--text-secondary);
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: default;
      white-space: nowrap;
      transition: all var(--transition-fast);
    }
    .file-tab.active {
      color: var(--text-primary);
      background: var(--bg-secondary);
      border-bottom-color: var(--accent-primary);
    }
    .file-tab-icon {
      width: 14px;
      height: 14px;
      border-radius: 3px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.6rem;
      font-weight: 850;
    }

    #file-modified-dot {
      display: inline-flex;
      align-items: center;
      opacity: 0.85;
    }
    /* Blue pulsing = unsaved changes */
    #file-modified-dot.state-modified {
      animation: dot-pulse 1.8s ease-in-out infinite;
    }
    #file-modified-dot.state-modified circle {
      fill: var(--accent-primary, #4f55e5);
    }
    /* Orange solid = saved but differs from default sample */
    #file-modified-dot.state-saved {
      animation: none;
      opacity: 1;
    }
    #file-modified-dot.state-saved circle {
      fill: #f59e0b;
    }
    @keyframes dot-pulse {
      0%, 100% { opacity: 0.85; }
      50%       { opacity: 0.35; }
    }
    #file-restore-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: none;
      border: none;
      padding: 2px 3px;
      margin-left: 1px;
      border-radius: 3px;
      color: var(--text-muted);
      cursor: pointer;
      opacity: 0.6;
      transition: opacity 0.15s, color 0.15s, background 0.15s;
      line-height: 1;
    }
    #file-restore-btn:hover {
      opacity: 1;
      color: var(--accent-primary);
      background: rgba(79, 85, 229, 0.1);
    }

    /* ── Welcome Screen ──────────────────────────────────────────────────── */
    /* Welcome screen sits inside .workspace which already fills the correct area */
    #welcome-screen {
      position: absolute;
      inset: 0;
      z-index: 10;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-primary);
      padding: 32px 24px;
    }
    #welcome-inner {
      text-align: center;
      max-width: 520px;
      width: 100%;
    }
    #welcome-logo {
      width: 72px;
      height: 72px;
      border-radius: 18px;
      background: linear-gradient(135deg, var(--accent-primary, #4f55e5), #7c3aed);
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 22px;
      color: #fff;
      box-shadow: 0 8px 28px rgba(79,85,229,0.32);
    }
    #welcome-title {
      margin: 0 0 10px;
      font-size: 1.6rem;
      font-weight: 700;
      color: var(--text-primary);
      letter-spacing: -0.025em;
    }
    @media (max-width: 768px) {
      #welcome-title { font-size: 1.25rem; }
      #welcome-logo  { width: 56px; height: 56px; border-radius: 14px; }
    }
    #welcome-sub {
      margin: 0 0 30px;
      font-size: 0.92rem;
      color: var(--text-secondary);
      line-height: 1.55;
    }
    #welcome-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      justify-content: center;
      margin-bottom: 14px;
    }
    .wchip {
      display: inline-block;
      padding: 6px 15px;
      border-radius: 20px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-subtle);
      color: var(--text-secondary);
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
      font-family: 'JetBrains Mono', monospace;
      text-decoration: none; /* chips are real <a> links for SEO + keyboard access */
    }
    .wchip:hover {
      background: var(--accent-primary);
      border-color: var(--accent-primary);
      color: #fff;
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(79,85,229,0.25);
    }
    #welcome-more-btn {
      padding: 6px 15px;
      border-radius: 20px;
      background: transparent;
      border: 1px dashed var(--border-default);
      color: var(--text-muted);
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
      font-family: 'JetBrains Mono', monospace;
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    #welcome-more-btn:hover {
      border-color: var(--accent-primary);
      color: var(--accent-primary);
      background: rgba(79,85,229,0.06);
    }
    #welcome-divider {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 20px 0 16px;
      color: var(--text-muted);
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    #welcome-divider::before,
    #welcome-divider::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border-subtle);
    }
    #welcome-hint {
      margin: 16px 0 0;
      font-size: 0.78rem;
      color: var(--text-muted);
    }

    /* Skeleton Loader for Language List */
    .skeleton-card {
      padding: 10px 14px;
      border-radius: var(--radius-md);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }
    .skeleton-bar {
      height: 14px;
      border-radius: 4px;
      background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s infinite;
    }
    @keyframes shimmer {
      0% { background-position: 200% 0; }
      100% { background-position: -200% 0; }
    }

    /* Output Panel - Improved Accessibility Contrast */
    #output-text.high-contrast {
      color: #e2e8f0;
    }

    /* Empty State - Output Panel */
    .output-empty-state {
      color: var(--text-muted);
      font-size: 0.82rem;
      line-height: 2;
    }
    .output-empty-state .shortcut {
      display: inline-block;
      padding: 1px 7px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-subtle);
      border-radius: 4px;
      font-size: 0.75rem;
      font-family: 'JetBrains Mono', monospace;
      color: var(--text-secondary);
    }

    /* Resize Handle - vertical divider on desktop (col-resize), hidden on mobile */
    .resize-handle {
      height: 5px;
      width: 100%;
      cursor: row-resize;
      background: transparent;
      transition: background var(--transition-fast);
      flex-shrink: 0;
      position: relative;
      z-index: 5;
      touch-action: none; /* the handle owns its touch gestures */
    }
    .resize-handle:hover,
    .resize-handle.active {
      background: var(--accent-primary);
    }
    /* Invisible hit-area expander — the 5px divider drags like a ~15px one */
    .resize-handle::after {
      content: '';
      position: absolute;
      top: -5px;
      bottom: -5px;
      left: -5px;
      right: -5px;
    }
    /* Visible grip pill so the divider is discoverable (desktop divider is vertical) */
    @media (min-width: 769px) {
      .resize-handle::before {
        content: '';
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 3px;
        height: 36px;
        border-radius: 2px;
        background: var(--border-default);
        transition: background var(--transition-fast);
        pointer-events: none;
      }
      .resize-handle:hover::before,
      .resize-handle.active::before {
        background: #ffffff;
      }
    }

    /* SEO Accordion - High Performance & Clean UI */
    .seo-accordion-container {
      border-top: 1px solid var(--border-subtle);
      background: var(--bg-secondary);
      flex-shrink: 0;
    }
    .seo-toggle-btn {
      width: 100%;
      padding: 14px 24px;
      background: transparent;
      border: none;
      color: var(--text-secondary);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: all var(--transition-fast);
      font-family: 'Inter', system-ui, sans-serif;
    }
    .seo-toggle-btn:hover {
      color: var(--accent-primary);
      background: rgba(99, 102, 241, 0.05);
    }
    .seo-toggle-btn .chevron {
      transition: transform var(--transition-slow);
    }
    .seo-toggle-btn[aria-expanded="true"] .chevron {
      transform: rotate(180deg);
    }
    .seo-content-wrapper {
      display: grid;
      grid-template-rows: 0fr;
      transition: grid-template-rows 0.3s ease-out;
      background: var(--bg-primary);
    }
    .seo-content-wrapper.open {
      grid-template-rows: 1fr;
    }
    .seo-inner-content {
      overflow: hidden;
      padding: 0 24px;
      opacity: 0;
      transition: opacity 0.4s ease, padding 0.3s ease;
    }
    .seo-content-wrapper.open .seo-inner-content {
      opacity: 1;
      padding: 24px;
    }
    .seo-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 1.5rem;
      margin-bottom: 1.5rem;
    }
    .seo-heading {
      font-size: 1.3rem;
      color: var(--text-primary);
      margin-bottom: 1.25rem;
      font-weight: 600;
    }
    .seo-column h3 {
      color: var(--accent-secondary);
      font-size: 1rem;
      margin-bottom: 0.5rem;
      font-weight: 600;
    }
    .seo-column p,
    .seo-keywords-block p {
      color: var(--text-muted);
      font-size: 0.85rem;
      line-height: 1.6;
    }
    .seo-features-list {
      list-style: none;
      padding: 0;
    }
    .seo-features-list li {
      color: var(--text-muted);
      font-size: 0.85rem;
      padding: 4px 0;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .seo-features-list li::before {
      content: '';
      width: 5px;
      height: 5px;
      background: var(--accent-primary);
      border-radius: 50%;
      flex-shrink: 0;
    }
    .seo-keywords-block {
      padding-top: 1rem;
      border-top: 1px solid var(--border-subtle);
    }
    .seo-keywords-block h3 {
      color: var(--text-secondary);
      font-size: 0.85rem;
      font-weight: 600;
      margin-bottom: 0.5rem;
    }

    /* Info Button (legacy, keep for overlay content) */
    .btn-info {
      background: rgba(99, 102, 241, 0.1);
      border-color: rgba(99, 102, 241, 0.3);
      color: var(--accent-primary);
    }
    .btn-info:hover {
      background: rgba(99, 102, 241, 0.2);
      border-color: rgba(99, 102, 241, 0.5);
      color: var(--accent-primary);
    }

    /* SEO Info Overlay - Full Page Knowledge Panel */
    .seo-info-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      backdrop-filter: blur(12px);
      z-index: 9998;
      display: none;
      overflow-y: auto;
      padding: 40px 20px;
    }
    .seo-info-overlay.show {
      display: block;
    }
    .seo-info-box {
      max-width: 900px;
      margin: 0 auto;
      background: var(--bg-secondary);
      border: 1px solid var(--border-default);
      border-radius: var(--radius-xl);
      padding: 40px;
      position: relative;
      box-shadow: var(--shadow-lg);
    }
    .seo-info-close {
      position: absolute;
      top: 16px;
      right: 16px;
      background: var(--bg-tertiary);
      border: 1px solid var(--border-default);
      color: var(--text-secondary);
      width: 36px;
      height: 36px;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.2rem;
      transition: all var(--transition-fast);
    }
    .seo-info-close:hover {
      background: var(--error);
      color: white;
      border-color: transparent;
    }
    .seo-info-box h2 {
      font-size: 1.5rem;
      color: var(--text-primary);
      margin-bottom: 8px;
      font-weight: 850;
    }
    .seo-info-box h3 {
      font-size: 1.15rem;
      color: var(--accent-secondary);
      margin: 24px 0 12px;
      font-weight: 600;
    }
    .seo-info-box p {
      color: var(--text-muted);
      font-size: 0.9rem;
      line-height: 1.7;
      margin-bottom: 12px;
    }
    .seo-info-tags {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin: 12px 0;
    }
    .seo-info-tag {
      font-size: 0.75rem;
      padding: 4px 12px;
      background: rgba(99, 102, 241, 0.1);
      border: 1px solid rgba(99, 102, 241, 0.2);
      border-radius: 999px;
      color: var(--accent-primary);
    }
    .seo-lang-detail {
      background: var(--bg-tertiary);
      border-radius: var(--radius-md);
      padding: 16px 20px;
      margin: 16px 0;
      border-left: 3px solid var(--accent-primary);
    }
    .seo-lang-detail h3 {
      color: var(--text-primary);
      font-size: 1rem;
      margin-bottom: 8px;
    }
    .seo-lang-detail p {
      color: var(--text-secondary);
      font-size: 0.85rem;
      line-height: 1.6;
      margin-bottom: 0;
    }

    /* Mobile Responsive - Professional SaaS Mobile Experience */
    @media (max-width: 1024px) {
      .seo-info-box {
        padding: 24px;
      }
      .actions {
        flex-wrap: nowrap;
        gap: 6px;
      }
    }

    @media (max-width: 768px) {
      .seo-header {
       padding: 8px 12px;
      }
      .seo-header-inner {
        gap: 6px;
      }
      .seo-chip {
        font-size: 0.62rem;
        padding: 2px 8px;
      }
      .seo-header h1 {
       font-size: 0.8rem;
      }
      .seo-description {
        display: none;
      }
      .file-tab-bar {
        height: 32px;
        padding: 0 4px;
      }
      .file-tab {
        padding: 4px 10px;
        font-size: 0.75rem;
      }
      .seo-info-overlay {
        padding: 20px 12px;
      }
      .seo-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
      }
      
      aside {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        z-index: 1000;
        width: 85%;
        max-width: 300px;
        background: var(--bg-secondary);
        box-shadow: var(--shadow-lg);
      }
      aside.show {
        left: 0;
      }
      
      .burger {
        display: flex !important;
        align-items: center;
        justify-content: center;
      }
      
      header {
        padding: 0 16px;
        height: 56px;
      }
      
      #active-lang-label {
        font-size: 0.9rem;
      }
      
      .actions {
        gap: 6px;
      }
      .btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        min-height: 44px; /* touch-target guideline (Apple HIG / Android) */
      }
      .mobile-tab,
      .burger {
        min-height: 44px;
      }
      /* 16px inputs prevent iOS Safari zoom-on-focus */
      #search,
      .terminal-inline-input,
      .terminal-generic-textarea,
      .lt-input,
      .modal-input {
        font-size: 16px;
      }
      .btn span:not(.menu-label) {
        display: none;
      }
      /* Always show labels inside the More dropdown */
      .actions-menu .menu-label {
        display: inline !important;
      }
      .btn-run {
        padding: 6px 14px;
      }
      .btn-run span {
        display: inline;
      }
      
      #editor-container {
        min-height: 200px;
      }

      .seo-toggle-btn {
        padding: 12px 16px;
        font-size: 0.8rem;
      }
      
      .input-modal-box {
        max-height: 80vh;
        margin: 16px;
      }
    }

    @media (max-width: 480px) {
      .brand-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
      }
      
      .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
      }
    }

    /* Utility Classes */
    .hidden {
      display: none !important;
    }

    /* Skip link for keyboard users — visible only on focus */
    .skip-link {
      position: absolute;
      left: -9999px;
      top: 0;
      z-index: 10002;
      padding: 10px 16px;
      background: var(--accent-primary);
      color: #fff;
      font-weight: 600;
      border-radius: 0 0 var(--radius-md) 0;
      text-decoration: none;
    }
    .skip-link:focus {
      left: 0;
    }
    
    /* Focus Visible for Accessibility */
    *:focus-visible {
      outline: 2px solid var(--accent-primary);
      outline-offset: 2px;
    }
    
    button:focus-visible {
      outline-offset: 2px;
    }
  
  /* Split-view icon toggle button */
  .btn-split-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .icon-split-open { display: flex; }
  .icon-split-close { display: none; }
  body.editor-focus .icon-split-open { display: none; }
  body.editor-focus .icon-split-close { display: flex; }

  /* Dark theme: sidebar surface (header rule already defined above) */
  body.dark-theme aside {
    background: rgba(30, 41, 59, 0.95);
  }

  /* CodeMirror light mode */
  body:not(.dark-theme) .CodeMirror {
    background: #ffffff !important;
    color: #24292e !important;
  }
  body:not(.dark-theme) .CodeMirror-gutters {
    background: #f1f5f9 !important;
    border-right-color: rgba(100, 116, 139, 0.2) !important;
  }
  body:not(.dark-theme) .CodeMirror-linenumber {
    color: #6e7781 !important;
  }
  body:not(.dark-theme) .cm-keyword  { color: #cf222e !important; }
  body:not(.dark-theme) .cm-string   { color: #0a3069 !important; }
  body:not(.dark-theme) .cm-number   { color: #0550ae !important; }
  body:not(.dark-theme) .cm-comment  { color: #6e7781 !important; font-style: italic; }
  body:not(.dark-theme) .cm-def      { color: #6639ba !important; }
  body:not(.dark-theme) .cm-variable { color: #0550ae !important; }
  body:not(.dark-theme) .cm-atom     { color: #e16f24 !important; }
  body:not(.dark-theme) .cm-operator { color: #24292e !important; }
  body:not(.dark-theme) .cm-builtin  { color: #953800 !important; }
  body:not(.dark-theme) .cm-type     { color: #116329 !important; }
  body:not(.dark-theme) .CodeMirror-cursor { border-left-color: #0f172a !important; }
  body:not(.dark-theme) .CodeMirror-selected { background: #dbeafe !important; }

  /* Output text contrast in light mode */
  body:not(.dark-theme) #output-text {
    background: #f8fafc;
    color: #334155;
  }

      .stdin-status{
        font-size: 11px;
        font-weight: 600;
        color: var(--text-secondary);
        opacity: 0.9;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .stdin-status.ok{ color: var(--success); }
      .stdin-status.warn{ color: var(--warning); }

  /* ── Compact output header on small screens ──────────────────────────
     One row that always fits: status dot + runtime badge on the left,
     run stats on the right. The title text and the neutral "no stdin"
     notice are hidden; stdin status shows only when it carries a signal. */
  @media (max-width: 768px) {
    .output-head {
      padding: 8px 12px;
      gap: 8px;
    }
    .output-title {
      display: none;
    }
    .badge {
      font-size: 0.62rem;
      padding: 2px 8px;
      max-width: 36vw;
      flex-shrink: 1;
      min-width: 0;
    }
    .output-head-right {
      gap: 8px;
    }
    .run-stats {
      font-size: 0.66rem;
    }
    .stdin-status {
      max-width: 28vw;
    }
    /* Hide the neutral "no stdin detected" state — only real signals show */
    .stdin-status:not(.ok):not(.warn) {
      display: none;
    }
  }
