  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #0ea5a4;
    --accent-hover: #0d9488;
    --success: #15803d;
    --warning: #b45309;
    --error: #e11d48;
    --shadow: rgba(15,23,42,0.08);
  }
  [data-theme="dark"] {
    --bg: #0a0e1a;
    --surface: #111827;
    --border: #1f2937;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #fb7185;
    --shadow: rgba(0,0,0,0.35);
  }


  * { box-sizing: border-box; margin: 0; padding: 0; }
  html { color-scheme: light; }
  [data-theme="dark"] { color-scheme: dark; }
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg); color: var(--text);
    min-height: 100vh; padding: 2rem;
    transition: background 0.2s, color 0.2s;
  }
  .container { max-width: 960px; margin: 0 auto; }
  .card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 1px 3px var(--shadow); padding: 1.5rem;
    transition: background 0.2s, border-color 0.2s;
  }
  h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; color: var(--text); letter-spacing: -0.01em; }
  .subtitle { color: var(--muted); font-size: 0.85rem; margin-bottom: 1.5rem; }
  .badge {
    display: inline-block; background: rgba(52,211,153,0.15); color: var(--success);
    font-size: 0.7rem; padding: 2px 8px; border-radius: 9999px; margin-left: 0.5rem;
    vertical-align: middle; font-weight: 500;
  }
  .theme-toggle {
    background: var(--surface); color: var(--muted); border: 1px solid var(--border);
    border-radius: 9999px; width: 2.1rem; height: 2.1rem; font-size: 1rem;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    padding: 0; transition: all 0.15s;
  }
  .theme-toggle:hover { color: var(--text); border-color: var(--accent); }
  label {
    display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem;
    font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
  }
  textarea {
    width: 100%; background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); padding: 0.75rem 1rem;
    font-family: 'SF Mono','Fira Code','Consolas',monospace; font-size: 0.85rem;
    line-height: 1.5; resize: vertical; transition: border-color 0.2s, background 0.2s;
  }
  textarea:focus { outline: none; border-color: var(--accent); }
  #input { min-height: 280px; }
  #output { min-height: 160px; }
  .actions { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; }
  button {
    background: var(--accent); color: var(--bg); border: none; border-radius: 6px;
    padding: 0.55rem 1.2rem; font-size: 0.85rem; font-weight: 600; cursor: pointer;
    transition: background 0.15s, transform 0.1s;
  }
  [data-theme="dark"] button { color: #ffffff; }
  button:hover { background: var(--accent-hover); }
  button:active { transform: scale(0.97); }
  .btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--border); }
  .output-section { margin-top: 1rem; }
  .status { font-size: 0.8rem; margin-top: 0.5rem; min-height: 1.2em; }
  .status.ok { color: var(--success); }
  .status.warn { color: var(--warning); }
  .status.err { color: var(--error); }
  .params-found { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.35rem; }
  .param-tag {
    font-size: 0.7rem; padding: 2px 8px; border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
  }
  .param-tag.abnormal { background: color-mix(in srgb, var(--error) 16%, transparent); color: var(--error); }
  .param-tag.section { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
  .divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
  .help-toggle {
    color: var(--muted); font-size: 0.8rem; cursor: pointer; text-decoration: underline;
    background: none; border: none; padding: 0; font-weight: 400;
  }
  .help-toggle:hover { color: var(--text); background: none; }
  .help-content {
    display: none; margin-top: 0.75rem; padding: 1rem; background: var(--bg);
    border: 1px solid var(--border); border-radius: 8px; font-size: 0.8rem; line-height: 1.6; color: var(--muted);
  }
  .help-content.show { display: block; }
  .help-content code {
    background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 5px; border-radius: 3px;
    color: var(--accent); font-size: 0.78rem;
  }
  .history-section { margin-top: 1.5rem; }
  .history-item {
    background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.6rem 0.8rem; margin-bottom: 0.4rem;
    font-family: 'SF Mono','Fira Code','Consolas',monospace; font-size: 0.8rem;
    line-height: 1.4; cursor: pointer; transition: border-color 0.15s;
    word-break: break-word; white-space: pre-wrap;
  }
  .history-item:hover { border-color: var(--accent); }
  .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
  .history-header label { margin: 0; }

  /* Tabs */
  .tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
  }
  .tab {
    background: none;
    color: var(--muted);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: 0;
  }
  .tab:hover { color: var(--text); background: none; }
  .tab.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }
  .tab-content { display: none; }
  .tab-content.active { display: block; }
  .type-btn {
    background: var(--bg); color: var(--muted); border: 1px solid var(--border);
    border-radius: 4px; padding: 0.35rem 0.7rem; font-size: 0.78rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s;
  }
  .type-btn:hover { color: var(--text); border-color: var(--accent); background: var(--bg); }
  .type-btn.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
  .preset-btn {
    background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
    border-radius: 4px; padding: 0.3rem 0.6rem; font-size: 0.72rem; font-weight: 500;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
  }
  .preset-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }
  .preset-btn:active { transform: scale(0.95); }
