:root {
  --ink: #2b211b;
  --brown: #5d2c16;
  --gold: #b88734;
  --green: #397448;
  --green-soft: #eef7ed;
  --blue: #2e6f9f;
  --blue-soft: #edf6fb;
  --rose: #d85268;
  --rose-soft: #fff1f3;
  --orange: #d98220;
  --paper: #fffdf8;
  --line: #dfc28c;
  --shadow: 0 18px 55px rgba(84, 63, 38, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Sans", "Meiryo", sans-serif;
  background:
    linear-gradient(120deg, rgba(245, 249, 236, 0.9), rgba(255, 248, 246, 0.95)),
    #f7f4ed;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.control-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: stretch;
  width: min(880px, 100%);
  margin: 34px auto 24px;
  padding: 30px;
  border: 1px solid rgba(184, 135, 52, 0.35);
  border-radius: 10px;
  background:
    radial-gradient(circle at 8% 12%, rgba(224, 238, 210, 0.8), transparent 22%),
    radial-gradient(circle at 95% 16%, rgba(255, 238, 226, 0.8), transparent 20%),
    rgba(255, 253, 248, 0.96);
  box-shadow: 0 16px 44px rgba(84, 63, 38, 0.12);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-family: Georgia, serif;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: var(--brown);
  font-size: 34px;
  line-height: 1.25;
  text-align: center;
}

.control-panel .eyebrow {
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: stretch;
}

.name-field {
  min-width: 0;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: #72502b;
  font-size: 15px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #d7bc91;
  border-radius: 6px;
  padding: 11px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

select {
  min-height: 50px;
  border: 1px solid #d7bc91;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

.birth-fields {
  display: grid;
  grid-template-columns: 1.15fr 0.8fr 0.8fr;
  gap: 8px;
}

.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.radio-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid #d7bc91;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-option span {
  display: block;
  margin: 0;
  color: #72502b;
  font-size: 18px;
  font-weight: 700;
}

.radio-option:has(input:checked) {
  border-color: var(--green);
  background: #edf7ed;
  box-shadow: inset 0 0 0 1px var(--green);
}

.radio-option:has(input:checked) span {
  color: var(--green);
}

button {
  min-height: 50px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--green);
  color: #fff;
}

.ghost-button {
  border-color: #cba768;
  background: #fffaf0;
  color: #7a4b12;
}

.message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--rose);
  font-size: 14px;
}

.preview-toolbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid rgba(184, 135, 52, 0.35);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 30px rgba(84, 63, 38, 0.1);
}

.preview-toolbar p {
  margin: 0;
  color: var(--brown);
  font-weight: 700;
  text-align: center;
}

body.print-preview {
  background: #eee7dc;
}

body.print-preview .control-panel {
  display: none;
}

body.print-preview .preview-toolbar {
  display: grid;
}

body.print-preview .app-shell {
  width: min(100%, 1120px);
  margin-top: 0;
}

body.print-preview .sheet {
  width: 210mm;
  min-height: 297mm;
  max-width: calc(100vw - 32px);
  margin-bottom: 40px;
  transform-origin: top center;
}

body.print-preview .profile-grid,
body.print-preview .feature-band,
body.print-preview .main-columns,
body.print-preview .detail-grid,
body.print-preview .lucky-row {
  break-inside: avoid;
}

body.print-preview .sheet-header h2 {
  font-size: 50px;
}

body.print-preview .sheet-header p {
  font-size: 18px;
}

body.print-preview .profile-row strong {
  font-size: 18px;
}

body.print-preview .lead {
  font-size: 22px;
}

body.print-preview .mini-card {
  min-height: 126px;
}

.sheet {
  position: relative;
  overflow: hidden;
  width: min(100%, 980px);
  min-height: 1386px;
  margin: 0 auto;
  padding: 34px 30px 26px;
  border: 1px solid #e0b873;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 253, 247, 0.58), rgba(255, 252, 246, 0.68)),
    url("./assets/sheet-background-watercolor.png?v=2") center / cover no-repeat,
    var(--paper);
  box-shadow: var(--shadow);
}

.sheet.is-hidden {
  display: none;
}

.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 120px;
  height: 520px;
  top: 70px;
  opacity: 0.2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 45% 8%, rgba(94, 143, 84, 0.55) 0 12px, transparent 13px),
    radial-gradient(ellipse at 68% 18%, rgba(124, 165, 101, 0.5) 0 11px, transparent 12px),
    radial-gradient(ellipse at 35% 28%, rgba(94, 143, 84, 0.48) 0 12px, transparent 13px),
    radial-gradient(ellipse at 64% 40%, rgba(160, 184, 115, 0.48) 0 10px, transparent 11px),
    radial-gradient(ellipse at 38% 52%, rgba(94, 143, 84, 0.45) 0 11px, transparent 12px),
    linear-gradient(108deg, transparent 46%, rgba(178, 136, 48, 0.5) 47% 48%, transparent 49%);
}

.sheet::before {
  left: 4px;
  transform: rotate(6deg);
}

.sheet::after {
  right: 4px;
  transform: scaleX(-1) rotate(6deg);
}

.sheet > * {
  position: relative;
  z-index: 1;
}

.corner {
  position: absolute;
  z-index: 0;
  width: 230px;
  height: 170px;
  opacity: 0.62;
  pointer-events: none;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  border-radius: 80% 0;
  border: 1px solid rgba(77, 130, 68, 0.38);
}

.corner::before {
  width: 150px;
  height: 54px;
  transform: rotate(-28deg);
}

.corner::after {
  width: 110px;
  height: 42px;
  top: 52px;
  left: 42px;
  transform: rotate(-10deg);
}

.corner-left {
  top: 10px;
  left: 12px;
}

.corner-right {
  top: 10px;
  right: 12px;
  transform: scaleX(-1);
}

.sheet-header {
  text-align: center;
  margin-bottom: 16px;
}

.ornament {
  width: 360px;
  max-width: 70%;
  height: 18px;
  margin: 0 auto 2px;
  border-top: 1px solid var(--gold);
  position: relative;
}

.ornament::after {
  content: "✦";
  position: absolute;
  left: 50%;
  top: -13px;
  transform: translateX(-50%);
  color: var(--gold);
  background: var(--paper);
  padding: 0 12px;
}

.sheet-header h2 {
  margin: 0;
  color: var(--brown);
  font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.65);
}

.sheet-header p {
  margin: 2px 0 0;
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 20px;
  font-style: italic;
}

.profile-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 8% 16%, rgba(137, 172, 111, 0.16), transparent 18%),
    radial-gradient(circle at 94% 82%, rgba(137, 172, 111, 0.14), transparent 16%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 250, 239, 0.86));
  margin-inline: 34px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.profile-grid::before,
.profile-grid::after {
  content: "";
  position: absolute;
  z-index: 0;
  width: 130px;
  height: 130px;
  opacity: 0.18;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 36% 22%, #4f8a50 0 10px, transparent 11px),
    radial-gradient(ellipse at 62% 38%, #8dad65 0 9px, transparent 10px),
    radial-gradient(ellipse at 42% 58%, #4f8a50 0 9px, transparent 10px),
    linear-gradient(135deg, transparent 46%, #b88734 47% 49%, transparent 50%);
}

.profile-grid::before {
  left: 6px;
  top: 8px;
  transform: rotate(-18deg);
}

.profile-grid::after {
  right: 6px;
  bottom: 4px;
  transform: scaleX(-1) rotate(-18deg);
}

.profile-row {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.5);
}

.profile-row {
  display: grid;
  grid-template-columns: 158px 1fr;
  min-height: 43px;
  border-bottom: 1px dotted #cfae75;
}

.profile-row:nth-child(odd) {
  border-right: 1px dotted #cfae75;
}

.profile-row:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.profile-row span {
  display: grid;
  place-items: center;
  margin: 6px 10px;
  border-radius: 5px;
  background: linear-gradient(180deg, #649867, #397448);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.profile-row strong {
  display: flex;
  align-items: center;
  padding: 7px 16px;
  font-size: 19px;
  font-weight: 600;
}

.feature-band {
  position: relative;
  margin: 24px 0 20px;
  padding: 26px 46px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 4% 20%, rgba(139, 174, 111, 0.18), transparent 13%),
    radial-gradient(circle at 95% 70%, rgba(139, 174, 111, 0.18), transparent 14%),
    rgba(255, 255, 255, 0.86);
  text-align: center;
}

.feature-band h3 {
  position: absolute;
  left: 50%;
  top: -17px;
  min-width: 140px;
  margin: 0;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #7aa06b, #3f8558, #7aa06b);
  color: #fff;
  font-size: 24px;
  line-height: 34px;
  clip-path: polygon(0 0, 100% 0, 90% 50%, 100% 100%, 0 100%, 10% 50%);
}

.feature-band p {
  margin: 0;
  font-size: 18px;
  line-height: 1.7;
}

.feature-band .catch-line {
  color: var(--rose);
  font-weight: 700;
}

.main-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.large-card,
.mini-card {
  border: 1px solid;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.large-card {
  min-height: 286px;
  padding: 18px 28px 20px;
  position: relative;
  overflow: hidden;
}

.large-card::after {
  content: none;
}

.tendency-image {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 0;
  width: 170px;
  height: 132px;
  object-fit: contain;
  opacity: 0.34;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.large-card > :not(.tendency-image) {
  position: relative;
  z-index: 1;
}

.green {
  border-color: #efc083;
  color: #c56e12;
  background:
    radial-gradient(circle at 75% 70%, rgba(226, 154, 64, 0.18), transparent 27%),
    linear-gradient(135deg, #fff5e8, #fff);
}

.blue {
  border-color: #91b9d5;
  color: #2c78a7;
  background:
    radial-gradient(circle at 82% 70%, rgba(67, 139, 182, 0.18), transparent 27%),
    linear-gradient(135deg, var(--blue-soft), #fff);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.card-title h3 {
  margin: 0;
  min-width: 180px;
  padding: 5px 24px 7px;
  color: #fff;
  clip-path: polygon(0 0, 100% 0, 92% 50%, 100% 100%, 0 100%, 8% 50%);
  font-size: 27px;
  line-height: 1.2;
  text-align: center;
}

.green .card-title h3 {
  background: linear-gradient(90deg, #e7b15f, #cf7b22, #e7b15f);
}

.blue .card-title h3 {
  background: linear-gradient(90deg, #6aa1c7, #2f78a8, #6aa1c7);
}

.lead {
  min-height: 62px;
  margin: 0 0 12px;
  color: currentColor;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 23px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  white-space: pre-line;
}

ul {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.8;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin-top: 16px;
}

.mini-card {
  min-height: 135px;
  padding: 13px 16px 12px;
}

.mini-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  line-height: 1.25;
  text-align: center;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  white-space: pre-line;
}

.mini-card ul {
  font-size: 14px;
  line-height: 1.58;
}

.tone-rose {
  border-color: #f1a6b2;
  color: #c84561;
  background: linear-gradient(145deg, var(--rose-soft), #fff);
}

.tone-green {
  border-color: #abc998;
  color: #267143;
  background: linear-gradient(145deg, #f1faef, #fff);
}

.tone-blue {
  border-color: #9fc3dc;
  color: #196aa2;
  background: linear-gradient(145deg, #eff8ff, #fff);
}

.tone-orange {
  border-color: #efc083;
  color: #c56e12;
  background: linear-gradient(145deg, #fff8ec, #fff);
}

.tone-purple {
  border-color: #cab1dc;
  color: #7850a0;
  background: linear-gradient(145deg, #fbf4ff, #fff);
}

.lucky-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 12px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 251, 239, 0.92)),
    rgba(255, 255, 255, 0.85);
}

.lucky-box {
  display: block;
  min-height: 76px;
  padding: 8px 12px;
  border-right: 1px dotted #d4ad6d;
  text-align: center;
}

.lucky-box:last-child {
  border-right: 0;
}

.lucky-box b {
  display: block;
  color: var(--green);
  font-size: 18px;
}

.lucky-box strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .control-panel,
  .form-grid,
  .main-columns,
  .profile-grid,
  .detail-grid,
  .lucky-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    grid-template-columns: 1fr 1fr;
  }

  .profile-row:nth-child(odd),
  .lucky-box {
    border-right: 0;
  }

  .sheet {
    padding: 28px 18px;
    min-height: auto;
  }

  .sheet-header h2 {
    font-size: 40px;
  }

  .profile-row {
    grid-template-columns: 142px 1fr;
  }

  .preview-toolbar {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: #fff;
  }

  .app-shell {
    width: auto;
    margin: 0;
  }

  .control-panel,
  .preview-toolbar {
    display: none;
  }

  .sheet {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .sheet-header h2 {
    font-size: 50px;
  }

  .sheet-header p {
    font-size: 18px;
  }

  .profile-grid {
    margin-inline: 34px;
  }

  .profile-row {
    min-height: 42px;
  }

  .profile-row span {
    font-size: 15px;
  }

  .profile-row strong {
    font-size: 18px;
  }

  .feature-band {
    margin: 22px 0 18px;
  }

  .feature-band p {
    font-size: 17px;
  }

  .large-card {
    min-height: 270px;
  }

  .lead {
    font-size: 21px;
  }

  .mini-card {
    min-height: 122px;
  }

  .mini-card h3 {
    font-size: 18px;
  }

  .mini-card ul {
    font-size: 13px;
    line-height: 1.5;
  }

  .lucky-box {
    min-height: 70px;
  }
}
