* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header / Nav */
.site-header {
  background: var(--secondary);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-title:hover { text-decoration: none; color: var(--accent); }
.site-title svg { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--gray-300);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

/* Main Content */
main { flex: 1; }
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: .825rem;
  color: var(--gray-500);
  margin-bottom: 20px;
  padding: 8px 0;
}
.breadcrumbs a { color: var(--gray-500); }
.breadcrumbs a:hover { color: var(--primary); }
.breadcrumbs span { color: var(--gray-400); }

/* Page Headers */
.page-header {
  text-align: center;
  margin-bottom: 32px;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--secondary);
  margin-bottom: 8px;
  line-height: 1.2;
}
.page-header p {
  font-size: 1.05rem;
  color: var(--gray-500);
  max-width: 640px;
  margin: 0 auto;
}

/* Tool Cards (Homepage) */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 30px 0;
}
.tool-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  transition: all .25s;
  display: flex;
  flex-direction: column;
}
.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: var(--primary);
}
.tool-card .icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.5rem;
}
.tool-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; }
.tool-card p { font-size: .875rem; color: var(--gray-500); flex: 1; margin-bottom: 16px; }
.tool-card .vol { font-size: .75rem; color: var(--gray-400); margin-bottom: 12px; }
.tool-card .btn {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  transition: background .2s;
  border: none;
  cursor: pointer;
  display: inline-block;
}
.tool-card .btn:hover { background: var(--primary-dark); text-decoration: none; }

/* Tool Page Layout */
.tool-wrapper {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  align-items: start;
}
@media (max-width: 900px) {
  .tool-wrapper { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
  .header-inner { flex-direction: column; height: auto; padding: 12px 20px; gap: 8px; }
  .nav-links { overflow-x: auto; width: 100%; justify-content: center; padding-bottom: 4px; }
}

/* Tool Box */
.tool-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.tool-box label {
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
  font-size: .9rem;
  color: var(--gray-700);
}
.tool-box input, .tool-box select, .tool-box textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color .2s;
  background: #fff;
  color: var(--gray-800);
}
.tool-box input:focus, .tool-box select:focus, .tool-box textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.tool-box textarea { resize: vertical; min-height: 120px; }
.form-group { margin-bottom: 18px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-secondary:hover { background: var(--gray-300); }

/* Results */
.result-box {
  margin-top: 24px;
  padding: 20px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  display: none;
}
.result-box.show { display: block; }
.result-box .result-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  padding: 10px 0;
}
.result-box .result-label {
  text-align: center;
  color: var(--gray-500);
  font-size: .9rem;
}
.result-box .result-detail {
  text-align: center;
  color: var(--gray-600);
  font-size: 1rem;
  margin-top: 4px;
}
.result-box .result-category {
  display: inline-block;
  padding: 4px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: .875rem;
  margin-top: 8px;
}
.cat-underweight { background: #dbeafe; color: #1e40af; }
.cat-normal { background: #d1fae5; color: #065f46; }
.cat-overweight { background: #fef3c7; color: #92400e; }
.cat-obese { background: #fee2e2; color: #991b1b; }

/* Stats Display */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.stat-item {
  text-align: center;
  padding: 16px 8px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}
.stat-item .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-item .stat-label {
  font-size: .75rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Password Options */
.pw-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.pw-options label { font-weight: 400; font-size: .875rem; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pw-options input[type="checkbox"] { width: auto; }
.pw-output {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  padding: 14px;
  background: var(--gray-800);
  color: #4ade80;
  border-radius: var(--radius-sm);
  word-break: break-all;
  text-align: center;
  margin: 16px 0;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pw-actions { display: flex; gap: 10px; }
.pw-actions .btn-secondary { flex: 1; }

/* QR Code */
.qr-display {
  display: flex;
  justify-content: center;
  padding: 20px;
  min-height: 260px;
  align-items: center;
}
#qr-result img { max-width: 100%; height: auto; }

/* Age Result */
.age-result {
  text-align: center;
  padding: 20px 0;
}
.age-result .age-big {
  font-size: 4rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.age-result .age-label {
  font-size: 1.1rem;
  color: var(--gray-500);
  margin-top: 4px;
}
.age-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.age-details .age-item {
  text-align: center;
  padding: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
}
.age-details .age-item .num {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--secondary);
}
.age-details .age-item .lbl {
  font-size: .8rem;
  color: var(--gray-500);
}

/* Ad Containers */
.ad-container {
  text-align: center;
  overflow: hidden;
  margin: 20px 0;
  min-height: 90px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--gray-400);
}
.ad-container.ad-leaderboard { min-height: 250px; }
.ad-container.ad-in-content { min-height: 120px; }
.ad-sidebar {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow);
  text-align: center;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--gray-400);
  position: sticky;
  top: 80px;
}
.ad-sidebar .ad-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

/* Content sections */
.content-section {
  margin: 40px 0;
}
.content-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 16px;
}
.content-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--gray-700);
  margin: 20px 0 10px;
}
.content-section p {
  color: var(--gray-600);
  margin-bottom: 12px;
  line-height: 1.7;
}
.content-section ul, .content-section ol {
  padding-left: 20px;
  margin-bottom: 16px;
  color: var(--gray-600);
}
.content-section li { margin-bottom: 6px; }

/* Affiliate */
.affiliate-box {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.affiliate-box p { flex: 1; margin: 0; font-size: .9rem; color: #78350f; }
.affiliate-box .aff-badge {
  background: #f59e0b;
  color: #fff;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.affiliate-box a {
  background: var(--secondary);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: .875rem;
  white-space: nowrap;
}
.affiliate-box a:hover { background: #000; text-decoration: none; }

/* FAQ Schema */
.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .95rem;
}
.faq-question:hover { background: var(--gray-50); }
.faq-question::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--gray-400);
  transition: transform .2s;
}
.faq-question.active::after {
  content: '−';
}
.faq-answer {
  padding: 0 18px;
  max-height: 0;
  overflow: hidden;
  transition: all .25s;
  color: var(--gray-600);
  font-size: .9rem;
}
.faq-answer.open {
  padding: 0 18px 16px;
  max-height: 500px;
}

/* Footer */
.site-footer {
  background: var(--secondary);
  color: var(--gray-400);
  padding: 30px 0;
  margin-top: 40px;
  font-size: .85rem;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
}
.footer-inner .col { flex: 1; min-width: 160px; }
.footer-inner h4 { color: #fff; margin-bottom: 10px; font-size: .9rem; }
.footer-inner a { color: var(--gray-400); display: block; margin-bottom: 4px; }
.footer-inner a:hover { color: #fff; }
.footer-bottom {
  text-align: center;
  padding-top: 20px;
  margin-top: 20px;
  border-top: 1px solid var(--gray-700);
  font-size: .8rem;
}

/* Copy toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--secondary);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 999;
}
.toast.show { opacity: 1; }

/* Range slider for password length */
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--gray-200);
  border-radius: 3px;
  outline: none;
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}
.length-display { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.length-display span { font-weight: 700; color: var(--primary); font-size: 1.1rem; }

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
  transition: top .2s;
}
.skip-link:focus { top: 0; }
