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

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --border: #e5e0d8;
  --text: #2c2416;
  --text-muted: #6b5e4a;
  --accent: #b56532;
  --accent-hover: #8f4e26;
  --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.06);
  --shadow-md: 0 4px 12px rgba(44, 36, 22, 0.08);
  --radius: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1100px;
}

html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-nav a {
  margin-left: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.site-nav a:hover, .site-nav a:focus-visible { color: var(--accent); }

/* Main */
main { flex: 1; max-width: var(--max-width); margin: 0 auto; padding: 1.5rem 1rem 3rem; width: 100%; }

/* Planner Section */
.planner-section { margin-bottom: 2.5rem; }
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.planner-controls h1 { font-size: 1.8rem; margin-bottom: 0.25rem; color: var(--text); }
.subtitle { color: var(--text-muted); margin-bottom: 1.25rem; font-size: 0.95rem; }

/* Form */
form { display: flex; flex-direction: column; gap: 1.25rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
legend { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); padding: 0 0.4rem; }
.input-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.input-group { flex: 1; min-width: 100px; }
.input-group label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.unit-wrapper { display: flex; align-items: center; gap: 0.3rem; }
.unit-wrapper input, .input-group input, .input-group select {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
}
.unit-wrapper input:focus, .input-group input:focus, .input-group select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
.unit { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.field-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Presets */
.preset-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.preset-btn {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }
.preset-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Action buttons */
.action-buttons { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.25rem; }
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
}
.btn:hover { background: var(--bg); border-color: var(--accent); }
.btn.secondary { background: var(--bg); }

/* Preview */
.planner-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.preview-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.75rem; }
.preview-header h2 { font-size: 1.1rem; }
.preview-dim-label { font-size: 0.8rem; color: var(--text-muted); }
.preview-canvas {
  background: #f2efe8;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1rem;
  aspect-ratio: 4 / 3;
  position: relative;
}
.preview-canvas svg { width: 100%; height: 100%; display: block; }

/* Nail positions */
.nail-positions { margin-bottom: 1rem; }
.nail-positions h3, .spacing-summary h3 { font-size: 0.95rem; margin-bottom: 0.4rem; }
.nail-positions ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.nail-positions li {
  background: var(--bg);
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
}
.empty-state { color: var(--text-muted); font-size: 0.85rem; }
.spacing-summary dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.75rem; font-size: 0.9rem; }
.spacing-summary dt { color: var(--text-muted); }
.spacing-summary dd { font-weight: 600; }

/* Support Content */
.support-content { margin-bottom: 2.5rem; }
.support-content h2 { font-size: 1.4rem; margin-bottom: 1rem; }
.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.support-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}
.support-card h3 { font-size: 1rem; margin-bottom: 0.4rem; }
.support-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* Scenario */
.scenario-section { margin-bottom: 2.5rem; }
.scenario-section h2 { font-size: 1.4rem; margin-bottom: 0.6rem; }
.scenario-section p { max-width: 65ch; color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }

/* QA */
.qa-section { margin-bottom: 2.5rem; }
.qa-section h2 { font-size: 1.4rem; margin-bottom: 0.75rem; }
.qa-section details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}
.qa-section summary { cursor: pointer; font-weight: 600; font-size: 0.95rem; }
.qa-section details p { margin-top: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-ecosystem a { color: var(--accent); text-decoration: none; }
.footer-nav { display: flex; gap: 1rem; }
.footer-nav a { color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--accent); }
.footer-version { font-size: 0.8rem; }

/* Print */
@media print {
  .site-header, .planner-controls, .action-buttons, .support-content, .scenario-section, .qa-section, .site-footer, .nail-positions, .spacing-summary, .preview-header h2, #ad-slot { display: none; }
  body { background: #fff; }
  .planner-layout { display: block; }
  .planner-preview { border: none; box-shadow: none; padding: 0; }
  .preview-canvas { background: #fff; border: 1px dashed #ccc; aspect-ratio: auto; height: auto; }
  .preview-canvas svg { width: 100%; height: auto; }
}

/* Responsive */
@media (max-width: 750px) {
  .planner-layout { grid-template-columns: 1fr; }
  .planner-preview { order: -1; }
  .support-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}



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