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

  input:-webkit-autofill {
  display: none !important;
  }

  :root {
    --bg: #0a0a0f;
    --surface: #111118;
    --surface2: #18181f;
    --border: #2a2a35;
    --border-bright: #3d3d52;
    --accent: #6c63ff;
    --accent2: #ff6584;
    --accent3: #3dd6a8;
    --text: #f0f0f8;
    --text-muted: #9090b8; /* Increased contrast for better visibility */
    --white: #fff;
    --text-dim: #606080; /* Adjusted for better contrast */
    --mono: 'IBM Plex Mono', monospace;
    --display: 'Syne', sans-serif;
    --error: #ff4d6a;
    --warn: #ffb547;
    --info: #4db6ff;
    --hint: #a0a0c0;
  }

  /* Light mode variables */
  .light-mode {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface2: #f1f3f4;
    --border: #dadce0;
    --border-bright: #bdc1c6;
    --accent: #1a73e8;
    --accent2: #ea4335;
    --accent3: #34a853;
    --text: #202124;
    --text-muted: #5f6368;
    --text-dim: #80868b;
  }

  html { scroll-behavior: smooth; }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--display);
    min-height: 100vh;
    overflow-x: hidden;
  }

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

  ::-webkit-scrollbar-track {
    background: var(--surface);
  }

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

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

  ::-webkit-scrollbar-corner {
    background: var(--surface);
  }

  /* ── GRID BACKGROUND ── */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(rgba(108,99,255,0.04) 1px, transparent 1px),
      linear-gradient(90deg, rgba(108,99,255,0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
  }

  .light-mode body::before {
    background-image:
      linear-gradient(rgba(189,193,198,0.3) 1px, transparent 1px),
      linear-gradient(90deg, rgba(189,193,198,0.3) 1px, transparent 1px);
  }

  /* ── HEADER ── */
  header {
    position: relative;
    z-index: 10;
    padding: 32px 48px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .logo-mark {
    width: 36px; height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono);
    font-weight: 600;
    font-size: 14px;
    color: #fff;
    letter-spacing: -1px;
    flex-shrink: 0;
  }

  .light-mode .logo-mark {
    color: var(--surface);
  }

  .logo-text {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
  }

  .logo-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 1px;
  }

  .info-btn {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent3);
    background: rgba(67,224,176,0.08);
    border: 1px solid rgba(67,224,176,0.2);
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .info-btn:hover {
    background: rgba(67,224,176,0.15);
  }

  .header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
  }

  .theme-toggle:hover {
    background: var(--surface2);
    border-color: var(--border-bright);
  }

  .light-mode .theme-toggle::before {
    content: '🌙';
  }

  .theme-toggle::before {
    content: '☀️';
  }

  /* ── MODAL ── */
  .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
  }

  .modal-content {
    background-color: var(--surface);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid var(--border);
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    color: var(--text);
  }

  .modal-content h2 {
    margin-top: 0;
    color: var(--accent3);
  }

  .modal-content p {
    margin: 10px 0;
  }

  .modal-content a {
    color: var(--accent);
    text-decoration: none;
  }

  .modal-content a:hover {
    text-decoration: underline;
  }

  .close {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
  }

  .close:hover {
    color: var(--text);
  }

  /* ── HERO ── */
  .hero {
    position: relative;
    z-index: 10;
    padding: 48px 48px 0;
    max-width: 720px;
  }

  .hero h1 {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -2px;
    color: var(--text);
    margin-bottom: 16px;
  }

  .hero h1 span { color: var(--accent); }

  .hero p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    font-family: var(--mono);
    max-width: 560px;
  }

  /* ── STEP PILLS ── */
  .steps {
    position: relative; z-index: 10;
    display: flex; gap: 8px;
    padding: 32px 48px 0;
    flex-wrap: wrap;
  }

  .step-pill {
    display: flex; align-items: center; gap: 8px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: all 0.3s ease;
    animation: stepPillFadeIn 0.5s ease-out;
    animation-fill-mode: both;
  }

  .step-pill:nth-child(1) { animation-delay: 0.1s; }
  .step-pill:nth-child(2) { animation-delay: 0.2s; }
  .step-pill:nth-child(3) { animation-delay: 0.3s; }
  .step-pill:nth-child(4) { animation-delay: 0.4s; }

  @keyframes stepPillFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
  }

  .step-pill.active {
    color: var(--accent);
    border-color: rgba(108,99,255,0.4);
    background: rgba(108,99,255,0.08);
    box-shadow: 0 0 20px rgba(108,99,255,0.2);
    transform: scale(1.05);
  }

  .step-pill .num {
    width: 18px; height: 18px;
    background: var(--border);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
    font-weight: 600;
  }

  .step-pill.active .num {
    background: var(--accent);
    color: #fff;
  }

  /* ── MAIN LAYOUT ── */
  .main {
    position: relative; z-index: 10;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    padding: 24px 48px 48px;
    width: 100%;
    max-width: 2000px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }

  /* Direct children of .main must never grow beyond their column */
  .main > * {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  /* Align header/hero/steps with the centered main on very wide screens */
  @media (min-width: 2000px) {
    header, .hero, .steps {
      max-width: 2000px;
      margin-left: auto;
      margin-right: auto;
      width: 100%;
      box-sizing: border-box;
    }

    /* Increase font sizes for large displays */
    body { font-size: 18px; }
    .hero h1 { font-size: clamp(40px, 6vw, 60px); }
    .hero p { font-size: 18px; }
    .step-pill .num { font-size: 11px; }
    .panel-title { font-size: 14px; }
    .panel-subtitle { font-size: 11px; }
    label { font-size: 11px; }
    select, input[type="text"], textarea { font-size: 14px; padding: 14px 16px; }
    .test-btn { font-size: 13px; padding: 14px 20px; }
    .generate-btn { font-size: 15px; }
    .output-title { font-size: 24px; }
    .tab-btn { font-size: 12px; }
    .copy-btn { font-size: 12px; }
    pre { font-size: 13.5px; }
    .step-content h3 { font-size: 15px; }
    .step-content p { font-size: 13px; }
  }

  @media (min-width: 2400px) {
    .main {
      max-width: none;
    }
    header, .hero, .steps {
      max-width: none;
      padding-left: 10vw;
      padding-right: 10vw;
    }
  }

  @media (max-width: 960px) {
    .main { grid-template-columns: 1fr; }
    header, .hero, .steps, .main { padding-left: 24px; padding-right: 24px; }
  }

  /* ── PANEL ── */
  .panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: visible;
    min-width: 0;
    width: 100%;
    animation: panelSlideIn 0.6s ease-out;
    animation-fill-mode: both;
  }

  .panel:nth-child(1) { animation-delay: 0.1s; }
  .panel:nth-child(2) { animation-delay: 0.2s; }
  .panel:nth-child(3) { animation-delay: 0.3s; }

  @keyframes panelSlideIn {
    from {
      opacity: 0;
      transform: translateY(20px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .panel-header {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 16px 16px 0 0;
  }

  .panel-icon {
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
  }

  .panel-icon.purple { background: rgba(108,99,255,0.15); }
  .panel-icon.teal   { background: rgba(67,224,176,0.12); }

  .panel-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: var(--text);
  }

  .panel-subtitle {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
    letter-spacing: 0.5px;
  }

  .panel-body { padding: 24px; display: flex; flex-direction: column; gap: 20px; min-width: 0; overflow: visible; }

  /* ── FORM ELEMENTS ── */
  .field { display: flex; flex-direction: column; gap: 8px; min-width: 0; width: 100%; }

  label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 6px;
  }

  label .required { color: var(--accent2); }

  select, input[type="text"], textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 12px 14px;
    outline: none;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
  }

  select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237070a0' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
  }

  select:focus, input[type="text"]:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
  }

  input.invalid {
    border-color: var(--error);
  }

  textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
  }

  /* ── SEVERITY SELECTOR ── */
  .severity-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .sev-btn {
    padding: 10px 6px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
  }

  .sev-btn .symbol {
    font-size: 14px;
    transition: all 0.15s;
    display: block;
    margin-bottom: 2px;
  }

  .sev-btn.selected[data-sev="error"]   { border-color: var(--error);   background: rgba(255,77,106,0.08);   color: var(--error); }
  .sev-btn.selected[data-sev="warning"] { border-color: var(--warn);    background: rgba(255,181,71,0.08);    color: var(--warn); }
  .sev-btn.selected[data-sev="info"]    { border-color: var(--info);    background: rgba(77,182,255,0.08);    color: var(--info); }
  .sev-btn.selected[data-sev="hint"]    { border-color: var(--hint);    background: rgba(160,160,192,0.08);   color: var(--hint); }

  /* Hover glow effects */
  .sev-btn:hover[data-sev="error"]   { box-shadow: 0 0 20px rgba(255,77,106,0.4), 0 0 40px rgba(255,77,106,0.2); }
  .sev-btn:hover[data-sev="warning"] { box-shadow: 0 0 20px rgba(255,181,71,0.4), 0 0 40px rgba(255,181,71,0.2); }
  .sev-btn:hover[data-sev="info"]    { box-shadow: 0 0 20px rgba(77,182,255,0.4), 0 0 40px rgba(77,182,255,0.2); }
  .sev-btn:hover[data-sev="hint"]    { box-shadow: 0 0 20px rgba(160,160,192,0.4), 0 0 40px rgba(160,160,192,0.2); }

  /* ── RULE TYPE TOGGLE ── */
  .type-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .type-btn {
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
  }

  .type-btn .type-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    display: block;
  }

  .type-btn.selected {
    border-color: var(--accent);
    background: rgba(108,99,255,0.1);
    color: var(--accent);
  }

  .type-btn.selected .type-name { color: var(--accent); }

  /* ── REGEX TEST AREA ── */
  .regex-test-area { display: flex; flex-direction: column; gap: 8px; }

  .test-input-row {
    display: flex; gap: 8px;
  }

  .test-input-row input { flex: 1; }

  .test-btn {
    padding: 12px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    letter-spacing: 0.5px;
  }

  .test-btn:hover { background: #7c74ff; transform: translateY(-1px); }
  .test-btn:active { transform: translateY(0); }

  .test-result {
    font-family: var(--mono);
    font-size: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    display: none;
  }

  .test-result.match    { background: rgba(67,224,176,0.1);  color: var(--accent3); border: 1px solid rgba(67,224,176,0.2); }
  .test-result.no-match { background: rgba(255,77,106,0.08); color: var(--error);   border: 1px solid rgba(255,77,106,0.2); }

  /* ── OUTPUT PANEL ── */
  .output-panel {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: visible;
    min-width: 0;
    width: 100%;
  }

  .output-header {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    border-radius: 16px 16px 0 0; 
    background: var(--surface2);
  }

  .output-title {
    font-size: 20px; font-weight: 700; color: var(--text);
  }

  .warning-box {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: rgba(255,181,71,0.08);
    border: 1px solid rgba(255,181,71,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    max-width: 400px;
  }

  .warning-icon {
    font-size: 14px;
    flex-shrink: 0;
    margin-top: 1px;
  }

  .warning-text {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--warn);
    line-height: 1.4;
  }

  .output-tabs {
    display: flex; gap: 4px; margin-left: auto;
  }

  .tab-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.5px;
  }

  .tab-btn.active {
    background: var(--surface);
    border-color: var(--border-bright);
    color: var(--text);
  }

  .copy-btn {
    padding: 6px 16px;
    background: rgba(108,99,255,0.15);
    border: 1px solid rgba(108,99,255,0.3);
    border-radius: 6px;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.5px;
  }

  .copy-btn:hover { background: rgba(108,99,255,0.25); }
  .copy-btn.copied { color: var(--accent3); border-color: rgba(67,224,176,0.3); background: rgba(67,224,176,0.08); }

  /* ── CODE BLOCK ── */
  .code-wrap { position: relative; }

  pre {
    padding: 24px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.75;
    color: #c8c8f0;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
  }

  pre::-webkit-scrollbar { width: 6px; height: 6px; }
  pre::-webkit-scrollbar-track { background: transparent; }
  pre::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

  .tok-comment  { color: #5a5a8a; font-style: italic; }
  .tok-keyword  { color: #6c63ff; }
  .tok-string   { color: #43e0b0; }
  .tok-fn       { color: #ffb547; }
  .tok-prop     { color: #ff6584; }
  .tok-num      { color: #4db6ff; }
  .tok-type     { color: #c084fc; }

  /* ── INSTRUCTIONS PANEL ── */
  .instructions { display: none; }
  .instructions.active { display: block; }

  .step-card {
    display: flex; gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
  }

  .step-card:last-child { border-bottom: none; }

  .step-num {
    width: 28px; height: 28px;
    background: rgba(108,99,255,0.15);
    border: 1px solid rgba(108,99,255,0.3);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
  }

  .step-content { flex: 1; }

  .step-content h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
  }

  .step-content p {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.65;
  }

  .inline-code {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: var(--accent3);
  }

  /* ── GENERATE BTN ── */
  .generate-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: var(--display);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    position: relative;
    overflow: hidden;
  }

  .generate-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
  }

  .generate-btn:hover:not(:disabled) {
    background: #7c74ff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108,99,255,0.3);
  }

  .generate-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(108,99,255,0.2);
  }

  .generate-btn:disabled {
    cursor: not-allowed;
  }

  .spinner {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
  }

  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .generate-btn:hover { background: #7c74ff; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(108,99,255,0.35); }
  .generate-btn:active { transform: translateY(0); }

  .generate-btn svg { width: 16px; height: 16px; }

  /* ── EMPTY STATE ── */
  .empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.8;
  }

  .empty-state .big { font-size: 32px; margin-bottom: 12px; opacity: 0.3; }

  /* ── FIELD ROW ── */
  .field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    min-width: 0;
  }

  /* VERIFY BUTTON */
  .verify-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #0a0a0f;
  background: var(--warn);
  border: none;
  border-radius: 4px;
  padding: 3px 10px;
  cursor: pointer;
  margin-left: 8px;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.verify-btn:hover:not(:disabled) { opacity: 0.85; }
.verify-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--text-dim); color: var(--text); }

  /* ── MOBILE BREAKPOINTS ── */
  @media (max-width: 600px) {
    /* Stack the two-col field row */
    .field-row {
      grid-template-columns: 1fr;
    }

    /* Stack severity to 2 cols instead of 4 */
    .severity-grid {
      grid-template-columns: repeat(2, 1fr);
    }

    /* Stack rule type toggle */
    .type-toggle {
      grid-template-columns: 1fr;
    }

    /* Output header wraps on small screens */
    .output-header {
      flex-wrap: wrap;
      gap: 8px;
    }
    .output-tabs {
      margin-left: 0;
      flex-wrap: wrap;
    }

    /* AI input row stacks */
    .ai-input-row {
      flex-direction: column;
    }
    .ai-input-row input,
    .ai-gen-btn {
      width: 100%;
    }

    /* Test row stacks */
    .test-input-row {
      flex-direction: column;
    }
    .test-input-row input,
    .test-btn {
      width: 100%;
    }

    /* Pattern lib header wraps */
    .pat-lib-header {
      flex-wrap: wrap;
    }

    /* Pattern items: shrink the Use button, don't let name overflow */
    .pat-item-use {
      padding: 6px 10px;
      font-size: 9px;
    }

    /* Node picker pills wrap naturally — already flex-wrap */
    .node-picker {
      overflow: hidden;
    }

    pre {
      font-size: 11px;
    }
  }

  /* ── NOTIFICATION ── */
  .notif {
    position: fixed;
    bottom: 24px; right: 24px;
    background: var(--surface2);
    border: 1px solid var(--accent3);
    color: var(--accent3);
    padding: 12px 20px;
    border-radius: 10px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    transform: translateY(80px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .notif.warn { border-color: var(--warn); color: var(--warn); }

  .notif.show { transform: translateY(0); opacity: 1; }

  .progress-bar {
    width: 0%;
    height: 3px;
    background: #4CAF50;
    border-radius: 2px;
    margin-top: 8px;
    transition: width 1s linear;
  }

  /* ── AST HELPER ── */
  .ast-hint {
    background: rgba(108,99,255,0.06);
    border: 1px solid rgba(108,99,255,0.2);
    border-radius: 8px;
    padding: 14px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.8;
  }

  .ast-hint strong { color: var(--accent); font-weight: 600; }

  .ast-node-chips {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  }

  .chip {
    padding: 4px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.3px;
    user-select: none;
  }

  .chip:hover { border-color: var(--accent3); background: rgba(67,224,176,0.08); color: var(--accent3); }
  .chip.selected { border-color: var(--accent3); background: rgba(67,224,176,0.15); color: var(--accent3); font-weight: 600; }

  select option { background: #18181f; }

  /* ── INPUT INVALID STATE ── */
  input.invalid {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(255,77,106,0.1);
  }

  /* ══ AI REGEX BOX ══ */
  .ai-box {
    background: rgba(108,99,255,0.05);
    border: 1px solid rgba(108,99,255,0.2);
    border-radius: 12px;
    overflow: hidden;
  }

  .ai-box-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(108,99,255,0.15);
    background: rgba(108,99,255,0.08);
  }

  .ai-badge {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #fff;
    background: var(--accent);
    padding: 3px 7px;
    border-radius: 4px;
    flex-shrink: 0;
  }

  .ai-box-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
  }

  .ai-box-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    margin-left: auto;
  }

  .ai-box-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .ai-examples {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .ai-example-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-dim);
    flex-shrink: 0;
  }

  .ai-chip {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent);
    background: rgba(108,99,255,0.1);
    border: 1px solid rgba(108,99,255,0.25);
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.2px;
  }

  .ai-chip:hover {
    background: rgba(108,99,255,0.2);
    border-color: rgba(108,99,255,0.5);
  }

  .ai-input-row {
    display: flex;
    gap: 8px;
  }

  .ai-input-row input {
    flex: 1;
    font-size: 12px;
    padding: 10px 12px;
  }

  .ai-gen-btn {
    padding: 10px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .ai-gen-btn:hover { background: #7c74ff; }
  .ai-gen-btn:disabled { opacity: 0.5; cursor: not-allowed; }

  .ai-gen-btn.loading {
    background: var(--surface2);
    color: var(--text-muted);
    border: 1px solid var(--border);
  }

  /* AI result states */
  #aiResult {
    font-family: var(--mono);
    font-size: 11px;
    border-radius: 8px;
    padding: 12px 14px;
    line-height: 1.7;
  }

  #aiResult.success {
    background: rgba(67,224,176,0.06);
    border: 1px solid rgba(67,224,176,0.2);
    color: var(--text-muted);
  }

  #aiResult.error {
    background: rgba(255,77,106,0.06);
    border: 1px solid rgba(255,77,106,0.2);
    color: var(--error);
  }

  .ai-result-pattern {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .ai-result-label {
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent3);
    flex-shrink: 0;
  }

  .ai-result-code {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent3);
    background: rgba(67,224,176,0.08);
    border: 1px solid rgba(67,224,176,0.2);
    padding: 4px 10px;
    border-radius: 6px;
    flex: 1;
    word-break: break-all;
  }

  .ai-use-btn {
    font-family: var(--mono);
    font-size: 10px;
    color: #fff;
    background: var(--accent3);
    border: none;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    color: #0a0a0f;
    font-weight: 700;
  }

  .ai-use-btn:hover { opacity: 0.85; }

  .ai-result-explain {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 4px;
  }

  .ai-result-example {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(67,224,176,0.1);
  }

  .ai-result-example-label {
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 4px;
  }

  .ai-result-example-code {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--warn);
    background: rgba(255,181,71,0.06);
    border: 1px solid rgba(255,181,71,0.15);
    padding: 8px 10px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-all;
  }

  /* ══ NODE PICKER ══ */
  .node-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
  }

  .node-pill {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--surface2);
    overflow: hidden;
    transition: border-color 0.15s;
  }

  .node-pill:hover { border-color: var(--border-bright); }

  .node-pill.selected {
    border-color: var(--accent3);
    background: rgba(67,224,176,0.08);
  }

  .node-pill-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 10px 4px 10px;
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
  }

  .node-pill.selected .node-pill-label { color: var(--accent3); font-weight: 600; }

  .node-pill-info {
    font-size: 10px;
    color: var(--text-dim);
    padding: 4px 8px 4px 4px;
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1;
    border-left: 1px solid transparent;
  }

  .node-pill:hover .node-pill-info { color: var(--text-muted); }
  .node-pill.selected .node-pill-info { color: var(--accent3); border-left-color: rgba(67,224,176,0.2); }

  /* ══ NODE INFO CARD ══ */
  .node-info-card {
    background: var(--surface2);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    overflow: hidden;
    animation: slideDown 0.15s ease;
  }

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

  .nic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(108,99,255,0.08);
    border-bottom: 1px solid var(--border);
  }

  .nic-name {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
  }

  .nic-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: color 0.15s;
  }

  .nic-close:hover { color: var(--text); }

  .nic-desc {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.7;
    padding: 12px 16px 0;
  }

  .nic-section-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 12px 16px 6px;
  }

  .nic-pre {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--warn);
    background: rgba(255,181,71,0.05);
    border-top: 1px solid rgba(255,181,71,0.1);
    border-bottom: 1px solid rgba(255,181,71,0.1);
    padding: 10px 16px;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.6;
    max-height: none;
  }

  .nic-props {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px 14px;
  }

  .nic-prop-chip {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent3);
    background: rgba(67,224,176,0.07);
    border: 1px solid rgba(67,224,176,0.2);
    padding: 3px 8px;
    border-radius: 4px;
  }

  /* TOOLTIP */
  .tooltip {
  position: relative;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
}

/* Tooltip text */
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: max-content;
  max-width: 200px;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;

  position: absolute;
  bottom: 125%; /* above button */
  left: 50%;
  transform: translateX(-50%);

  transition: opacity 0.2s ease;
  z-index: 10;
}

/* Arrow */
.tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

/* Show on hover */
.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

  /* ══ PATTERN LIBRARY ══ */
  .pat-lib-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
  }

  .pat-lib-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(67,224,176,0.05);
  }

  .pat-lib-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent3);
    letter-spacing: 0.3px;
    flex-shrink: 0;
  }

  .pat-search {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 11px;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.2s;
    width: auto;
  }

  .pat-search:focus { border-color: var(--accent3); }

  .pat-lib-tabs {
    display: flex;
    gap: 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 4px;
  }

  .pat-tab {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
  }

  .pat-tab:hover { color: var(--text); border-color: var(--border); }

  .pat-tab.active {
    color: var(--accent3);
    border-color: rgba(67,224,176,0.3);
    background: rgba(67,224,176,0.08);
  }

  .pat-lib-list {
    max-height: 320px;
    overflow-y: auto;
  }

  .pat-lib-list::-webkit-scrollbar { width: 4px; }
  .pat-lib-list::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 2px; }

  .pat-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    gap: 2px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.12s;
    min-width: 0;
    overflow: hidden;
  }

  .pat-item:last-child { border-bottom: none; }
  .pat-item:hover { background: rgba(67,224,176,0.04); }

  .pat-item-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pat-item-cat {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-dim);
    grid-column: 1;
    grid-row: 2;
  }

  .pat-item-cat.database    { color: #4db6ff; }
  .pat-item-cat.security    { color: #ff6584; }
  .pat-item-cat.performance { color: #ffb547; }
  .pat-item-cat.code-quality { color: #43e0b0; }
  .pat-item-cat.solid       { color: #c084fc; }

  .pat-item-pattern {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--accent3);
    background: rgba(67,224,176,0.06);
    border: 1px solid rgba(67,224,176,0.15);
    padding: 3px 8px;
    border-radius: 4px;
    grid-column: 1;
    grid-row: 3;
    margin-top: 4px;
    width: fit-content;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pat-item-use {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: #0a0a0f;
    background: var(--accent3);
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: center;
    transition: opacity 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .pat-item-use:hover { opacity: 0.85; }

  .pat-empty {
    padding: 24px;
    text-align: center;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
  }

  /* ══ PATTERN ITEM — LANGUAGE BADGE  (added v0.2) ══
     .pat-item grid gains a 4th row for the meta strip
     (category + language badge side by side)
  ══════════════════════════════════════════════════ */

  /* Move pattern chip to row 3, keep Use button spanning all rows */
  .pat-item {
    grid-template-rows: auto auto auto;
  }

  /* Meta row: category + language badge inline */
  .pat-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    grid-column: 1;
    grid-row: 2;
    margin-top: 1px;
  }

  /* Override the old standalone .pat-item-cat row placement */
  .pat-item-cat {
    grid-column: unset;
    grid-row: unset;
  }

  /* Language badge */
  .pat-item-lang {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid;
    flex-shrink: 0;
  }

  /* Badge colours — one per language */
  .pat-lang-all    { color: #9090b8; border-color: rgba(144,144,184,0.3); background: rgba(144,144,184,0.07); }
  .pat-lang-js-ts  { color: #f0db4f; border-color: rgba(240,219,79,0.3);  background: rgba(240,219,79,0.07);  }
  .pat-lang-python { color: #4db6ff; border-color: rgba(77,182,255,0.3);  background: rgba(77,182,255,0.07);  }
  .pat-lang-java   { color: #ff8f47; border-color: rgba(255,143,71,0.3);  background: rgba(255,143,71,0.07);  }
  .pat-lang-cpp    { color: #a78bfa; border-color: rgba(167,139,250,0.3); background: rgba(167,139,250,0.07); }

  /* ══ LANGUAGE TARGET DROPDOWN  (added v0.2) ══
     The ruleLanguage select in the regex section.
     No special styles needed — inherits from select{}.
     Light-mode overrides for the language badge colours:
  ══════════════════════════════════════════════════ */
  .light-mode .pat-lang-all    { color: #5f6368; border-color: rgba(95,99,104,0.3);  background: rgba(95,99,104,0.07);  }
  .light-mode .pat-lang-js-ts  { color: #b8860b; border-color: rgba(184,134,11,0.3); background: rgba(184,134,11,0.07); }
  .light-mode .pat-lang-python { color: #1a73e8; border-color: rgba(26,115,232,0.3); background: rgba(26,115,232,0.07); }
  .light-mode .pat-lang-java   { color: #e8710a; border-color: rgba(232,113,10,0.3); background: rgba(232,113,10,0.07); }
  .light-mode .pat-lang-cpp    { color: #7c3aed; border-color: rgba(124,58,237,0.3); background: rgba(124,58,237,0.07); }
  /* ══ CONFIRMATION MODAL ══ */
  .confirm-modal-content {
    max-width: 420px;
    text-align: center;
    padding: 32px 28px;
  }

  .confirm-icon {
    font-size: 36px;
    margin-bottom: 12px;
    line-height: 1;
  }

  .confirm-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    letter-spacing: -0.3px;
  }

  .confirm-body {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--white);
    line-height: 1.7;
    margin-bottom: 16px;
  }

  /* Quality issues — shown when hint/message are weak */
  .confirm-quality-check {
    display: none;
    margin-bottom: 16px;
    text-align: left;
  }

  .confirm-quality-issue {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--warn);
    background: rgba(255,181,71,0.07);
    border: 1px solid rgba(255,181,71,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 6px;
    line-height: 1.5;
  }

  .confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .confirm-btn {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
  }

  /* Yes, copy it — primary action */
  .confirm-btn-primary {
    background: var(--accent3);
    color: #0a0a0f;
    border-color: var(--accent3);
  }
  .confirm-btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

  /* Not yet — secondary */
  .confirm-btn-secondary {
    background: var(--surface2);
    color: var(--text-muted);
    border-color: var(--border);
  }
  .confirm-btn-secondary:hover { border-color: var(--border-bright); color: var(--text); }

  /* Open Claude — accent action */
  .confirm-btn-accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
  }
  .confirm-btn-accent:hover { background: #7c74ff; transform: translateY(-1px); }

  /* Skip for now — ghost */
  .confirm-btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border-color: transparent;
  }
  .confirm-btn-ghost:hover { color: var(--text-muted); }

  /* ══════════════════════════════════════════════════════
     RESPONSIVE — additions for new components (v0.2+)
  ══════════════════════════════════════════════════════ */

  /* ── Laptop range: 960px–1200px ─────────────────────
     Main grid already stacks at 960px (from original CSS).
     Reduce padding so content isn't cramped. */
  @media (max-width: 1200px) and (min-width: 961px) {
    header, .hero, .steps, .main {
      padding-left: 28px;
      padding-right: 28px;
    }
  }

  /* ── Tablet: 601px–960px ─────────────────────────── */
  @media (max-width: 960px) {
    /* Warning box in output header — allow it to go full width */
    .warning-box {
      max-width: 100%;
    }

    /* Output header: wrap so warning box doesn't get squished */
    .output-header {
      flex-wrap: wrap;
      align-items: flex-start;
    }

    /* Pat lib tabs: reduce padding on smaller screens */
    .pat-tab {
      padding: 4px 9px;
      font-size: 9px;
    }

    /* Language badge: slightly smaller */
    .pat-item-lang {
      font-size: 7px;
      padding: 1px 5px;
    }
  }

  /* ── Mobile: ≤ 600px ─────────────────────────────── */
  @media (max-width: 600px) {

    /* Confirmation modal — full width with safe margins */
    .confirm-modal-content {
      width: calc(100% - 28px);
      margin: 10% auto;
      padding: 24px 18px;
    }

    .confirm-icon { font-size: 28px; }

    .confirm-title { font-size: 16px; }

    .confirm-body { font-size: 11px; }

    /* Warning box — stack icon and text */
    .warning-box {
      max-width: 100%;
      flex-wrap: wrap;
    }

    /* Verify button — full width on mobile */
    .verify-btn {
      display: block;
      margin-left: 0;
      margin-top: 6px;
      width: 100%;
      text-align: center;
    }

    /* Pattern lib tabs wrap and shrink */
    .pat-lib-tabs {
      padding: 6px 10px;
    }
    .pat-tab {
      font-size: 9px;
      padding: 3px 8px;
    }

    /* Pat item — compress on very small screens */
    .pat-item {
      padding: 10px 12px;
    }
    .pat-item-name {
      font-size: 11px;
    }

    /* Language badge — hide label text, just show colour dot effect */
    .pat-item-lang {
      font-size: 7px;
      padding: 1px 5px;
      letter-spacing: 0;
    }

    /* Node pills — smaller on mobile */
    .node-pill-label {
      font-size: 9px;
      padding: 4px 8px;
    }

    /* Multiline fields box */
    #multilineFields {
      padding: 10px;
    }

    /* Info modal */
    .modal-content {
      width: calc(100% - 28px);
      margin: 20% auto;
      padding: 20px 16px;
    }

    /* Notif — full width */
    .notif {
      left: 14px;
      right: 14px;
      bottom: 14px;
    }
  }

  /* ── Very small: ≤ 380px (iPhone SE etc) ─────────── */
  @media (max-width: 380px) {
    header {
      padding: 12px 12px 0;
    }

    .logo-sub {
      display: none;
    }

    .hero h1 {
      font-size: 26px;
      letter-spacing: -1px;
    }

    .step-pill {
      padding: 5px 10px;
      font-size: 10px;
    }

    /* Hide step pill labels, keep just numbers */
    .step-pill > span:not(.num) {
      display: none;
    }

    .panel-body {
      padding: 16px 14px;
    }

    .severity-grid {
      gap: 6px;
    }

    .sev-btn {
      font-size: 9px;
      padding: 8px 4px;
    }
  }

  /* ══════════════════════════════════════════════════════
     CONFUSED? BUTTON
  ══════════════════════════════════════════════════════ */
  .help-btn {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: rgba(108,99,255,0.08);
    border: 1px solid rgba(108,99,255,0.22);
    padding: 6px 14px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .help-btn:hover {
    background: rgba(108,99,255,0.16);
    border-color: rgba(108,99,255,0.45);
    transform: translateY(-1px);
  }

  /* ══════════════════════════════════════════════════════
     HELP MODAL — outer shell
  ══════════════════════════════════════════════════════ */
  .help-modal-content {
    width: 90%;
    max-width: 720px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    margin: 5vh auto;
  }

  /* ── Header ── */
  .help-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 28px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
  }

  .help-modal-eyebrow {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    display: block;
    margin-bottom: 4px;
  }

  .help-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    margin: 0;
  }

  .help-modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s;
    flex-shrink: 0;
    margin-left: 16px;
    margin-top: 2px;
  }

  .help-modal-close:hover { color: var(--text); }

  /* ── Scrollable body ── */
  .help-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 0;
  }

  .help-modal-body::-webkit-scrollbar { width: 5px; }
  .help-modal-body::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

  /* ══════════════════════════════════════════════════════
     ACCORDION SECTIONS
  ══════════════════════════════════════════════════════ */
  .help-section {
    border-bottom: 1px solid var(--border);
  }

  .help-section:last-child { border-bottom: none; }

  .help-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 28px;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
  }

  .help-section-toggle:hover { background: rgba(108,99,255,0.04); }

  .help-section-num {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    flex-shrink: 0;
  }

  .help-section-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
  }

  .help-section-chevron {
    font-size: 14px;
    color: var(--text-dim);
    flex-shrink: 0;
    transition: transform 0.2s;
  }

  .help-section-toggle[aria-expanded="true"] .help-section-chevron {
    transform: rotate(180deg);
  }

  /* ── Section body ── */
  .help-section-body {
    padding: 0 28px 24px;
  }

  /* ══════════════════════════════════════════════════════
     STEP-BY-STEP (section 1)
  ══════════════════════════════════════════════════════ */
  .help-steps {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .help-step {
    display: flex;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
  }

  .help-step:last-child { border-bottom: none; }

  .help-step-num {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(108,99,255,0.12);
    border: 1px solid rgba(108,99,255,0.28);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 1px;
  }

  .help-step-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
  }

  .help-step-desc {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.75;
  }

  .help-step-desc code {
    color: var(--accent3);
    background: rgba(61,214,168,0.08);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
  }

  /* ══════════════════════════════════════════════════════
     TWO-COL CARDS (use / don't use)
  ══════════════════════════════════════════════════════ */
  .help-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .help-card {
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid;
  }

  .help-card-green {
    background: rgba(61,214,168,0.05);
    border-color: rgba(61,214,168,0.2);
  }

  .help-card-red {
    background: rgba(255,77,106,0.05);
    border-color: rgba(255,77,106,0.2);
  }

  .help-card-title {
    font-size: 11px;
    font-weight: 700;
    margin-bottom: 10px;
    font-family: var(--mono);
  }

  .help-card-green .help-card-title { color: var(--accent3); }
  .help-card-red   .help-card-title { color: var(--error); }

  .help-card-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .help-card-list li {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.5;
    padding-left: 12px;
    position: relative;
  }

  .help-card-green .help-card-list li::before { content: '✓ '; color: var(--accent3); position: absolute; left: 0; }
  .help-card-red   .help-card-list li::before { content: '✗ '; color: var(--error);   position: absolute; left: 0; }

  .help-card-list li code {
    color: var(--accent3);
    font-size: 9px;
  }

  /* ══════════════════════════════════════════════════════
     CODE EXAMPLES
  ══════════════════════════════════════════════════════ */
  .help-example-block {
    margin-bottom: 20px;
  }

  .help-example-block:last-child { margin-bottom: 0; }

  .help-example-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
  }

  .help-example-label code {
    color: var(--accent3);
  }

  .help-example-desc {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 8px;
  }

  .help-code {
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.65;
    color: var(--accent3);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    white-space: pre;
    margin: 0;
  }

  .help-code-dim { color: var(--text-muted); }

  /* ══════════════════════════════════════════════════════
     AST EXPLAINER + TREE
  ══════════════════════════════════════════════════════ */
  .help-explainer {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .help-explainer b { color: var(--text); }

  .help-ast-tree {
    margin-bottom: 20px;
  }

  .help-ast-label {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
  }

  /* ══════════════════════════════════════════════════════
     RESOURCE LINKS (section 4)
  ══════════════════════════════════════════════════════ */
  .help-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .help-link {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.15s;
    border: 1px solid transparent;
  }

  .help-link:hover {
    background: rgba(108,99,255,0.06);
    border-color: var(--border);
  }

  .help-link-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
  }

  .help-link-body { flex: 1; min-width: 0; }

  .help-link-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
  }

  .help-link-desc {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.65;
  }

  .help-link-desc b { color: var(--text); }

  .help-link-arrow {
    font-size: 14px;
    color: var(--text-dim);
    flex-shrink: 0;
    transition: color 0.15s, transform 0.15s;
    margin-top: 2px;
  }

  .help-link:hover .help-link-arrow {
    color: var(--accent);
    transform: translate(2px, -2px);
  }

  /* ══════════════════════════════════════════════════════
     RESPONSIVE — help modal
  ══════════════════════════════════════════════════════ */
  @media (max-width: 600px) {
    .help-modal-content {
      width: calc(100% - 20px);
      max-height: 92vh;
      margin: 4vh auto;
    }

    .help-modal-header { padding: 18px 18px 14px; }
    .help-modal-title  { font-size: 15px; }
    .help-section-toggle { padding: 14px 18px; gap: 10px; }
    .help-section-body   { padding: 0 18px 18px; }
    .help-section-label  { font-size: 12px; }

    .help-two-col {
      grid-template-columns: 1fr;
    }

    .help-code { font-size: 10px; }

    .help-step-desc { font-size: 10px; }
  }

  /* ══════════════════════════════════════════════════════
     CUSTOM SELECT COMPONENTS
     Replaces native <select> on all screen sizes.
     category pills · language pills · context dropdown
  ══════════════════════════════════════════════════════ */

  /* ── Pill grid (category + language) ── */
  .custom-pill-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .cpill {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    user-select: none;
    line-height: 1;
  }

  .cpill:hover {
    border-color: var(--border-bright);
    color: var(--text);
    background: var(--surface2);
  }

  .cpill.cpill-selected {
    border-color: var(--accent);
    background: rgba(108,99,255,0.12);
    color: var(--accent);
    font-weight: 600;
  }

  /* Tighter on very small screens */
  @media (max-width: 380px) {
    .cpill {
      font-size: 10px;
      padding: 6px 10px;
    }
  }

  /* ── Custom dropdown (context type) ── */
  .custom-dropdown {
    position: relative;
    width: 100%;
  }

  .cdd-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
  }

  .cdd-trigger:focus,
  .custom-dropdown.cdd-open .cdd-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(108,99,255,0.12);
    outline: none;
  }

  .cdd-value {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
  }

  .cdd-arrow {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
  }

  .custom-dropdown.cdd-open .cdd-arrow {
    transform: rotate(180deg);
  }

  .cdd-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border-bright);
    border-radius: 10px;
    overflow-y: auto;
    max-height: 280px;
    z-index: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    animation: cddFadeIn 0.12s ease;
  }

  /* Opens upward when .cdd-up modifier is added by JS */
  .custom-dropdown.cdd-up .cdd-menu {
    top: auto;
    bottom: calc(100% + 4px);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.25);
  }

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

  .cdd-option {
    width: 100%;
    display: block;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 11px 16px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    line-height: 1.4;
  }

  .cdd-option:last-child { border-bottom: none; }

  .cdd-option:hover {
    background: rgba(108,99,255,0.06);
    color: var(--text);
  }

  .cdd-option.cdd-selected {
    color: var(--accent);
    background: rgba(108,99,255,0.08);
    font-weight: 600;
  }

  /* Light mode adjustments */
  .light-mode .cdd-menu {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  }

  /* Mobile — make dropdown menu max-height scrollable */
  @media (max-width: 600px) {
    .cdd-menu {
      max-height: 260px;
      overflow-y: auto;
    }
    .cdd-trigger {
      font-size: 12px;
      padding: 11px 12px;
    }
    .cdd-option {
      font-size: 11px;
      padding: 12px 14px;
    }
  }