/* regex-ai 1.6.1 · ToolCMS Spec 3.19 · 仅片段样式，根容器自适应，主题色全部走站点令牌 */

.rgx-app, .regex-ai-app {
  width: 100%; max-width: 100%; min-width: 0; margin: 0; box-sizing: border-box;
  color: var(--text-1, #1e293b);
  font-family: inherit; line-height: 1.6;
  --rgx-line: var(--border, #e2e8f0);
  --rgx-soft: var(--bg-soft, #f8fafc);
  --rgx-tint: var(--primary-light, #eff4ff);
  --rgx-ink: var(--text-1, #1e293b);
  --rgx-mut: var(--text-2, #64748b);
  --rgx-light: var(--text-3, #94a3b8);
  --rgx-pri: var(--primary, #10b981);
  --rgx-card: var(--bg-card, #fff);
}
.rgx-app *, .regex-ai-app * { box-sizing: border-box; }
.regex-ai-app.rgx-boot { visibility: hidden; }

.rgx-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.rgx-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.rgx-card {
  align-self: stretch; width: 100%; min-width: 0;
  background: var(--rgx-card); border: 1px solid var(--rgx-line);
  border-radius: 12px; padding: 14px 16px 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.rgx-card > h2 {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 0 0 0 10px;
  font-size: 15px; font-weight: 600; color: var(--rgx-ink);
  border-left: 3px solid var(--rgx-pri); line-height: 1.3;
}
.rgx-card > h2 .rgx-h2hint { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--rgx-mut); }

.rgx-label { display: block; margin: 0 0 5px; font-size: 12.5px; color: var(--rgx-mut); }
.rgx-input, .rgx-select, .rgx-textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13.5px; color: var(--rgx-ink);
  background: var(--rgx-card); border: 1px solid var(--rgx-line); border-radius: 8px;
  outline: 0; transition: border-color .15s, box-shadow .15s;
}
.rgx-input:focus, .rgx-select:focus, .rgx-textarea:focus {
  border-color: var(--rgx-pri); box-shadow: 0 0 0 3px var(--primary-bg, rgba(37,99,235,.12));
}
.rgx-textarea { resize: vertical; line-height: 1.65; }
.rgx-select { appearance: auto; }

.rgx-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 12px; }
.rgx-row + .rgx-row, .rgx-field + .rgx-field { margin-top: 10px; }

.rgx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 600;
  color: #fff; background: var(--rgx-pri); border: 1px solid var(--rgx-pri); border-radius: 8px;
  cursor: pointer; transition: filter .15s, background .15s;
}
.rgx-btn:hover:not(:disabled) { filter: brightness(.94); }
.rgx-btn:disabled { opacity: .55; cursor: not-allowed; }
.rgx-btn.ghost { color: var(--rgx-mut); background: var(--rgx-card); border-color: var(--rgx-line); font-weight: 500; }
.rgx-btn.ghost:hover:not(:disabled) { color: var(--rgx-pri); border-color: var(--rgx-pri); background: var(--rgx-tint); }
.rgx-btn.danger { background: var(--danger, #dc2626); border-color: var(--danger, #dc2626); }
.rgx-btn-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rgx-btn-group .rgx-btn { flex: 1 1 120px; }

.rgx-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rgx-chip {
  padding: 5px 11px; font-size: 12.5px; color: var(--rgx-mut); background: var(--rgx-soft);
  border: 1px solid var(--rgx-line); border-radius: 999px; cursor: pointer; transition: .15s;
}
.rgx-chip:hover { color: var(--rgx-pri); border-color: var(--rgx-pri); }
.rgx-chip.on { color: var(--rgx-pri); background: var(--rgx-tint); border-color: var(--rgx-pri); font-weight: 600; }

.rgx-switch { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--rgx-mut); cursor: pointer; }
.rgx-switch input { width: 16px; height: 16px; accent-color: var(--rgx-pri); }

.rgx-range { width: 100%; accent-color: var(--rgx-pri); }
.rgx-rangeval { min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--rgx-mut); }

.rgx-stat { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12.5px; color: var(--rgx-mut); }
.rgx-stat b { color: var(--rgx-ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.rgx-empty {
  padding: 26px 16px; text-align: center; font-size: 12.5px; line-height: 1.7; color: var(--rgx-mut);
  border: 1px dashed var(--rgx-line); border-radius: 10px; background: var(--rgx-soft);
}
.rgx-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--rgx-light); }
.rgx-hidden { display: none !important; }

.rgx-preview { max-width: 100%; overflow: auto; border: 1px solid var(--rgx-line); border-radius: 10px; background: var(--rgx-soft); }
.rgx-preview canvas, .rgx-preview img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

.rgx-list { display: flex; flex-direction: column; gap: 8px; }
.rgx-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 11px; background: var(--rgx-soft); border: 1px solid var(--rgx-line); border-radius: 9px; }
.rgx-item code, .rgx-code { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; color: var(--rgx-ink); background: var(--rgx-card); border: 1px solid var(--rgx-line); border-radius: 6px; padding: 6px 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.rgx-meta { font-size: 12px; color: var(--rgx-light); }

/* 主题令牌接管：本地皮肤一律回落站点变量 */
.rgx-app, .regex-ai-app {
  --rgx-line: var(--border, #e2e8f0);
  --rgx-soft: var(--bg-soft, #f8fafc);
  --rgx-tint: var(--primary-light, #eff4ff);
  --rgx-ink: var(--text-1, #1e293b);
  --rgx-mut: var(--text-2, #64748b);
  --rgx-light: var(--text-3, #94a3b8);
  --rgx-pri: var(--primary, #10b981);
  --rgx-card: var(--bg-card, #ffffff);
}

/* V3.19 / 附录 P.8 整列悬浮：合成层滚动时间线，JS 只量一次 */
@supports (animation-timeline: scroll(root block)) {
  .rgx-col.is-float-native {
    animation: rgxFloatUp linear both;
    animation-timeline: scroll(root block);
    animation-range: var(--float-start, 0px) var(--float-end, 0px);
  }
}
@keyframes rgxFloatUp {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, var(--float-travel, 0px), 0); }
}
@media print { .is-float-native { animation: none !important; transform: none !important; } }

@media (max-width: 960px) {
  .rgx-grid { grid-template-columns: minmax(0, 1fr); }
  .rgx-app, .regex-ai-app { --rgx-label-offset: 20px; }
}

.rgx-app ::placeholder { color: var(--rgx-light, #94a3b8); opacity: 1; }
.rgx-out {
  margin: 0 0 10px; padding: 12px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--rgx-ink); background: var(--rgx-soft); border: 1px solid var(--rgx-line); border-radius: 8px;
}
.rgx-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.rgx-flags { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.rgx-switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--rgx-mut); cursor: pointer; }
.rgx-switch input { width: 15px; height: 15px; accent-color: var(--rgx-pri); }
.rgx-chips { margin-top: 12px; }
.rgx-preview {
  margin-top: 10px; padding: 10px 12px; max-height: 150px; overflow: auto; border-radius: 8px;
  font: 12.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--rgx-soft); border: 1px solid var(--rgx-line); color: var(--rgx-ink); white-space: pre-wrap;
}
.rgx-preview mark { background: var(--rgx-tint); color: var(--rgx-pri); border-bottom: 1px solid var(--rgx-pri); padding: 0 1px; }
.rgx-list { margin: 0; padding: 0 0 0 18px; font-size: 13px; color: var(--rgx-mut); line-height: 1.8; }
.rgx-list li b { color: var(--rgx-ink); font-family: ui-monospace, Menlo, monospace; font-weight: 600; }
.rgx-replaced { max-height: 150px; font-size: 12px; }

/* 1.4.0 多字段脱敏 */
.rgx-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rgx-select { width: 100%; }
