    :root {
      --bg: #f5f6f8;
      --panel: #ffffff;
      --panel-soft: #fafbfc;
      --line: #e6e8eb;
      --line-strong: #d8dce1;
      --text: #1f2329;
      --muted: #646a73;
      --brand: #2563eb;
      --brand-soft: #edf4ff;
      --success: #15803d;
      --radius-lg: 18px;
      --radius-md: 14px;
      --radius-sm: 10px;
      --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
      --heading-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      --body-font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
      --mono-font: "SFMono-Regular", "Menlo", "Consolas", monospace;
      --work-area-min-height: 720px;
      --preview-frame-min-height: clamp(620px, calc(100vh - 250px), 860px);
      --editor-pane-width: 50%;
      --synced-top-height: auto;
    }

    * {
      box-sizing: border-box;
    }

    [hidden] {
      display: none !important;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: var(--body-font);
    }

    body.is-resizing {
      cursor: col-resize;
      user-select: none;
    }

    .app {
      width: min(1720px, calc(100vw - 24px));
      margin: 18px auto 28px;
    }

    .topbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      margin-bottom: 16px;
      padding: 14px 18px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 16px;
      box-shadow: var(--shadow);
    }

    .topbar-brand {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
    }

    .topbar-logo {
      width: 40px;
      height: 40px;
      flex-shrink: 0;
      object-fit: cover;
      display: block;
    }

    .topbar-brand-text {
      min-width: 0;
    }

    .topbar-title {
      margin: 0;
      font-size: 20px;
      font-weight: 650;
      letter-spacing: -0.02em;
    }

    .topbar-desc {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 13px;
    }

    .topbar-meta {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }

    .member-auth-entry {
      display: inline-flex;
      align-items: center;
    }

    .member-login-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      height: 34px;
      padding: 0 16px;
      border-radius: 999px;
      border: none;
      background: linear-gradient(135deg, #4D6BFE, #6C5CE7);
      color: #fff;
      text-decoration: none;
      font-size: 13px;
      font-weight: 600;
      transition: all 0.2s;
      box-shadow: 0 2px 8px rgba(77, 107, 254, 0.25);
    }

    .member-login-btn:hover {
      opacity: 0.9;
      box-shadow: 0 4px 12px rgba(77, 107, 254, 0.35);
    }

    .member-user-summary {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 5px 12px;
      border-radius: 999px;
      flex-wrap: nowrap;
      white-space: nowrap;
      border: 1px solid var(--line);
      background: var(--panel-soft);
      max-width: min(52vw, 460px);
    }

    .member-plan-badge {
      display: inline-flex;
      align-items: center;
      padding: 3px 10px;
      border-radius: 999px;
      background: #e0ecff;
      color: #1e40af;
      font-size: 12px;
      font-weight: 600;
      white-space: nowrap;
    }

    .member-plan-badge.pro {
      background: linear-gradient(135deg, #fbbf24, #f59e0b);
      color: #fff;
      text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    }

    .member-email-text {
      display: none;
    }

    .member-center-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #dbe1ea;
      background: #fff;
      color: #334155;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      padding: 3px 12px;
      text-decoration: none;
      white-space: nowrap;
      transition: all 0.15s;
    }

    .member-center-btn:hover {
      border-color: #4D6BFE;
      color: #4D6BFE;
      background: #f0f4ff;
    }

    .member-admin-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #bfdbfe;
      background: #eff6ff;
      color: #1d4ed8;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      text-decoration: none;
      padding: 3px 12px;
      white-space: nowrap;
      transition: all 0.15s;
    }

    .member-admin-btn:hover {
      border-color: #93c5fd;
      background: #dbeafe;
    }

    .member-logout-btn {
      border: 1px solid #e2e8f0;
      background: #fff;
      color: #94a3b8;
      border-radius: 999px;
      font-size: 12px;
      white-space: nowrap;
      flex-shrink: 0;
      padding: 3px 10px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .member-logout-btn:hover {
      border-color: #fca5a5;
      color: #ef4444;
      background: #fef2f2;
    }

    .status {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 9px 12px;
      border-radius: 999px;
      background: var(--panel-soft);
      border: 1px solid var(--line);
      color: var(--muted);
      font-size: 13px;
      white-space: nowrap;
    }

    .status::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #94a3b8;
    }

    .status.ready::before {
      background: var(--success);
    }

    .debug-toggle {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 7px 10px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--panel-soft);
      color: var(--muted);
      font-size: 13px;
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }

    .debug-toggle input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }

    .debug-toggle-track {
      position: relative;
      width: 36px;
      height: 22px;
      border-radius: 999px;
      background: #cbd5e1;
      transition: background 160ms ease;
      flex: 0 0 auto;
    }

    .debug-toggle-thumb {
      position: absolute;
      top: 2px;
      left: 2px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #ffffff;
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
      transition: transform 160ms ease;
    }

    .debug-toggle input:checked + .debug-toggle-track {
      background: var(--brand);
    }

    .debug-toggle input:checked + .debug-toggle-track .debug-toggle-thumb {
      transform: translateX(14px);
    }

    .debug-toggle-text {
      color: var(--text);
      font-weight: 520;
    }

    .layout {
      display: flex;
      gap: 16px;
      align-items: stretch;
      justify-content: space-between;
    }

    .panel {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow);
    }

    .editor-panel {
      min-width: 0;
      flex: 0 0 var(--editor-pane-width);
      position: relative;
      display: flex;
      flex-direction: column;
    }

    .preview-panel {
      min-width: 0;
      display: flex;
      flex-direction: column;
      flex: 1 1 0;
      overflow: hidden;
    }

    .layout-divider {
      position: relative;
      flex: 0 0 14px;
      align-self: stretch;
      border-radius: 999px;
      background: transparent;
      cursor: col-resize;
      touch-action: none;
    }

    .layout-divider::before {
      content: "";
      position: absolute;
      inset: 0;
      margin: auto;
      width: 4px;
      height: 72px;
      border-radius: 999px;
      background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
      opacity: 0.8;
      transition: transform 140ms ease, opacity 140ms ease;
    }

    .layout-divider:hover::before,
    .layout-divider:focus-visible::before {
      transform: scaleX(1.15);
      opacity: 1;
    }

    .layout-divider:focus-visible {
      outline: none;
    }

    .section.preview-body {
      padding: 12px 22px 18px;
      display: flex;
      flex: 1 1 auto;
      align-items: flex-start;
      overflow: visible;
    }

    .panel-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 20px 22px 16px;
      border-bottom: 1px solid var(--line);
    }

    .editor-sticky {
      position: relative;
      z-index: 2;
      flex: 0 0 auto;
      background: var(--panel);
      border-radius: var(--radius-lg) var(--radius-lg) 0 0;
      min-height: var(--synced-top-height);
    }

    .editor-sticky:has(#aiPresetSelectWrap.open) {
      z-index: 60;
    }

    .panel-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .panel-action-slot {
      display: flex;
      align-items: center;
    }

    .copy-btn-slot {
      display: flex;
      align-items: center;
    }

    .panel-title {
      margin: 0;
      font-size: 16px;
      font-weight: 650;
    }

    .toolbar {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      padding: 8px 12px;
      border: 1px solid var(--line);
      border-bottom: none;
      border-radius: 12px 12px 0 0;
      background: #f8f9fb;
      position: sticky;
      top: 0;
      z-index: 5;
    }

    .toolbar-group {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      flex-wrap: wrap;
    }

    button {
      font: inherit;
    }

    .tool-btn,
    .action-btn,
    .theme-btn,
    .view-btn,
    .debug-btn,
    .toolbar-select,
    .toolbar-picker-btn,
    .style-reset-btn {
      border: 1px solid var(--line-strong);
      border-radius: 10px;
      background: #fff;
      color: var(--text);
      cursor: pointer;
      transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    }

    .tool-btn:hover,
    .action-btn:hover,
    .theme-btn:hover,
    .view-btn:hover,
    .debug-btn:hover,
    .toolbar-select:hover,
    .toolbar-picker-btn:hover,
    .style-reset-btn:hover {
      border-color: #c2c8d0;
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
      transform: translateY(-1px);
    }

    .tool-btn {
      width: 34px;
      height: 34px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 13px;
      font-weight: 650;
      background: #fff;
      border-radius: 8px;
    }

    .tool-btn.textual {
      width: 40px;
      font-size: 12px;
      font-weight: 700;
    }

    .tool-btn.active {
      background: var(--brand-soft);
      border-color: #aac8ff;
      color: #1746a2;
    }

    .tool-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      color: #3f4752;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: -0.02em;
      line-height: 1;
    }

    .tool-icon.htext {
      font-size: 14px;
      font-weight: 500;
    }

    .tool-icon svg {
      width: 19px;
      height: 19px;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .toolbar-divider {
      width: 1px;
      height: 24px;
      background: var(--line);
      margin: auto 2px;
    }

    .toolbar-help-spacer {
      margin-left: auto;
      background: transparent;
    }

    .toolbar-help-btn {
      width: auto;
      min-width: 0;
      padding: 0 10px;
      gap: 6px;
      color: var(--muted);
      font-size: 13px;
      font-weight: 600;
      line-height: 1;
      white-space: nowrap;
    }

    .toolbar-help-btn .tool-icon {
      width: auto;
      height: 16px;
      color: currentColor;
      flex: 0 0 auto;
      line-height: 1;
    }

    .toolbar-help-btn .tool-icon svg {
      width: 16px;
      height: 16px;
    }

    .toolbar-help-label {
      display: inline-flex;
      align-items: center;
      height: 16px;
      line-height: 16px;
    }

    .toolbar-select {
      height: 34px;
      padding: 0 12px;
      min-width: 72px;
      font-size: 12px;
      font-weight: 600;
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 8px center;
      background-color: #ffffff;
      padding-right: 26px;
    }

    .toolbar-select.toolbar-format-select {
      min-width: 90px;
    }

    .toolbar-format-select-wrap {
      position: relative;
      width: 72px;
      flex: 0 0 auto;
    }

    .ai-select-trigger.toolbar-format-trigger {
      width: 72px;
      min-height: 34px;
      height: 34px;
      padding: 0 7px 0 9px;
      border-radius: 8px;
      gap: 4px;
      border-color: var(--line-strong);
      background: #fff;
      box-shadow: none;
    }

    .toolbar-format-trigger .ai-select-caret {
      width: 13px;
      height: 13px;
    }

    .ai-selected-text.toolbar-format-selected {
      font-size: 12px;
      font-weight: 600;
      line-height: 1;
    }

    .ai-select-dropdown-menu.toolbar-format-menu {
      top: calc(100% + 6px);
      right: auto;
      min-width: 96px;
      padding: 6px;
      z-index: 80;
    }

    .toolbar-format-menu .ai-select-option {
      padding: 8px 10px;
      font-size: 13px;
    }

    .toolbar-popover-wrap {
      position: relative;
    }

    .toolbar-picker-btn {
      width: 34px;
      min-width: 34px;
      height: 34px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .toolbar-picker-btn.active {
      border-color: #7aa2ff;
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
    }

    .picker-preview {
      width: 18px;
      height: 18px;
      border-radius: 6px;
      border: 1px solid #cbd5e1;
      background: #ffffff;
      position: relative;
      overflow: hidden;
      flex: 0 0 auto;
      color: #1f2329;
    }

    .picker-preview.font::before {
      content: "A";
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 700;
      color: currentColor;
    }

    .picker-preview.bg::before {
      content: "";
      position: absolute;
      inset: 0;
      background: currentColor;
    }

    .picker-preview.none::after {
      content: "";
      position: absolute;
      width: 28px;
      height: 2px;
      background: #2563eb;
      transform: rotate(-45deg);
      left: -4px;
      top: 8px;
      z-index: 1;
    }

    .style-palette {
      position: absolute;
      top: calc(100% + 10px);
      left: 0;
      width: 426px;
      padding: 18px;
      border: 1px solid #d4d9e1;
      border-radius: 16px;
      background: #ffffff;
      box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
      z-index: 50;
    }

    .style-palette.hidden {
      display: none;
    }

    .style-palette-section + .style-palette-section {
      margin-top: 18px;
    }

    .style-palette-label {
      margin-bottom: 12px;
      font-size: 15px;
      font-weight: 700;
      color: #1f2329;
    }

    .style-swatch-grid {
      display: grid;
      grid-template-columns: repeat(8, minmax(0, 1fr));
      gap: 8px;
    }

    .style-swatch {
      position: relative;
      width: 42px;
      height: 42px;
      padding: 0;
      border: 1px solid #d0d7de;
      border-radius: 8px;
      background: #ffffff;
      box-shadow: none;
      transform: none;
    }

    .style-swatch:hover,
    .style-swatch.active {
      border-color: #4f7cff;
      box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.18);
      transform: none;
    }

    .style-swatch[data-kind="text"]::before {
      content: "A";
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 23px;
      font-weight: 500;
      color: var(--swatch-color, #1f2329);
    }

    .style-swatch[data-kind="background"]::before {
      content: "";
      position: absolute;
      inset: 0;
      border-radius: 7px;
      background: var(--swatch-color, #ffffff);
    }

    .style-swatch[data-empty="true"]::after {
      content: "";
      position: absolute;
      width: 48px;
      height: 2px;
      background: #4f7cff;
      transform: rotate(-45deg);
      left: -3px;
      top: 19px;
      z-index: 1;
    }

    .style-reset-btn {
      width: 100%;
      height: 46px;
      margin-top: 18px;
      font-size: 15px;
      font-weight: 650;
      color: #374151;
      box-shadow: none;
      transform: none;
    }

    .editor-wrap {
      position: relative;
      padding: 16px 22px 22px;
      flex: 1 1 auto;
      overflow: visible;
      max-width: 760px;
      margin: 0 auto;
      width: 100%;
    }

    .editor {
      min-height: var(--work-area-min-height);
      overflow: visible;
      border: 1px solid var(--line);
      border-top: none;
      border-radius: 0 0 12px 12px;
      background: #fff;
      padding: 28px 36px 64px;
      outline: none;
      font-size: var(--editor-base-font-size, 16px);
      line-height: 1.8;
      color: var(--text);
      white-space: normal;
    }

    .editor[data-placeholder]:empty::before {
      content: attr(data-placeholder);
      color: #9ca3af;
    }

    .editor-status-bar {
      position: absolute;
      right: 48px;
      bottom: 48px;
      z-index: 3;
      pointer-events: none;
    }

    .editor-word-count {
      display: inline-flex;
      align-items: center;
      color: #94a3b8;
      font-size: 13px;
      line-height: 1;
      white-space: nowrap;
    }

    .editor-helper-text {
      margin: 6px 0 0;
      color: #8b93a1;
      font-size: 12px;
      line-height: 1.5;
    }

    .editor h1,
    .editor h2,
    .editor h3,
    .editor h4,
    .editor h5,
    .editor h6 {
      margin: 1.5em 0 0.6em;
      font-family: var(--heading-font);
      line-height: 1.4;
    }

    .editor h1 {
      font-size: var(--editor-h1-font-size, 28px);
    }

    .editor h2 {
      font-size: var(--editor-h2-font-size, 20px);
    }

    .editor h3 {
      font-size: var(--editor-h3-font-size, 17px);
    }

    .editor h4 {
      font-size: var(--editor-h4-font-size, 16px);
    }

    .editor h5 {
      font-size: var(--editor-h5-font-size, 15px);
    }

    .editor h6 {
      font-size: var(--editor-h6-font-size, 14px);
    }

    .editor p,
    .editor ul,
    .editor ol,
    .editor pre,
    .editor blockquote {
      margin: 0 0 1.5em;
    }

    .editor blockquote {
      padding: 12px 0 12px 18px;
      border-left: 3px solid #d4d8de;
      color: #475467;
      line-height: 1.8;
    }

    .editor pre {
      padding: 16px 18px;
      border-radius: 10px;
      background: #f7f8fa;
      border: 1px solid var(--line);
      overflow: auto;
      font-family: var(--mono-font);
      font-size: 13px;
      line-height: 1.7;
    }

    .editor hr {
      border: 0;
      border-top: 1px solid var(--line);
      margin: 32px 0;
    }

    .editor figure {
      margin: 0 0 1.5em;
    }

    .editor img {
      display: block;
      width: 100%;
      max-width: 100%;
      height: auto;
      border-radius: 10px;
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }

    .editor table {
      width: 100%;
      border-collapse: collapse;
      table-layout: auto;
      margin: 0 0 1.5em;
      font-size: inherit;
      line-height: inherit;
      color: inherit;
      background: #ffffff;
    }

    .editor th,
    .editor td {
      border: 1px solid var(--line);
      padding: 8px 10px;
      vertical-align: top;
      word-break: break-word;
    }

    .editor th {
      background: #f8fafc;
      font-weight: 700;
      text-align: left;
    }

    .editor table[data-mc-table-type="image-grid"] {
      table-layout: fixed;
      border: none;
      background: transparent;
    }

    .editor table[data-mc-table-type="image-grid"] th,
    .editor table[data-mc-table-type="image-grid"] td {
      border: none;
      background: transparent;
      padding: 0 4px;
    }

    .editor code {
      font-family: var(--mono-font);
      font-size: 0.85em;
      padding: 2px 6px;
      border-radius: 5px;
      background: #f1f3f5;
    }

    .editor pre code {
      padding: 0;
      background: transparent;
      font-size: 13px;
    }

    .editor ul:not([data-list-type="todo"]) {
      list-style: none;
      padding-left: 0;
    }

    .editor li > ul:not([data-list-type="todo"]) {
      margin-top: 10px;
      padding-left: 1.45em;
    }

    .editor ol {
      list-style: decimal;
      list-style-position: outside;
      padding-left: 1.5em;
    }

    .editor li > ol {
      margin-top: 10px;
      padding-left: 1.5em;
    }

    .editor ol > li {
      padding-left: 0.12em;
    }

    .editor ul:not([data-list-type="todo"]) > li {
      position: relative;
      padding-left: 1.45em;
    }

    .editor ul:not([data-list-type="todo"]) > li::before {
      content: "•";
      position: absolute;
      left: 0.15em;
      top: -0.02em;
      color: #2563eb;
      font-size: 1.15em;
      line-height: 1.55;
      font-weight: 700;
    }

    .editor li {
      margin-bottom: 10px;
      line-height: 1.8;
    }

    .editor ul[data-list-type="todo"] {
      list-style: none;
      padding-left: 0;
    }

    .editor li > ul[data-list-type="todo"] {
      margin-top: 10px;
    }

    .editor ul[data-list-type="todo"] > li {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px 14px;
      border-radius: 12px;
      background: #f3f4f6;
      color: var(--text);
    }

    .editor [data-checkbox="true"] {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px;
      height: 22px;
      margin-top: 2px;
      border-radius: 7px;
      border: 1.6px solid #3f4752;
      color: transparent;
      background: #ffffff;
      font-size: 0;
    }

    .editor [data-checkbox-state="checked"] [data-checkbox="true"] {
      border-color: #2563eb;
      background: #2563eb;
      position: relative;
    }

    .editor [data-checkbox-state="checked"] [data-checkbox="true"]::after {
      content: "";
      width: 9px;
      height: 5px;
      border-left: 2px solid #ffffff;
      border-bottom: 2px solid #ffffff;
      transform: rotate(-45deg) translateY(-1px);
    }

    .editor [data-callout-block="true"] {
      margin: 1.5em 0;
    }

    .editor [data-callout-shell="true"] {
      display: flex;
      align-items: flex-start;
      gap: 12px;
    }

    .editor [data-callout-icon-node="true"] {
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 28px;
      min-height: 28px;
      font-size: 18px;
      line-height: 1;
      transform: translateY(1px);
    }

    .editor [data-callout-content="true"] {
      flex: 1 1 auto;
      min-width: 0;
    }

    .action-btn {
      padding: 10px 14px;
      font-size: 13px;
    }

    .action-btn.primary {
      background: var(--brand);
      color: #fff;
      border-color: #1d4ed8;
    }

    .ai-panel {
      display: grid;
      gap: 14px;
      padding: 14px 18px 16px;
      border-top: 1px solid var(--line);
      background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
    }

    .ai-panel.hidden {
      display: none;
    }

    .ai-panel-section {
      display: grid;
      gap: 12px;
    }

    .ai-service-panel {
      padding-bottom: 16px;
      border-bottom: 1px solid #eef2f7;
    }

    .ai-style-panel-group {
      gap: 14px;
    }

    .ai-panel-compact-row {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }

    .ai-channel-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 2px 0 0;
      margin-bottom: 0;
    }

    .ai-platform-hint {
      font-size: 12px;
      color: #059669;
      margin-left: auto;
    }

    .ai-self-config-row {
      padding: 0;
      border-bottom: none;
      margin-bottom: 0;
    }

    .ai-config-entry {
      display: grid;
      gap: 6px;
      min-width: 180px;
    }

    .ai-config-entry-title {
      padding-left: 2px;
    }

    /* ── Pro 升级引导提示条（主页 AI 排版服务商下方） ── */
    .ai-pro-upgrade-tip {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 7px 10px;
      margin: 0;
      background: #eff6ff;
      border: 1px solid #dbeafe;
      border-radius: 8px;
      font-size: 12px;
      color: #475569;
      line-height: 1.4;
    }
    .ai-pro-upgrade-tip-icon {
      flex-shrink: 0;
      font-size: 13px;
    }
    .ai-pro-upgrade-tip-copy {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 4px 6px;
      flex-wrap: wrap;
    }
    .ai-pro-upgrade-tip-prefix,
    .ai-pro-upgrade-tip-suffix {
      color: #475569;
    }
    .ai-pro-upgrade-tip-link {
      flex-shrink: 0;
      color: #4D6BFE;
      font-size: 12px;
      font-weight: 600;
      text-decoration: underline;
      text-decoration-color: currentColor;
      text-decoration-thickness: 1.5px;
      text-underline-offset: 3px;
      white-space: nowrap;
    }
    .ai-pro-upgrade-tip-link:hover {
      text-decoration: underline;
    }
    .ai-pro-upgrade-tip-close {
      flex-shrink: 0;
      background: none;
      border: none;
      color: #94a3b8;
      font-size: 13px;
      cursor: pointer;
      padding: 0 2px;
      line-height: 1;
    }
    .ai-pro-upgrade-tip-close:hover {
      color: #64748b;
    }

    /* ── Pro 升级引导提示（API 配置弹窗标题下） ── */
    .ai-config-modal-pro-tip {
      display: flex;
      align-items: center;
      gap: 6px;
      margin: 0;
      padding: 0;
      font-size: 13px;
      color: #64748b;
      line-height: 1.5;
    }
    .ai-config-modal-pro-tip-icon {
      flex-shrink: 0;
      font-size: 15px;
      line-height: 1;
    }
    .ai-config-modal-pro-tip-copy {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 4px 6px;
    }
    .ai-config-modal-pro-tip-prefix,
    .ai-config-modal-pro-tip-suffix {
      color: #64748b;
    }
    .ai-config-modal-pro-tip-link {
      display: inline-flex;
      align-items: center;
      flex-shrink: 0;
      color: #4D6BFE;
      font-size: 13px;
      font-weight: 600;
      text-decoration: underline;
      text-decoration-color: currentColor;
      text-decoration-thickness: 1.5px;
      text-underline-offset: 3px;
      white-space: nowrap;
    }
    .ai-config-modal-pro-tip-link:hover {
      text-decoration: underline;
    }

    .ai-channel-switch {
      display: flex;
      width: fit-content;
      border: 1px solid #d1d5db;
      border-radius: 8px;
      overflow: hidden;
      margin-top: 2px;
    }
    .ai-channel-btn {
      padding: 4px 12px;
      font-size: 12px;
      border: none;
      background: #f9fafb;
      color: #6b7280;
      cursor: pointer;
      transition: all 0.15s;
    }
    .ai-channel-btn.active {
      background: linear-gradient(135deg, #4D6BFE, #6C5CE7);
      color: #fff;
    }
    .ai-channel-btn:hover:not(.active) {
      background: #e5e7eb;
    }
    .ai-channel-badge {
      display: inline-block;
      font-size: 9px;
      padding: 1px 4px;
      border-radius: 3px;
      background: rgba(255,255,255,0.3);
      color: inherit;
      margin-left: 4px;
      vertical-align: super;
      line-height: 1;
    }
    .ai-channel-btn.active .ai-channel-badge {
      background: rgba(255,255,255,0.25);
      color: #fff;
    }
    .ai-channel-btn:not(.active) .ai-channel-badge {
      background: #fef3c7;
      color: #d97706;
    }

    .ai-config-btn-icon {
      font-size: 14px;
      line-height: 1;
    }

    .ai-config-btn-label {
      font-size: 13px;
      font-weight: 600;
      color: #0f172a;
      line-height: 1.4;
    }

    .ai-service-status-btn {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 11px 14px;
      border-radius: 14px;
      border: 1px solid #dbe5f0;
      background: linear-gradient(180deg, #ffffff, #f8fbff);
      color: var(--text);
      font: inherit;
      cursor: pointer;
      transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    }

    .ai-service-status-btn:hover {
      border-color: #bfd1ea;
      box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
      transform: translateY(-1px);
    }

    .ai-service-status-main {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .ai-service-status-dot {
      width: 10px;
      height: 10px;
      border-radius: 999px;
      background: #94a3b8;
      box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
      flex: 0 0 auto;
    }

    .ai-service-status-copy {
      min-width: 0;
      display: grid;
      gap: 2px;
      text-align: left;
    }

    .ai-service-status-label {
      font-size: 11px;
      color: #64748b;
      font-weight: 600;
      letter-spacing: 0.01em;
    }

    .ai-service-status-action {
      flex: 0 0 auto;
      font-size: 12px;
      font-weight: 600;
      color: #2563eb;
    }

    .ai-service-status-btn.status-unverified .ai-service-status-dot {
      background: #94a3b8;
      box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.14);
    }

    .ai-service-status-btn.status-unverified .ai-service-status-label {
      color: #64748b;
    }

    .ai-service-status-btn.status-ready .ai-service-status-dot {
      background: #22c55e;
      box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
    }

    .ai-service-status-btn.status-ready .ai-service-status-label {
      color: #15803d;
    }

    .ai-service-status-btn.status-error .ai-service-status-dot {
      background: #ef4444;
      box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.14);
    }

    .ai-service-status-btn.status-error .ai-service-status-label {
      color: #b91c1c;
    }

    .ai-preset-row {
      flex: 1 1 0;
      min-width: 180px;
    }

    .ai-preset-field {
      gap: 4px !important;
    }

    .ai-preset-select-wrap {
      position: relative;
      display: block;
    }

    .ai-label-row {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .ai-native-select {
      display: none !important;
    }

    .ai-custom-select-wrap {
      position: relative;
    }

    .ai-select-trigger {
      width: 100%;
      min-height: 46px;
      padding: 0 14px 0 16px;
      border: 1px solid #d9e2ec;
      border-radius: 14px;
      background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
      color: #0f172a;
      font: inherit;
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      cursor: pointer;
      transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
    }

    .ai-select-trigger:hover,
    .ai-select-trigger.open {
      border-color: #c7d6ea;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    }

    .ai-select-trigger:focus-visible {
      outline: none;
      border-color: #93c5fd;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    }

    .ai-selected-text {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: left;
      font-size: 14px;
      font-weight: 600;
      color: #0f172a;
    }

    .ai-preset-select-wrap .ai-selected-text {
      display: inline-flex;
      align-items: flex-start;
      flex: 1 1 auto;
      overflow: visible;
      padding-top: 4px;
      padding-bottom: 4px;
    }

    .ai-select-trigger.is-custom .ai-selected-text {
      color: #2563eb;
    }

    .ai-select-caret {
      width: 16px;
      height: 16px;
      flex: 0 0 auto;
      color: #64748b;
      transition: transform 140ms ease, color 140ms ease;
    }

    .ai-select-trigger.open .ai-select-caret {
      transform: rotate(180deg);
      color: #334155;
    }

    .ai-select-dropdown-menu {
      position: absolute;
      top: calc(100% + 8px);
      left: 0;
      right: 0;
      z-index: 40;
      padding: 8px;
      border-radius: 12px;
      border: 1px solid #e2e8f0;
      background: rgba(255, 255, 255, 0.98);
      box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1);
      backdrop-filter: blur(10px);
    }

    #aiPresetSelectMenu {
      max-height: min(420px, calc(100vh - 220px));
      overflow-y: auto;
      overscroll-behavior: contain;
    }

    .ai-select-option {
      width: 100%;
      border: none;
      background: transparent;
      border-radius: 8px;
      padding: 10px 12px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      color: #334155;
      font: inherit;
      font-size: 14px;
      text-align: left;
      cursor: pointer;
      transition: background 120ms ease, color 120ms ease;
    }

    .ai-select-option:hover {
      background: #f1f5f9;
    }

    .ai-select-option.active {
      background: #eff6ff;
      color: #2563eb;
    }

    .ai-select-option-label,
    .style-preview-preset-name,
    .ai-style-title,
    .preview-info-section-title {
      display: inline-flex;
      align-items: flex-start;
      gap: 3px;
      min-width: 0;
    }

    .ai-vip-label {
      display: inline-flex;
      align-items: flex-start;
      gap: 3px;
      max-width: 100%;
      min-width: 0;
    }

    .ai-vip-label-text {
      min-width: 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .ai-vip-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      padding: 1px 5px;
      border-radius: 8px 8px 8px 0;
      background: #ede9fe;
      color: #4f46e5;
      font-size: 10px;
      font-weight: 700;
      line-height: 1.15;
      white-space: nowrap;
      vertical-align: super;
      transform: translateY(-0.42em);
    }

    .ai-check-icon {
      width: 14px;
      height: 14px;
      flex: 0 0 auto;
      opacity: 0;
      transform: scale(0.9);
      transition: opacity 120ms ease, transform 120ms ease;
    }

    .ai-select-option.active .ai-check-icon {
      opacity: 1;
      transform: scale(1);
    }

    .ai-inline-field-row-stacked {
      flex-direction: column;
      align-items: stretch;
      gap: 8px;
    }

    .ai-capsule-group {
      display: inline-flex;
      flex-wrap: wrap;
      padding: 4px;
      border-radius: 8px;
      background: #e2e8f0;
      align-self: flex-start;
      width: fit-content;
      max-width: 100%;
    }

    .ai-capsule-group input {
      display: none;
    }

    .ai-capsule-group label {
      padding: 6px 16px;
      border-radius: 6px;
      display: inline-flex;
      align-items: center;
      justify-content: flex-start;
      text-align: left;
      color: #64748b;
      font-size: 13px;
      font-weight: 500;
      line-height: 1.3;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .ai-capsule-group label:hover {
      color: #475569;
    }

    .ai-capsule-group input:checked + label {
      background: #ffffff;
      color: #0f172a;
      font-weight: 600;
      box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    }

    .ai-select,
    .ai-compact-select {
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
      background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 13px) calc(50% - 3px);
      background-size: 6px 6px, 6px 6px;
      background-repeat: no-repeat;
      padding-right: 36px;
    }

    .ai-style-module {
      display: grid;
      gap: 10px;
      padding: 14px;
      border-radius: 18px;
      border: 1px solid #e8eef6;
      background: linear-gradient(180deg, #f8fafc 0%, #f4f8fc 100%);
    }

    .ai-style-card {
      margin: 0;
      padding: 12px;
      border-radius: 14px;
      border: 1px solid #e4ebf3;
      background: rgba(255, 255, 255, 0.94);
    }

    .ai-style-card-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 0;
    }

    .ai-style-card-head-spaced {
      align-items: flex-start;
    }

    .ai-style-card-copy {
      min-width: 0;
    }

    .ai-style-card-note {
      font-size: 12px;
      color: #6b7280;
      display: block;
      margin-top: 4px;
      line-height: 1.5;
    }

    .ai-inline-switch {
      margin: 0;
      flex: 0 0 auto;
    }

    .ai-inline-switch .ai-switch-track {
      width: 32px;
      height: 18px;
    }

    .ai-inline-switch .ai-switch-thumb {
      width: 14px;
      height: 14px;
    }

    .ai-style-card-body {
      margin-top: 10px;
      display: grid;
      gap: 8px;
    }

    .ai-inline-field-row {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }

    .ai-inline-field-label {
      font-size: 12px;
      color: #6b7280;
      white-space: nowrap;
    }

    .ai-inline-textarea {
      font-size: 12px;
      min-height: 60px;
      resize: vertical;
    }

    .ai-inline-form-grid {
      display: grid;
      gap: 8px;
    }

    .ai-inline-label {
      font-size: 12px;
    }

    .ai-inline-input {
      font-size: 12px;
      min-height: 34px;
    }

    .ai-prompt-card {
      padding: 0;
      border-radius: 14px;
      border: 1px solid #e4ebf3;
      background: rgba(255, 255, 255, 0.94);
    }

    .ai-style-info-btn {
      flex: 0 0 auto;
      width: 22px;
      height: 22px;
      padding: 0;
      border: none;
      border-radius: 4px;
      background: transparent;
      color: #94a3b8;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-shadow: none;
      transition: background 140ms ease, color 140ms ease;
    }

    .ai-style-info-btn svg {
      width: 14px;
      height: 14px;
    }

    .ai-style-info-btn:hover {
      background: rgba(148, 163, 184, 0.12);
      color: #64748b;
      transform: none;
    }

    .ai-style-info-btn:focus-visible {
      outline: none;
      background: rgba(148, 163, 184, 0.12);
      color: #64748b;
    }

    .ai-inline-info-btn {
      width: 22px;
      height: 22px;
    }

    .ai-section-title-group {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      min-width: 0;
      flex-wrap: wrap;
    }

    .ai-label-row {
      gap: 6px;
    }

    .ai-section-title {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
      color: #374151;
      font-size: 13px;
      font-weight: 600;
      line-height: 1.35;
    }

    .ai-section-icon {
      width: 16px;
      height: 16px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #64748b;
      flex: 0 0 auto;
    }

    .ai-section-icon svg {
      width: 16px;
      height: 16px;
      display: block;
      stroke: currentColor;
      fill: none;
      stroke-width: 1.7;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .ai-nav-section:has(#aiNavToggle:checked) .ai-section-icon,
    .ai-follow-card-section:has(#aiFollowCardToggle:checked) .ai-section-icon,
    .ai-capsule-section:has(#aiCapsuleToggle:checked) .ai-section-icon {
      color: #2563eb;
    }

    .ai-style-popover {
      position: relative;
      border: 1px solid #dbe5f0;
      border-radius: 14px;
      background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.98) 58%),
        linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
      padding: 12px 14px;
      display: grid;
      gap: 10px;
      animation: fadeIn 160ms ease;
    }

    .ai-style-popover.hidden {
      display: none;
    }

    .ai-preview-popover {
      margin-top: 12px;
      border: 1px solid #dbe5f0;
      border-radius: 16px;
      background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.98) 58%),
        linear-gradient(135deg, rgba(37, 99, 235, 0.04), rgba(16, 185, 129, 0.04));
      padding: 14px;
      display: grid;
      gap: 12px;
      animation: fadeIn 160ms ease;
    }

    .ai-preview-popover.hidden {
      display: none;
    }

    .ai-preview-popover-title {
      margin: 0;
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
    }

    .ai-preview-popover-desc {
      margin: 4px 0 0;
      font-size: 12px;
      line-height: 1.7;
      color: #667085;
    }

    .ai-preview-popover-body {
      display: grid;
      gap: 10px;
    }

    .ai-prompt-toggle {
      width: 100%;
    }

    .ai-prompt-toggle-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: var(--panel-soft);
      cursor: pointer;
      user-select: none;
      list-style: none;
      transition: background 120ms ease;
    }

    .ai-prompt-toggle-header::-webkit-details-marker {
      display: none;
    }

    .ai-prompt-toggle-header:hover {
      background: #f0f3f7;
    }

    .ai-prompt-toggle-arrow {
      display: inline-block;
      width: 0;
      height: 0;
      border-left: 5px solid transparent;
      border-right: 5px solid transparent;
      border-top: 6px solid var(--muted);
      transition: transform 160ms ease;
    }

    .ai-prompt-toggle[open] > .ai-prompt-toggle-header {
      border-radius: 10px 10px 0 0;
      border-bottom: none;
    }

    .ai-prompt-toggle[open] > .ai-prompt-toggle-header .ai-prompt-toggle-arrow {
      transform: rotate(180deg);
    }

    .ai-prompt-toggle .ai-textarea {
      border-radius: 0 0 10px 10px;
      border-top: 1px solid var(--line);
    }

    .ai-toggle-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 18px;
      border-top: 1px solid var(--line);
      background: #fcfdff;
    }

    .ai-toggle-copy {
      display: grid;
      gap: 4px;
    }

    .ai-toggle-title {
      margin: 0;
      font-size: 14px;
      font-weight: 650;
      color: var(--text);
    }

    .ai-toggle-desc {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.6;
    }

    .ai-switch {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 6px 10px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: #fff;
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
    }

    .ai-switch input {
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }

    .ai-switch-track {
      position: relative;
      width: 38px;
      height: 22px;
      border-radius: 999px;
      background: #cbd5e1;
      transition: background 160ms ease;
      flex: 0 0 auto;
    }

    .ai-switch-thumb {
      position: absolute;
      top: 2px;
      left: 2px;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: #fff;
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
      transition: transform 160ms ease;
    }

    .ai-switch input:checked + .ai-switch-track {
      background: var(--brand);
    }

    .ai-switch input:checked + .ai-switch-track .ai-switch-thumb {
      transform: translateX(16px);
    }

    .ai-switch-label {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .ai-panel-top {
      display: none;
    }

    .ai-panel-title {
      margin: 0;
      font-size: 14px;
      font-weight: 650;
    }

    .ai-panel-desc {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.6;
    }

    .ai-badge {
      display: none;
    }

    .ai-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
    }

    .ai-field {
      display: grid;
      gap: 6px;
      min-width: 0;
    }

    .ai-field.full {
      grid-column: 1 / -1;
    }

    .ai-label {
      font-size: 12px;
      color: var(--muted);
      font-weight: 600;
    }

    .ai-input,
    .ai-select,
    .ai-textarea,
    .ai-fixed-mode {
      width: 100%;
      border: 1px solid var(--line-strong);
      border-radius: 12px;
      background: #fff;
      color: var(--text);
      font: inherit;
      transition: border-color 140ms ease, box-shadow 140ms ease;
    }

    .ai-input,
    .ai-select {
      min-height: 40px;
      padding: 0 12px;
      font-size: 13px;
    }

    .ai-textarea {
      min-height: 96px;
      padding: 10px 12px;
      font-size: 13px;
      line-height: 1.7;
      resize: vertical;
    }

    .ai-style-prompt-textarea {
      min-height: 220px;
      background: linear-gradient(180deg, #ffffff, #fbfdff);
    }

    .ai-fixed-mode {
      min-height: 40px;
      padding: 0 12px;
      display: inline-flex;
      align-items: center;
      font-size: 13px;
      font-weight: 600;
      color: #1d4ed8;
      background: #eff6ff;
      border-color: #bfdbfe;
    }

    .ai-style-overview {
      display: none;
    }

    .ai-style-head {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: flex-start;
      flex-wrap: wrap;
    }

    .ai-style-title {
      margin: 0;
      font-size: 14px;
      font-weight: 700;
      color: #0f172a;
    }

    .ai-style-tone {
      margin: 4px 0 0;
      font-size: 12px;
      line-height: 1.65;
      color: #5b6472;
    }

    .ai-style-badges {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: flex-end;
    }

    .ai-style-badge {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border-radius: 999px;
      background: #ffffff;
      border: 1px solid #d9e2ec;
      font-size: 11px;
      font-weight: 700;
      color: #1d4ed8;
      letter-spacing: 0.02em;
    }

    .ai-style-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
    }

    .ai-style-block {
      padding: 10px 12px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.88);
      border: 1px solid rgba(219, 229, 240, 0.92);
      min-width: 0;
    }

    .ai-style-label {
      display: inline-block;
      margin-bottom: 6px;
      font-size: 11px;
      font-weight: 700;
      color: #64748b;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .ai-style-value {
      margin: 0;
      font-size: 12px;
      line-height: 1.7;
      color: #1f2937;
    }

    .ai-input:focus,
    .ai-select:focus,
    .ai-textarea:focus {
      outline: none;
      border-color: #93c5fd;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    }

    .ai-note {
      display: none;
    }

    .ai-config-box {
      display: none;
    }

    .ai-config-title {
      display: none;
    }

    .ai-config-summary {
      display: none;
    }

    .ai-config-actions {
      display: none;
    }

    .ai-actions {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .ai-actions-main {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ai-actions-side {
      margin-left: auto;
      display: flex;
      align-items: center;
      justify-content: flex-end;
    }

    .ai-actions-side .action-btn {
      border-color: #d6dde7;
      background: transparent;
      color: #64748b;
      box-shadow: none;
    }

    .ai-actions-side .action-btn:hover:not(:disabled) {
      border-color: #bcc8d8;
      background: #f8fafc;
      color: #334155;
      box-shadow: none;
      transform: none;
    }

    .ai-action-btn {
      padding: 10px 14px;
      border-radius: 12px;
      border: 1px solid var(--line-strong);
      background: #fff;
      color: var(--text);
      font: inherit;
      font-size: 13px;
      cursor: pointer;
      transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
    }

    .ai-action-btn:hover:not(:disabled) {
      border-color: #c2c8d0;
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
      transform: translateY(-1px);
    }

    .ai-action-btn.primary {
      background: var(--brand);
      color: #fff;
      border-color: #1d4ed8;
    }

    .ai-action-btn.secondary {
      background: var(--brand-soft);
      color: #1d4ed8;
      border-color: rgba(37, 99, 235, 0.14);
    }

    .ai-action-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      box-shadow: none;
      transform: none;
    }

    .ai-status {
      padding: 11px 12px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #f8fafc;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.7;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .ai-status.ready {
      border-color: rgba(21, 128, 61, 0.16);
      background: rgba(21, 128, 61, 0.06);
      color: #166534;
    }

    .ai-status.warning {
      border-color: rgba(217, 119, 6, 0.16);
      background: rgba(217, 119, 6, 0.08);
      color: #b45309;
    }

    .ai-status.error {
      border-color: rgba(220, 38, 38, 0.16);
      background: rgba(220, 38, 38, 0.06);
      color: #b91c1c;
    }

    .ai-status.pending {
      border-color: rgba(37, 99, 235, 0.16);
      background: rgba(37, 99, 235, 0.06);
      color: #1d4ed8;
    }

    .mc-center-toast {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%) scale(.95);
      opacity: 0;
      z-index: 1000000;
      padding: 12px 28px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 500;
      line-height: 1.6;
      text-align: center;
      max-width: min(520px, calc(100vw - 32px));
      box-shadow: 0 6px 24px rgba(0,0,0,0.2);
      pointer-events: none;
      transition: opacity .2s, transform .2s;
      background: rgba(0,0,0,.75);
      color: #fff;
    }

    .mc-center-toast-show {
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }

    .mc-center-toast-ready,
    .mc-center-toast-error,
    .mc-center-toast-warning,
    .mc-center-toast-pending,
    .mc-center-toast-info {
      background: rgba(0,0,0,.75);
      color: #fff;
    }

    .undo-toast {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, calc(-50% + 20px));
      display: inline-flex;
      align-items: center;
      gap: 16px;
      padding: 12px 24px;
      border-radius: 999px;
      background: #1e293b;
      color: #f8fafc;
      box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
      transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, visibility 0.3s ease;
      z-index: 1000001;
      max-width: min(520px, calc(100vw - 32px));
    }

    .undo-toast.show {
      transform: translate(-50%, -50%);
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }

    .toast-text {
      font-size: 14px;
      font-weight: 500;
      line-height: 1.5;
      white-space: nowrap;
    }

    .undo-btn {
      border: none;
      background: transparent;
      color: #60a5fa;
      padding: 4px 8px;
      margin: -4px -8px -4px 0;
      border-radius: 4px;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .undo-btn:hover {
      background: rgba(96, 165, 250, 0.15);
      color: #93c5fd;
    }

    .undo-btn:focus-visible {
      outline: 2px solid rgba(147, 197, 253, 0.9);
      outline-offset: 2px;
    }

    @media (max-width: 640px) {
      .undo-toast {
        width: calc(100vw - 32px);
        justify-content: space-between;
        gap: 12px;
        padding: 12px 18px;
      }

      .toast-text {
        white-space: normal;
      }
    }

    .ai-validation {
      display: grid;
      gap: 8px;
      padding: 12px;
      border-radius: 12px;
      border: 1px dashed var(--line-strong);
      background: #fff;
    }

    .ai-validation.hidden {
      display: none;
    }

    .ai-validation-title {
      margin: 0;
      font-size: 12px;
      font-weight: 650;
      color: var(--muted);
    }

    .ai-validation-list {
      margin: 0;
      padding-left: 18px;
      color: var(--text);
      font-size: 12px;
      line-height: 1.7;
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 1200;
      display: grid;
      place-items: center;
      padding: 20px;
      background: rgba(15, 23, 42, 0.42);
      backdrop-filter: blur(10px);
      overscroll-behavior: contain;
    }

    .modal-backdrop.hidden {
      display: none;
    }

    .modal-card {
      width: min(640px, calc(100vw - 24px));
      max-height: calc(100vh - 40px);
      overflow: auto;
      overscroll-behavior: contain;
      background: #fff;
      border: 1px solid rgba(148, 163, 184, 0.25);
      border-radius: 20px;
      box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    }

    .member-entitlement-modal-card {
      width: min(360px, calc(100vw - 24px));
      border-radius: 16px;
      text-align: center;
      box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
      overflow: hidden;
    }

    .member-entitlement-modal-card .modal-head {
      display: block;
      position: relative;
      padding: 24px 24px 16px;
      border-bottom: none;
    }

    .member-entitlement-modal-card .modal-title {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      color: #0f172a;
    }

    .member-entitlement-modal-card .modal-close-btn {
      position: absolute;
      top: 24px;
      right: 24px;
      width: auto;
      height: auto;
      border: none;
      border-radius: 0;
      background: transparent;
      color: #94a3b8;
      font-size: 24px;
      line-height: 1;
      transition: color 0.2s ease;
    }

    .member-entitlement-modal-card .modal-close-btn:hover {
      background: transparent;
      color: #0f172a;
    }

    .member-entitlement-modal-body {
      padding: 16px 24px 32px;
      background: #fff;
    }

    .member-entitlement-modal-body p {
      margin: 0 0 24px;
      font-size: 15px;
      line-height: 1.6;
      color: #475569;
    }

    .member-entitlement-actions {
      display: flex;
      justify-content: center;
      gap: 12px;
    }

    .member-entitlement-actions .action-btn {
      flex: 1;
      min-width: 0;
      height: auto;
      padding: 10px 0;
      border-radius: 8px;
      font-weight: 500;
      align-items: center;
      justify-content: center;
      text-decoration: none;
    }

    .member-entitlement-actions .action-btn:not(.primary) {
      border: 1px solid #cbd5e1;
      background: #fff;
      color: #475569;
    }

    .member-entitlement-actions .action-btn.primary {
      border: none;
      background: #2563eb;
      color: #fff;
    }

    .member-entitlement-actions .action-btn:hover {
      transform: none;
      box-shadow: none;
    }

    .member-entitlement-actions .action-btn:not(.primary):hover {
      border-color: #cbd5e1;
      background: #fff;
      color: #475569;
    }

    .member-entitlement-actions .action-btn.primary:hover {
      background: #1d4ed8;
      color: #fff;
    }

    body.modal-scroll-locked {
      overflow: hidden;
    }

    .modal-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
      padding: 18px 22px;
      border-bottom: 1px solid var(--line);
    }

    .modal-head-copy {
      min-width: 0;
      display: grid;
      gap: 6px;
    }

    .modal-title {
      margin: 0;
      font-size: 16px;
      font-weight: 700;
    }

    .modal-close-btn {
      flex: 0 0 auto;
      width: 32px;
      height: 32px;
      padding: 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      color: var(--muted);
      font-size: 16px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 120ms ease, color 120ms ease;
    }

    .modal-close-btn:hover {
      background: #f1f3f5;
      color: var(--text);
    }

    .modal-desc {
      display: none;
    }

    .modal-body {
      display: grid;
      gap: 12px;
      padding: 18px 22px 22px;
    }

    .help-modal {
      width: min(1000px, calc(100vw - 48px));
      max-height: calc(100vh - 48px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .help-modal .modal-head {
      padding: 30px 38px 22px;
      border-bottom: 0;
    }

    .help-modal .modal-title {
      font-size: 24px;
      line-height: 1.25;
      letter-spacing: 0;
    }

    .help-modal .modal-close-btn {
      width: 48px;
      height: 48px;
      border-radius: 14px;
      font-size: 24px;
      color: #94a3b8;
    }

    .syntax-help-desc {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 18px;
      line-height: 1.7;
    }

    .syntax-help-tabs {
      display: flex;
      align-items: flex-end;
      gap: 46px;
      min-height: 58px;
      padding: 0 38px;
      border-bottom: 1px solid var(--line);
      background: #fff;
      overflow-x: auto;
      scrollbar-width: none;
    }

    .syntax-help-tabs::-webkit-scrollbar {
      display: none;
    }

    .tab-item {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      flex: 0 0 auto;
      min-height: 58px;
      padding: 0;
      border: 0;
      background: transparent;
      color: var(--muted);
      font: inherit;
      font-size: 18px;
      font-weight: 700;
      cursor: pointer;
      transition: color 140ms ease;
    }

    .tab-item:hover,
    .tab-item.active {
      color: var(--brand);
    }

    .tab-item.active::after {
      content: "";
      position: absolute;
      left: 0;
      right: 0;
      bottom: -1px;
      height: 3px;
      border-radius: 999px 999px 0 0;
      background: var(--brand);
    }

    .syntax-help-tab-icon {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
    }

    .syntax-help-tab-icon svg {
      width: 20px;
      height: 20px;
      fill: none;
      stroke: currentColor;
      stroke-width: 1.8;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .syntax-help-body {
      flex: 1 1 auto;
      min-height: 0;
      display: block;
      padding: 34px 38px;
      overflow-y: auto;
      background: #f8fafc;
    }

    .tab-panel {
      display: none;
    }

    .tab-panel.active {
      display: block;
    }

    .syntax-section-title {
      margin: 0 0 12px;
      color: #475569;
      font-size: 14px;
      font-weight: 700;
    }

    .syntax-section-title:not(:first-child) {
      margin-top: 16px;
    }

    .syntax-card {
      margin-bottom: 16px;
      padding: 18px;
      border: 1px solid #e2e8f0;
      border-radius: 12px;
      background: #fff;
      box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
      transition: border-color 140ms ease;
    }

    .syntax-card:hover {
      border-color: #cbd5e1;
    }

    .syntax-card:last-child {
      margin-bottom: 0;
    }

    .syntax-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      margin-bottom: 12px;
    }

    .syntax-title {
      color: #1e293b;
      font-size: 15px;
      font-weight: 700;
    }

    .copy-btn {
      flex: 0 0 auto;
      padding: 5px 12px;
      border: 0;
      border-radius: 7px;
      background: #f1f5f9;
      color: #475569;
      font: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: background 140ms ease, color 140ms ease;
    }

    .copy-btn:hover {
      background: #e2e8f0;
      color: #0f172a;
    }

    .copy-btn.copied {
      background: #eff6ff;
      color: #2563eb;
    }

    .syntax-code {
      padding: 12px 14px;
      border: 1px solid #f1f5f9;
      border-radius: 9px;
      background: #f8fafc;
      color: #334155;
      font-family: var(--mono-font);
      font-size: 13px;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .syntax-tip {
      margin-top: 12px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
      display: flex;
      align-items: flex-start;
      gap: 6px;
    }

    .syntax-tip span {
      flex: 0 0 auto;
    }

    .modal-actions {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ai-history-modal-card {
      width: min(760px, calc(100vw - 24px));
    }

    .ai-regenerate-modal-card {
      width: min(520px, calc(100vw - 24px));
    }

    .ai-history-modal-desc {
      margin: 4px 0 0;
      font-size: 12px;
      line-height: 1.7;
      color: var(--muted);
    }

    .ai-regenerate-options {
      display: grid;
      gap: 12px;
    }

    .ai-regenerate-option {
      width: 100%;
      display: grid;
      gap: 6px;
      text-align: left;
      padding: 14px 16px;
      border: 1px solid #dbe3f0;
      border-radius: 14px;
      background: #f8fbff;
      cursor: pointer;
      transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
    }

    .ai-regenerate-option:hover {
      border-color: #93c5fd;
      background: #eff6ff;
      transform: translateY(-1px);
    }

    .ai-regenerate-option-title {
      font-size: 14px;
      font-weight: 700;
      color: #0f172a;
    }

    .ai-regenerate-option-desc {
      font-size: 12px;
      line-height: 1.7;
      color: #64748b;
    }

    .ai-history-list {
      display: grid;
      gap: 10px;
      max-height: 56vh;
      overflow: auto;
      padding-right: 2px;
    }

    .ai-history-empty {
      padding: 16px;
      border-radius: 12px;
      border: 1px dashed var(--line-strong);
      background: #f8fafc;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.7;
      text-align: center;
    }

    .ai-history-item {
      display: grid;
      gap: 8px;
      padding: 12px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #fff;
    }

    .ai-history-item.current {
      border-color: rgba(37, 99, 235, 0.35);
      background: #f8fbff;
    }

    .ai-history-item-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    .ai-history-item-title {
      margin: 0;
      font-size: 13px;
      font-weight: 650;
      color: var(--text);
    }

    .ai-history-item-time {
      font-size: 12px;
      color: var(--muted);
    }

    .ai-history-item-meta {
      margin: 0;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.7;
      word-break: break-word;
    }

    .ai-history-item-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ai-history-item-btn {
      padding: 7px 11px;
      font-size: 12px;
      border-radius: 10px;
    }

    .ai-history-tag {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid rgba(37, 99, 235, 0.25);
      background: rgba(37, 99, 235, 0.1);
      color: #1d4ed8;
      font-size: 11px;
      font-weight: 600;
    }

    .ai-history-actions {
      justify-content: flex-end;
      gap: 10px;
    }

    .ai-config-help {
      display: grid;
      gap: 10px;
      padding: 14px 16px;
      border-radius: 16px;
      border: 1px solid #dbe5f0;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    }

    .ai-config-help-title {
      margin: 0;
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
    }

    .ai-config-help-copy {
      margin: 0;
      font-size: 12px;
      line-height: 1.8;
      color: #64748b;
    }

    .ai-config-help-list {
      margin: 0;
      padding: 0;
      list-style: none;
      display: grid;
      gap: 12px;
    }

    .ai-config-help-item {
      display: grid;
      grid-template-columns: 24px minmax(0, 1fr);
      gap: 10px;
      align-items: start;
    }

    .ai-config-help-step {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 999px;
      background: #eff6ff;
      color: #2563eb;
      font-size: 12px;
      font-weight: 700;
      line-height: 1;
    }

    .ai-config-help-link {
      justify-self: start;
      padding: 0;
      border: none;
      background: transparent;
      color: #2563eb;
      font: inherit;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      text-decoration: underline;
      text-underline-offset: 3px;
      transition: color 140ms ease, opacity 140ms ease;
    }

    .ai-config-help-link:hover {
      color: #1d4ed8;
    }

    .ai-config-help-link:focus-visible {
      outline: 2px solid rgba(37, 99, 235, 0.2);
      outline-offset: 4px;
      border-radius: 6px;
    }

    .style-preview-modal-card {
      width: min(1100px, calc(100vw - 24px));
      scrollbar-width: thin;
      scrollbar-color: rgba(100, 116, 139, 0.55) rgba(226, 232, 240, 0.7);
    }

    .preview-info-modal-card {
      width: min(980px, calc(100vw - 24px));
      scrollbar-width: thin;
      scrollbar-color: rgba(100, 116, 139, 0.55) rgba(226, 232, 240, 0.7);
    }

    .preview-info-modal-desc {
      margin: 6px 0 0;
      font-size: 13px;
      line-height: 1.75;
      color: var(--muted);
    }

    .preview-info-modal-body {
      gap: 18px;
      padding-top: 20px;
    }

    .preview-info-stack,
    .preview-info-single {
      display: grid;
      gap: 18px;
    }

    .preview-info-section {
      display: grid;
      gap: 12px;
      padding: 18px;
      border-radius: 22px;
      border: 1px solid #dbe5f0;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    }

    .preview-info-section-head {
      display: grid;
      gap: 6px;
      padding: 0 2px;
    }

    .preview-info-section-title {
      margin: 0;
      font-size: 16px;
      font-weight: 750;
      color: #0f172a;
    }

    .preview-info-section-copy {
      margin: 0;
      font-size: 13px;
      line-height: 1.75;
      color: #667085;
    }

    .preview-info-surface {
      padding: 24px;
      border-radius: 20px;
      background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
      border: 1px solid rgba(219, 229, 240, 0.92);
      overflow: hidden;
    }

    .preview-info-surface-nav {
      padding: 24px;
    }

    .preview-info-surface-follow,
    .preview-info-surface-capsule {
      padding: 28px 32px;
    }

    .style-preview-modal-body {
      gap: 16px;
      padding-top: 16px;
    }

    .style-preview-modal-desc {
      margin: 6px 0 0;
      font-size: 13px;
      line-height: 1.7;
      color: var(--muted);
    }

    .style-preview-layout {
      display: grid;
      grid-template-columns: 240px minmax(0, 1fr);
      gap: 16px;
      align-items: start;
    }

    .style-preview-sidebar {
      min-width: 0;
    }

    .style-preview-preset-list {
      display: grid;
      gap: 8px;
      max-height: calc(100vh - 190px);
      overflow: auto;
      padding-right: 4px;
      scrollbar-width: thin;
      scrollbar-color: rgba(100, 116, 139, 0.55) rgba(226, 232, 240, 0.7);
    }

    .style-preview-preset-btn {
      width: 100%;
      padding: 12px 14px;
      border-radius: 14px;
      border: 1px solid #dbe5f0;
      background: #fff;
      text-align: left;
      cursor: pointer;
      transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
    }

    .style-preview-preset-btn:hover {
      border-color: #93c5fd;
      background: #f8fbff;
      transform: translateY(-1px);
    }

    .style-preview-preset-btn.active {
      border-color: #3b82f6;
      background: linear-gradient(180deg, #eff6ff 0%, #f8fbff 100%);
      box-shadow: 0 10px 22px rgba(59, 130, 246, 0.12);
    }

    .style-preview-preset-name {
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
    }

    .style-preview-preset-desc {
      display: block;
      margin-top: 6px;
      font-size: 12px;
      line-height: 1.6;
      color: #667085;
    }

    .style-preview-main {
      min-width: 0;
      display: grid;
      gap: 14px;
    }

    .style-preview-preset-list::-webkit-scrollbar,
    .style-preview-modal-card::-webkit-scrollbar,
    .preview-info-modal-card::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .style-preview-preset-list::-webkit-scrollbar-track,
    .style-preview-modal-card::-webkit-scrollbar-track,
    .preview-info-modal-card::-webkit-scrollbar-track {
      background: rgba(226, 232, 240, 0.72);
      border-radius: 999px;
    }

    .style-preview-preset-list::-webkit-scrollbar-thumb,
    .style-preview-modal-card::-webkit-scrollbar-thumb,
    .preview-info-modal-card::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, rgba(148, 163, 184, 0.88) 0%, rgba(100, 116, 139, 0.92) 100%);
      border-radius: 999px;
      border: 2px solid rgba(255, 255, 255, 0.85);
    }

    .style-preview-preset-list::-webkit-scrollbar-thumb:hover,
    .style-preview-modal-card::-webkit-scrollbar-thumb:hover,
    .preview-info-modal-card::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, rgba(100, 116, 139, 0.95) 0%, rgba(71, 85, 105, 0.98) 100%);
    }

    .style-preview-summary {
      display: grid;
      gap: 12px;
      padding: 16px;
      border-radius: 18px;
      background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.94), rgba(248, 251, 255, 0.98) 58%),
        linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(16, 185, 129, 0.05));
      border: 1px solid #dbe5f0;
    }

    .style-preview-note {
      margin: 0;
      font-size: 12px;
      line-height: 1.75;
      color: #667085;
    }

    .style-preview-canvas {
      display: grid;
      gap: 12px;
      min-width: 0;
    }

    .style-preview-canvas-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
      font-size: 13px;
      font-weight: 700;
      color: #0f172a;
    }

    #stylePreviewSampleLabel {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border-radius: 999px;
      background: #eff6ff;
      color: #2563eb;
      font-size: 11px;
      font-weight: 700;
    }

    .preview-head {
      display: grid;
      gap: 10px;
      padding: 16px 22px 14px;
      border-bottom: 1px solid var(--line);
      background: #fbfcfd;
      flex: 0 0 auto;
      align-content: start;
      min-height: var(--synced-top-height);
    }

    .preview-head-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex-wrap: wrap;
    }

    .preview-head-actions {
      display: flex;
      align-items: center;
      justify-content: flex-start;
      gap: 8px;
      min-height: 0;
    }

    .preview-head-action-btn {
      min-height: 34px;
      padding: 7px 12px;
      border-radius: 10px;
      font-size: 12px;
    }

    .section {
      padding: 0;
    }

    .section + .section {
      border-top: 0;
    }

    .section-title {
      margin: 0;
      font-size: 15px;
      font-weight: 650;
    }

    .themes {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .theme-btn {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px 10px 12px;
      background: #fff;
      min-height: auto;
      font-size: 13px;
      font-weight: 650;
      border-radius: 999px;
    }

    .theme-preview {
      width: 20px;
      height: 20px;
      border-radius: 6px;
      border: 1px solid var(--line);
      flex-shrink: 0;
    }

    .theme-btn.active {
      border-color: #aac8ff;
      background: var(--brand-soft);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
    }

    .theme-name {
      margin: 0;
      font-size: 13px;
      font-weight: 650;
    }

    .views {
      display: inline-flex;
      gap: 8px;
      padding: 4px;
      background: #f8fafc;
      border: 1px solid var(--line);
      border-radius: 12px;
    }

    .view-btn {
      padding: 8px 12px;
      border: 0;
      background: transparent;
      border-radius: 8px;
      font-size: 13px;
    }

    .view-btn.active {
      background: #fff;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    }

    .preview-shell {
      display: flex;
      flex-direction: column;
      margin-top: 0;
      max-width: 100%;
      overflow: hidden;
    }

    .preview-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      width: 100%;
      max-width: 100%;
      align-items: start;
      overflow: hidden;
    }

    .preview-grid.ai-single {
      grid-template-columns: 1fr;
    }

    .preview-column {
      display: grid;
      gap: 10px;
      min-width: 0;
      overflow: hidden;
    }

    .preview-column.hidden {
      display: none;
    }

    .preview-column-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      flex-wrap: wrap;
    }

    .preview-column-title {
      margin: 0;
      font-size: 14px;
      font-weight: 650;
    }

    .preview-column-meta {
      display: none;
    }

    .preview-shell.empty .frame {
      border-style: dashed;
      background: #fcfdff;
    }

    .preview-empty {
      display: grid;
      place-items: center;
      min-height: 240px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.7;
      text-align: center;
      padding: 24px;
    }

    .ai-stream-card {
      min-height: 520px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      padding: 28px 18px;
      color: #111827;
      text-align: center;
    }

    .ai-stream-orb {
      width: 54px;
      height: 54px;
      border-radius: 50%;
      background:
        radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 32%),
        linear-gradient(135deg, #2563eb 0%, #14b8a6 100%);
      box-shadow: 0 18px 42px rgba(37, 99, 235, 0.22);
      animation: aiStreamPulse 1.8s ease-in-out infinite;
    }

    .ai-stream-card h3 {
      margin: 4px 0 0;
      font-size: 17px;
      font-weight: 750;
      color: #0f172a;
    }

    .ai-stream-stage {
      margin: 0;
      max-width: 320px;
      color: #64748b;
      font-size: 13px;
      line-height: 1.7;
    }

    .ai-stream-progress {
      width: min(260px, 86%);
      height: 7px;
      overflow: hidden;
      border-radius: 999px;
      background: #e5e7eb;
    }

    .ai-stream-progress span {
      display: block;
      height: 100%;
      border-radius: inherit;
      background: linear-gradient(90deg, #2563eb 0%, #3b82f6 30%, #14b8a6 55%, #3b82f6 80%, #2563eb 100%);
      background-size: 220% 100%;
      transition: width 220ms ease;
      animation: aiStreamBarFlow 1.6s linear infinite;
    }

    .ai-stream-fallback {
      margin: 0;
      max-width: 320px;
      color: #a16207;
      font-size: 12px;
      line-height: 1.6;
    }

    .ai-stream-toggle {
      border: 0;
      background: #eff6ff;
      color: #2563eb;
      border-radius: 999px;
      padding: 7px 13px;
      font-size: 12px;
      cursor: pointer;
    }

    .ai-stream-summary {
      width: min(360px, 100%);
      display: grid;
      gap: 10px;
      margin-top: 4px;
      text-align: left;
    }

    .ai-stream-log-window {
      border: 1px solid #dbeafe;
      border-radius: 12px;
      background: #f8fbff;
      padding: 10px 12px;
      min-height: 124px;
      max-height: 220px;
      overflow: auto;
      display: grid;
      align-content: start;
      gap: 8px;
    }

    .ai-stream-log-line {
      position: relative;
      padding-left: 14px;
      color: #334155;
      font-size: 12px;
      line-height: 1.7;
    }

    .ai-stream-log-line::before {
      content: "";
      position: absolute;
      left: 0;
      top: 8px;
      width: 5px;
      height: 5px;
      border-radius: 50%;
      background: #2563eb;
      opacity: 0.8;
    }

    .ai-stream-block {
      border: 1px solid #dbeafe;
      border-radius: 12px;
      background: #f8fbff;
      padding: 10px;
    }

    .ai-stream-block-title {
      margin-bottom: 6px;
      color: #2563eb;
      font-size: 12px;
      font-weight: 700;
    }

    .ai-stream-block pre {
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
      color: #334155;
      font-size: 12px;
      line-height: 1.65;
      font-family: inherit;
    }

    .ai-stream-muted {
      color: #64748b;
      font-size: 12px;
      text-align: center;
    }

    @keyframes aiStreamPulse {
      0%, 100% {
        transform: scale(1);
        opacity: 0.9;
      }
      50% {
        transform: scale(1.08);
        opacity: 1;
      }
    }

    @keyframes aiStreamBarFlow {
      0% {
        background-position: 200% 0;
      }
      100% {
        background-position: 0 0;
      }
    }

    .preview-shell.mobile {
      width: min(486px, 100%);
      max-width: 100%;
      margin: 0 auto;
    }

    .preview-shell.desktop {
      width: 100%;
      margin-top: 0;
    }

    .frame {
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: #fff;
      border: 1px solid var(--line);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
    }

    .preview-shell.mobile .frame {
      position: relative;
      min-height: var(--preview-frame-min-height);
      border-radius: 42px;
      border: 10px solid #d5d8df;
      background:
        linear-gradient(145deg, #f6f7fa 0%, #c2c7d1 30%, #eef1f6 65%, #b8bec9 100%);
      box-shadow:
        0 12px 32px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 -1px 0 rgba(148, 163, 184, 0.22);
    }

    .preview-shell.mobile .frame::before {
      content: "";
      position: absolute;
      top: 10px;
      left: 50%;
      transform: translateX(-50%);
      width: 126px;
      height: 34px;
      border-radius: 999px;
      background: linear-gradient(180deg, #161a20 0%, #050607 100%);
      box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.22);
      z-index: 3;
    }

    .preview-shell.desktop .frame {
      min-height: var(--preview-frame-min-height);
      border-radius: 12px;
    }

    .frame-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      padding: 10px 14px;
      background: #f8fafc;
      border-bottom: 1px solid var(--line);
      color: var(--muted);
      font-size: 12px;
    }

    .preview-shell.mobile .frame-bar {
      padding: 52px 18px 12px;
      background: #fbfcfe;
    }

    .dots {
      display: flex;
      gap: 5px;
    }

    .dots span {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #c7ced6;
    }

    .preview-scroll {
      flex: 1 1 auto;
      overflow-x: hidden;
      overflow-y: auto;
      background: #ffffff;
      padding: 18px;
    }

    .preview-html {
      animation: fadeIn 160ms ease;
      overflow-x: hidden;
      word-break: break-word;
      max-width: 100%;
    }

    .preview-html * {
      max-width: 100%;
      box-sizing: border-box;
    }

    .preview-html table {
      table-layout: auto;
      width: 100%;
    }

    .preview-html img {
      height: auto;
    }

    .debug-panel {
      margin-top: 16px;
    }

    .debug-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 18px;
      border-bottom: 1px solid var(--line);
    }

    .debug-title {
      margin: 0;
      font-size: 14px;
      font-weight: 650;
    }

    .debug-actions {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
    }

    .debug-btn {
      padding: 6px 10px;
      color: var(--muted);
      font-size: 12px;
    }

    .details-content {
      padding: 12px 18px 18px;
      display: grid;
      gap: 0;
    }

    .details-content.hidden {
      display: none;
    }

    .debug-sections {
      display: grid;
      gap: 0;
    }

    .debug-section {
      border: 1px solid var(--line);
      border-bottom: none;
      background: #fff;
    }

    .debug-section:first-child {
      border-radius: 12px 12px 0 0;
    }

    .debug-section:last-child {
      border-bottom: 1px solid var(--line);
      border-radius: 0 0 12px 12px;
    }

    .debug-section:only-child {
      border-radius: 12px;
      border-bottom: 1px solid var(--line);
    }

    .debug-section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 14px;
      cursor: pointer;
      user-select: none;
      list-style: none;
      background: var(--panel-soft);
      transition: background 120ms ease;
    }

    .debug-section-header::-webkit-details-marker {
      display: none;
    }

    .debug-section-header::before {
      content: "▸";
      flex: 0 0 auto;
      margin-right: 8px;
      font-size: 11px;
      color: var(--muted);
      transition: transform 140ms ease;
    }

    .debug-section[open] > .debug-section-header::before {
      transform: rotate(90deg);
    }

    .debug-section-header:hover {
      background: #f0f3f7;
    }

    .debug-section-title {
      flex: 1 1 auto;
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .debug-section-copy {
      flex: 0 0 auto;
      padding: 3px 8px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #fff;
      color: var(--muted);
      font-size: 11px;
      cursor: pointer;
      transition: background 120ms ease, border-color 120ms ease;
    }

    .debug-section-copy:hover {
      background: var(--brand-soft);
      border-color: var(--brand);
      color: var(--brand);
    }

    .debug-section-body {
      padding: 10px 14px 14px;
      display: grid;
      gap: 8px;
      border-top: 1px solid var(--line);
    }

    .debug-item {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--panel-soft);
      padding: 8px 10px;
    }

    .debug-item-label {
      display: block;
      margin-bottom: 4px;
      font-size: 11px;
      font-weight: 600;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .debug-section-body > pre {
      padding: 10px 12px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--panel-soft);
      max-height: 260px;
      overflow: auto;
    }

    .ai-debug-section-body {
      padding: 12px 14px 16px;
    }

    .ai-debug-grid {
      display: grid;
      gap: 12px;
      grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
      max-height: min(82vh, 1400px);
      overflow: auto;
      overscroll-behavior: contain;
      padding-right: 4px;
    }

    .ai-debug-empty {
      padding: 18px 16px;
      border: 1px dashed var(--line);
      border-radius: 12px;
      background: var(--panel-soft);
      color: var(--muted);
      font-size: 13px;
      text-align: center;
    }

    .ai-debug-pane {
      min-width: 0;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #fff;
      display: flex;
      flex-direction: column;
      min-height: 420px;
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    }

    .ai-debug-pane-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 14px;
      border-bottom: 1px solid var(--line);
      background: var(--panel-soft);
    }

    .ai-debug-pane-title {
      margin: 0;
      font-size: 13px;
      font-weight: 650;
      color: var(--text);
    }

    .ai-debug-pane-copy {
      flex: 0 0 auto;
      padding: 4px 9px;
      border: 1px solid var(--line);
      border-radius: 7px;
      background: #fff;
      color: var(--muted);
      font-size: 11px;
      cursor: pointer;
      transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    }

    .ai-debug-pane-copy:hover {
      background: var(--brand-soft);
      border-color: var(--brand);
      color: var(--brand);
    }

    .ai-debug-pane-body {
      flex: 1 1 auto;
      min-height: 0;
      padding: 12px 14px 14px;
    }

    .ai-debug-pane-body > pre {
      height: 100%;
      min-height: 380px;
      max-height: min(64vh, 860px);
      overflow: auto;
      padding: 12px 14px;
      border-radius: 10px;
      border: 1px solid var(--line);
      background: #f8fafc;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
      font-size: 12px;
      line-height: 1.6;
      white-space: pre-wrap;
      word-break: break-word;
    }

    .ai-debug-grid::-webkit-scrollbar,
    .ai-debug-pane-body > pre::-webkit-scrollbar {
      width: 10px;
      height: 10px;
    }

    .ai-debug-grid::-webkit-scrollbar-thumb,
    .ai-debug-pane-body > pre::-webkit-scrollbar-thumb {
      background: rgba(148, 163, 184, 0.55);
      border-radius: 999px;
    }

    .ai-debug-grid::-webkit-scrollbar-track,
    .ai-debug-pane-body > pre::-webkit-scrollbar-track {
      background: rgba(241, 245, 249, 0.9);
      border-radius: 999px;
    }

    pre {
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
      font-family: var(--mono-font);
      font-size: 12px;
      line-height: 1.7;
    }

    .code-box {
      padding: 14px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: #fbfcfd;
      max-height: 280px;
      overflow: auto;
    }

    .back-to-top {
      position: fixed;
      bottom: 24px;
      right: 24px;
      z-index: 900;
      width: 56px;
      height: 56px;
      padding: 0;
      border: 1px solid var(--line-strong);
      border-radius: 16px;
      background: #fff;
      color: var(--text);
      font-size: 24px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
      transition: opacity 200ms ease, transform 200ms ease, background 120ms ease;
      opacity: 1;
      transform: translateY(0);
      touch-action: manipulation;
    }

    .back-to-top.hidden {
      opacity: 0;
      pointer-events: none;
      transform: translateY(12px);
    }

    .back-to-top:hover {
      background: var(--brand);
      color: #fff;
      border-color: var(--brand);
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(4px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @media (max-width: 1120px) {
      :root {
        --preview-frame-min-height: clamp(520px, calc(100vh - 220px), 760px);
      }

      .layout {
        flex-direction: column;
      }

      .editor-panel,
      .preview-panel {
        flex: none;
        width: 100%;
      }

      .ai-grid,
      .preview-grid {
        grid-template-columns: 1fr;
      }

      .layout-divider {
        display: none;
      }

      .editor {
        min-height: 520px;
        max-height: none;
        max-width: none;
      }

      .editor-wrap {
        overflow: visible;
        max-width: none;
      }

    }

    @media (max-width: 720px) {
      :root {
        --preview-frame-min-height: clamp(420px, calc(100vh - 190px), 620px);
      }

      .app {
        width: min(100vw - 16px, 100%);
        margin: 8px auto 20px;
      }

      .topbar,
      .panel-header,
      .toolbar,
      .editor-wrap,
      .preview-head,
      .preview-body,
      .details-content {
        padding-left: 14px;
        padding-right: 14px;
      }

      .editor {
        padding: 18px;
        padding-bottom: 56px;
        min-height: 420px;
        max-width: none;
      }

      .editor-status-bar {
        right: 26px;
        bottom: 24px;
      }

      .themes {
        gap: 6px;
      }

      .theme-btn {
        padding: 8px 12px 8px 10px;
        font-size: 12px;
      }

      .ai-style-grid {
        grid-template-columns: 1fr;
      }

      .theme-preview {
        width: 18px;
        height: 18px;
      }

      .diagnostics {
        grid-template-columns: 1fr;
      }

      .topbar {
        flex-direction: column;
        align-items: flex-start;
      }

      .topbar-brand {
        width: 100%;
      }

      .topbar-logo {
        width: 36px;
        height: 36px;
      }

      .topbar-meta {
        width: 100%;
        justify-content: space-between;
      }

      .panel-header {
        align-items: flex-start;
      }

      .panel-header-actions {
        width: 100%;
        justify-content: flex-start;
      }

      .ai-pro-upgrade-tip,
      .ai-config-modal-pro-tip {
        align-items: flex-start;
      }

      .ai-service-status-btn,
      .ai-style-card-head {
        align-items: flex-start;
      }

      .ai-inline-field-row {
        flex-direction: column;
        align-items: stretch;
      }

      .ai-actions-main,
      .ai-actions-side {
        width: 100%;
      }

      .ai-actions-side {
        margin-left: 0;
        justify-content: flex-start;
      }

      .style-preview-modal-card {
        width: min(100vw - 16px, 100%);
      }

      .preview-info-modal-card {
        width: min(100vw - 16px, 100%);
      }

      .help-modal {
        width: min(100vw - 16px, 100%);
        max-height: calc(100vh - 16px);
      }

      .help-modal .modal-head {
        padding: 24px 28px 18px;
      }

      .help-modal .modal-title {
        font-size: 22px;
      }

      .help-modal .modal-close-btn {
        width: 44px;
        height: 44px;
      }

      .syntax-help-desc {
        font-size: 16px;
      }

      .syntax-help-tabs {
        gap: 34px;
        min-height: 54px;
        padding: 0 28px;
      }

      .tab-item {
        min-height: 54px;
        font-size: 16px;
      }

      .syntax-help-body {
        padding: 26px 28px;
      }

      .style-preview-layout {
        grid-template-columns: 1fr;
      }

      .style-preview-preset-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: none;
        padding-right: 0;
      }

      .preview-info-section,
      .preview-info-surface,
      .preview-info-surface-follow,
      .preview-info-surface-capsule {
        padding: 16px;
      }
    }
