:root {
      --ink: #0b1739;
      --muted: #66728e;
      --line: rgba(111, 128, 171, 0.17);
      --blue: #1768ff;
      --blue-deep: #0c4ee8;
      --violet: #7a4cff;
      --green: #12a967;
      --orange: #f36a2c;
      --page: #f8fbff;
      --white: rgba(255, 255, 255, 0.84);
      --glass: rgba(255, 255, 255, 0.72);
      --shadow: 0 24px 65px rgba(53, 82, 150, 0.11);
      --radius: 28px;
    }

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

    body {
      min-width: 320px;
      min-height: 100vh;
      color: var(--ink);
      background:
        radial-gradient(circle at 14% 22%, rgba(87, 170, 255, 0.15), transparent 24rem),
        radial-gradient(circle at 88% 16%, rgba(123, 76, 255, 0.12), transparent 27rem),
        linear-gradient(180deg, #ffffff 0%, var(--page) 100%);
      font-family: "Avenir Next", Avenir, "PingFang SC", "Microsoft YaHei", sans-serif;
      overflow-x: hidden;
    }

    body::before,
    body::after {
      position: fixed;
      z-index: -1;
      content: "";
      pointer-events: none;
      border: 1px solid rgba(103, 126, 197, 0.09);
      border-radius: 50%;
    }

    body::before {
      width: 560px;
      height: 560px;
      top: 120px;
      right: -315px;
      box-shadow: 0 0 0 58px rgba(98, 129, 230, 0.022), 0 0 0 116px rgba(98, 129, 230, 0.018);
    }

    body::after {
      width: 420px;
      height: 420px;
      left: -300px;
      bottom: -80px;
      box-shadow: 0 0 0 48px rgba(50, 156, 255, 0.025), 0 0 0 96px rgba(50, 156, 255, 0.018);
    }

    a { color: inherit; }
    button, a { -webkit-tap-highlight-color: transparent; }
    button, input, textarea { font: inherit; }

    .site-header {
      height: 82px;
      border-bottom: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.76);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    .header-inner {
      width: min(1440px, calc(100% - 48px));
      height: 100%;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 28px;
    }

    .header-start {
      display: flex;
      align-items: center;
      gap: 16px;
      min-width: 0;
    }

    .back-home {
      min-height: 38px;
      padding: 8px 13px 8px 10px;
      display: inline-flex;
      align-items: center;
      gap: 7px;
      color: #43516f;
      border: 1px solid rgba(82, 100, 134, 0.16);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.72);
      box-shadow: 0 5px 18px rgba(52, 72, 119, 0.05);
      text-decoration: none;
      white-space: nowrap;
      font-size: 13px;
      font-weight: 650;
      transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    }

    .back-home:hover {
      color: var(--blue);
      border-color: rgba(23, 104, 255, 0.28);
      box-shadow: 0 8px 20px rgba(44, 90, 188, 0.10);
      transform: translateX(-2px);
    }

    .back-home svg,
    .nav-item svg,
    .tool-button svg,
    .upload-button svg {
      fill: none;
      stroke: currentColor;
      stroke-width: 2;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .back-home svg { width: 17px; height: 17px; }

    .brand {
      display: inline-flex;
      align-items: center;
      gap: 13px;
      color: var(--ink);
      min-width: 0;
    }

    .brand-mark {
      position: relative;
      width: 48px;
      height: 48px;
      flex: 0 0 48px;
      display: grid;
      place-items: center;
      color: white;
      border-radius: 15px;
      background: linear-gradient(150deg, #0b77ff 7%, #3d55ff 56%, #ad31ed 100%);
      box-shadow: 0 10px 22px rgba(53, 83, 239, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.42);
      font-size: 30px;
      font-weight: 750;
      line-height: 1;
    }

    .brand-mark::after {
      position: absolute;
      width: 16px;
      height: 4px;
      top: 12px;
      right: 8px;
      content: "";
      border-radius: 99px;
      background: rgba(255, 255, 255, 0.32);
      transform: rotate(-18deg);
    }

    .brand-word-icon {
      width: 52px;
      height: 52px;
      flex: 0 0 52px;
      display: grid;
      place-items: center;
    }

    .brand-word-icon svg {
      width: 52px;
      height: 52px;
      filter: drop-shadow(0 10px 18px rgba(53, 83, 239, 0.18));
    }

    .brand-copy { display: grid; line-height: 1.05; min-width: 0; }
    .brand-name { font-size: 25px; font-weight: 750; letter-spacing: -0.04em; white-space: nowrap; }
    .brand-name span { color: var(--blue); }
    .brand-subtitle { margin-top: 5px; color: #263354; font-size: 13px; font-weight: 650; letter-spacing: 0.08em; white-space: nowrap; }

    .header-nav {
      display: flex;
      align-items: center;
      gap: 24px;
      color: #34425f;
      font-size: 14px;
      font-weight: 600;
      white-space: nowrap;
    }

    .nav-item {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      text-decoration: none;
      color: inherit;
    }

    .nav-item svg { width: 19px; height: 19px; color: #526486; stroke-width: 1.8; }

    a.nav-item:hover { opacity: .72; }

    .page-shell {
      width: min(1440px, calc(100% - 48px));
      margin: 0 auto;
      padding: 18px 0 28px;
    }

    .top-grid {
      display: grid;
      grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr);
      gap: 20px;
      align-items: stretch;
    }

    .intro-card,
    .control-card,
    .text-card {
      position: relative;
      border: 1px solid rgba(255, 255, 255, 0.95);
      border-radius: var(--radius);
      background: var(--white);
      box-shadow: var(--shadow), inset 0 0 0 1px rgba(78, 101, 154, 0.05);
      overflow: hidden;
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }

    .intro-card {
      min-height: 224px;
      padding: 26px 26px 24px;
      display: flex;
      flex-direction: column;
      background:
        radial-gradient(circle at 80% 20%, rgba(23, 104, 255, 0.12), transparent 13rem),
        linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(241, 247, 255, 0.82));
    }

    .intro-kicker {
      width: fit-content;
      padding: 7px 13px;
      color: #37527e;
      border: 1px solid rgba(69, 105, 176, 0.15);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.67);
      box-shadow: 0 8px 30px rgba(60, 91, 149, 0.06);
      font-size: 12px;
      font-weight: 650;
      letter-spacing: 0.12em;
    }

    .intro-title {
      margin-top: 24px;
      color: transparent;
      background: linear-gradient(120deg, #0871ff 4%, #3f63ff 52%, #8c5cff 100%);
      -webkit-background-clip: text;
      background-clip: text;
      font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
      font-size: clamp(32px, 3.1vw, 45px);
      font-weight: 800;
      line-height: 1.18;
      letter-spacing: -0.035em;
      white-space: nowrap;
    }

    .intro-subtitle {
      margin-top: 15px;
      color: var(--ink);
      font-size: 18px;
      font-weight: 720;
      letter-spacing: -0.03em;
    }

    .intro-desc {
      margin-top: 9px;
      color: #64708b;
      font-size: 13px;
      line-height: 1.6;
    }

    .intro-principles {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 8px;
      margin-top: auto;
      padding-top: 22px;
    }

    .principle {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      color: #34425f;
      font-size: 12px;
      line-height: 1.45;
    }

    .principle::before {
      width: 8px;
      height: 8px;
      margin-top: 7px;
      content: "";
      flex: 0 0 8px;
      border-radius: 50%;
      background: var(--blue);
      box-shadow: 0 0 0 5px rgba(23, 104, 255, 0.10);
    }

    .control-card {
      height: 410px;
      min-height: 410px;
      display: grid;
      grid-template-rows: auto 1fr auto;
    }

    .tabs {
      display: flex;
      gap: 10px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.52);
    }

    .tab-button {
      min-height: 36px;
      padding: 0 15px;
      color: #526486;
      border: 1px solid rgba(82, 100, 134, 0.12);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.62);
      cursor: pointer;
      font-size: 14px;
      font-weight: 700;
      transition: 0.2s ease;
    }

    .tab-button:hover,
    .tab-button.active {
      color: white;
      border-color: transparent;
      background: linear-gradient(120deg, var(--blue), #6052f4);
      box-shadow: 0 10px 22px rgba(49, 93, 236, 0.18);
    }

    .tab-panel {
      display: none;
      height: 292px;
      padding: 14px 16px;
      overflow: hidden;
    }

    .tab-panel.active {
      display: flex;
      flex-direction: column;
    }

    .tab-panel.rules-panel-active {
      height: auto;
      min-height: 292px;
      max-height: 520px;
    }

    .panel-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 10px;
    }

    .panel-title h2 {
      color: var(--ink);
      font-size: 19px;
      font-weight: 740;
      letter-spacing: -0.04em;
    }

    .panel-title p,
    .field-hint {
      color: #78839b;
      font-size: 12px;
      line-height: 1.6;
    }



    .preset-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(220px, 1fr));
      grid-template-rows: repeat(2, minmax(82px, 1fr));
      gap: 12px;
      flex: 1;
      min-height: 0;
    }

    .preset-card {
      min-height: 0;
      height: 100%;
      padding: 13px 14px;
      text-align: left;
      color: #43516f;
      border: 1px solid rgba(82, 100, 134, 0.14);
      border-radius: 20px;
      background: rgba(255, 255, 255, 0.62);
      cursor: pointer;
      transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    }

    .preset-card:hover,
    .preset-card.active {
      transform: translateY(-2px);
      border-color: rgba(23, 104, 255, 0.30);
      background: rgba(255, 255, 255, 0.92);
      box-shadow: 0 12px 26px rgba(44, 90, 188, 0.10);
    }

    .preset-card.active {
      color: white;
      border-color: transparent;
      background: linear-gradient(120deg, var(--blue), #6052f4);
    }

    .preset-card strong {
      display: block;
      margin-bottom: 6px;
      font-size: 14px;
      line-height: 1.2;
    }

    .preset-card span {
      display: block;
      color: inherit;
      opacity: 0.78;
      font-size: 12px;
      line-height: 1.45;
    }

    .node-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 6px;
      max-height: none;
      overflow: auto;
      padding-right: 2px;
    }

    .node-grid::-webkit-scrollbar {
      width: 5px;
    }
    .node-grid::-webkit-scrollbar-track {
      background: transparent;
    }
    .node-grid::-webkit-scrollbar-thumb {
      background: rgba(82, 100, 134, 0.18);
      border-radius: 99px;
    }

    .rule-group-label {
      grid-column: 1 / -1;
      padding: 6px 0 2px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.06em;
      border-top: 1px solid var(--line);
      margin-top: 4px;
    }
    .rule-group-label:first-child {
      border-top: 0;
      margin-top: 0;
    }

    .rule-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-top: 12px;
    }

    .node {
      min-height: 56px;
      padding: 8px 10px;
      display: flex;
      align-items: flex-start;
      gap: 8px;
      border: 1px solid rgba(82, 100, 134, 0.10);
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.52);
      cursor: pointer;
      transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    }

    .node:hover {
      border-color: rgba(23, 104, 255, 0.20);
      background: rgba(255, 255, 255, 0.82);
    }

    .node.selected {
      border-color: rgba(23, 104, 255, 0.22);
      background: rgba(23, 104, 255, 0.04);
    }

    .node.detect {
      border-style: dashed;
    }

    .node input[type="checkbox"] {
      width: 16px;
      height: 16px;
      margin-top: 1px;
      flex: 0 0 16px;
      accent-color: var(--blue);
      cursor: pointer;
    }

    .node input[type="checkbox"]:disabled {
      cursor: default;
    }

    .node-text {
      min-width: 0;
      flex: 1;
    }

    .node strong {
      display: block;
      color: #162449;
      font-size: 12.5px;
      font-weight: 700;
      line-height: 1.25;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .node span {
      display: block;
      margin-top: 2px;
      color: #78839b;
      font-size: 10.5px;
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .intent-area {
      display: flex;
      flex: 1;
      min-height: 0;
    }

    .intent-box {
      min-height: 0;
      width: 100%;
      height: 100%;
      resize: none;
      padding: 16px;
      color: var(--ink);
      border: 1px solid rgba(82, 100, 134, 0.16);
      border-radius: 20px;
      outline: none;
      background: rgba(255, 255, 255, 0.72);
      line-height: 1.7;
    }

    .intent-box:focus,
    .text-input:focus {
      border-color: rgba(23, 104, 255, 0.45);
      box-shadow: 0 0 0 4px rgba(23, 104, 255, 0.08);
    }

    .llm-note {
      padding: 10px 13px;
      color: #43516f;
      border: 1px solid rgba(23, 104, 255, 0.12);
      border-radius: 18px;
      background: rgba(23, 104, 255, 0.055);
      font-size: 13px;
      line-height: 1.7;
    }

    .control-actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 10px;
      min-height: 64px;
      padding: 9px 16px 15px;
      border-top: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.36);
    }

    .tool-button {
      min-height: 40px;
      padding: 0 16px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      color: #43516f;
      border: 1px solid rgba(82, 100, 134, 0.16);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.72);
      cursor: pointer;
      font-size: 13px;
      font-weight: 700;
      transition: 0.2s ease;
    }

    .tool-button svg { width: 16px; height: 16px; }

    .tool-button:hover {
      color: var(--blue);
      border-color: rgba(23, 104, 255, 0.28);
      transform: translateY(-1px);
      box-shadow: 0 8px 20px rgba(44, 90, 188, 0.10);
    }

    .tool-button.primary {
      color: white;
      border-color: transparent;
      background: linear-gradient(120deg, var(--blue), #6052f4);
      box-shadow: 0 10px 22px rgba(49, 93, 236, 0.22);
    }

    .tool-button.danger {
      color: #a43c1b;
      border-color: rgba(196, 82, 43, 0.18);
      background: rgba(255, 248, 244, 0.88);
    }

    .tool-button.danger:hover {
      color: #8f2d12;
      border-color: rgba(196, 82, 43, 0.30);
      box-shadow: 0 8px 20px rgba(196, 82, 43, 0.10);
    }

    .result-actions {
      display: flex;
      align-items: center;
      flex-direction: row;
      flex-wrap: nowrap;
      gap: 10px;
      flex: 0 0 auto;
      white-space: nowrap;
    }

    .source-actions {
      display: flex;
      align-items: center;
      flex-direction: row;
      flex-wrap: nowrap;
      gap: 10px;
      flex: 0 0 auto;
      white-space: nowrap;
    }

    .download-options {
      position: fixed;
      top: 0;
      left: 0;
      z-index: 100;
      width: 108px;
      padding: 6px;
      display: grid;
      gap: 5px;
      border: 1px solid rgba(82, 100, 134, 0.14);
      border-radius: 16px;
      background: rgba(255, 255, 255, 0.96);
      box-shadow: 0 18px 38px rgba(44, 72, 133, 0.15);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      opacity: 0;
      pointer-events: none;
      transform: translateY(-4px);
      transition: opacity 0.16s ease, transform 0.16s ease;
    }

    .download-options[hidden] {
      display: none !important;
    }

    .download-options.open {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }

    .download-options button {
      min-height: 34px;
      padding: 0 12px;
      color: #43516f;
      border: 0;
      border-radius: 11px;
      background: transparent;
      cursor: pointer;
      text-align: left;
      font-size: 13px;
      font-weight: 750;
    }

    .download-options button:hover {
      color: var(--blue);
      background: rgba(23, 104, 255, 0.075);
    }

    .compare-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 20px;
      margin-top: 14px;
    }

    .text-card {
      min-height: 560px;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
    }

    .result-card {
      overflow: hidden;
    }

    .card-head {
      height: 94px;
      min-height: 94px;
      padding: 18px 20px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      border-bottom: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.52);
    }

    .card-title h2 {
      color: var(--ink);
      font-size: 23px;
      font-weight: 740;
      letter-spacing: -0.04em;
    }

    .title-row {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .status-badge {
      min-height: 24px;
      padding: 0 9px;
      display: inline-flex;
      align-items: center;
      color: #64708b;
      border: 1px solid rgba(82, 100, 134, 0.13);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.62);
      font-size: 12px;
      font-weight: 750;
      letter-spacing: 0;
      white-space: nowrap;
    }

    .status-badge.processing {
      color: #0c4ee8;
      border-color: rgba(23, 104, 255, 0.18);
      background: rgba(23, 104, 255, 0.075);
    }

    .status-badge.done {
      color: #0d6b43;
      border-color: rgba(18, 169, 103, 0.18);
      background: rgba(18, 169, 103, 0.075);
    }

    .card-title p {
      margin-top: 4px;
      color: #78839b;
      font-size: 12px;
    }

    .upload-button {
      position: relative;
      min-height: 38px;
      padding: 0 14px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      color: var(--blue);
      border: 1px dashed rgba(23, 104, 255, 0.35);
      border-radius: 999px;
      background: rgba(23, 104, 255, 0.055);
      cursor: pointer;
      font-size: 13px;
      font-weight: 750;
      overflow: hidden;
    }

    .upload-button svg { width: 16px; height: 16px; }
    .upload-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

    .text-input,
    .output {
      width: 100%;
      height: 430px;
      border: 0;
      outline: none;
      resize: none;
      padding: 22px;
      color: #142247;
      background: transparent;
      font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
      font-size: 17px;
      line-height: 1.85;
      overflow: auto;
    }

    .output {
      white-space: pre-wrap;
    }

    .output.empty { color: rgba(102, 114, 142, 0.72); }

    .pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 10px;
      color: #64708b;
      border: 1px solid rgba(82, 100, 134, 0.13);
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.58);
      font-size: 12px;
      font-weight: 750;
    }

    mark.ai {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(255, 196, 56, 0.46);
      color: #5b3b00;
    }

    mark[data-highlight-key] {
      cursor: context-menu;
    }

    mark.dup {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(18, 169, 103, 0.16);
      color: #0d5b39;
    }

    mark.source {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(122, 76, 255, 0.16);
      color: #4a2bb0;
    }

    mark.web-noise {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(243, 106, 44, 0.16);
      color: #93380f;
    }

    mark.url {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(23, 104, 255, 0.14);
      color: #0c4ee8;
    }

    mark.emoji {
      padding: 2px 5px;
      border-radius: 7px;
      background: rgba(236, 72, 153, 0.14);
      color: #9d174d;
    }

    .toast {
      position: fixed;
      left: 50%;
      bottom: 24px;
      z-index: 20;
      transform: translateX(-50%) translateY(20px);
      padding: 12px 16px;
      color: white;
      border-radius: 999px;
      background: linear-gradient(120deg, var(--blue), #6052f4);
      box-shadow: 0 14px 30px rgba(49, 93, 236, 0.26);
      font-weight: 750;
      opacity: 0;
      pointer-events: none;
      transition: 0.22s ease;
    }

    .toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }

    @media (max-width: 1180px) {
      .top-grid,
      .compare-grid {
        grid-template-columns: 1fr;
      }

      .node-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 760px) {
      .site-header { height: 72px; }
      .header-inner, .page-shell { width: min(100% - 28px, 1440px); }
      .back-home span, .brand-subtitle, .header-nav .nav-item span { display: none; }
      .back-home { width: 38px; height: 38px; min-height: 38px; padding: 0; justify-content: center; }
      .brand-mark { width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; font-size: 26px; }
      .brand-word-icon,
      .brand-word-icon svg { width: 44px; height: 44px; flex-basis: 44px; }
      .brand-name { font-size: 21px; }
      .page-shell { padding-top: 18px; }
      .intro-card { padding: 24px; min-height: auto; }
      .control-card { height: auto; min-height: 0; }
      .tab-panel { height: auto; min-height: 260px; overflow: visible; }
      .preset-grid { grid-template-columns: 1fr; }
      .node-grid { grid-template-columns: 1fr; height: 230px; }
      .panel-title, .card-head { align-items: flex-start; flex-direction: column; }
      .result-card .card-head {
        align-items: center;
        flex-direction: row;
      }
      .result-card .card-title {
        min-width: 0;
      }
      .result-actions {
        margin-left: auto;
      }
      .source-actions {
        margin-left: 0;
      }
      .text-input, .output { height: 360px; }
    }
