/* 查找替换 · frp- 前缀，颜色全部走全站变量，日/夜模式自动跟随 */
.frp-app {
  --frp-primary: var(--blue, #1677ff);
  --frp-soft: var(--blue-soft, #e8f1ff);
  --frp-green: var(--green, #00b42a);
  --frp-red: var(--red, #f53f3f);
  --frp-orange: var(--orange, #ff7d00);
  width: 100%;
  color: var(--text, #1d2129);
  font-size: 14px;
  line-height: 1.6;
}
.frp-app * { box-sizing: border-box; }
.frp-app button,
.frp-app textarea,
.frp-app input { font-family: inherit; }

.frp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 12px;
  background: var(--bg-2, #f7f8fa);
}
.frp-modes {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 9px;
  background: var(--card, #fff);
  overflow: hidden;
}
.frp-mode {
  height: 30px;
  padding: 0 16px;
  border: 0;
  border-right: 1px solid var(--border, #e5e6eb);
  background: transparent;
  color: var(--text-2, #4e5969);
  font-size: 13px;
  line-height: 30px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s, background .16s;
}
.frp-mode:last-child { border-right: 0; }
.frp-mode:hover:not(.frp-mode-on) { color: var(--frp-primary, #1677ff); background: var(--frp-soft, #e8f1ff); }
.frp-mode.frp-mode-on {
  background: var(--frp-primary, #1677ff);
  color: #fff;
  font-weight: 600;
}

/* ---------- 查找 / 替换输入 ---------- */
.frp-fields {
  display: flex;
  flex-wrap: wrap;
  margin: 10px -5px 0;
}
.frp-field {
  display: flex;
  flex: 1 1 260px;
  align-items: center;
  min-width: 0;
  margin: 0 5px 8px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 9px;
  background: var(--bg-input, #fff);
  transition: border-color .16s, box-shadow .16s;
}
.frp-field:focus-within { border-color: var(--frp-primary, #1677ff); box-shadow: 0 0 0 2px rgba(22, 119, 255, .12); }
.frp-field-label {
  flex: none;
  margin-right: 10px;
  color: var(--text-3, #86909c);
  font-size: 12.5px;
  white-space: nowrap;
}
.frp-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text, #1d2129);
  font-size: 13.5px;
  outline: none;
}
.frp-input::placeholder { color: var(--text-3, #86909c); }

/* ---------- 选项条 ---------- */
.frp-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 6px 6px 0;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 12px;
  background: var(--bg-2, #f7f8fa);
}
.frp-opt { display: flex; align-items: center; margin: 0 6px 6px; }
.frp-check {
  display: inline-flex;
  align-items: center;
  height: 30px;
  color: var(--text-2, #4e5969);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.frp-check input {
  width: 15px;
  height: 15px;
  margin: 0 6px 0 0;
  accent-color: var(--frp-primary, #1677ff);
  cursor: pointer;
}
.frp-check input:disabled { cursor: not-allowed; }
.frp-check input:disabled + span { color: var(--text-3, #86909c); opacity: .7; }

/* ---------- 按钮 ---------- */
.frp-btn {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 7px;
  background: var(--card, #fff);
  color: var(--text-2, #4e5969);
  font-size: 13px;
  line-height: 30px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .16s, border-color .16s, background .16s, box-shadow .16s;
}
.frp-btn:hover:not(:disabled) {
  color: var(--frp-primary, #1677ff);
  border-color: var(--frp-primary, #1677ff);
  background: var(--frp-soft, #e8f1ff);
}
.frp-btn:disabled { opacity: .45; cursor: not-allowed; }
.frp-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-3, #86909c);
}
.frp-btn-ghost:hover:not(:disabled) { background: var(--frp-soft, #e8f1ff); }
.frp-btn:focus-visible,
.frp-mode:focus-visible,
.frp-check input:focus-visible,
.frp-help summary:focus-visible {
  outline: 2px solid var(--frp-primary, #1677ff);
  outline-offset: 2px;
}

/* ---------- 工作区 ---------- */
.frp-work { display: flex; align-items: stretch; margin-top: 12px; }
.frp-panel {
  flex: 1 1 0;
  min-width: 0;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 12px;
  background: var(--card, #fff);
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  overflow: hidden;
}
.frp-mid {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.frp-mid-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px dashed var(--border-2, #c9cdd4);
  border-radius: 50%;
  background: var(--card, #fff);
  color: var(--text-3, #86909c);
}
.frp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 44px;
  padding: 8px 12px 8px 14px;
  border-bottom: 1px solid var(--border, #e5e6eb);
  background: var(--bg-2, #f7f8fa);
}
.frp-panel-title {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text, #1d2129);
  cursor: default;
}
.frp-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--frp-primary, #1677ff);
  flex: none;
}
.frp-dot-green { background: var(--frp-green, #00b42a); }
.frp-badge {
  flex: none;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 180, 42, .12);
  color: var(--frp-green, #00b42a);
  font-size: 11.5px;
  line-height: 18px;
  white-space: nowrap;
}
.frp-tools { display: flex; align-items: center; margin-left: auto; }
.frp-tools .frp-btn { margin-left: 6px; }

.frp-textarea {
  display: block;
  width: 100%;
  height: 300px;
  min-height: 200px;
  max-height: 58vh;
  margin: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: var(--bg-input, #fff);
  color: var(--text, #1d2129);
  font-size: 14px;
  line-height: 1.8;
  resize: vertical;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.frp-textarea::placeholder { color: var(--text-3, #86909c); }
.frp-textarea:focus { box-shadow: inset 0 0 0 2px rgba(22, 119, 255, .14); }
.frp-out {
  background: var(--bg-3, #f0f1f5);
  color: var(--text-2, #4e5969);
  cursor: default;
}
.frp-out:focus { box-shadow: inset 0 0 0 2px rgba(22, 119, 255, .1); }

.frp-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 34px;
  padding: 7px 14px;
  border-top: 1px solid var(--border, #e5e6eb);
  background: var(--bg-2, #f7f8fa);
  color: var(--text-3, #86909c);
  font-size: 12px;
}
.frp-hint { margin-left: 12px; color: var(--text-3, #86909c); }

/* ---------- 状态与说明 ---------- */
.frp-status {
  min-height: 36px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px dashed var(--border, #e5e6eb);
  border-radius: 9px;
  background: var(--bg-2, #f7f8fa);
  color: var(--text-3, #86909c);
  font-size: 12.5px;
  line-height: 1.6;
  transition: color .16s, border-color .16s, background .16s;
}
.frp-status.frp-st-active {
  color: var(--frp-primary, #1677ff);
  border-color: var(--frp-primary, #1677ff);
  background: var(--frp-soft, #e8f1ff);
}
.frp-status.frp-st-done {
  color: var(--frp-green, #00b42a);
  border-color: var(--border, #e5e6eb);
  background: var(--bg-2, #f7f8fa);
}
.frp-status.frp-st-warn {
  color: var(--frp-orange, #ff7d00);
  border-color: var(--frp-orange, #ff7d00);
  background: rgba(255, 125, 0, .08);
}
.frp-status.frp-st-error {
  color: var(--frp-red, #f53f3f);
  border-color: var(--frp-red, #f53f3f);
  background: rgba(245, 63, 63, .07);
}

.frp-help {
  margin-top: 12px;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 10px;
  background: var(--card, #fff);
  overflow: hidden;
}
.frp-help summary {
  position: relative;
  padding: 11px 38px 11px 14px;
  color: var(--text-2, #4e5969);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.frp-help summary::-webkit-details-marker { display: none; }
.frp-help summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: -10px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 50%;
  color: var(--text-3, #86909c);
  font-size: 15px;
  font-weight: 400;
}
.frp-help[open] summary::after { content: "−"; }
.frp-help-body {
  padding: 0 14px 13px;
  border-top: 1px solid var(--border, #e5e6eb);
  color: var(--text-2, #4e5969);
  font-size: 13px;
  line-height: 1.85;
}
.frp-help-body p { margin: 9px 0 0; }
.frp-help-body b { color: var(--text, #1d2129); }
.frp-help-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-code, #f5f5f5);
  color: var(--text, #1d2129);
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
}
.frp-help-note {
  margin-top: 12px !important;
  padding-top: 10px;
  border-top: 1px dashed var(--border, #e5e6eb);
  color: var(--text-3, #86909c) !important;
  font-size: 12.5px;
}

/* 复制失败时的临时选区，不放页面上 */
.frp-sr {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- 暗色补充：只补写死的底色/阴影 ---------- */
body.dark .frp-app { color-scheme: dark; }
body.dark .frp-panel { box-shadow: 0 2px 12px rgba(0, 0, 0, .22); }
body.dark .frp-textarea:focus { box-shadow: inset 0 0 0 2px rgba(96, 165, 250, .22); }
body.dark .frp-out:focus { box-shadow: inset 0 0 0 2px rgba(96, 165, 250, .16); }
body.dark .frp-field:focus-within { box-shadow: 0 0 0 2px rgba(96, 165, 250, .2); }
body.dark .frp-status.frp-st-active { background: rgba(30, 58, 95, .55); }
body.dark .frp-badge { background: rgba(63, 185, 80, .18); }
body.dark .frp-mid-icon { background: var(--bg-2, #1a2332); }

/* ---------- 手机 ---------- */
@media screen and (max-width: 760px) {
  .frp-bar { padding: 10px 10px; }
  .frp-modes { width: 100%; margin-bottom: 8px; }
  .frp-mode { flex: 1 1 0; padding: 0 6px; text-align: center; }
  .frp-field { flex: 1 1 100%; margin: 0 5px 8px; }
  .frp-opts { padding: 6px 8px 0; }
  .frp-opt { flex: 0 0 50%; width: 50%; margin: 0 0 8px; padding-right: 4px; }
  .frp-work { flex-direction: column; }
  .frp-panel { flex: 0 0 auto; width: 100%; }
  .frp-mid { flex: 0 0 auto; height: 38px; }
  .frp-mid-icon svg { transform: rotate(90deg); }
  .frp-textarea { height: 200px; min-height: 150px; max-height: none; }
  .frp-panel-head { padding: 8px 10px 8px 12px; }
  .frp-panel-foot { padding: 7px 12px; }
  .frp-hint { display: none; }
  .frp-help-body { font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  .frp-app * { transition: none !important; }
}
