@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* === CUSTOM PROPERTIES === */
:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-light: #eff6ff;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.05);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.08);
  --nav-h: 64px;
  --score1: #ef4444;
  --score2: #f97316;
  --score3: #ca8a04;
  --score4: #65a30d;
  --score5: #16a34a;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === LAYOUT === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
.section {
  padding: 3rem 0;
}
.section + .section {
  padding-top: 0;
}

/* === NAVIGATION === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.nav-logo span { color: var(--accent); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex-wrap: wrap;
}
.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); background: var(--bg); }
.nav-cta {
  margin-left: auto;
  background: var(--accent);
  color: #fff !important;
  border-radius: 8px !important;
  padding: 0.45rem 1rem !important;
  font-weight: 600 !important;
}
.nav-cta:hover { background: var(--accent-dark); color: #fff !important; }

/* === HERO (homepage) === */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  padding: 5rem 0 4rem;
  text-align: center;
  color: #fff;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto 2rem;
}
.search-wrap {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}
.search-wrap input {
  width: 100%;
  padding: 0.9rem 1.25rem 0.9rem 3rem;
  border-radius: 50px;
  border: none;
  font-size: 1rem;
  font-family: inherit;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  outline: none;
  color: var(--text);
}
.search-wrap input:focus { box-shadow: 0 4px 20px rgba(0,0,0,0.25); }
.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* === PAGE HERO (calculator pages) === */
.page-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  padding: 3rem 0 2.5rem;
  color: #fff;
}
.page-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}
.page-intro {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 680px;
  line-height: 1.7;
}
.page-updated {
  font-size: 0.8rem;
  opacity: 0.65;
  margin-top: 0.75rem;
  font-style: italic;
}

/* === HOW IT WORKS === */
.how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}
.step-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.step-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.step-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.step-card p { font-size: 0.9rem; color: var(--text-muted); }

/* === CALCULATOR GRID (homepage) === */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}
.section-title span { color: var(--accent); }
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.calc-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
}
.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.calc-card-emoji {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.calc-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}
.calc-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.calc-card-link {
  margin-top: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* === CALCULATOR UI === */
#calculator {
  margin-bottom: 1.5rem;
}
.calc-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.calc-section-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.section-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
}
.section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}
.section-weight {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}
.input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.input-row label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}
.input-with-max {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.input-with-max input[type="number"] {
  width: 64px;
  padding: 0.4rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  -moz-appearance: textfield;
}
.input-with-max input[type="number"]::-webkit-outer-spin-button,
.input-with-max input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.input-with-max input[type="number"]:focus { border-color: var(--accent); }
.max-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  margin: 0.5rem 0 0.25rem;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(37,99,235,0.4);
  transition: transform 0.1s;
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.frq-row {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--bg);
}
.frq-row:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.frq-row > label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.frq-input-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.frq-input-group .slider { margin: 0; flex: 1; }

/* === SCORE DISPLAY === */
.score-display-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
  text-align: center;
}
.score-badge {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  transition: background 0.35s ease, transform 0.2s;
}
.score-badge.has-score { transform: scale(1.03); }
.score-number {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1;
  color: currentColor;
}
.score-text {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}
.score-qualifier {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  min-height: 1.4em;
  font-weight: 500;
}

/* Score color classes */
.score-1 { background: var(--score1); color: #fff; }
.score-2 { background: var(--score2); color: #fff; }
.score-3 { background: var(--score3); color: #fff; }
.score-4 { background: var(--score4); color: #fff; }
.score-5 { background: var(--score5); color: #fff; }

.composite-display { margin-bottom: 1.25rem; }
.composite-numbers {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.composite-sep, .composite-max {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}
.composite-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.progress-bar-outer {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s ease, background 0.35s;
  width: 0%;
}
.pb-1 { background: var(--score1); }
.pb-2 { background: var(--score2); }
.pb-3 { background: var(--score3); }
.pb-4 { background: var(--score4); }
.pb-5 { background: var(--score5); }

.score-breakdown {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  text-align: left;
}
.score-breakdown h4 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  padding: 0.25rem 0;
  color: var(--text-muted);
}
.breakdown-row span:last-child { font-weight: 600; color: var(--text); }

/* === CONVERSION TABLE === */
.conversion-table-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}
.conversion-table-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}
.score-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.score-table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--border);
}
.score-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--bg);
  vertical-align: middle;
}
.score-table tr:last-child td { border-bottom: none; }
.score-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
}
.table-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1rem;
  font-style: italic;
}
.current-score-row {
  background: var(--accent-light) !important;
  font-weight: 600;
}

/* === CONTENT SECTIONS === */
.content-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.content-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}
.content-card p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}
.content-card p:last-child { margin-bottom: 0; }
.score-meanings {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.score-meaning-item {
  border-radius: var(--radius);
  padding: 1rem 0.75rem;
  text-align: center;
}
.score-meaning-item .score-num {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.35rem;
}
.score-meaning-item .score-desc {
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
}
.sm-1 { background: #fef2f2; color: var(--score1); }
.sm-2 { background: #fff7ed; color: var(--score2); }
.sm-3 { background: #fefce8; color: var(--score3); }
.sm-4 { background: #f7fee7; color: var(--score4); }
.sm-5 { background: #f0fdf4; color: var(--score5); }
.sm-1 .score-desc { color: var(--score1); }
.sm-2 .score-desc { color: var(--score2); }
.sm-3 .score-desc { color: var(--score3); }
.sm-4 .score-desc { color: var(--score4); }
.sm-5 .score-desc { color: var(--score5); }

/* === FAQ === */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  user-select: none;
  transition: background 0.1s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { background: var(--bg); }
.faq-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item[open] .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}
.faq-answer p { margin-bottom: 0.75rem; }
.faq-answer p:last-child { margin-bottom: 0; }

/* === RELATED CALCULATORS === */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.related-card-emoji { font-size: 1.5rem; }
.related-card-name { font-weight: 600; font-size: 0.875rem; line-height: 1.3; }
.related-card-action { font-size: 0.78rem; color: var(--accent); font-weight: 600; }

/* === FOOTER === */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  margin-top: 4rem;
  padding: 3rem 0 2rem;
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 3rem;
  margin-bottom: 2rem;
}
.footer-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: block;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.footer-brand p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
}
.footer-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.footer-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  margin-bottom: 0.75rem;
}
.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer-col a {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-col a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 1.5rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* === UTILITIES === */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.hidden { display: none !important; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-blue { background: var(--accent-light); color: var(--accent); }

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .calc-wrapper {
    grid-template-columns: 1fr;
  }
  .score-display-card {
    position: static;
    order: -1;
  }
  .score-meanings {
    grid-template-columns: repeat(5, 1fr);
  }
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-links {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 680px) {
  .how-it-works {
    grid-template-columns: 1fr;
  }
  .score-meanings {
    grid-template-columns: repeat(3, 1fr);
  }
  .nav-links { display: none; }
  .hero { padding: 3rem 0 2.5rem; }
  .section { padding: 2rem 0; }
  .footer-links { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .score-meanings { grid-template-columns: repeat(2, 1fr); }
  .calc-grid { grid-template-columns: 1fr 1fr; }
  .related-grid { grid-template-columns: 1fr 1fr; }
}

/* === SCORE STATS GRID === */
.calc-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
@media (max-width: 700px) {
  .calc-stats-grid { grid-template-columns: 1fr; }
}
.stats-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}
.stats-heading {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.875rem;
  color: var(--text);
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.stats-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 0 0.5rem;
  border-bottom: 1px solid var(--border);
}
.stats-table td {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.stats-table tr:last-child td { border-bottom: none; }
.stats-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}
.score-badge-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
}
.sb-5 { background: #16a34a; }
.sb-4 { background: #2563eb; }
.sb-3 { background: #7c3aed; }
.sb-2 { background: #d97706; }
.sb-1 { background: #dc2626; }
.dist-bar-wrap {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  width: 100%;
  min-width: 60px;
  overflow: hidden;
}
.dist-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.db-5 { background: #16a34a; }
.db-4 { background: #2563eb; }
.db-3 { background: #7c3aed; }
.db-2 { background: #d97706; }
.db-1 { background: #dc2626; }
