/* ============================================================
   ToolCot — Master Stylesheet
   Modern, Ultra-Responsive UX/UI with Clean Geometry
   High-Contrast Dark Footer & Indigo/Violet Gradient Theme
   System Font Stack — 100% Offline & Hostinger Optimized
   ============================================================ */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --accent: #7c3aed;
  --accent-light: #ede9fe;
  --gradient-brand: linear-gradient(135deg, #4f46e5, #7c3aed);
  --gradient-brand-subtle: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 50%, #eff6ff 100%);
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --bg: #f8fafc;
  --card: #ffffff;
  --card-hover: #ffffff;
  --footer-bg: #0b0f19;
  --footer-text: #e2e8f0;
  --footer-muted: #94a3b8;
  --green: #10b981;
  --green-bg: #f0fdf4;
  --green-border: #bbf7d0;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --amber: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 36px -4px rgba(79, 70, 229, 0.16), 0 4px 8px -2px rgba(15, 23, 42, 0.05);
  --tap: 44px;
}

/* ---------- 1. Reset & Global Anti-Overflow Guarantees ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg);
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  width: 100%;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.18s ease, text-decoration 0.18s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font: inherit;
  color: var(--ink);
  max-width: 100%;
}

:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 2. Header & Navigation ---------- */
.site-header {
  position: static;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
  width: 100%;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.logo:hover {
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  flex: 0 0 38px;
  background: var(--gradient-brand);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.logo-accent {
  color: var(--primary);
}

/* Hamburger button */
.nav-toggle {
  display: none;
  width: var(--tap);
  height: var(--tap);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  transition: border-color 0.2s, background 0.2s;
}

.nav-toggle:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.25s, opacity 0.25s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Desktop nav */
nav.site-nav {
  display: flex;
  align-items: center;
}

.nav-list, .nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-list a, .nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-list a:hover, .nav-links a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.nav-list a.active, .nav-links a.active {
  background: var(--primary);
  color: #ffffff;
}

/* ---------- 3. Hero Section & Search ---------- */
.hero {
  position: relative;
  background: var(--gradient-brand-subtle);
  border-bottom: 1px solid var(--line);
  padding: 48px 0 44px;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: var(--primary-hover);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  max-width: 100%;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 800;
}

.hero-tagline {
  color: var(--ink-soft);
  max-width: 650px;
  font-size: 1.05rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

.search-form {
  width: 100%;
  max-width: 620px;
}

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 6px 4px 18px;
  box-shadow: var(--shadow-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.search-lens {
  font-size: 1.15rem;
  color: var(--muted);
  margin-right: 8px;
  user-select: none;
}

.search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  border: none;
  background: transparent;
  font-size: 1rem;
  outline: none;
  color: var(--ink);
}

.search-btn {
  background: var(--gradient-brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: 999px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s, filter 0.15s;
}

.search-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ---------- 4. Sections & Content Layout ---------- */
.section {
  padding: 40px 0;
}

.section-header {
  margin-bottom: 20px;
}

.section-header h2, .section h2 {
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.section-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

/* Category Grid & Cards */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cat-card:hover {
  transform: translateY(-3px);
  border-color: #818cf8;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--ink);
}

.cat-emoji {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex: 0 0 42px;
}

.cat-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.cat-name {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}

.cat-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 999px;
  display: inline-block;
  margin-top: 4px;
  width: fit-content;
}

/* Tool Grid & Tool Cards */
.tool-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 18px;
}

.tool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: break-word;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #818cf8;
  text-decoration: none;
  color: var(--ink);
}

.tool-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  flex: 0 0 46px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.tool-name {
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

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

.tool-arrow {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.no-results, .empty-note {
  grid-column: 1 / -1;
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: 1rem;
}

/* ---------- 5. Tool Detail Page Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 28px 0 56px;
}

.layout-main {
  min-width: 0;
  max-width: 100%;
}

.tool-page-title {
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.25;
  word-break: break-word;
}

/* Breadcrumb */
.breadcrumb {
  margin-bottom: 16px;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  color: var(--line-strong);
  font-size: 0.8rem;
}

.breadcrumb a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb li[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* Quick Answer Callout */
.quick-answer {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.qa-badge {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 6px;
}

.quick-answer p {
  font-size: 0.98rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0;
}

/* Interactive Tool Card (.tool-card-app) */
.tool-section {
  margin-bottom: 32px;
}

.tool-section h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.015em;
}

.tool-card-app {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.tool-card-app::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-brand);
}

/* Guide steps */
.guide-intro {
  margin-bottom: 12px;
  line-height: 1.65;
}

ol.guide-steps {
  margin: 0 0 16px 22px;
  line-height: 1.7;
}

ol.guide-steps li {
  margin-bottom: 8px;
  padding-left: 4px;
}

/* Formula & Example boxes */
.formula-box {
  background: #0f172a;
  color: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1rem;
  line-height: 1.6;
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid #1e293b;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  word-break: break-word;
}

.example-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

/* FAQ Accordion */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: box-shadow 0.25s, border-color 0.25s;
}

.faq-item.open {
  box-shadow: var(--shadow-md);
  border-color: #c7d2fe;
}

.faq-q {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: none;
  border: none;
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  padding: 16px 20px;
  min-height: var(--tap);
  cursor: pointer;
}

.faq-toggle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
  flex: 0 0 30px;
}

.faq-item.open .faq-toggle {
  transform: rotate(45deg);
  background: var(--primary);
  color: #ffffff;
}

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
  color: var(--ink-soft);
}

.faq-a p {
  padding: 0 20px 18px;
  line-height: 1.65;
  margin: 0;
}

/* ---------- 6. Tool Engine Components (te- prefix) ---------- */
.te-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.te-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.te-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.te-label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.te-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.te-input, .te-select, .te-textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.te-input:focus, .te-select:focus, .te-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
  outline: none;
}

.te-textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.55;
}

.te-input-unit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.te-input-unit .te-input {
  flex: 1;
}

.te-unit {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

.te-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Engine Buttons */
.te-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  background: var(--gradient-brand);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.te-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
}

.te-btn:active {
  transform: translateY(0);
}

.te-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.te-btn-ghost {
  background: #ffffff;
  color: var(--primary);
  border: 1.5px solid var(--line-strong);
  box-shadow: none;
}

.te-btn-ghost:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: none;
}

.te-btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  font-size: 0.88rem;
  border-radius: 8px;
}

.te-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Engine Results */
.te-result {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

.te-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 1rem;
}

.te-result-label {
  color: var(--ink-soft);
  font-weight: 500;
}

.te-result-value {
  font-weight: 800;
  color: var(--primary);
}

.te-result-big {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  padding: 8px 0;
  word-break: break-word;
}

.te-note {
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--bg);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  line-height: 1.55;
}

.te-error {
  display: none;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.te-error.show {
  display: block;
}

.te-success {
  color: #15803d;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

/* Stats, Tabs, and Helpers */
.te-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.te-stat {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.te-stat b {
  color: var(--primary);
  font-size: 1rem;
  margin-left: 4px;
}

.te-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  padding-bottom: 2px;
}

.te-tab {
  border: none;
  background: none;
  padding: 10px 16px;
  min-height: var(--tap);
  font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 8px 8px 0 0;
}

.te-tab:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.te-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.te-pane {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.te-pane.active {
  display: flex;
}

.te-progress {
  height: 14px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.te-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--gradient-brand);
  transition: width 0.35s ease;
}

.te-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  margin: 12px 0;
}

table.te-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 0.95rem;
  min-width: 280px;
}

table.te-table caption {
  font-weight: 800;
  color: var(--primary);
  padding: 10px;
  caption-side: top;
  background: var(--primary-light);
}

table.te-table th, table.te-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

table.te-table thead th {
  background: #f1f5f9;
  color: var(--ink);
  font-weight: 700;
}

table.te-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

/* Error box rendered by main.js */
.error-box {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  color: #991b1b;
}

.error-box b {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

/* ---------- 7. Sidebar ---------- */
aside.sidebar {
  display: none;
}

.sidebar-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 8px;
}

.sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  margin: 0;
}

.sidebar-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.18s;
}

.sidebar-links a:hover {
  background: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

.sidebar-links a span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- 8. Static & Informational Pages ---------- */
.page-content {
  padding: 36px 0 56px;
  max-width: 860px;
  margin: 0 auto;
}

.page-content h1 {
  font-size: clamp(1.8rem, 4.2vw, 2.5rem);
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.025em;
}

.page-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ink);
  margin: 32px 0 12px;
  letter-spacing: -0.015em;
}

.page-content p {
  color: var(--ink-soft);
  margin-bottom: 16px;
  line-height: 1.7;
}

.page-content ul, .page-content ol {
  margin: 0 0 20px 24px;
  line-height: 1.7;
}

.page-content li {
  margin-bottom: 8px;
}

/* Category Page Header */
.category-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.cat-hero-emoji {
  font-size: 2.2rem;
  display: inline-block;
}

.cat-intro {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* Contact Form */
.contact-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  margin: 24px 0 32px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.form-row label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--ink);
}

.form-row input, .form-row textarea {
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-row input:focus, .form-row textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
  outline: none;
}

.form-row button[type="submit"] {
  background: var(--gradient-brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  min-height: var(--tap);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.2s;
}

.form-row button[type="submit"]:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.notice {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  margin-bottom: 20px;
}

.notice-success {
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  color: #15803d;
}

.notice-error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: #991b1b;
}

/* 404 Page */
.error-page {
  text-align: center;
  padding: 60px 20px;
}

.error-code {
  font-size: clamp(4rem, 15vw, 7rem);
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 12px;
}

/* ---------- 9. Footer Overhaul (High Contrast & Glass Icons) ---------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  margin-top: 48px;
  padding-top: 52px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  padding-bottom: 40px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.footer-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.footer-tagline {
  font-size: 0.92rem;
  color: var(--footer-muted);
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 320px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.social-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  transition: all 0.25s ease;
  text-decoration: none;
}

.social-pill:hover {
  background: var(--primary);
  border-color: #818cf8;
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
  text-decoration: none;
}

.footer-heading {
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: var(--footer-muted);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 0.18s ease, transform 0.18s ease;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
}

.footer-links a:hover {
  color: #ffffff;
  transform: translateX(3px);
  text-decoration: none;
}

.contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0;
  margin: 0;
  font-size: 0.92rem;
  color: var(--footer-muted);
}

.contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.contact-icon {
  color: #818cf8;
  font-size: 1rem;
  flex: 0 0 20px;
}

.contact-list a {
  color: #cbd5e1;
  text-decoration: none;
}

.contact-list a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: #64748b;
}

.footer-bottom a {
  color: var(--footer-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: #ffffff;
}

/* ---------- 10. Floating Scroll Buttons ---------- */
.fab, #toTop, #toDown {
  position: fixed;
  right: 20px;
  z-index: 100;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--gradient-brand);
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.2s ease;
}

.fab.show, #toTop.show, #toDown.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fab:hover, #toTop:hover, #toDown:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}

#toTop {
  bottom: 76px;
}

#toDown {
  bottom: 20px;
}

/* ---------- 11. Scroll Reveal Animations ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ---------- 12. Media Queries & Responsive Breakpoints ---------- */

/* Mobile viewports (< 640px) */
@media (max-width: 639.98px) {
  .container {
    padding: 0 16px;
  }
  .tool-card-app {
    padding: 18px 16px;
  }
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .cat-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .cat-emoji {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    font-size: 1.15rem;
  }
  .cat-name {
    font-size: 0.88rem;
  }
  .search-input-wrap {
    padding: 3px 4px 3px 14px;
  }
  .search-btn {
    padding: 8px 16px;
    font-size: 0.88rem;
  }
  .te-result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Tablet viewports (≥ 640px) */
@media (min-width: 640px) {
  .cat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .te-row.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .te-row.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Desktop viewports (≥ 1024px) */
@media (min-width: 1024px) {
  .nav-toggle {
    display: none;
  }
  nav.site-nav {
    display: flex;
  }

  .cat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }

  /* 2-column layout with sticky sidebar */
  .layout {
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 32px;
  }
  aside.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 24px;
  }

  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 36px;
  }
}

/* Mobile Nav Drawer (< 1024px) */
@media (max-width: 1023.98px) {
  .site-header {
    position: relative;
  }
  .nav-toggle {
    display: inline-flex;
  }
  nav.site-nav {
    display: none;
    position: absolute;
    top: 68px;
    left: 0;
    right: 0;
    z-index: 999;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    padding: 12px 20px 20px;
  }
  nav.site-nav.open {
    display: block;
    animation: drawerDown 0.22s ease-out;
  }
  @keyframes drawerDown {
    from {
      opacity: 0;
      transform: translateY(-8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .nav-list, .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .nav-list a, .nav-links a {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
  }
}
