@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg:         #0a0c12;
  --surface:    #111420;
  --surface2:   #181c2e;
  --border:     #232840;
  --text:       #e4e8f7;
  --muted:      #6b7280;
  --accent:     #4f6ef7;
  --accent-h:   #3d5ce5;
  --green:      #22c55e;
  --red:        #ef4444;
  --yellow:     #f59e0b;
  --radius:     10px;
  --font-ui:    'Syne', sans-serif;
  --font-code:  'JetBrains Mono', monospace;
}

[data-theme="light"] {
  --bg:       #f0f2f8;
  --surface:  #ffffff;
  --surface2: #f5f7ff;
  --border:   #dde2f0;
  --text:     #0f1221;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 54px;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1.1rem;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: white;
  font-weight: 800;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.nav a {
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.nav a:hover {
  color: var(--text);
  background: var(--surface2);
}

.nav a.active {
  color: var(--accent);
  background: var(--surface2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gh-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
}

.gh-link:hover {
  color: var(--text);
  background: var(--surface2);
}

.gh-link svg {
  width: 16px;
  height: 16px;
}

#theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s;
}

#theme-toggle:hover {
  background: var(--border);
}

.ad-slot {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px;
}

.ad-slot-leaderboard {
  min-height: 90px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.ad-slot-rect {
  min-height: 250px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px;
  flex: 1;
  width: 100%;
}

.page-title {
  margin-bottom: 24px;
}

.page-title h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}

.page-title p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 600;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.tool-card-toolbar {
  background: var(--surface2);
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-h);
  border-color: var(--accent-h);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  justify-content: center;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.editor-pane {
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.editor-pane-header {
  padding: 12px 16px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.editor-pane-label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.char-count {
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--muted);
}

textarea,
.output-area {
  font-family: var(--font-code);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 16px;
  min-height: 280px;
  background: var(--surface);
  color: var(--text);
  border: none;
  resize: vertical;
  width: 100%;
}

textarea {
  outline: none;
}

textarea::placeholder {
  color: var(--muted);
  opacity: 0.5;
}

.output-area {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border-left: 3px solid transparent;
}

.output-area.valid {
  border-left-color: var(--green);
}

.output-area.invalid {
  border-left-color: var(--red);
}

.status-bar {
  padding: 10px 16px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-code);
  font-size: 0.75rem;
  color: var(--muted);
}

.status-restored {
  color: var(--accent);
}

#ai-panel {
  display: none;
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  border-top: 1px solid var(--border);
  padding: 20px;
}

#ai-panel.visible {
  display: block;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 0.9rem;
}

.ai-badge {
  padding: 4px 10px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#ai-output {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.ai-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: aiPulse 1.4s infinite ease-in-out;
}

.ai-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes aiPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

.related-tools {
  margin-top: 48px;
}

.related-tools h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.related-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.related-link {
  flex: 1;
  min-width: 200px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.related-link:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-link-icon {
  font-size: 1.3rem;
}

.related-link-name {
  font-weight: 700;
  font-size: 0.9rem;
}

#site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--text);
}

.footer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--surface2);
  font-size: 0.75rem;
  font-weight: 600;
}

.hero {
  text-align: center;
  padding: 60px 20px 40px;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.1;
}

.hero p {
  font-size: 1.2rem;
  color: var(--muted);
  margin-bottom: 24px;
}

.hero-badges {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.hero-badge {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stats-bar {
  display: flex;
  gap: 32px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 32px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 48px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.tool-card-home {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tool-card-home:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}

.tool-card-icon {
  font-size: 2rem;
  margin-bottom: 4px;
}

.tool-card-name {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.tool-card-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

.tool-card-tags {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.tool-tag {
  padding: 4px 10px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tool-tag.free {
  color: var(--green);
}

.tool-tag.ai {
  color: var(--accent);
}

.faq-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.faq-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.faq-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.faq-section summary {
  padding: 16px 20px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.faq-section summary:hover {
  background: var(--surface2);
}

.faq-section details[open] summary {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.faq-section details p {
  padding: 16px 20px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 680px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
  
  .nav {
    display: none;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .stats-bar {
    gap: 20px;
  }
  
  .stat-value {
    font-size: 1.4rem;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
}
