*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red-500: #ef4444;
  --green-500: #22c55e;
  --amber-500: #f59e0b;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,.07), 0 10px 15px rgba(0,0,0,.1);
}
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-logo { font-size: 1.25rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.site-logo:hover { text-decoration: none; }
.site-nav { display: flex; gap: 8px; }
.site-nav a {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: background .15s, color .15s;
}
.site-nav a:hover { background: var(--gray-100); color: var(--gray-900); text-decoration: none; }

/* Layout */
.wrapper { flex: 1; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Tool page layout */
.tool-page { padding: 32px 0 48px; }
.tool-header { text-align: center; margin-bottom: 32px; }
.tool-header h1 { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.tool-header p { font-size: 1rem; color: var(--gray-500); max-width: 600px; margin: 0 auto; }
.tool-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 640px;
  margin: 0 auto;
}
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
  background: #fff;
  color: var(--gray-800);
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  font-size: .875rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-group { display: flex; gap: 12px; margin-top: 8px; }
.result-box {
  margin-top: 24px;
  padding: 20px;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 1px solid rgba(37,99,235,.2);
}
.result-box h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500); margin-bottom: 4px; }
.result-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.result-detail { font-size: .875rem; color: var(--gray-500); margin-top: 4px; }
.result-list { margin-top: 16px; }
.result-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-200); font-size: .875rem; }
.result-item:last-child { border-bottom: none; }
.result-item .label { color: var(--gray-500); }
.result-item .value { font-weight: 600; color: var(--gray-800); }
.error-text { color: var(--red-500); font-size: .875rem; margin-top: 4px; }
.hidden { display: none; }

/* Landing page */
.hero {
  text-align: center;
  padding: 64px 16px 48px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: #fff;
}
.hero h1 { font-size: 2.25rem; font-weight: 800; margin-bottom: 12px; }
.hero p { font-size: 1.125rem; opacity: .9; max-width: 600px; margin: 0 auto 32px; }
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  padding: 48px 16px 64px;
  max-width: 1100px;
  margin: 0 auto;
}
.tool-card-link {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 28px;
  transition: box-shadow .2s, transform .2s;
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
}
.tool-card-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); text-decoration: none; }
.tool-card-link .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
}
.tool-card-link h2 { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); margin-bottom: 8px; }
.tool-card-link p { font-size: .875rem; color: var(--gray-500); line-height: 1.5; }

/* Footer */
.site-footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 24px 16px;
  text-align: center;
  font-size: .875rem;
}
.site-footer a { color: var(--gray-300); }
.site-footer a:hover { color: #fff; }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }

/* AdSense notice */
.adsense-notice {
  background: var(--amber-500);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: .8125rem;
  font-weight: 500;
}

/* Responsive */
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .tool-card { padding: 20px; border-radius: 0; box-shadow: none; }
  .hero h1 { font-size: 1.5rem; }
  .hero { padding: 40px 16px 32px; }
  .tools-grid { grid-template-columns: 1fr; padding: 32px 16px; gap: 16px; }
  .site-nav a { padding: 6px 8px; font-size: .8125rem; }
}
