:root {
  color-scheme: light;
  --ink: #211813;
  --muted: #6f655d;
  --paper: #f8f2e7;
  --panel: #fffaf0;
  --line: #d6b970;
  --vermillion: #a6332c;
  --moss: #516f57;
  --indigo: #283c61;
  --gold: #bf9136;
  --plum: #6d3e59;
  --shadow: 0 24px 70px rgba(53, 35, 16, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(166, 51, 44, 0.12), transparent 30%),
    linear-gradient(300deg, rgba(40, 60, 97, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 250, 240, 0.92), rgba(246, 232, 204, 0.86)),
    repeating-linear-gradient(45deg, rgba(191, 145, 54, 0.08) 0 1px, transparent 1px 18px),
    var(--paper);
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 38px 0 56px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 30px;
  align-items: end;
  min-height: 390px;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid rgba(191, 145, 54, 0.65);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 240, 0.96), rgba(255, 255, 255, 0.78)),
    radial-gradient(ellipse at top left, rgba(191, 145, 54, 0.22), transparent 42%),
    repeating-linear-gradient(90deg, rgba(81, 111, 87, 0.12) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(0deg, rgba(166, 51, 44, 0.08) 0 1px, transparent 1px 24px);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(191, 145, 54, 0.46);
  border-radius: 6px;
  pointer-events: none;
}

.hero::after {
  content: "九星";
  position: absolute;
  right: clamp(18px, 5vw, 54px);
  top: 22px;
  color: rgba(191, 145, 54, 0.12);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4.2rem, 14vw, 10rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.eyebrow,
.mini-label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  max-width: 8em;
  font-size: clamp(2.7rem, 7vw, 6rem);
  font-weight: 800;
  color: #24130f;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72), 0 16px 34px rgba(80, 42, 18, 0.18);
}

h2 {
  font-size: 1.5rem;
}

.lead {
  max-width: 680px;
  margin: 22px 0 0;
  color: #5d514a;
  font-size: 1.03rem;
  line-height: 1.9;
}

.fortune-form {
  position: relative;
  z-index: 1;
  padding: 24px;
  border: 1px solid rgba(191, 145, 54, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 232, 0.9)),
    repeating-linear-gradient(135deg, rgba(191, 145, 54, 0.08) 0 1px, transparent 1px 16px);
  box-shadow: 0 18px 45px rgba(53, 35, 16, 0.18);
  backdrop-filter: blur(10px);
}

.fortune-form fieldset {
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.fortune-form legend {
  margin-bottom: 10px;
  color: #3a2c24;
  font-weight: 700;
}

.birth-selects {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 10px;
}

.birth-selects label {
  display: grid;
  gap: 6px;
}

.birth-selects span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select,
button {
  min-height: 48px;
  border: 1px solid rgba(191, 145, 54, 0.48);
  border-radius: 6px;
  font: inherit;
}

select {
  width: 100%;
  padding: 0 14px;
  background: linear-gradient(180deg, #fff, #fff9ec);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

button {
  width: 100%;
  padding: 0 18px;
  border-color: #8f2e29;
  background: linear-gradient(135deg, #bd463a, #8e2d27 55%, #6d3e59);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 14px 25px rgba(166, 51, 44, 0.28);
  cursor: pointer;
}

button:hover {
  background: linear-gradient(135deg, #c65345, #7f2722 58%, #5f334d);
}

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

.gender-options label {
  position: relative;
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid rgba(191, 145, 54, 0.48);
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #fff9ec);
  cursor: pointer;
}

.gender-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.gender-options span {
  font-weight: 700;
}

.gender-options label:has(input:checked) {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(191, 145, 54, 0.18), rgba(81, 111, 87, 0.14));
  color: #314c37;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.empty-state,
.result {
  margin-top: 24px;
}

.empty-state {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed rgba(191, 145, 54, 0.7);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 250, 240, 0.76);
  box-shadow: 0 16px 38px rgba(53, 35, 16, 0.08);
}

.hidden {
  display: none !important;
}

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

.summary-card,
.panel {
  border: 1px solid rgba(191, 145, 54, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 248, 232, 0.92)),
    var(--panel);
  box-shadow: 0 18px 42px rgba(60, 47, 30, 0.13);
}

.summary-card {
  position: relative;
  min-height: 138px;
  padding: 20px;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--accent, var(--moss)), var(--gold));
}

.summary-card::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -34px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(191, 145, 54, 0.22);
  transform: rotate(45deg);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.summary-card strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(1.25rem, 3vw, 2rem);
  line-height: 1.25;
}

.accent-water {
  --accent: var(--indigo);
}

.accent-wood {
  --accent: var(--moss);
}

.accent-gold {
  --accent: var(--gold);
}

.accent-fire {
  --accent: var(--vermillion);
}

.notice {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 5px solid var(--vermillion);
  border-radius: 6px;
  background: #fff4ea;
  color: #6f2e1e;
  line-height: 1.7;
}

.panel {
  margin-top: 16px;
  padding: 24px;
}

.panel-heading {
  margin-bottom: 16px;
}

.lucky-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.lucky-card {
  padding: 18px;
  border: 1px solid rgba(191, 145, 54, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(180deg, #fffdf8, #fff5df),
    repeating-linear-gradient(90deg, rgba(191, 145, 54, 0.08) 0 1px, transparent 1px 18px);
}

.lucky-card h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
  color: #3b2b22;
}

.lucky-item {
  display: grid;
  grid-template-columns: 4.5em 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(191, 145, 54, 0.22);
  line-height: 1.55;
}

.lucky-item span {
  color: var(--muted);
  font-weight: 700;
}

.type-label {
  display: inline-block;
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px solid rgba(81, 111, 87, 0.22);
  border-radius: 6px;
  background: linear-gradient(135deg, #edf3ed, #fff7e5);
  color: var(--moss);
  font-weight: 700;
}

.tagline {
  margin: 0 0 12px;
  font-size: 1.18rem;
  font-weight: 700;
}

.description {
  margin: 0;
  color: var(--muted);
  line-height: 1.9;
  white-space: pre-line;
}

.more-info {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid rgba(191, 145, 54, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 246, 225, 0.92)),
    repeating-linear-gradient(90deg, rgba(191, 145, 54, 0.08) 0 1px, transparent 1px 18px);
  box-shadow: 0 18px 42px rgba(60, 47, 30, 0.12);
}

.more-info p {
  margin: 0;
  color: #4f4239;
  line-height: 1.8;
}

.more-info p + p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.94rem;
}

.more-info a {
  display: inline-grid;
  min-height: 44px;
  margin-top: 16px;
  padding: 0 18px;
  place-items: center;
  border: 1px solid #8f2e29;
  border-radius: 6px;
  background: linear-gradient(135deg, #bd463a, #8e2d27 55%, #6d3e59);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 12px 24px rgba(166, 51, 44, 0.24);
}

.more-info a:hover {
  background: linear-gradient(135deg, #c65345, #7f2722 58%, #5f334d);
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 16px;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 24px;
  }

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

  .birth-selects,
  .gender-options {
    grid-template-columns: 1fr;
  }
}
