:root {
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --ink: #1F2933;
  --muted: #52606D;
  --line: #D9D2C5;
  --accent: #2E7D7A;
  --accent-ink: #FFFFFF;
  --gold: #D9A441;
  --green: #5B8C5A;
  --red: #A94E4E;
  --blue: #4A6FA5;
  --purple: #7E5A83;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
  --max: 1180px;
  --pad: clamp(16px, 3vw, 32px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #F2EDE3;
}
.brand-text strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}
.brand-text .brand-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.site-nav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink);
  font-size: 14px;
  padding: 6px 0;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  max-width: var(--max);
  margin: 0 auto;
}

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

section { margin: 40px 0; }

.intro {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.intro h1 {
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.15;
  margin: 0 0 12px;
  color: var(--ink);
}
.intro p { color: var(--muted); margin: 0 0 12px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.intro-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: center;
}
.stat {
  background: #FBF8F2;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 8px;
}
.stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #266A67; border-color: #266A67; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #8E3F3F; border-color: #8E3F3F; }

.planner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.planner-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
}
.panel {
  background: #FBF8F2;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.panel h2 { font-size: 18px; margin: 0 0 14px; }
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}
.field input, .field select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.template-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.template-btn {
  padding: 8px 6px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink);
}
.template-btn:hover { border-color: var(--accent); color: var(--accent); }

.canvas-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  background: var(--surface);
}
.canvas-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.canvas-header h2 { margin: 0; font-size: 18px; }
.legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.sw-closet { background: var(--gold); }
.sw-underbed { background: var(--green); }
.sw-cabinet { background: var(--blue); }
.sw-shelf { background: var(--purple); }
.sw-entry { background: var(--accent); }
.sw-shared { background: var(--red); }

.grid {
  display: grid;
  gap: 4px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-height: 320px;
}
.cell {
  background: var(--surface);
  border-radius: 4px;
  padding: 6px;
  min-height: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  border: 1px solid transparent;
  transition: border-color 0.1s ease, background 0.1s ease;
}
.cell:hover { border-color: var(--ink); }
.cell.selected { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.cell .zone {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.cell .label {
  font-size: 12px;
  color: var(--ink);
  word-break: break-word;
}
.cell.closet { background: #FDF2D9; }
.cell.underbed { background: #E1EEDD; }
.cell.cabinet { background: #DCE5F0; }
.cell.shelf { background: #E4DCEB; }
.cell.entry { background: #D9EFED; }
.cell.shared { background: #F2D7D7; }

.templates h2, .guidance h2 { font-size: 22px; margin: 0 0 8px; }
.section-lead { color: var(--muted); margin: 0 0 18px; max-width: 720px; }
.template-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { color: var(--muted); margin: 0 0 10px; }
.card ul { margin: 0 0 14px; padding-left: 18px; color: var(--muted); }
.card li { margin-bottom: 4px; font-size: 14px; }

.guidance-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.guidance-grid article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.guidance-grid h3 { margin: 0 0 8px; font-size: 16px; color: var(--accent); }
.guidance-grid p { color: var(--muted); margin: 0; }

.scenario, .mistakes, .questions, .assumptions {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.scenario h3, .mistakes h3, .questions h3, .assumptions h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--accent);
}
.scenario p, .assumptions p { color: var(--muted); margin: 0 0 10px; }
.mistakes ul { margin: 0; padding-left: 18px; color: var(--muted); }
.mistakes li { margin-bottom: 6px; }
.questions dl { margin: 0; }
.questions dt { font-weight: 600; color: var(--ink); margin-top: 10px; }
.questions dd { margin: 4px 0 0; color: var(--muted); }

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 24px var(--pad);
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.footer-inner nav {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.last-updated { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; }
  .intro-stats { grid-template-columns: repeat(3, 1fr); }
  .planner-grid { grid-template-columns: 1fr; }
  .template-cards { grid-template-columns: 1fr; }
  .guidance-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .site-nav { gap: 12px; }
  .intro-stats { grid-template-columns: 1fr 1fr 1fr; }
  .template-row { grid-template-columns: 1fr; }
}

@media print {
  body { background: #fff; }
  .site-header, .site-footer, .panel, .btn, .legend, .hint, .intro-actions, .intro-stats, .templates, .guidance { display: none; }
  .planner { box-shadow: none; border: 0; padding: 0; }
  .canvas-wrap { border: 0; padding: 0; }
  .grid { background: #ccc; border: 1px solid #ccc; }
  .cell { border: 1px solid #999; }
}


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