:root {
  --ink: #12304a;
  --muted: #617589;
  --teal: #0f817d;
  --teal-dark: #08635f;
  --mint: #dff4ee;
  --sky: #e7f2fb;
  --yellow: #fff1c6;
  --line: #d9e5eb;
  --surface: #ffffff;
  --soft: #f5f9fa;
  --shadow: 0 18px 48px rgba(33, 75, 90, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(135deg, #f3fbfa 0%, #f8fbfd 48%, #edf5fb 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.65;
}
button, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
#profileNameInput { width: 100%; margin: 0 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }

.app-shell { min-height: 100vh; }
.site-header {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; font-weight: 800; text-decoration: none; letter-spacing: .03em; }
.brand small { margin-left: 3px; color: var(--teal); font-size: 13px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 12px; color: #fff; background: var(--teal); box-shadow: 0 5px 12px rgba(15,129,125,.22); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.profile-picker select, .header-button { height: 36px; padding: 0 10px; border: 1px solid #d7e4e8; border-radius: 9px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 700; }
.profile-picker select { max-width: 145px; }
.header-button:hover { background: var(--soft); }
.save-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.save-dot { width: 9px; height: 9px; border-radius: 50%; background: #43ad83; box-shadow: 0 0 0 4px rgba(67,173,131,.13); }

main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; }
.hero { position: relative; overflow: hidden; padding: 66px 72px 62px; border-radius: 30px; background: var(--surface); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -78px; top: -85px; width: 285px; height: 285px; border-radius: 50%; background: var(--mint); opacity: .78; }
.hero::before { content: ""; position: absolute; right: 88px; bottom: -112px; width: 240px; height: 240px; border-radius: 50%; border: 38px solid var(--sky); }
.hero > * { position: relative; z-index: 1; max-width: 740px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 14px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(29px, 4vw, 48px); line-height: 1.35; letter-spacing: .015em; }
.hero > p:not(.eyebrow) { margin: 22px 0 19px; color: var(--muted); font-size: 16px; }
.hero-note { display: inline-flex; gap: 8px; align-items: center; padding: 9px 15px; border-radius: 999px; color: #655024; background: var(--yellow); font-size: 14px; font-weight: 700; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: 12px; }

.workspace { display: grid; grid-template-columns: 278px 1fr; gap: 24px; margin: 30px 0; align-items: start; }
.question-nav, .question-panel, .summary-section { border: 1px solid rgba(202,221,227,.72); background: var(--surface); box-shadow: var(--shadow); }
.question-nav { position: sticky; top: 16px; padding: 25px 20px 20px; border-radius: 22px; }
.nav-heading p, .question-count { margin: 0; color: var(--muted); font-size: 13px; }
.nav-heading strong { font-size: 17px; }
.progress-track { height: 8px; margin: 13px 0 18px; overflow: hidden; border-radius: 999px; background: #e7eff2; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2bb0a0, var(--teal)); transition: width .25s ease; }
#categoryNav { display: grid; gap: 5px; }
.nav-item { display: flex; width: 100%; padding: 10px; gap: 10px; align-items: center; border: 0; border-radius: 11px; color: var(--muted); background: transparent; text-align: left; font-size: 14px; }
.nav-item:hover { background: var(--soft); }
.nav-item.active { color: var(--teal-dark); background: var(--mint); font-weight: 800; }
.nav-number { display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: #93a8b6; font-size: 12px; font-weight: 800; }
.nav-item.active .nav-number, .nav-item.complete .nav-number { background: var(--teal); }
.outline-button { width: 100%; margin-top: 20px; padding: 9px 12px; border: 1px solid #d5e0e5; border-radius: 10px; color: var(--muted); background: #fff; font-size: 13px; }
.outline-button:hover { border-color: #e2a9a9; color: #a54343; background: #fff9f9; }

.question-panel { min-height: 570px; padding: 48px 56px 38px; border-radius: 24px; }
.section-label { display: inline-block; padding: 4px 12px; border-radius: 999px; color: var(--teal-dark); background: var(--mint); font-size: 13px; font-weight: 800; }
.question-count { float: right; margin-top: 4px; }
.question-panel h2 { clear: both; margin: 22px 0 9px; font-size: clamp(24px, 3vw, 34px); line-height: 1.42; letter-spacing: .01em; }
.question-help { min-height: 54px; margin: 0 0 23px; color: var(--muted); font-size: 15px; }
.answer-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 800; }
textarea { display: block; width: 100%; min-height: 190px; padding: 17px 18px; resize: vertical; border: 2px solid #d9e5ea; border-radius: 15px; color: var(--ink); background: #fcfefe; font-size: 16px; line-height: 1.75; outline: none; transition: border-color .16s, box-shadow .16s; }
textarea::placeholder { color: #9aabb5; }
textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15,129,125,.13); }
.answer-footer { display: flex; justify-content: space-between; margin-top: 8px; color: #81949f; font-size: 12px; }
.question-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 29px; }
.primary-button, .secondary-button, .copy-button, .individual-copy-button, .prompt-copy-button { min-height: 48px; padding: 11px 20px; border-radius: 12px; font-weight: 800; transition: transform .15s, background .15s; }
.primary-button, .copy-button { border: 1px solid var(--teal); color: #fff; background: var(--teal); box-shadow: 0 7px 15px rgba(15,129,125,.17); }
.primary-button:hover, .copy-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.secondary-button { border: 1px solid #d5e2e6; color: var(--ink); background: #fff; }
.secondary-button:hover { background: var(--soft); }
.secondary-button:disabled { cursor: not-allowed; opacity: .38; }
.individual-copy-button { border: 1px solid #b8d9d4; color: var(--teal-dark); background: #f1fbf8; }
.individual-copy-button:hover { background: var(--mint); }

.summary-section { display: flex; gap: 36px; align-items: center; justify-content: space-between; margin-bottom: 40px; padding: 32px 42px; border-radius: 22px; background: linear-gradient(105deg, #e9f8f4, #fff 65%); }
.summary-section h2 { margin: 0 0 7px; font-size: 25px; }
.summary-section > div:first-child p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 14px; }
.summary-actions { width: min(100%, 390px); min-width: 310px; text-align: center; }
.copy-button { width: 100%; font-size: 15px; }
.prompt-copy-button { width: 100%; margin-top: 9px; border: 1px solid #7c9fba; color: #17435f; background: #eef6fb; font-size: 13px; }
.prompt-copy-button:hover { background: #deeff9; }
.ai-launcher { margin-top: 15px; padding: 14px; border: 1px solid #d7e5ea; border-radius: 13px; background: #fff; }
.ai-launcher p { margin: 0 0 10px; color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.5; }
.ai-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ai-link { display: flex; min-height: 44px; align-items: center; justify-content: center; border: 1px solid #d2dfe4; border-radius: 10px; color: var(--ink); background: #fff; font-size: 13px; font-weight: 800; text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.ai-link:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(33, 75, 90, .11); }
.ai-link:focus-visible { outline: 3px solid rgba(15,129,125,.28); outline-offset: 2px; }
.chatgpt-link:hover { border-color: #10a37f; }
.claude-link:hover { border-color: #c26f4b; }
.gemini-link:hover { border-color: #6d8ee8; }
.ai-launcher small { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.copy-message { display: block; min-height: 22px; margin-top: 7px; color: var(--teal-dark); font-size: 13px; font-weight: 700; }
footer { padding: 28px 20px 34px; color: #718591; text-align: center; font-size: 12px; }
footer p { margin: 0 0 12px; }
.organization-link { display: inline-flex; min-height: 44px; flex-direction: column; justify-content: center; padding: 8px 14px; color: var(--teal-dark); font-size: 15px; font-weight: 700; text-underline-offset: 4px; }
.organization-link span { font-size: 12px; font-weight: 400; }
.organization-link:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

dialog { width: min(620px, calc(100% - 32px)); padding: 28px; border: 1px solid #d5e5e7; border-radius: 20px; color: var(--ink); box-shadow: 0 24px 80px rgba(20, 49, 66, .28); }
dialog::backdrop { background: rgba(14, 38, 52, .38); backdrop-filter: blur(2px); }
.dialog-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 0; font-size: 26px; }
.dialog-header .eyebrow { margin-bottom: 2px; }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 10px; color: var(--muted); background: var(--soft); font-size: 25px; line-height: 1; }
.dialog-description { margin: 13px 0 17px; color: var(--muted); font-size: 13px; }
.archive-list { display: grid; gap: 9px; max-height: 380px; overflow: auto; }
.archive-card { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid #dce8ea; border-radius: 13px; }
.archive-card.active { border-color: #5fb7aa; background: #f2fbf9; }
.archive-name { display: block; font-weight: 800; }
.archive-meta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.archive-card-actions { display: flex; gap: 7px; }
.archive-use, .archive-delete { padding: 7px 10px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.archive-use { border: 1px solid #9ecfc7; color: var(--teal-dark); background: #fff; }
.archive-delete { border: 1px solid #f0c8c8; color: #a14040; background: #fffafa; }
.dialog-new-button { width: 100%; margin-top: 18px; }

@media (max-width: 780px) {
  .site-header, main { width: min(100% - 28px, 640px); }
  .site-header { height: 68px; }
  .header-actions { gap: 5px; }
  .header-button { padding: 0 7px; font-size: 11px; }
  .profile-picker select { width: 106px; padding: 0 6px; }
  .save-status { display: none; }
  .hero { padding: 42px 26px 38px; border-radius: 22px; }
  .hero::before { right: -40px; opacity: .55; }
  .workspace { grid-template-columns: 1fr; }
  .question-nav { position: static; padding: 20px; }
  #categoryNav { grid-template-columns: repeat(3, 1fr); }
  .nav-item { justify-content: center; padding: 8px; }
  .nav-item span:last-child { display: none; }
  .question-panel { min-height: 0; padding: 32px 24px 25px; border-radius: 22px; }
  .question-help { min-height: 0; }
  .summary-section { display: block; padding: 29px 25px; }
  .summary-actions { width: 100%; min-width: 0; margin-top: 20px; }
}

@media (max-width: 430px) {
  .site-header { height: auto; padding: 14px 0; flex-wrap: wrap; gap: 12px; }
  .header-actions { flex-wrap: wrap; }
  .header-button { white-space: nowrap; }
  .brand { font-size: 15px; }
  .brand small { font-size: 11px; }
  .hero > p:not(.eyebrow) { font-size: 14px; }
  .question-actions { flex-direction: column-reverse; }
  .primary-button, .secondary-button, .individual-copy-button { width: 100%; }
  .answer-footer { gap: 8px; flex-direction: column; }
  .ai-links { grid-template-columns: 1fr; }
}

.input-helper { margin: 0 0 22px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.input-helper legend { font-size: 14px; font-weight: 700; }
.input-helper p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.suggestion-list, .skip-actions, .review-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion-list button, .skip-actions button { min-height: 44px; padding: 8px 12px; border: 1px solid #9ecfc7; border-radius: 10px; color: var(--teal-dark); background: white; text-align: left; }
.suggestion-list button:hover { background: var(--mint); }
.skip-actions { margin-top: 12px; }
.skip-actions button { border-color: var(--line); color: var(--ink); }
#answerState { margin: 8px 0 0; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.review-section { margin-bottom: 40px; padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: white; }
.review-section h2 { margin-top: 0; }
.review-section > p { color: var(--muted); font-size: 14px; }
#shareAudience { max-width: 100%; margin: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.share-items { display: grid; gap: 8px; margin-top: 20px; }
.share-choice { display: flex; align-items: start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.share-choice input { flex-shrink: 0; width: 22px; height: 22px; accent-color: var(--teal); }
.share-choice span { overflow-wrap: anywhere; }
.sheet-preview { padding: 24px; border: 1px solid var(--line); background: white; overflow-wrap: anywhere; }
.sheet-preview h3 { margin-top: 0; }
.sheet-entry { margin: 16px 0; }
.sheet-entry h4 { margin: 0 0 6px; font-size: 15px; }
.sheet-entry p { margin: 0; white-space: pre-wrap; }
.sheet-preview .sheet-note { font-size: 12px; color: var(--muted); }
@media (max-width: 430px) {
  .review-section { padding: 20px 16px; }
  .review-tools { flex-direction: column; }
  .sheet-preview { padding: 16px; }
}
@page { size: A4; margin: 15mm; }
@media print {
  body { background: white; min-width: 0; color: black; font-size: 10pt; }
  .site-header, .hero, .workspace, .summary-section, footer, dialog { display: none !important; }
  main { width: 100%; margin: 0; }
  .review-section { border: 0; margin: 0; padding: 0; }
  .review-section > :not(#sheetPreview) { display: none !important; }
  .sheet-preview { border: 0; padding: 0; color: black; }
  .sheet-entry h4 { break-after: avoid; }
  .sheet-entry p { orphans: 3; widows: 3; }
}
