/* 
   =====================================================================
   TOOLS CSS - ULTRA-MINIMALIST AESTHETIC (VERCEL / LINEAR STYLE)
   ===================================================================== 
*/

:root {
  /* Ultra-Minimalist Palette */
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-hover: #f1f1f1;
  --border: #eaeaea;
  --border-focus: #333333;
  
  --text-main: #111111;
  --text-muted: #666666;
  --text-light: #888888;
  
  --error-bg: #fffcfc;
  --error-text: #d90000;
  --error-border: #f5d6d6;
  
  --success-bg: #fcfcfc;
  --success-text: #111111;
  --success-border: #eaeaea;
  
  /* Typography */
  --font-sans: 'Geist', 'Inter', 'SF Pro Display', Roboto, 'Helvetica Neue', Arial, sans-serif;
  
  /* Structure */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 6px; /* Max 6px per instruction */
  
  /* Spacing */
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: clamp(24px, 4vw, 40px);
  --space-xl: clamp(40px, 8vw, 80px);
  
  /* Transitions */
  --transition: all 0.15s ease-in-out;
}

/* ================== RESET & BASE ================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-main);
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

p {
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

/* ================== TYPOGRAPHY & HEADERS ================== */
.hero-h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; margin-bottom: var(--space-sm); }
.hero-sub { font-size: clamp(1rem, 2vw, 1.25rem); color: var(--text-muted); max-width: 65ch; margin-bottom: var(--space-xl); line-height: 1.6; }
.tool-hero { text-align: left; padding: var(--space-xl) 0 var(--space-lg); }
.hero-badge, .mode-tag, .chip { display: inline-flex; align-items: center; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500; color: var(--text-muted); background: var(--surface); margin-bottom: var(--space-md); font-family: var(--font-sans); }

/* ================== LAYOUT & CONTAINERS ================== */
.calc-container, .calculator-container, .container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  padding-bottom: var(--space-xl);
}

.calc-card, .metric-card, .stat-card, .result-box, .status-panel-card, .recipe-checklist-section, .derivation-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: none; /* No drop shadows */
}

/* ================== FORMS & INPUTS ================== */
.input-group, .form-group { display: flex; flex-direction: column; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.input-label, .form-label { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.form-label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }

.input-vercel, .input-field, .calc-input, input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.input-vercel:focus, .input-field:focus, .calc-input:focus, input:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: none; /* No glowing rings */
}

/* ================== BUTTONS ================== */
.btn, .btn-primary, .btn-vercel-primary, .btn-calc-primary, .cta-btn-primary, .conversion-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: var(--text-main);
  color: var(--bg);
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:hover, .btn-vercel-primary:hover, .btn-calc-primary:hover, .cta-btn-primary:hover {
  opacity: 0.85;
}

.btn-vercel-reset, .btn-vercel-secondary, .btn-secondary, .btn-calc-secondary, .tab-btn, .calc-tab-btn {
  background: var(--bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-vercel-reset:hover, .btn-vercel-secondary:hover, .btn-secondary:hover, .btn-calc-secondary:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}

.action-bar, .calc-action-bar, .sim-btn-row {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

/* ================== GRIDS & METRICS ================== */
.calc-grid, .calc-grid-layout, .dashboard-metrics, .metrics-grid, .variables-panel, .grid-inputs, .sim-panel-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-lg);
}

.stat-label, .metric-label, .metric-panel-lbl, .metric-desc, .ratio-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.stat-value, .metric-value, .metric-panel-val, .metric-val, .summary-metric {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.metric-panel-card, .metric-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  background: var(--bg);
}

/* ================== PUNNETT & TABLES ================== */
.grid-wrap {
  margin: var(--space-lg) 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: var(--space-lg);
}

.calc-table, .data-tbl, .comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.calc-table th, .data-tbl th, .comparison-table th {
  text-align: left;
  padding: 16px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.calc-table td, .data-tbl td, .comparison-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

/* Remove vertical borders for clean flow */
.ind-cell, .ind-col-header, .ind-row-header {
  border-left: none;
  border-right: none;
}

.ind-col-header, .ind-row-header {
  color: var(--text-muted);
  font-weight: 500;
}

.input-cross {
  font-size: 1.5rem;
  color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ratios */
.ratios-wrap { display: flex; gap: var(--space-lg); margin-top: var(--space-lg); flex-wrap: wrap; }
.ratio-card { flex: 1; min-width: 200px; border: 1px solid var(--border); padding: var(--space-lg); border-radius: var(--radius-md); }
.ratio-list { list-style: none; }
.ratio-list li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.ratio-list li:last-child { border-bottom: none; }
.ratio-geno { font-family: var(--font-sans); font-weight: 500; }
.ratio-pct { font-weight: 500; }

/* ================== ALERTS & BADGES ================== */
.alert-box {
  padding: 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.95rem;
  border: 1px solid var(--border);
}

.alert-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-border); }

.status-badge, .result-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-main);
}
.status-badge.eq, .result-badge.not-significant { background: var(--success-bg); border-color: var(--success-border); }
.status-badge.not-eq, .result-badge.significant { background: var(--error-bg); color: var(--error-text); border-color: var(--error-border); }

/* ================== MISCELLANEOUS ================== */
.equation-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  text-align: center;
  font-family: 'Times New Roman', serif;
  font-size: 1.5rem;
  margin: var(--space-lg) 0;
}

.math-symbol { font-style: italic; font-weight: 500; color: var(--text-main); margin: 0 6px; }

.chart-container, .chart-wrapper {
  width: 100%; height: 350px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
}

.recipe-list { list-style: none; }
.recipe-list li { display: flex; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.recipe-list li:last-child { border-bottom: none; }
.highlight { font-weight: 600; color: var(--text-main); }
.summary-card { padding: var(--space-xl); text-align: center; border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--space-lg); }
.conversion-box { 
  padding: 2.5rem; 
  border: 1px solid var(--border); 
  border-radius: var(--radius-lg); 
  background: var(--surface);
  display: flex; 
  flex-direction: column;
  gap: var(--space-md);
  margin: 3rem 0;
  text-align: left;
}
.conversion-box h3 { margin: 0; font-size: 1.5rem; color: var(--text-main); }
.conversion-box p { margin: 0; line-height: 1.6; }
.conversion-box .conversion-btn { align-self: flex-start; margin-top: var(--space-md); }

/* Tabs */
.tabs-header { display: flex; gap: var(--space-md); border-bottom: 1px solid var(--border); margin-bottom: var(--space-lg); }
.tab-btn, .calc-tab-btn { background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 12px 0; color: var(--text-muted); }
.tab-btn:hover, .calc-tab-btn:hover { color: var(--text-main); background: none; border-color: transparent; }
.tab-btn.active, .calc-tab-btn.active { color: var(--text-main); border-bottom-color: var(--text-main); }

/* =====================================================================
   LAYOUT RESTORATION & TYPOGRAPHY - ULTRA-MINIMALIST
   ===================================================================== */
   
/* Main Content Article */
.content, .landing-article {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
}

.content h2, .content h3 {
  color: var(--text-main);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.content p {
  margin-bottom: var(--space-lg);
  line-height: 1.7;
}

.content ul, .content ol {
  margin-bottom: var(--space-lg);
  padding-left: 20px;
}

.content li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.hr, .content-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-xl) 0;
}

/* Callouts & Info Boxes */
.callout, .edu-callout, .callout-info, .callout-tip, .callout-svc, .cta-conversion-card {
  padding: var(--space-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
}

.callout h3, .edu-callout h3 {
  margin-top: 0;
}

.callout p:last-child, .edu-callout p:last-child {
  margin-bottom: 0;
}

.callout-info { border-left: 4px solid var(--text-main); }
.callout-svc { background: var(--bg); border-style: dashed; }

/* FAQ Accordions */
.faq-accordion, .faq-wrapper {
  margin-top: var(--space-xl);
}

.faq-list {
  list-style: none;
  padding: 0;
}

.faq-item, .faq-panel {
  border: none;
  margin-bottom: 3rem;
}

.faq-item:first-child, .faq-panel:first-child {
  border: none;
}

.faq-q, .faq-trigger {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0 0 1rem 0;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-main);
  cursor: default;
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 1rem;
}

.faq-q::before, .faq-trigger::before {
  content: "Q: ";
}

.faq-q svg, .faq-trigger svg {
  display: none;
}

.faq-q:hover, .faq-trigger:hover {
  color: var(--text-main);
}

.faq-a, .faq-body {
  padding: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.faq-a::before, .faq-body::before {
  content: "A: ";
  font-weight: 700;
  color: var(--text-muted);
}

/* Tables in Content */
.tbl-wrap, .table-responsive, .edu-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: var(--space-xl) 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.data-tbl, .edu-data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
}

.data-tbl th, .edu-data-table th {
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.data-tbl td, .edu-data-table td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}

.data-tbl tr:last-child td, .edu-data-table tr:last-child td {
  border-bottom: none;
}

/* Page Hero */
.page-hero {
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

/* Breadcrumbs */
.breadcrumb, .breadcrumb-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.breadcrumb a, .breadcrumb-bar a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover, .breadcrumb-bar a:hover {
  color: var(--text-main);
}

.breadcrumb-sep, .sep {
  color: var(--border);
}

/* Math and Code Blocks */
.math-block, .font-code {
  font-family: var(--font-sans);
  background: var(--surface);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}

/* SEO Wrapper */
.seo-content-wrapper {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  padding-top: var(--space-xl);
}

/* =====================================================================
   METICULOUS ALIGNMENT AND GRID FIXES
   ===================================================================== */

/* 1. Fix Breadcrumbs and Hero centering */
.breadcrumb, .breadcrumb-bar, .hero-section, .tool-hero {
  max-width: 900px;
  margin: 0 auto;
  padding-left: var(--space-lg);
  padding-right: var(--space-lg);
}

.hero-section, .tool-hero {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-lg);
}

/* 2. Fix the primary Calculator Grid (Sidebar vs Main) */
.calc-grid, .pane-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}
@media (min-width: 768px) {
  .calc-grid {
    grid-template-columns: 320px 1fr;
    align-items: start;
  }
}

/* 3. Fix the nested grids (metrics inside the right panel) */
.dashboard-metrics, .metrics-grid, .nested-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

/* 4. Fix Allele specific panel layout */
.panel-input {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* 5. Fix Punnett Square Specific Grids */
.grid-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--text-muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-xl);
}
.grid-ph svg {
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-md);
  color: var(--border);
}

.calc-error {
  display: none;
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  font-size: 0.95rem;
  text-align: center;
}
.calc-error.vis {
  display: block;
}
.punnett-tbl, .ind-cell {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.25rem;
}

/* 6. Fix Header/Footer if they are missing container constraints */
.main-header, .site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 16px 0;
}
.header-container, .nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-links, .nav-list {
  display: flex;
  gap: 24px;
  list-style: none;
  align-items: center;
}
.nav-links a, .nav-list a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
}
.nav-links a:hover, .nav-list a:hover {
  color: var(--text-main);
}
.header-logo, .nav-logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-main);
  text-decoration: none;
}
.header-logo span, .nav-logo span {
  color: var(--text-muted);
}
.main-footer, .site-footer {
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 40px 0;
  background: var(--surface);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}
.footer-legal, .footer-bottom {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}
.footer-legal a, .footer-bottom a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-legal a:hover, .footer-bottom a:hover {
  text-decoration: underline;
}

/* Overriding the 200px calc-grid from previously so it works as sidebar */
/* Remove the old rule by making the new one more specific */
main.calc-container .calc-grid {
  grid-template-columns: 1fr;
}
@media (min-width: 850px) {
  main.calc-container .calc-grid {
    grid-template-columns: 340px 1fr;
  }
}

/* =====================================================================
   ALLELE FREQUENCY FIXES (PANEL BOUNDARIES & LOG OVERFLOW)
   ===================================================================== */

/* 1. Prevent Grid Blowout */
.panel-input, .panel-results {
  min-width: 0;
  overflow: hidden;
}

/* 2. Fitness Nested Grid Fix (Stack them cleanly in the sidebar) */
.panel-input .nested-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.panel-input .nested-grid > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-input .nested-grid > div > span {
  margin-bottom: 0 !important;
}
.panel-input .nested-grid > div > input {
  width: 100px;
}

/* 3. History Log Table Overflow and Styling */
.log-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-top: var(--space-md);
}
.log-table {
  width: 100%;
  border-collapse: collapse;
}
.log-table th {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
}
.log-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  font-family: var(--font-code);
  font-size: 0.9rem;
}
.log-table tr:last-child td {
  border-bottom: none;
}

/* 4. Chart Fixes */
.results-tbl-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.chart-container {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  margin-top: var(--space-md);
  padding: var(--space-md);
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}
.chart-legend {
  display: flex;
  gap: var(--space-md);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.legend-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.chart-wrapper {
  width: 100%;
  position: relative;
}
.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* 5. Fix Article Width by extending .content */
.landing-content, .seo-content-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  color: var(--text-muted);
}
.landing-content h2, .landing-content h3, .seo-content-wrapper h2, .seo-content-wrapper h3 {
  color: var(--text-main);
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.landing-content p, .seo-content-wrapper p {
  margin-bottom: var(--space-lg);
  line-height: 1.7;
}

/* Action Controls Alignment */
.sim-btn-row {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}
.action-bar {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

/* =====================================================================
   DASHBOARD WIDTH EXPANSION (Fixes squished tables & charts)
   ===================================================================== */

/* 1. Expand the Calculator Dashboard container to 1200px */
.calc-container, .calculator-container {
  max-width: 1200px !important;
}

/* 2. Fix nested-grid alignment (ensure label text doesn't overlap/squish) */
.panel-input .nested-grid > div {
  flex-wrap: wrap; /* allow wrapping if super narrow, but mostly prevent overlapping */
  gap: 8px;
}
.panel-input .nested-grid > div > span {
  flex: 1 1 auto;
  min-width: max-content;
}
.panel-input .nested-grid > div > input {
  flex: 0 0 100px;
}

/* 3. Ensure tables can be scrolled instead of cut off if screen is small */
.responsive-table {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  background: var(--surface);
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
}
.comparison-table th {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}
.comparison-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
  white-space: nowrap;
}
.comparison-table tr:last-child td {
  border-bottom: none;
}

/* =====================================================================
   BUTTON ALIGNMENT FIX (Sidebar Constraints)
   ===================================================================== */

/* Ensure the action bar inside the sidebar stacks cleanly instead of squishing */
.action-bar, .calc-action-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  padding-top: var(--space-md);
}

.action-bar > .btn, .calc-action-bar > .btn, 
.action-bar > button, .calc-action-bar > button {
  width: 100%;
}

/* Make the internal row of small buttons distribute evenly without overflowing */
.sim-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sim-btn-row > button {
  flex: 1 1 calc(33.333% - 8px);
  padding: 12px 8px; /* reduce padding so they fit nicely */
  text-align: center;
}

/* =====================================================================
   CARRYING CAPACITY SVG CHART STYLES (Fixes the black blob & overlaps)
   ===================================================================== */

.chart-wrapper {
  margin-bottom: var(--space-xl);
  padding-bottom: 32px; /* room for the overflowing x-axis labels */
}

/* SVG Core Elements */
.chart-curve {
  fill: none;
  stroke: var(--text-main);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-node {
  fill: var(--text-main);
  stroke: var(--bg);
  stroke-width: 1.5;
}
.chart-node:hover {
  fill: #2563EB;
  cursor: crosshair;
}

/* Grids and Axes */
.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis-line {
  stroke: var(--text-muted);
  stroke-width: 1;
}

.chart-tick-text {
  font-family: var(--font-sans);
  font-size: 12px;
  fill: var(--text-muted);
}
.chart-tick-text.y-axis {
  text-anchor: end;
}

/* Special Marker Lines */
.chart-k-line {
  stroke: #DC2626;
  stroke-width: 1.5;
  stroke-dasharray: 6,4;
}

.chart-inflection-line {
  stroke: #7C3AED;
  stroke-width: 1.5;
  stroke-dasharray: 4,4;
}

.chart-tooltip {
  position: absolute;
  background: var(--text-main);
  color: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
  font-family: var(--font-sans);
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* =====================================================================
   PUNNETT SQUARE SPECIFIC LAYOUT (Fixes 100% wide stacked inputs)
   ===================================================================== */

/* Force the Parent 1 and Parent 2 inputs to sit side-by-side */
.input-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap; /* responsive wrap for mobile */
}

/* Restrict the width of each input group so they don't stretch forever */
.input-row .input-group {
  flex: 1;
  max-width: 320px;
  margin-bottom: 0; /* remove bottom margin since row handles spacing */
}

/* Align the multiplication cross */
.input-cross {
  font-size: 1.5rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 16px; /* push down to align with input box, not label */
  user-select: none;
}

/* Center the hints and mode tags */
.input-hint {
  text-align: center;
  margin-bottom: var(--space-xl);
}

#mode-tag {
  display: flex;
  justify-content: center;
  margin: var(--space-md) auto;
  width: fit-content;
}

/* =====================================================================
   PUNNETT RATIO SUMMARY FIX (Full width for long text)
   ===================================================================== */

/* Force the Ratio Summary card to drop to its own full-width line */
.ratio-summary {
  flex: 1 1 100%;
}

/* Give the paragraph text inside the summary some breathing room */
.ratio-summary p {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
  line-height: 1.8;
  font-size: 0.95rem;
}

/* =====================================================================
   BOTTOM CALL TO ACTION (CTA)
   ===================================================================== */
.cta-sec {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 100px 24px;
  margin-top: 80px;
  text-align: center;
}

.cta-inner {
  max-width: 760px;
  margin: 0 auto;
}

.cta-inner h2 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-main);
  margin-bottom: var(--space-md);
  line-height: 1.1;
}

.cta-inner p {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-xl);
}

.cta-btns {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 32px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s ease;
}

.cta-primary {
  background: var(--text-main);
  color: var(--bg);
  border: 1px solid var(--text-main);
}

.cta-primary:hover {
  background: var(--text-muted);
  border-color: var(--text-muted);
}

.cta-secondary {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.cta-secondary:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}
