:root {
      --primary: #06b6d4;
      --primary-dark: #0891b2;
      --accent: #8b5cf6;
      --glow-primary: rgba(6,182,212,0.18);
      --glow-accent:  rgba(139,92,246,0.12);
    }
    :root.theme-light {
      --primary: #0891b2;
      --primary-dark: #0e7490;
      --accent: #7c3aed;
      --glow-primary: rgba(8,145,178,0.12);
      --glow-accent:  rgba(124,58,237,0.08);
    }

    .divider {
      width: 6px;
      flex-shrink: 0;
      background: var(--border);
      cursor: col-resize;
      position: relative;
      z-index: 10;
      transition: background 0.15s;
    }
    .divider:hover { background: var(--primary); opacity: 0.5; }
    .divider.dragging { background: var(--primary); opacity: 0.7; cursor: col-resize; }

    .dot-cyan   { background: var(--primary); box-shadow: 0 0 5px var(--glow-primary); }
    .dot-purple { background: var(--accent);  box-shadow: 0 0 5px rgba(139,92,246,.5); }

    #btnShowDup {
      position: relative;
    }
    #btnShowDup .eye-open,
    #btnShowDup .eye-closed {
      position: absolute;
      transition: opacity 0.2s;
    }
    #btnShowDup .eye-open {
      opacity: 1;
    }
    #btnShowDup .eye-closed {
      opacity: 0;
    }
    #btnShowDup.active .eye-open {
      opacity: 0;
    }
    #btnShowDup.active .eye-closed {
      opacity: 1;
      display: block !important;
    }
    #btnShowDup.active {
      color: var(--primary);
      border-color: var(--primary);
    }

    .input-wrap {
      flex: 1;
      position: relative;
      overflow: hidden;
      background: var(--surface);
      min-height: 0;
    }

    textarea {
      position: absolute;
      inset: 0;
      width: 100%; height: 100%;
      background: transparent;
      color: #a8b8cc;
      caret-color: #a8b8cc;
      border: none; outline: none; resize: none; padding: 16px;
      font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65; tab-size: 2;
      z-index: 1;
      white-space: pre-wrap;
      word-break: break-word;
    }
    textarea::placeholder { color: var(--text-muted); opacity: 0.7; }

    textarea::-webkit-scrollbar { width: 7px; height: 7px; }
    textarea::-webkit-scrollbar-track { background: transparent; }
    textarea::-webkit-scrollbar-thumb {
      background: rgba(120, 135, 165, 0.25);
      border-radius: 4px;
    }
    textarea::-webkit-scrollbar-thumb:hover  { background: rgba(120, 135, 165, 0.45); }
    textarea::-webkit-scrollbar-thumb:active { background: rgba(120, 135, 165, 0.65); }
    textarea { scrollbar-width: thin; scrollbar-color: rgba(120,135,165,.25) transparent; }

    :root.theme-light textarea {
      color: #2e3d52;
      caret-color: #2e3d52;
    }
    :root.theme-light textarea::-webkit-scrollbar-thumb { background: rgba(100,116,139,.2); }
    :root.theme-light textarea::-webkit-scrollbar-thumb:hover  { background: rgba(100,116,139,.38); }
    :root.theme-light textarea { scrollbar-color: rgba(100,116,139,.2) transparent; }

    #input:focus {
      box-shadow: inset 0 0 0 1.5px rgba(6,182,212,.4), inset 0 0 20px rgba(6,182,212,.04);
    }
    :root.theme-light #input:focus {
      box-shadow: inset 0 0 0 1.5px rgba(8,145,178,.35);
    }

    .output-wrap { flex: 1; overflow: auto; background: var(--surface); position: relative; }

    .output-wrap::-webkit-scrollbar { width: 7px; height: 7px; }
    .output-wrap::-webkit-scrollbar-track { background: transparent; }
    .output-wrap::-webkit-scrollbar-thumb {
      background: rgba(120, 135, 165, 0.25);
      border-radius: 4px;
    }
    .output-wrap::-webkit-scrollbar-thumb:hover  { background: rgba(120, 135, 165, 0.45); }
    .output-wrap::-webkit-scrollbar-thumb:active { background: rgba(120, 135, 165, 0.65); }
    .output-wrap { scrollbar-width: thin; scrollbar-color: rgba(120,135,165,.25) transparent; }

    :root.theme-light .output-wrap::-webkit-scrollbar-thumb { background: rgba(100,116,139,.2); }
    :root.theme-light .output-wrap::-webkit-scrollbar-thumb:hover  { background: rgba(100,116,139,.38); }
    :root.theme-light .output-wrap { scrollbar-color: rgba(100,116,139,.2) transparent; }

    .output-wrap:focus-within {
      box-shadow: inset 0 0 0 1.5px rgba(6,182,212,.4), inset 0 0 20px rgba(6,182,212,.04);
    }
    :root.theme-light .output-wrap:focus-within {
      box-shadow: inset 0 0 0 1.5px rgba(8,145,178,.35);
    }

    #output {
      padding: 16px; font-family: var(--font-mono); font-size: 13.5px;
      line-height: 1.65; white-space: pre-wrap; word-break: break-word;
      min-height: 100%;
      color: #a8b8cc;
      caret-color: #a8b8cc;
      outline: none;
    }
    :root.theme-light #output { color: #2e3d52; caret-color: #2e3d52; }
    #output:focus { box-shadow: none; }

    .line-dup {
      background: rgba(239,68,68,.13);
      color: #f87171;
      border-left: 2px solid rgba(239,68,68,.5);
      padding-left: 6px;
      margin-left: -8px;
      border-radius: 2px;
      display: block;
    }
    .line-unique {
      color: #a8b8cc;
    }
    :root.theme-light .line-unique { color: #2e3d52; }
    :root.theme-light .line-dup { color: #dc2626; }

    .badge { display: inline-block; padding: 1px 7px; border-radius: 20px; font-size: 11px; font-weight: 600; }
    .badge-ok   { background: rgba(52,200,138,.15); color: var(--success); }
    .badge-info { background: rgba(6,182,212,.15);  color: var(--primary); }
    .badge-warn { background: rgba(245,158,11,.15); color: var(--warning); }

    .mode-group {
      display: flex; gap: 5px;
    }
    .mode-opt {
      padding: 4px 10px; border-radius: 6px;
      border: 1px solid var(--border);
      background: transparent; color: var(--text-muted);
      cursor: pointer; font-size: 12px; font-weight: 500;
      transition: background 0.12s, color 0.12s, border-color 0.12s;
      user-select: none;
    }
    .mode-opt:hover { background: var(--border); color: var(--text); }
    .mode-opt.sel {
      background: rgba(6,182,212,.15); color: var(--primary);
      border-color: var(--primary);
    }

    .mode-select-caption {
      font-size: 12px;
      color: var(--text-muted);
      white-space: nowrap;
    }
    .mode-select-wrap { position: relative; }
    .mode-select-trigger {
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      min-width: 128px;
      padding: 7px 11px;
      border-radius: 7px;
      border: 1px solid var(--border);
      background: var(--surface2);
      color: var(--text);
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    }
    .mode-select-trigger.placeholder { color: var(--text-muted); }
    .mode-select-trigger:hover { border-color: var(--primary); background: var(--border); }
    .mode-select-trigger.active {
      border-color: var(--primary);
      box-shadow: 0 0 0 2px var(--glow-primary);
    }
    .mode-select-chevron {
      flex-shrink: 0;
      color: var(--text-muted);
      transition: transform 0.18s;
    }
    .mode-select-trigger.active .mode-select-chevron { transform: rotate(180deg); }

    .mode-select-popover {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      z-index: 250;
      min-width: 150px;
      padding: 6px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 0 16px var(--glow-primary);
    }
    .mode-select-popover.open { display: block; animation: tipFadeIn 0.12s ease; }
    .mode-select-option {
      padding: 7px 10px;
      border-radius: 6px;
      font-size: 13px;
      color: var(--text);
      cursor: pointer;
      user-select: none;
      transition: background 0.12s, color 0.12s;
    }
    .mode-select-option:hover { background: var(--border); }
    .mode-select-option.sel {
      background: var(--glow-primary);
      color: var(--primary);
      font-weight: 600;
    }
    :root.theme-light .mode-select-popover {
      box-shadow: 0 8px 24px rgba(0,0,0,.14);
    }

    .mode-select-native {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .custom-separator-input {
      display: none;
      width: 96px;
      padding: 7px 10px;
      margin-left: 8px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: var(--surface2);
      color: var(--text);
      font-size: 13px;
      transition: border-color 0.15s, box-shadow 0.15s;
    }
    .custom-separator-input::placeholder { color: var(--text-muted); }
    .custom-separator-input:focus {
      outline: none;
      border-color: var(--primary);
      box-shadow: 0 0 0 2px var(--glow-primary);
    }

    .mode-tooltip {
      position: fixed;
      z-index: 600;
      background: #13151e;
      border: 1px solid rgba(6,182,212,.3);
      border-radius: 9px;
      padding: 10px 13px;
      min-width: 200px;
      max-width: 260px;
      box-shadow: 0 8px 28px rgba(0,0,0,.55), 0 0 14px rgba(6,182,212,.1);
      pointer-events: none;
      display: none;
      animation: tipFadeIn 0.12s ease;
    }
    .mode-tooltip.show { display: block; }
    @keyframes tipFadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to   { opacity: 1; transform: translateY(0); }
    }
    .tip-title {
      font-size: 12px; font-weight: 700;
      color: var(--primary);
      margin-bottom: 5px;
      display: flex; align-items: center; gap: 5px;
    }
    .tip-desc {
      font-size: 12px; color: var(--text-muted);
      line-height: 1.6; margin-bottom: 7px;
    }
    .tip-example {
      background: rgba(255,255,255,.04);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 6px 9px;
      font-family: var(--font-mono);
      font-size: 11.5px;
      line-height: 1.7;
    }
    .tip-ex-label {
      font-size: 10px; font-weight: 600; text-transform: uppercase;
      letter-spacing: 0.4px; color: var(--text-muted); margin-bottom: 3px;
    }
    .tip-ex-row { display: flex; align-items: center; gap: 7px; }
    .tip-ex-in  { color: #a8b8cc; }
    .tip-ex-arr { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
    .tip-ex-out { color: var(--success); }
    .tip-ex-del { color: var(--danger); text-decoration: line-through; opacity: .7; }

    :root.theme-light .mode-tooltip {
      background: #f0faff;
      border-color: rgba(8,145,178,.35);
      box-shadow: 0 8px 24px rgba(0,0,0,.14);
    }
    :root.theme-light .tip-example { background: rgba(0,0,0,.03); }
    :root.theme-light .tip-ex-in { color: #2e3d52; }

    .input-highlight {
      position: absolute;
      inset: 0;
      pointer-events: none;   padding: 16px;
      font-family: var(--font-mono); font-size: 13.5px; line-height: 1.65; tab-size: 2;
      white-space: pre-wrap;
      word-break: break-word;
      overflow: auto;         z-index: 2;             color: transparent;     scrollbar-width: none;  }
    .input-highlight::-webkit-scrollbar { display: none; }
    .dedup-view #input {
      color: transparent !important;
      caret-color: transparent;
    }
    .dedup-view .input-highlight {
      pointer-events: auto;   }

    .hl-unique {
      display: inline;
      color: #a8b8cc;
      border-radius: 3px;
      transition: background 0.12s, outline 0.12s, box-shadow 0.12s;
      white-space: pre-wrap;
      word-break: break-word;
    }
    :root.theme-light .hl-unique { color: #2e3d52; }
    
    .hl-unique.hl-source {
      position: relative;
    }

    .hl-dup {
      display: inline;
      color: #f87171;
      cursor: pointer;
      transition: background 0.12s;
      background: rgba(248,113,113,.12);
    }
    :root.theme-light .hl-dup { color: #dc2626; }

    .hl-dup:hover {
      background: rgba(248,113,113,.2);
    }
    .hl-unique.hl-source-active {
      background: rgba(6,182,212,.15);
      color: #22d3ee;
    }
    :root.theme-light .hl-unique.hl-source-active {
      background: rgba(8,145,178,.1);
      color: #0891b2;
    }

    .hl-dup.hl-hover {
      background: rgba(248,113,113,.25);
      outline: 1.5px solid rgba(248,113,113,.6);
    }


    .empty-hint {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 10px;
      color: var(--text-muted);
      pointer-events: none;
      opacity: 0.7;
      font-size: 13px;
    }
    .empty-hint svg { opacity: 0.4; }
    .empty-hint.hidden { display: none; }
