:root {
  --bg: #f6f1e7;
  --bg-2: #efe7d6;
  --ink: #2f3e2c;
  --muted: #5a6b53;
  --line: #c9b98e;
  --accent: #2a9d8f;
  --accent-2: #e76f51;
  --warn: #e9c46a;
  --bad: #c8553d;
  --good: #3d8b37;
  --card: #ffffff;
  --shadow: 0 10px 30px rgba(47, 62, 44, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --max: 1180px;
  --pad: clamp(16px, 3vw, 32px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 17px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 var(--pad); }

.site-header {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.2px;
}
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; }
.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a { color: var(--ink); font-weight: 600; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 32px;
  padding: 48px 0 24px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--ink);
}
.lead { color: var(--muted); font-size: 18px; max-width: 56ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.hero-stats {
  list-style: none;
  display: flex;
  gap: 24px;
  padding: 0;
  margin: 24px 0 0;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 24px; color: var(--accent); }
.hero-stats span { color: var(--muted); font-size: 14px; }

.hero-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.card-puzzle {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 10px;
  background: repeating-linear-gradient(45deg, #e9c46a 0 12px, #f4a261 12px 24px);
  box-shadow: inset 0 0 0 6px var(--ink);
}
.cp-box {
  position: absolute;
  top: 16px;
  left: 16px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  display: flex;
  flex-direction: column;
}
.cp-label { font-weight: 700; }
.cp-sub { color: var(--muted); }
.cp-piece {
  position: absolute;
  width: 36px;
  height: 36px;
  background: #2a9d8f;
  border: 2px solid var(--ink);
  border-radius: 6px;
  bottom: 24px;
  right: 24px;
}
.cp-piece.two { background: #e76f51; bottom: 70px; right: 70px; }
.cp-piece.three { background: #3d8b37; bottom: 24px; right: 70px; }
.cp-piece.four { background: #e9c46a; bottom: 70px; right: 24px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  font-size: 15px;
  transition: transform 0.05s ease, background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--bg-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #238377; }
.btn-ghost { background: transparent; }

section {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
section:first-of-type { border-top: none; }
section h2 { font-size: clamp(22px, 2.6vw, 30px); margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.estimator-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: start;
}
.estimator-form, .estimator-result {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 15px;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="search"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}
.field textarea { resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 14px;
  cursor: pointer;
}
.chip input { accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.result-band {
  border-radius: var(--radius-sm);
  padding: 16px;
  border: 1px solid var(--line);
  background: #f0f5e9;
}
.result-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.result-label { font-size: 20px; font-weight: 800; }
.result-score { font-size: 14px; color: var(--muted); }
.result-bar {
  height: 10px;
  background: #e6e6d8;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.result-fill {
  height: 100%;
  width: 20%;
  background: var(--good);
  transition: width 0.25s ease, background 0.25s ease;
}
.result-good { background: #eef6e6; border-color: #b9d3a3; }
.result-good .result-fill { background: var(--good); width: 20%; }
.result-medium { background: #fdf3e0; border-color: #e9c46a; }
.result-medium .result-fill { background: var(--warn); width: 50%; }
.result-caution { background: #fbe9d8; border-color: #f4a261; }
.result-caution .result-fill { background: #f4a261; width: 70%; }
.result-high { background: #f7dcd0; border-color: var(--bad); }
.result-high .result-fill { background: var(--bad); width: 90%; }

.result-body { margin-top: 18px; }
.result-body h3 { margin: 16px 0 6px; font-size: 17px; }
.result-body p, .result-body li { color: var(--ink); }
.checklist { padding-left: 20px; }
.checklist li { margin: 4px 0; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.walkthrough-content { margin-top: 18px; max-width: 75ch; }
.walkthrough-content h3 { margin-top: 18px; }
.scenario {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 24px;
  margin-top: 18px;
  align-items: start;
}
.scenario-steps {
  padding-left: 22px;
  margin: 0;
}
.scenario-steps li { margin: 8px 0; }
.scenario-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.scenario-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 15px;
}
.scenario-row:last-child { border-bottom: none; }
.scenario-label { color: var(--muted); }
.scenario-value { font-weight: 700; }
.result-medium { color: #b87a1a; }

.inventory-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.inventory-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.inventory-controls input,
.inventory-controls select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 15px;
  font-family: inherit;
}
.inventory-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.inv-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  border-left: 6px solid var(--good);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-card.medium { border-left-color: var(--warn); }
.inv-card.caution { border-left-color: #f4a261; }
.inv-card.high { border-left-color: var(--bad); }
.inv-card .inv-brand { font-weight: 800; font-size: 17px; }
.inv-card .inv-meta { color: var(--muted); font-size: 14px; }
.inv-card .inv-result { font-weight: 700; }
.inv-card .inv-actions { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.inv-card .btn { padding: 6px 10px; font-size: 13px; }

.empty-state {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.reference-grid article {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.reference-grid h3 { margin-top: 0; }
.reference-note {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--bg-2);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  margin-top: 40px;
  background: var(--bg-2);
  border-top: 1px solid var(--line);
  padding: 24px 0;
}
.footer-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.site-footer nav { display: flex; gap: 14px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .estimator-grid { grid-template-columns: 1fr; }
  .scenario { grid-template-columns: 1fr; }
  .nav { gap: 12px; }
  .nav a { font-size: 15px; }
}

@media (max-width: 560px) {
  .hero-stats { gap: 14px; }
  .hero-card { min-height: 220px; }
  .card-puzzle { width: 180px; height: 180px; }
  .btn { width: 100%; }
  .form-actions .btn { width: auto; flex: 1 1 auto; }
  .inventory-controls .btn { width: auto; }
  section { padding: 28px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}



/* 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;
}
