    :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-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;
    }

    .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);
    }

    .panel-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .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-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-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 {
      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;
      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 h1,
    .editor h2,
    .editor h3 {
      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 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 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: 10px;
      padding: 12px 18px 14px;
      border-top: 1px solid var(--line);
      background: linear-gradient(180deg, #ffffff 0%, #fafcff 100%);
    }

    .ai-panel.hidden {
      display: none;
    }

    .ai-panel-compact-row {
      display: flex;
      align-items: flex-end;
      gap: 12px;
      flex-wrap: wrap;
    }

    .ai-config-entry {
      display: grid;
      gap: 6px;
      min-width: 180px;
    }

    .ai-config-entry-title {
      padding-left: 2px;
    }

    .ai-config-btn-icon {
      font-size: 14px;
      line-height: 1;
    }

    .ai-config-btn-label {
      font-size: 12px;
    }

    .ai-preset-row {
      flex: 1 1 0;
      min-width: 180px;
    }

    .ai-preset-field {
      gap: 4px !important;
    }

    .ai-preset-select-wrap {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .ai-preset-select-wrap .ai-select {
      flex: 1 1 auto;
    }

    .ai-style-info-btn {
      flex: 0 0 auto;
      width: 24px;
      height: 24px;
      padding: 0;
      border: 1px solid rgba(148, 163, 184, 0.4);
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.88);
      color: #94a3b8;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
      transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
    }

    .ai-style-info-btn:hover {
      background: #ffffff;
      border-color: rgba(59, 130, 246, 0.35);
      color: #64748b;
      transform: translateY(-1px);
    }

    .ai-inline-info-btn {
      width: 22px;
      height: 22px;
      font-size: 11px;
    }

    .ai-section-title-group {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      min-width: 0;
    }

    .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;
      gap: 8px;
      flex-wrap: wrap;
    }

    .ai-actions .copy-btn-slot {
      flex: 0 0 auto;
    }

    .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;
    }

    .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);
    }

    body.modal-scroll-locked {
      overflow: hidden;
    }

    .modal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 18px 22px;
      border-bottom: 1px solid var(--line);
    }

    .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;
    }

    .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-history-modal-desc {
      margin: 4px 0 0;
      font-size: 12px;
      line-height: 1.7;
      color: var(--muted);
    }

    .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 {
      display: block;
      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;
    }

    .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;
    }

    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;
        min-height: 420px;
        max-width: none;
      }

      .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-meta {
        width: 100%;
        justify-content: space-between;
      }

      .panel-header {
        align-items: flex-start;
      }

      .panel-header-actions {
        width: 100%;
        justify-content: flex-start;
      }

      .style-preview-modal-card {
        width: min(100vw - 16px, 100%);
      }

      .preview-info-modal-card {
        width: min(100vw - 16px, 100%);
      }

      .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;
      }
    }
