*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ochre-dark: #8B4513;
  --ochre: #B45F2A;
  --ochre-light: #D4945C;
  --cream: #FDF6E8;
  --cream-dark: #F3D9B1;
  --stone: #4A3F35;
  --stone-light: #6B5D4F;
  --slate: #2C3E50;
  --slate-light: #546E7A;
  --success: #2E7D32;
  --warning: #E67E22;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
}

html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--cream);
  color: var(--stone);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: #fff;
  border-bottom: 2px solid var(--cream-dark);
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ochre-dark);
  font-weight: 700;
  font-size: 1.1rem;
}
.logo svg { flex-shrink: 0; }
.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  text-decoration: none;
  color: var(--stone-light);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.site-nav a:hover, .site-nav a:focus { color: var(--ochre); }

main { flex: 1; }

.hero {
  background: linear-gradient(135deg, #FDF6E8 0%, #F3D9B1 100%);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}
.hero-content { max-width: 700px; margin: 0 auto; }
.hero h1 {
  font-size: 2rem;
  color: var(--ochre-dark);
  margin-bottom: 0.75rem;
  line-height: 1.3;
}
.hero p { font-size: 1.1rem; color: var(--stone-light); max-width: 600px; margin: 0 auto; }

.worksheet {
  padding: 2rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.worksheet-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
  align-items: start;
}

.controls-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
}
.controls-panel h2 { color: var(--ochre-dark); margin-bottom: 0.25rem; font-size: 1.4rem; }
.panel-subtitle { color: var(--stone-light); font-size: 0.9rem; margin-bottom: 1.25rem; }

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
.preset-btn {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--stone);
  font-weight: 500;
}
.preset-btn:hover, .preset-btn:focus { background: var(--ochre-light); color: #fff; border-color: var(--ochre); }

.slider-group { margin-bottom: 1rem; }
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.slider-label {
  min-width: 100px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--stone);
}
.slider-input {
  flex: 1;
  min-width: 120px;
  accent-color: var(--ochre);
}
.slider-value {
  min-width: 45px;
  text-align: right;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ochre-dark);
}

.total-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}
.total-track {
  flex: 1;
  height: 8px;
  background: #e0d7c8;
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.total-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.2s, background 0.2s;
}
.total-fill.warn { background: var(--warning); }
.warning { color: var(--warning); font-size: 0.85rem; }
.hidden { display: none; }

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--ochre);
  background: #fff;
  color: var(--ochre);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  margin-right: 0.5rem;
  margin-top: 0.5rem;
}
.action-btn:hover, .action-btn:focus { background: var(--ochre); color: #fff; }
.action-btn.icon-only { padding: 0.5rem; border: none; background: transparent; color: var(--stone-light); }
.action-btn.icon-only:hover { color: var(--ochre); }

.results-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 2px solid var(--ochre-light);
  position: sticky;
  top: 5rem;
}
.results-panel h2 { color: var(--ochre-dark); font-size: 1.2rem; margin-bottom: 0.75rem; }
.big-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--ochre-dark);
  text-align: center;
  line-height: 1;
  margin: 0.5rem 0;
}
.estimate-label { text-align: center; color: var(--stone-light); font-size: 0.9rem; margin-bottom: 1rem; }
.percentile-bar { margin: 1rem 0; }
.percentile-label { font-size: 0.85rem; color: var(--stone-light); display: block; margin-bottom: 0.25rem; }
.percentile-track {
  height: 10px;
  background: #e0d7c8;
  border-radius: 5px;
  overflow: hidden;
  margin: 0.25rem 0;
}
.percentile-fill {
  height: 100%;
  background: var(--ochre);
  border-radius: 5px;
  transition: width 0.3s;
}
.result-note { font-size: 0.9rem; color: var(--stone); margin: 0.75rem 0; }
.saved-profiles { margin-top: 1.5rem; border-top: 1px solid var(--cream-dark); padding-top: 1rem; }
.saved-profiles h3 { font-size: 0.95rem; color: var(--stone-light); margin-bottom: 0.5rem; }
#saved-list { list-style: none; font-size: 0.85rem; }
#saved-list li {
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--cream-dark);
  cursor: pointer;
  color: var(--ochre);
}
#saved-list li:hover { text-decoration: underline; }

.comparison {
  padding: 2rem 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}
.comparison h2 { color: var(--ochre-dark); font-size: 1.5rem; margin-bottom: 0.5rem; }
.comparison p { color: var(--stone-light); margin-bottom: 1.25rem; }
.table-scroll { overflow-x: auto; }
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 0.9rem;
}
.comparison-table th {
  background: var(--ochre-dark);
  color: #fff;
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
}
.comparison-table td { padding: 0.6rem 1rem; border-bottom: 1px solid var(--cream-dark); }
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table tr.highlight { background: #FFF8E1; font-weight: 600; }
.table-note { font-size: 0.8rem; color: var(--stone-light); margin-top: 0.75rem; font-style: italic; }

.timeline {
  padding: 2rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}
.timeline h2 { color: var(--ochre-dark); font-size: 1.5rem; margin-bottom: 0.25rem; }
.timeline p { color: var(--stone-light); margin-bottom: 1.5rem; }
.timeline-visual { display: flex; flex-direction: column; gap: 1rem; }
.tl-item {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
  border-left: 3px solid var(--ochre-light);
  padding-left: 1.25rem;
  position: relative;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 0.5rem;
  width: 11px;
  height: 11px;
  background: var(--ochre);
  border-radius: 50%;
}
.tl-year { font-weight: 700; color: var(--ochre-dark); min-width: 90px; font-size: 0.9rem; }
.tl-desc { color: var(--stone); font-size: 0.95rem; }

.supporting-content {
  padding: 2rem 1.5rem 3rem;
  max-width: 1000px;
  margin: 0 auto;
}
.supporting-content h2 { color: var(--ochre-dark); font-size: 1.5rem; margin-bottom: 1.5rem; }
.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.content-block {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--cream-dark);
}
.content-block h3 { color: var(--ochre-dark); font-size: 1.1rem; margin-bottom: 0.5rem; }
.content-block p { color: var(--stone); font-size: 0.95rem; }
.why-exists {
  background: #FFF8E1;
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--cream-dark);
}
.why-exists h3 { color: var(--ochre-dark); margin-bottom: 0.5rem; }
.why-exists p { color: var(--stone); font-size: 0.95rem; }

.site-footer {
  background: var(--stone);
  color: #ddd;
  padding: 1.5rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
}
.footer-inner a { color: var(--cream-dark); text-decoration: none; }
.footer-inner a:hover { text-decoration: underline; }
.footer-nav { display: flex; gap: 1.5rem; }

@media (max-width: 850px) {
  .worksheet-layout { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  .content-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.6rem; }
  .big-number { font-size: 2.5rem; }
}
@media (max-width: 500px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .slider-row { flex-direction: column; align-items: flex-start; }
  .slider-input { width: 100%; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
