:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #202522;
  --muted: #68706a;
  --line: #dedbd3;
  --line-strong: #c7c3b8;
  --primary: #356b68;
  --primary-strong: #245653;
  --primary-soft: #e8f1ee;
  --accent: #d97d59;
  --accent-soft: #faece5;
  --danger: #a33d32;
  --danger-soft: #fff0ed;
  --focus: #1e5b91;
  --shadow: 0 12px 34px rgba(44, 51, 46, 0.08);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --shell: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

.shell {
  width: min(100% - 28px, var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 10px;
  z-index: 999;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  backdrop-filter: blur(14px);
}
.header-inner {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: white;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.brand-word span { color: var(--primary); }
.beta-badge {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.hero {
  padding-block: 48px 34px;
  display: grid;
  gap: 28px;
}
.eyebrow, .step-label, .card-kicker, .prompt-label {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -0.035em; }
h1 { margin: 0; font-size: clamp(38px, 11vw, 68px); max-width: 720px; }
h2 { margin: 0; font-size: clamp(29px, 8vw, 46px); }
h3 { margin: 0; font-size: clamp(23px, 6vw, 31px); }
h4 { margin: 0; font-size: 18px; }
.hero-lead {
  margin: 18px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(18px, 5vw, 21px);
}

.concept-visual {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--surface-strong), #f0eee6);
  box-shadow: var(--shadow);
}
.concept-root {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--primary);
  color: white;
  text-align: center;
}
.concept-root strong { display: block; font-size: 18px; }
.concept-kicker { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; opacity: .75; }
.concept-connector { width: 2px; height: 22px; margin: auto; background: var(--line-strong); }
.concept-children { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.concept-children span {
  display: grid;
  place-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: center;
  font-size: 12px;
  font-weight: 750;
}

.config-section { padding-block: 30px 60px; }
.section-heading { max-width: 720px; }
.section-heading p:not(.step-label):not(.card-kicker) { margin: 10px 0 0; color: var(--muted); }
.compact-heading { margin-bottom: 24px; }

#project-form { display: grid; gap: 14px; }
.config-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 6px 22px rgba(44, 51, 46, 0.04);
}
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend, .text-field label {
  width: 100%;
  margin-bottom: 11px;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.015em;
}
.filter-group + .filter-group { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.select-hint, .field-help, .privacy-note {
  margin: -4px 0 11px;
  color: var(--muted);
  font-size: 13px;
}
.text-field + .text-field { margin-top: 20px; }
.text-field input, .text-field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.text-field textarea { min-height: 116px; resize: vertical; }
.text-field input:focus, .text-field textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}

.choice-grid { display: grid; gap: 9px; }
.choice-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-grid-3 { grid-template-columns: 1fr; }
.choice-grid-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-button {
  position: relative;
  min-height: 54px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-strong);
  cursor: pointer;
  text-align: left;
  font-weight: 720;
  transition: transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.choice-button:hover { border-color: #9caaa3; transform: translateY(-1px); }
.choice-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent);
  outline-offset: 2px;
}
.choice-button[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px var(--primary);
}
.choice-button[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  right: 10px;
  top: 9px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 900;
}
.choice-label { display: block; padding-right: 20px; }
.choice-button small { display: block; margin-top: 4px; padding-right: 10px; color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.35; }
.category-choice { min-height: 92px; }
.category-choice .choice-label { font-size: 18px; }
.level-choice { min-height: 84px; }

.has-error { border-color: var(--danger) !important; }
.field-error {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.generate-wrap { padding-top: 8px; }
.primary-button, .secondary-button, .text-button, .copy-button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
}
.primary-button {
  min-height: 52px;
  padding: 13px 18px;
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 20px rgba(53, 107, 104, .18);
}
.primary-button:hover { background: var(--primary-strong); }
.primary-button:focus-visible, .secondary-button:focus-visible, .text-button:focus-visible, .copy-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
  outline-offset: 2px;
}
.generate-button { width: 100%; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 17px; }
.privacy-note { margin: 10px 0 0; text-align: center; }

.transition { padding-block: 26px 62px; }
.transition-card {
  min-height: 180px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: var(--shadow);
}
.transition-project { width: 54px; height: 54px; border-radius: 18px; background: var(--primary-soft); border: 2px solid var(--primary); }
.transition-dots { display: flex; gap: 6px; }
.transition-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: pulse 1s infinite alternate; }
.transition-dots i:nth-child(2) { animation-delay: .18s; }
.transition-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes pulse { from { opacity: .25; transform: translateY(2px); } to { opacity: 1; transform: translateY(-2px); } }
.transition-card p { margin: 0; font-weight: 760; }

.result-section { padding-block: 34px 76px; }
.result-hero { padding-bottom: 24px; }
.result-description { margin: 12px 0 0; max-width: 800px; color: var(--muted); font-size: 18px; }
.result-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.result-meta span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.result-card {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 8px 26px rgba(44, 51, 46, 0.045);
}
.card-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-heading-row p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.copy-button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface-strong);
  color: var(--primary-strong);
  font-size: 12px;
}
.copy-button:hover { background: var(--primary-soft); }
.source-list { display: grid; gap: 9px; list-style: none; padding: 0; margin: 18px 0 0; }
.source-list li { display: flex; gap: 9px; align-items: flex-start; }
.source-list li span { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 900; }
.copy-block {
  margin: 16px 0 0;
  max-width: 100%;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f5f3ed;
  color: #343a36;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  font: 500 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.map-card {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--line));
  background: linear-gradient(160deg, #fffefb, #f1f6f3);
  box-shadow: var(--shadow);
}
.result-heading { margin-bottom: 18px; }
.project-map { min-width: 0; }
.map-root {
  max-width: 420px;
  margin-inline: auto;
  padding: 15px;
  border-radius: 15px;
  background: var(--primary);
  color: white;
  text-align: center;
}
.map-root span { display: block; margin-bottom: 3px; font-size: 10px; font-weight: 900; letter-spacing: .12em; opacity: .72; }
.map-root strong { font-size: 17px; }
.map-connector { width: 2px; height: 26px; margin: auto; background: var(--line-strong); }
.map-nodes { display: grid; gap: 8px; }
.map-node {
  position: relative;
  width: 100%;
  min-width: 0;
  padding: 13px 13px 13px 46px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-strong);
  text-align: left;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.map-node:hover { transform: translateY(-1px); border-color: var(--primary); }
.map-node:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 30%, transparent); outline-offset: 2px; }
.map-node.is-active {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary), 0 8px 20px rgba(53, 107, 104, .09);
  background: #fbfffd;
}
.map-node-index {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 900;
}
.map-node strong { display: block; line-height: 1.25; }
.map-node small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.one-chat-note { margin: 13px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: #75412f; text-align: center; font-size: 13px; font-weight: 750; }

.chat-panel { scroll-margin-top: 76px; }
.chat-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chat-role { margin: 9px 0 0; color: var(--muted); }
.chat-index { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-size: 12px; font-weight: 800; }
.chat-facts { display: grid; gap: 9px; margin-top: 17px; }
.fact-card, .handoff-box {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
}
.fact-card > span, .handoff-box > span { display: block; margin-bottom: 5px; color: var(--primary); font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.fact-card p, .handoff-box p { margin: 0; color: #464d48; font-size: 14px; }
.fact-card ul { margin: 0; padding-left: 18px; color: #464d48; font-size: 14px; }
.handoff-box { margin-top: 9px; background: var(--primary-soft); border-color: #c6d9d2; }
.prompt-box { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.prompt-heading { align-items: center; }
.prompt-label { display: block; margin: 0; }
.prompt-copy { max-height: 480px; overflow: auto; }

.workflow-visual { display: grid; gap: 0; }
.flow-step { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding-bottom: 18px; }
.flow-step:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: -2px; width: 2px; background: var(--line-strong); }
.flow-step-marker { position: relative; z-index: 1; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 900; }
.flow-step-body { min-width: 0; padding: 6px 0 0; }
.flow-step-body > strong { display: inline-block; font-size: 16px; }
.flow-step-body > p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.flow-badge { display: inline-block; margin-left: 7px; padding: 3px 6px; border-radius: 999px; background: var(--accent-soft); color: #7b452f; font-size: 10px; font-weight: 800; vertical-align: middle; }
.flow-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.flow-link { display: inline-grid; grid-template-columns: auto 1fr; column-gap: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-strong); font-size: 11px; font-weight: 750; }
.flow-link small { grid-column: 2; color: var(--muted); font-weight: 500; }
.flow-link.feedback { background: var(--accent-soft); border-color: #efcab9; }
.internal-flow { display: grid; gap: 3px; margin-top: 8px; padding: 8px 10px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 9px 9px 0; }
.internal-flow span { font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--primary-strong); }
.internal-flow small { color: #4a5952; }

.action-card { display: grid; gap: 18px; }
.action-card p { color: var(--muted); margin: 9px 0 0; }
.action-buttons { display: grid; gap: 8px; }
.secondary-button { min-height: 48px; padding: 11px 14px; border: 1px solid var(--primary); background: var(--surface-strong); color: var(--primary-strong); }
.secondary-button:hover { background: var(--primary-soft); }
.text-button { min-height: 42px; padding: 8px 12px; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.guides { padding-block: 24px 80px; }
.guide-list { display: grid; gap: 8px; }
.guide-list details { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.guide-list summary { cursor: pointer; padding: 14px 15px; font-weight: 800; }
.guide-list p { margin: 0; padding: 0 15px 15px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); padding-block: 24px; color: var(--muted); font-size: 12px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 80; transform: translateX(-50%); padding: 10px 14px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 13px; font-weight: 800; white-space: nowrap; }
.print-plan { display: none; }

@media (min-width: 430px) {
  .shell { width: min(100% - 36px, var(--shell)); }
  .config-block, .result-card { padding: 22px; }
  .choice-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-nodes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chat-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .header-inner { min-height: 70px; }
  .hero { min-height: 480px; padding-block: 74px 58px; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); align-items: center; gap: 48px; }
  .concept-visual { padding: 24px; }
  .config-section { padding-block: 48px 84px; }
  #project-form { gap: 18px; }
  .config-block { padding: 28px; }
  .choice-grid-auto { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result-section { padding-block: 48px 96px; }
  .result-card { margin-top: 18px; padding: 28px; }
  .map-nodes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .action-card { grid-template-columns: 1fr auto; align-items: center; }
  .action-buttons { min-width: 260px; }
  .guide-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guide-list details { align-self: start; }
}

@media (min-width: 1024px) {
  .map-nodes { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .choice-grid-auto { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  :root { --ink: #111; }
  body { background: #fff; color: #111; font-size: 10.5pt; }
  .site-header, main > :not(.result-section), .result-section > :not(.print-plan), .site-footer, .toast { display: none !important; }
  .shell, .result-section { width: 100%; max-width: none; margin: 0; padding: 0; }
  .print-plan { display: block !important; }
  .print-cover { min-height: 190mm; display: flex; flex-direction: column; justify-content: center; border-bottom: 2px solid #333; page-break-after: always; }
  .print-cover p:first-child { font-size: 9pt; font-weight: 800; letter-spacing: .08em; }
  .print-cover h1 { font-size: 30pt; margin: 8mm 0 5mm; }
  .print-cover p { max-width: 160mm; font-size: 14pt; }
  .print-cover div { margin-top: 8mm; font-size: 10pt; }
  .print-plan section { margin: 0 0 10mm; }
  .print-plan h2 { font-size: 18pt; margin: 0 0 5mm; padding-bottom: 2mm; border-bottom: 1px solid #bbb; }
  .print-plan h3 { font-size: 14pt; margin: 0 0 3mm; }
  .print-plan h4 { font-size: 11pt; margin: 5mm 0 2mm; }
  .print-plan ul, .print-plan ol { padding-left: 6mm; }
  .print-plan li { margin-bottom: 2mm; }
  .print-plan pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 8.5pt/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 4mm; border: 1px solid #ccc; background: #f7f7f7; }
  .print-chat { break-inside: avoid-page; page-break-inside: avoid; margin-bottom: 10mm; padding-top: 2mm; }
  .print-flow-step { margin: 0 0 4mm; padding: 3mm; border-left: 2px solid #444; }
  .print-checklist { list-style: none; padding-left: 0 !important; }
}
