/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --primary-dark: #3730a3;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 10px 25px rgba(0,0,0,0.1);
  --transition: all 0.2s ease;
}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh;
}

/* ===== Header ===== */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white; padding: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.3);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: white; font-size: 1.25rem; font-weight: 700; }
.logo-icon { font-size: 1.5rem; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: rgba(255,255,255,0.85); text-decoration: none; padding: 6px 14px;
  border-radius: 8px; font-size: 0.875rem; font-weight: 500;
  transition: var(--transition); white-space: nowrap;
}
nav a:hover, nav a.active { background: rgba(255,255,255,0.15); color: white; }

/* ===== Main Container ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* ===== Hero Section ===== */
.hero {
  text-align: center; padding: 60px 24px 40px;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: 0 0 24px 24px; margin-bottom: 32px;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; color: var(--primary-dark); margin-bottom: 12px; }
.hero p { font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; line-height: 1.7; }

/* ===== Tool Grid ===== */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; margin: 32px 0;
}
.tool-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 28px 24px;
  box-shadow: var(--shadow); transition: var(--transition);
  border: 1px solid var(--border); cursor: pointer;
  text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.tool-card:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-hover);
  border-color: var(--primary-light);
}
.tool-icon { font-size: 2rem; margin-bottom: 14px; }
.tool-card h3 { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.tool-card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.5; flex: 1; }

/* ===== Tool Page ===== */
.tool-page { max-width: 860px; margin: 0 auto; }
.tool-header { margin-bottom: 28px; }
.tool-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.tool-header p { color: var(--text-secondary); margin-top: 6px; }
.tool-box {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 28px; margin-bottom: 24px;
}
.tool-box label { display: block; font-weight: 600; margin-bottom: 8px; font-size: 0.95rem; }
.tool-box textarea, .tool-box input[type="text"], .tool-box input[type="number"], .tool-box select {
  width: 100%; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.95rem; font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  background: #f8fafc; transition: var(--transition); outline: none;
  color: var(--text);
}
.tool-box textarea:focus, .tool-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }
.tool-box textarea { resize: vertical; min-height: 120px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 22px;
  border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.copy-btn { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.copy-btn:hover { background: #e0f2fe; }

/* ===== Output ===== */
.output-area {
  background: #f1f5f9; border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; min-height: 60px; font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.9rem; white-space: pre-wrap; word-break: break-all;
  margin-top: 8px; max-height: 400px; overflow-y: auto;
}
.copy-wrapper { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ===== Status Badge ===== */
.status-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600; margin-top: 8px;
}
.status-valid { background: #d1fae5; color: #065f46; }
.status-invalid { background: #fee2e2; color: #991b1b; }

/* ===== Ad / Donation Section ===== */
.ad-section {
  margin-top: 40px; padding: 24px; background: var(--card-bg);
  border-radius: var(--radius); border: 1px dashed var(--border);
  text-align: center;
}
.ad-placeholder {
  background: #f1f5f9; border-radius: 8px; padding: 20px;
  color: var(--text-secondary); font-size: 0.85rem;
}
.support-section {
  margin-top: 16px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap;
}
.support-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 24px;
  border-radius: 8px; text-decoration: none; font-size: 0.9rem; font-weight: 600;
  transition: var(--transition);
}
.support-btn.wechat { background: #07c160; color: white; }
.support-btn.wechat:hover { background: #06ad56; }
.support-btn.coffee { background: #ff813f; color: white; }
.support-btn.coffee:hover { background: #e66a2f; }
.support-btn.ads { background: #4285f4; color: white; }
.support-btn.ads:hover { background: #3367d6; }

/* ===== Footer ===== */
footer {
  text-align: center; padding: 32px 24px; color: var(--text-secondary);
  font-size: 0.85rem; border-top: 1px solid var(--border); margin-top: 48px;
}
footer a { color: var(--primary); text-decoration: none; }

/* ===== Breadcrumb ===== */
.breadcrumb { margin-bottom: 16px; font-size: 0.85rem; color: var(--text-secondary); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { color: var(--text-secondary); }

/* ===== Utilities ===== */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.hidden { display: none !important; }

/* ===== Dark Mode Toggle ===== */
.theme-toggle {
  background: rgba(255,255,255,0.15); border: none; color: white;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  font-size: 1.1rem; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.theme-toggle:hover { background: rgba(255,255,255,0.25); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: white; padding: 10px 24px; border-radius: 8px;
  font-size: 0.875rem; opacity: 0; transition: all 0.3s ease; pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 10px; padding: 12px 16px; }
  nav { justify-content: center; }
  nav a { font-size: 0.8rem; padding: 4px 10px; }
  .hero h1 { font-size: 1.6rem; }
  .hero { padding: 40px 16px 30px; }
  .container { padding: 20px 16px; }
  .tool-grid { grid-template-columns: 1fr; }
  .tool-box { padding: 20px; }
  .btn-row { flex-direction: column; }
  .btn { justify-content: center; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 1.35rem; }
  .tool-card { padding: 20px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


/* ===== Floating Donate Button ===== */
.floating-support {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.floating-support-btn {
  width: 52px; height: 52px; border-radius: 50%; border: none;
  cursor: pointer; font-size: 1.4rem; box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: all 0.25s ease; display: flex; align-items: center; justify-content: center;
  position: relative; color: white;
}
.floating-support-btn:hover { transform: scale(1.12); }
.floating-support-btn.donate { background: linear-gradient(135deg, #07c160, #06ad56); }
.floating-support-btn.share { background: linear-gradient(135deg, #4f46e5, #3730a3); width: 42px; height: 42px; font-size: 1.1rem; }
.floating-support-btn .tooltip {
  position: absolute; right: 60px; background: var(--text); color: white;
  padding: 6px 14px; border-radius: 6px; font-size: 0.8rem; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.floating-support-btn:hover .tooltip { opacity: 1; }
.floating-donate-panel {
  position: fixed; bottom: 86px; right: 24px; z-index: 998;
  background: var(--card-bg); border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 20px; width: 220px; text-align: center;
  transform: scale(0.9); opacity: 0; pointer-events: none;
  transition: all 0.25s ease; border: 1px solid var(--border);
}
.floating-donate-panel.show {
  transform: scale(1); opacity: 1; pointer-events: auto;
}
.floating-donate-panel img { width: 160px; height: 160px; border-radius: 10px; margin-bottom: 10px; }
.floating-donate-panel p { font-size: 0.85rem; color: var(--text-secondary); }
.floating-donate-close {
  position: absolute; top: 6px; right: 10px; background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: var(--text-secondary);
}

/* ===== Social Share ===== */
.share-bar {
  display: flex; gap: 10px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin: 20px 0 10px;
}
.share-bar .label { font-size: 0.85rem; color: var(--text-secondary); }
.share-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px;
  border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease; text-decoration: none; color: white;
}
.share-btn:hover { transform: translateY(-1px); }
.share-btn.wechat-qr { background: #07c160; color: white; }
.share-btn.weibo { background: #e6162d; color: white; }
.share-btn.twitter { background: #1da1f2; color: white; }
.share-btn.link { background: #64748b; color: white; }

/* ===== Recommended Tools ===== */
.related-tools {
  margin-top: 32px; padding-top: 24px; border-top: 2px solid var(--border);
}
.related-tools h3 {
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  margin-bottom: 16px; text-align: center;
}
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.related-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; color: inherit;
  transition: all 0.2s ease;
}
.related-card:hover {
  border-color: var(--primary-light); box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.related-card .icon { font-size: 1.3rem; }
.related-card .name { font-size: 0.85rem; font-weight: 600; }
.related-card .desc { font-size: 0.75rem; color: var(--text-secondary); }

/* ===== Ad Inline ===== */
.ad-inline {
  margin: 20px 0; padding: 16px; background: #f8fafc;
  border: 1px dashed #d1d5db; border-radius: 8px; text-align: center;
  font-size: 0.8rem; color: #94a3b8; overflow: hidden;
}

/* ===== Stats Counter ===== */
.site-stats {
  display: flex; gap: 20px; justify-content: center; flex-wrap: wrap;
  margin: 16px 0; font-size: 0.85rem; color: var(--text-secondary);
}
.site-stats span { display: flex; align-items: center; gap: 4px; }

/* ===== Donation Goal ===== */
.donation-progress {
  max-width: 400px; margin: 16px auto; text-align: left;
}
.donation-progress .bar-bg {
  background: #e2e8f0; border-radius: 10px; height: 10px; overflow: hidden;
}
.donation-progress .bar-fill {
  height: 100%; background: linear-gradient(90deg, #07c160, #10b981);
  border-radius: 10px; width: 0%; transition: width 1s ease;
}
.donation-progress .labels {
  display: flex; justify-content: space-between; margin-top: 6px;
  font-size: 0.8rem; color: var(--text-secondary);
}

/* ===== Back to Top ===== */
.back-top {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px;
  background: var(--primary); color: white; border: none; border-radius: 8px;
  font-size: 0.85rem; cursor: pointer; transition: all 0.2s ease;
  margin: 16px auto;
}
.back-top:hover { background: var(--primary-dark); }

/* ===== Announcement Banner ===== */
.announce-banner {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  text-align: center; padding: 10px 16px; font-size: 0.85rem; color: #92400e;
  border-bottom: 1px solid #f59e0b;
}
.announce-banner a { color: #92400e; font-weight: 600; text-decoration: underline; }
