:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --primary: #0f766e;
  --primary-light: #0d9488;
  --accent: #0891b2;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Heebo', -apple-system, BlinkMacSystemFont, sans-serif;
}

body.theme-dark {
  --bg: #0f172a;
  --surface: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.3);
}

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

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.header {
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 50%, #0891b2 100%);
  color: #fff;
  padding: 1rem 0 1.5rem;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-main {
  flex: 1;
  min-width: 0;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.tagline {
  font-size: 0.95rem;
  opacity: 0.95;
  font-weight: 400;
}

.header-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.toolbar-btn,
.support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.toolbar-btn:hover,
.support-btn:hover {
  background: rgba(255,255,255,0.35);
}

.support-btn {
  text-decoration: none;
}

.translate-wrap {
  min-width: 0;
}

.translate-wrap .goog-te-combo,
.translate-wrap select {
  max-width: 140px;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.85rem;
}

.translate-wrap option {
  background: var(--surface);
  color: var(--text);
}

/* Info toggle */
.info-toggle-wrap {
  padding: 0.35rem 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.info-toggle-btn {
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.info-toggle-btn:hover {
  background: var(--bg);
  color: var(--primary);
}

.info-section.collapsed {
  display: none;
}

/* Info section */
.info-section {
  background: var(--surface);
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--border);
}

.info-section h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.info-section > .container > p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.65;
}

.info-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.info-col h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.4rem;
}

.info-col p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Search */
.search-section {
  padding: 1.5rem 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}

.search-box {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  max-width: 600px;
}

.search-box input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.search-box button {
  padding: 0.85rem 1.5rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.search-box button:hover {
  background: var(--primary-light);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.filters select {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.9rem;
  background: var(--surface);
  cursor: pointer;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-right: auto;
}

/* Tools grid */
.tools-section {
  flex: 1;
  padding: 2rem 0 3rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.tool-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  line-height: 1.35;
}

.tool-card .category-badge,
.tool-card .type-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.tool-card .category-badge {
  background: #e0f2fe;
  color: #0369a1;
  margin-left: 0.35rem;
}

.tool-card .type-badge {
  background: #f0fdf4;
  color: #15803d;
}

.tool-card .pricing {
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: auto;
  padding-top: 0.75rem;
}

.tool-card .description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card .open-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.tool-card .open-link:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

.tool-card .open-link::before {
  content: '↗';
  font-size: 1em;
}

.tool-card .open-link[href="#"] {
  color: var(--text-muted);
  cursor: default;
}

.tool-card .open-link[href="#"]:hover {
  text-decoration: none;
}

/* Loading state */
.loading-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.loading-state.error {
  color: #b91c1c;
  font-weight: 500;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 1.05rem;
}

/* Footer */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 640px) {
  .search-box {
    flex-direction: column;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
}
