:root {
  --primary: #e63b3b;
  --primary-dark: #c92f2f;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #2b2f36;
  --muted: #8a919c;
  --border: #e6e8eb;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 880px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, #ff5252, #c92f2f);
  color: #fff;
  padding: 32px 0 40px;
  text-align: center;
}
.site-header h1 { font-size: 26px; font-weight: 700; }
.site-header .subtitle { margin-top: 8px; font-size: 14px; opacity: .92; }
.site-header .subtitle b { font-weight: 700; }

/* Card */
.tool-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: -20px;
  overflow: hidden;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab {
  border: 1px solid var(--border);
  background: #fafbfc;
  color: var(--text);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.tab:hover { border-color: var(--primary); color: var(--primary); }
.tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.actions { display: flex; gap: 8px; }
.action-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.action-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Panels */
.panel { padding: 16px; border-bottom: 1px solid var(--border); }

#input {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color .15s;
}
#input:focus { border-color: var(--primary); }

.input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.btn-group { display: flex; gap: 8px; }
#charCount { color: var(--muted); font-size: 13px; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { background: var(--primary-dark); }

/* 自定义违禁词库切换按钮 */
.badge {
  display: inline-block;
  min-width: 18px;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
#btnCustom.active {
  border-color: var(--primary);
  background: #fff3f3;
  color: var(--primary);
}

/* Result */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 10px;
}
.hit-summary { font-size: 13px; color: var(--primary); font-weight: 600; }
.hit-summary.clean { color: #28a745; }
.result-content {
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-all;
  background: #fff;
}
.result-content:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
}
.result-actions { display: flex; gap: 8px; margin-top: 10px; }

mark.hit {
  background: none;
  color: inherit;
}
mark.hit {
  background: #ffe3e3;
  color: var(--primary);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 1px;
}

/* Custom */
.custom-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.custom-head label { font-size: 14px; font-weight: 600; }
.custom-count {
  font-size: 12px;
  color: var(--muted);
  background: #f0f1f3;
  border-radius: 999px;
  padding: 1px 8px;
}
.link-btn {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
}
.link-btn:hover { color: var(--primary); background: #f5f5f5; }
.custom-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}
#customWords {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}
#customWords:focus { border-color: var(--primary); }
.custom-actions { display: flex; align-items: center; margin-top: 10px; }
.custom-actions .btn { margin-top: 0; }
.tip { margin-left: 12px; font-size: 13px; color: #28a745; }

/* Disclaimer & footer */
.disclaimer {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 0 16px;
}
.site-footer { text-align: center; padding: 24px 0 40px; font-size: 13px; color: var(--muted); }

/* 工具说明 */
.tool-desc {
  background: linear-gradient(180deg, #fff 0%, #fdf4f4 100%);
  border: 1px solid #f0d8d8;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(230, 59, 59, .08);
  padding: 26px 26px 24px;
  margin-top: 18px;
  position: relative;
  overflow: hidden;
}
.tool-desc::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff8a8a, var(--primary), var(--primary-dark));
}
.tool-desc h2,
.tool-desc h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 12px;
}
.tool-desc h2 { margin-top: 6px; }
.tool-desc h2::before,
.tool-desc h3::before {
  content: '';
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
  flex-shrink: 0;
}
.tool-desc p {
  font-size: 14px;
  color: #5a5f69;
  line-height: 1.8;
  margin-bottom: 10px;
}

/* 工具优势卡片 */
.td-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0 2px;
}
.td-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all .2s;
}
.td-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(230, 59, 59, .08);
  transform: translateY(-2px);
}
.td-ico {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #fff0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.td-card b {
  display: block;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 3px;
}
.td-card p {
  font-size: 13px;
  color: #5a5f69;
  line-height: 1.7;
  margin: 0;
}
.faq-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.faq-item { border: 1px solid #e8ebf0; border-radius: 12px; padding: 14px 16px; background: #fff; }
.faq-item b { display: block; font-size: 14px; color: #1f2d3d; margin-bottom: 6px; }
.faq-item p { font-size: 13px; color: #5a5f69; line-height: 1.8; margin: 0; }

/* 使用步骤 */
.td-steps {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}
.td-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  color: #555a63;
  line-height: 1.7;
}
.td-steps li:last-child { border-bottom: none; }
.td-step-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 3px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
.modal.show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: min(90vw, 360px);
  text-align: center;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h3 { font-size: 18px; margin-bottom: 14px; }
.modal-box #qrcode { display: inline-block; padding: 8px; background: #fff; }
.modal-box #qrcode img, .modal-box #qrcode canvas { margin: 0 auto; }
.modal-tip { font-size: 13px; color: var(--muted); margin: 12px 0; }
.modal-tip.warn { color: #e67e22; text-align: left; }
.modal-tip code { background: #f0f1f3; padding: 1px 5px; border-radius: 4px; }

.donate-codes { display: flex; gap: 16px; justify-content: center; align-items: flex-start; margin: 8px 0; }
.donate-item { width: 120px; text-align: center; }
.donate-item img { width: 120px; height: 120px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 8px; }
.donate-item p { font-size: 13px; margin-top: 6px; color: var(--muted); }

/* 打赏左右卡片（微信绿 / 支付宝蓝） */
.donate-box { width: min(92vw, 480px); }
.donate-cards { display: flex; gap: 16px; justify-content: center; margin: 12px 0 16px; }
.pay-card {
  flex: 1;
  max-width: 210px;
  border-radius: 12px;
  padding: 14px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
}
.pay-card-wechat { background: #07c160; }
.pay-card-alipay { background: #1677ff; }
.pay-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
.pay-logo { width: 22px; height: 22px; }
.pay-qr {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 4px;
}
.pay-main { font-size: 15px; margin: 12px 0 8px; }
.pay-sub {
  font-size: 12px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .5);
  padding: 4px 10px;
  border-radius: 999px;
  color: #fff;
}

@media (max-width: 520px) {
  .donate-cards { flex-direction: column; align-items: center; }
  .pay-card { width: 100%; max-width: 260px; }
  .donate-box { width: min(92vw, 340px); }
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.8);
  color: #fff;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
#toast.show { opacity: 1; }

@media (max-width: 600px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .tabs { justify-content: center; }
  .actions { justify-content: center; }
  .site-header h1 { font-size: 21px; }
  #input, .result-content { min-height: 160px; }
  .tool-desc { padding: 20px 16px; }
  .td-grid { grid-template-columns: 1fr; }
}
