:root {
  --navy: #3D5A80;
  --navy-soft: #4F6E95;
  --beige: #EAF1F6;
  --beige-light: #f4f6f9;
  --sand: #98C1D9;
  --white: #ffffff;
  --ink: #3D3D3D;
  --muted: #6E7686;
  --line: #DCE4EC;
  --sage: #C25A3F;
  --shadow: 0 18px 45px rgba(61, 90, 128, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(250, 246, 239, 0.96), rgba(255, 255, 255, 0.98) 42%),
    var(--beige-light);
  font-family:
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  line-height: 1.8;
  line-break: strict;
  overflow-wrap: anywhere;
  word-break: auto-phrase;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header {
  color: var(--white);
  background:
    linear-gradient(135deg, rgba(32, 52, 79, 0.98), rgba(47, 73, 104, 0.94)),
    var(--navy);
  border-bottom: 6px solid var(--sand);
}

.header-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 46px 0 40px;
}

.brand-label {
  margin: 0 0 12px;
  color: #CFE0EC;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 16px;
  font-size: clamp(1.9rem, 4.4vw, 3.05rem);
  line-height: 1.24;
  letter-spacing: 0;
}

.lead {
  max-width: 900px;
  margin-bottom: 18px;
  color: #edf5ff;
  font-size: clamp(1rem, 2.5vw, 1.24rem);
  font-weight: 700;
}

.intro {
  max-width: 760px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.88);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 34px auto 40px;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-panel,
.result-panel {
  padding: 26px;
}

.result-panel {
  position: sticky;
  top: 18px;
}

.panel-heading {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-bottom: 10px;
  padding: 2px 12px;
  color: var(--navy);
  background: #EAF1F6;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.panel-heading h2 {
  margin-bottom: 6px;
  color: var(--navy);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  line-height: 1.45;
}

.panel-heading p,
.form-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field,
.field-group {
  display: grid;
  gap: 8px;
}

.field span,
.field-group legend {
  color: var(--navy);
  font-weight: 700;
}

.field-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 8px;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: var(--white);
  border: 1px solid #DCE4EC;
  border-radius: var(--radius);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

input,
select {
  min-height: 46px;
  padding: 10px 13px;
}

input[type="file"] {
  min-height: auto;
  padding: 11px;
  background: #f4f9ff;
}

.file-field small {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

textarea {
  min-height: 108px;
  resize: vertical;
  padding: 12px 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 4px rgba(47, 73, 104, 0.12);
  background: #f9fcff;
}

::placeholder {
  color: #6E7686;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice-grid label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 44px;
  padding: 10px 11px;
  background: #f4f9ff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #3D5A80;
  font-size: 0.93rem;
  line-height: 1.45;
}

.choice-grid input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin-top: 1px;
  accent-color: var(--navy);
}

.select-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.sample-box {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 16px;
  background: #EAF1F6;
  border: 1px solid #C7DCEA;
  border-radius: var(--radius);
}

.sample-box h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 1rem;
  line-height: 1.45;
}

.sample-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.primary-button,
.sample-button,
.secondary-button,
.print-button,
.copy-button {
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 700;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}

.primary-button {
  flex: 1 1 220px;
  padding: 12px 20px;
  color: var(--white);
  background: var(--navy);
  box-shadow: 0 12px 22px rgba(32, 52, 79, 0.18);
}

.primary-button:hover,
.sample-button:hover,
.print-button:hover,
.copy-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(32, 52, 79, 0.2);
}

.sample-button {
  flex: 1 1 190px;
  padding: 12px 18px;
  color: #3D3D3D;
  background: #dce1e8;
  border: 1px solid #bfc8d4;
}

.sample-button:hover {
  background: #d0d8e1;
}

.secondary-button {
  flex: 1 1 200px;
  padding: 12px 18px;
  color: var(--navy);
  background: #dce5ef;
  border: 1px solid #b1c3d9;
}

.secondary-button:hover {
  background: #cdd9e7;
}

.form-note {
  margin-top: 14px;
}

.reset-status {
  min-height: 1.7em;
  margin: 10px 0 0;
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.reset-status.is-visible {
  opacity: 1;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  background: #f0f5fb;
  border: 1px dashed #b6c5d8;
  border-radius: var(--radius);
  text-align: center;
}

.empty-state p {
  margin: 0;
}

.error-message {
  display: none;
  margin-bottom: 16px;
  padding: 12px 14px;
  color: #7a321d;
  background: #fff0e8;
  border: 1px solid #f0c6b5;
  border-radius: var(--radius);
  font-weight: 700;
}

.error-message.is-visible {
  display: block;
}

.results {
  display: grid;
  gap: 16px;
}

.result-card {
  padding: 18px;
  background: #f9fcff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-card.featured {
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(246, 239, 228, 0.9)),
    #f9fcff;
  border-color: #a6bcd6;
}

.result-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.result-header h3 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 1.05rem;
  line-height: 1.45;
}

.result-card.featured h3 {
  font-size: 1.18rem;
}

.result-text {
  margin-bottom: 0;
  color: #2d3749;
  font-size: 0.98rem;
  line-height: 1.9;
  white-space: pre-line;
}

.featured .result-text {
  font-size: 1.04rem;
}

.sr-copy-text {
  display: none;
}

.profile-card {
  display: grid;
  gap: 16px;
  color: #2d3749;
}

.profile-top {
  display: grid;
  gap: 18px;
  align-items: center;
  padding: 18px;
  background: #e4edf7;
  border: 1px solid #aec2da;
  border-radius: var(--radius);
}

.profile-top.has-image {
  grid-template-columns: 132px minmax(0, 1fr);
}

.profile-top.no-image {
  grid-template-columns: 1fr;
}

.profile-photo {
  display: grid;
  width: 132px;
  aspect-ratio: 1;
  place-items: center;
  padding: 12px;
  color: #68778a;
  background: rgba(255, 255, 255, 0.74);
  border: 1.5px dashed #9fb3cb;
  border-radius: 18px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.profile-photo.has-image {
  padding: 0;
  overflow: hidden;
  border-style: solid;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-label {
  margin-bottom: 6px;
  color: var(--sage);
  font-size: 0.82rem;
  font-weight: 700;
}

.profile-name {
  margin-bottom: 4px;
  color: var(--navy);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 800;
  line-height: 1.35;
}

.profile-company {
  margin-bottom: 10px;
  color: #4b5565;
  font-weight: 700;
}

.profile-catch {
  margin-bottom: 0;
  padding: 10px 12px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.72);
  border-left: 4px solid var(--sand);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-weight: 700;
  line-height: 1.65;
}

.profile-summary {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-summary dt,
.profile-summary dd {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.profile-summary dt {
  color: var(--navy);
  background: #e9eff7;
  font-weight: 700;
}

.profile-summary dd {
  background: rgba(255, 255, 255, 0.75);
}

.profile-summary dt:last-of-type,
.profile-summary dd:last-of-type {
  border-bottom: 0;
}

.profile-sections {
  display: grid;
  gap: 12px;
}

.profile-section {
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.72);
  border-left: 4px solid var(--sand);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.profile-section h4 {
  margin: 0 0 6px;
  color: var(--navy);
  font-size: 0.96rem;
  line-height: 1.5;
}

.profile-section p {
  margin-bottom: 0;
  line-height: 1.8;
}

.profile-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(104px, 0.8fr);
  gap: 14px;
  align-items: stretch;
}

.profile-bottom.no-qr {
  grid-template-columns: 1fr;
}

.profile-contact,
.qr-box {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.profile-contact {
  padding: 14px 15px;
}

.profile-contact h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 0.96rem;
}

.profile-contact dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.contact-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.contact-label,
.contact-value {
  margin: 0;
  line-height: 1.55;
}

.contact-label {
  color: var(--sage);
  font-weight: 700;
  white-space: nowrap;
}

.contact-value {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 132px;
  padding: 12px;
  color: #555f6c;
  background: #ffffff;
  border-color: #c2d0e0;
  text-align: center;
  font-weight: 700;
  line-height: 1.55;
}

.print-title {
  display: none;
}

.qr-label {
  margin: 0;
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.45;
}

.qr-frame {
  display: grid;
  width: min(118px, 100%);
  aspect-ratio: 1;
  place-items: center;
  padding: 9px;
  background: #f4f9ff;
  border: 1px dashed #b5c4d7;
  border-radius: var(--radius);
  color: #68778a;
  font-size: 0.8rem;
  line-height: 1.45;
}

.qr-frame.has-image {
  padding: 7px;
  background: #ffffff;
  border-style: solid;
}

.qr-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.copy-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--white);
  background: var(--sage);
  font-size: 0.88rem;
  white-space: nowrap;
}

.copy-button.copied {
  background: var(--navy);
}

.print-actions {
  display: none;
  margin-top: 18px;
}

.print-actions.is-visible {
  display: block;
}

.print-button {
  width: 100%;
  padding: 12px 18px;
  color: var(--white);
  background: var(--navy-soft);
}

.print-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.65;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer strong,
.site-footer span {
  display: block;
}

.site-footer strong {
  color: var(--navy);
}

.site-footer p {
  max-width: 920px;
  margin: 12px auto 0;
  line-height: 1.8;
}

@media (max-width: 960px) {
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  .header-inner {
    width: min(100% - 24px, 1120px);
    padding: 30px 0 26px;
  }

  .brand-label {
    margin-bottom: 8px;
    font-size: 0.78rem;
  }

  h1 {
    margin-bottom: 12px;
    font-size: clamp(1.55rem, 8vw, 2.05rem);
    line-height: 1.32;
  }

  .lead {
    margin-bottom: 12px;
    font-size: 0.98rem;
    line-height: 1.65;
  }

  .intro {
    font-size: 0.9rem;
    line-height: 1.75;
  }

  .page-shell {
    width: min(100% - 24px, 1180px);
    margin-top: 16px;
  }

  .form-panel,
  .result-panel {
    padding: 18px;
  }

  .choice-grid,
  .select-row,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    display: grid;
  }

  .sample-box {
    display: grid;
    gap: 12px;
    padding: 14px;
  }

  .sample-box .sample-button {
    width: 100%;
  }

  .result-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .copy-button {
    width: 100%;
  }

  .profile-summary {
    grid-template-columns: 1fr;
  }

  .profile-top,
  .profile-bottom,
  .profile-bottom.has-qr,
  .profile-bottom.no-qr {
    grid-template-columns: 1fr;
  }

  .profile-photo {
    width: min(160px, 52vw);
    justify-self: center;
  }

  .profile-summary dt {
    padding-bottom: 4px;
    border-bottom: 0;
  }

  .profile-summary dd {
    padding-top: 4px;
  }

  .profile-summary dt:not(:first-of-type) {
    border-top: 1px solid var(--line);
  }

  .profile-top {
    padding: 16px;
  }

  .profile-section {
    padding: 13px;
  }

  .contact-row {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }

  .contact-row:not(:last-child) {
    margin-bottom: 8px;
  }

  .qr-box {
    min-height: 112px;
  }
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html,
  body {
    background: #ffffff;
    color: #10233f;
    width: 210mm;
    min-height: auto !important;
    margin: 0;
    padding: 0;
    font-size: 10pt;
    line-height: 1.5;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page-shell,
  .tool-grid,
  .result-panel,
  .results,
  .result-card,
  .profile-card {
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
  }

  .site-header,
  .form-panel,
  .panel-heading,
  .empty-state,
  .error-message,
  .reset-status,
  .print-actions,
  .copy-button,
  .site-footer {
    display: none !important;
  }

  .page-shell {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tool-grid {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .result-panel {
    position: static;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  .results {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .result-card,
  .result-card[data-output-index="0"],
  .result-card[data-output-index="1"],
  .result-card[data-output-index="3"],
  .result-card[data-output-index="4"] {
    display: none !important;
  }

  .result-card[data-output-index="2"] {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .result-card.featured {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  .result-header {
    margin-bottom: 4mm;
    padding-bottom: 2.5mm;
    border-bottom: 1px solid #b8c6d8;
  }

  .result-card[data-output-index="2"] > .result-header {
    display: none !important;
  }

  .print-title {
    display: none !important;
  }

  .result-header h3 {
    color: #10233f;
    font-size: 13pt;
    line-height: 1.3;
  }

  .result-card.featured h3 {
    font-size: 14pt;
  }

  .result-text,
  .featured .result-text {
    display: none !important;
    color: #10233f;
    font-size: 11pt;
    line-height: 1.75;
  }

  .sr-copy-text {
    display: none !important;
  }

  .profile-card {
    width: 100% !important;
    max-width: 190mm !important;
    margin: 0 auto !important;
    padding: 6mm !important;
    gap: 2.4mm;
    color: #10233f;
    background: #f9fcff !important;
    border: 1px solid #b8c6d8 !important;
    border-radius: 4mm;
    page-break-before: avoid !important;
    break-before: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .profile-top {
    gap: 5mm;
    align-items: center;
    padding: 3.2mm;
    background: #e4edf7 !important;
    border: 1px solid #b8c6d8;
    border-radius: 4mm;
  }

  .profile-top.has-image {
    grid-template-columns: 32mm minmax(0, 1fr);
  }

  .profile-top.no-image {
    grid-template-columns: 1fr;
  }

  .profile-photo {
    width: 32mm;
    padding: 2mm;
    color: #555f6c;
    background: #ffffff !important;
    border-color: #90a2b7;
    border-radius: 4mm;
    font-size: 8pt;
  }

  .profile-label {
    margin-bottom: 1mm;
    color: #585f68;
    font-size: 9pt;
  }

  .profile-name {
    margin-bottom: 1mm;
    color: #10233f;
    font-size: 22pt;
    line-height: 1.2;
  }

  .profile-company {
    margin-bottom: 2.5mm;
    color: #374151;
    font-size: 10.5pt;
  }

  .profile-catch {
    padding: 2mm 3mm;
    color: #10233f;
    background: #ffffff !important;
    border-left-color: #8fa9c9;
    font-size: 10pt;
    line-height: 1.45;
  }

  .profile-summary {
    grid-template-columns: 30mm minmax(0, 1fr);
    border-color: #b8c6d8;
    border-radius: 3mm;
  }

  .profile-summary dt,
  .profile-summary dd {
    padding: 1.7mm 2.5mm;
    border-color: #cad5e3;
    font-size: 9.5pt;
    line-height: 1.45;
  }

  .profile-summary dt {
    color: #10233f;
    background: #dfe8f2 !important;
  }

  .profile-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2mm;
  }

  .profile-section {
    padding: 2mm 2.5mm;
    background: #ffffff !important;
    border: 1px solid #cad5e3;
    border-left: 3px solid #8fa9c9;
    border-radius: 0 3mm 3mm 0;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .profile-section h4 {
    margin-bottom: 1mm;
    color: #10233f;
    font-size: 9.3pt;
    line-height: 1.3;
  }

  .profile-section p {
    font-size: 8.9pt;
    line-height: 1.42;
  }

  .profile-bottom.has-qr {
    grid-template-columns: minmax(0, 1.6fr) 34mm;
    gap: 4mm;
  }

  .profile-bottom.no-qr {
    grid-template-columns: 1fr;
  }

  .profile-contact {
    padding: 2.5mm;
    background: #ffffff !important;
    border-color: #b8c6d8;
    border-radius: 3mm;
  }

  .profile-contact h4 {
    margin-bottom: 1.5mm;
    color: #10233f;
    font-size: 9.5pt;
    line-height: 1.3;
  }

  .profile-contact dl {
    gap: 1mm;
  }

  .contact-row {
    grid-template-columns: 24mm minmax(0, 1fr);
    gap: 2.5mm;
  }

  .contact-label,
  .contact-value {
    font-size: 8.3pt;
    line-height: 1.3;
  }

  .qr-box {
    width: 34mm;
    min-height: auto;
    padding: 2mm;
    background: #ffffff !important;
    border-color: #b8c6d8;
    border-radius: 3mm;
    font-size: 8.5pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .qr-label {
    font-size: 8.5pt;
    line-height: 1.25;
  }

  .qr-frame {
    width: 29mm;
    padding: 1.5mm;
    background: #f4f9ff !important;
    border-color: #90a2b7;
    font-size: 7.5pt;
  }

  .qr-frame.has-image {
    background: #ffffff !important;
  }
}
