:root {
  --bg: #f3f1eb;
  --surface: #fffdf8;
  --surface-soft: #f8f3e8;
  --ink: #24221d;
  --muted: #6d675d;
  --line: #d8cbb5;
  --accent: #24594b;
  --accent-dark: #14372f;
  --accent-soft: #ecf4ed;
  --gold: #b9904b;
  --gold-dark: #7f5b23;
  --warm: #8f4742;
  --warning: #8b3531;
  --shadow: 0 24px 60px rgba(37, 31, 22, 0.12);
  --shadow-soft: 0 12px 32px rgba(37, 31, 22, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(36, 89, 75, 0.08) 0%, rgba(36, 89, 75, 0) 34%),
    linear-gradient(180deg, #faf8f1 0%, var(--bg) 48%, #ebe5d8 100%);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  letter-spacing: 0;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 4vw, 44px);
  color: #fffdf8;
  border-bottom: 1px solid rgba(185, 144, 75, 0.42);
  background:
    linear-gradient(135deg, rgba(185, 144, 75, 0.16) 0%, rgba(185, 144, 75, 0) 36%),
    linear-gradient(135deg, #112c28 0%, #244d40 72%, #352d24 100%);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 18px 42px rgba(20, 35, 29, 0.18);
  backdrop-filter: blur(12px);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.app-header h1,
.section-heading h2,
.empty-state h2 {
  margin: 0;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.app-header h1 {
  font-size: clamp(24px, 4vw, 38px);
  color: #fffdf8;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 700;
}

.app-header .eyebrow {
  color: #d9c184;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 28px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 36px) 56px;
}

.input-surface {
  position: relative;
  overflow: hidden;
  align-self: start;
  padding: 22px;
  background: var(--surface);
  border: 1px solid rgba(185, 144, 75, 0.38);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-surface::before,
.empty-state::before,
.result-card::before,
.insight-section::before {
  content: "";
  display: block;
  height: 3px;
  margin: -1px -1px 16px;
  background: linear-gradient(90deg, rgba(185, 144, 75, 0.88), rgba(36, 89, 75, 0.7), rgba(143, 71, 66, 0.52));
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-top: 20px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 22px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

label,
.field-block {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.field-label {
  display: block;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffefb;
  border: 1px solid rgba(166, 147, 114, 0.56);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input,
select {
  min-height: 44px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.7;
}

.date-selects {
  display: grid;
  grid-template-columns: minmax(112px, 1.2fr) minmax(84px, 0.9fr) minmax(84px, 0.9fr);
  gap: 8px;
}

.date-part {
  min-width: 0;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(185, 144, 75, 0.26);
  outline-offset: 2px;
  border-color: var(--gold);
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
}

.profile-preview {
  display: grid;
  gap: 8px;
  padding: 12px;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, #f7f1e5);
  border: 1px solid rgba(185, 144, 75, 0.34);
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.profile-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.profile-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-pill {
  display: inline-grid;
  gap: 2px;
  min-width: 88px;
  padding: 7px 9px;
  color: var(--accent-dark);
  background: #fffdf8;
  border: 1px solid rgba(185, 144, 75, 0.35);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 800;
}

.profile-pill strong {
  color: var(--gold-dark);
  font-size: 11px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0 4px;
  padding: 12px;
  background: linear-gradient(180deg, #fbf8ef, var(--surface-soft));
  border: 1px solid rgba(185, 144, 75, 0.34);
  border-radius: 6px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.partner-fields {
  margin-top: 14px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

button {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.primary-button {
  flex: 1;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border-color: rgba(185, 144, 75, 0.4);
  box-shadow: 0 12px 24px rgba(20, 55, 47, 0.18);
}

.primary-button:hover {
  background: linear-gradient(135deg, #0f2f28, #2a6655);
  box-shadow: 0 14px 28px rgba(20, 55, 47, 0.22);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: #fffdf8;
  border-color: rgba(185, 144, 75, 0.48);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
  box-shadow: var(--shadow-soft);
}

.header-actions .ghost-button {
  color: #fffdf8;
  background: rgba(255, 253, 248, 0.08);
  border-color: rgba(217, 193, 132, 0.48);
}

.header-actions .ghost-button:hover {
  color: #fffdf8;
  background: rgba(255, 253, 248, 0.14);
  border-color: rgba(217, 193, 132, 0.86);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.error-message {
  margin: 12px 0 0;
  color: var(--warning);
  font-weight: 700;
  line-height: 1.6;
}

.result-area {
  min-width: 0;
}

.empty-state {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 6vw, 52px);
  min-height: 280px;
  display: grid;
  align-content: center;
  background: var(--surface);
  border: 1px dashed rgba(185, 144, 75, 0.62);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.empty-state p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.result-header {
  display: grid;
  gap: 12px;
  padding: 24px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(217, 193, 132, 0.2), rgba(217, 193, 132, 0) 38%),
    linear-gradient(135deg, #102d28 0%, #24594b 68%, #4a3430 100%);
  border: 1px solid rgba(217, 193, 132, 0.28);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.result-header h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 40px);
  line-height: 1.22;
}

.result-header p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.7;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.result-actions button,
.result-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  color: #fff;
  text-decoration: none;
  border: 1px solid rgba(217, 193, 132, 0.48);
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.1);
  font-weight: 700;
  text-align: center;
}

.result-actions .report-button {
  border-color: rgba(196, 110, 84, 0.62);
  background: rgba(139, 61, 47, 0.2);
}

.result-actions .report-button:hover:not(:disabled) {
  background: rgba(139, 61, 47, 0.3);
}

.result-stack {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-card,
.insight-section {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(185, 144, 75, 0.34);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.result-card {
  padding: 16px;
  min-height: 150px;
}

.result-card h3,
.insight-section h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.result-card .star-name {
  margin: 8px 0 6px;
  color: var(--gold-dark);
  font-size: 24px;
  font-weight: 800;
}

.result-card p,
.insight-section p,
.insight-section li {
  color: var(--muted);
  line-height: 1.75;
}

.result-card p {
  margin: 0;
}

.insight-section {
  padding: 18px;
}

.insight-section > p:last-child {
  margin-bottom: 0;
}

.answer-section {
  background:
    linear-gradient(135deg, rgba(185, 144, 75, 0.12), rgba(185, 144, 75, 0) 42%),
    var(--surface);
}

.answer-lead {
  margin-top: 0;
  color: var(--ink) !important;
  font-size: 17px;
  font-weight: 800;
}

.phrase-box {
  margin-top: 14px;
  padding: 14px;
  background: #fff8ec;
  border: 1px solid rgba(185, 144, 75, 0.36);
  border-radius: 6px;
}

.phrase-box p {
  margin: 0;
}

.phrase-box p + p {
  margin-top: 6px;
}

.lucky-list {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff8ec;
  border: 1px solid rgba(185, 144, 75, 0.32);
  border-radius: 6px;
}

.lucky-list p {
  margin: 0;
}

.lucky-list p:first-child {
  color: var(--ink);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--accent-dark);
  background: linear-gradient(180deg, #f5efd9, #e9f1e8);
  border: 1px solid rgba(185, 144, 75, 0.32);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.topic-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  color: var(--gold-dark) !important;
  background: #fff8ec;
  border: 1px solid rgba(185, 144, 75, 0.34);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
}

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

.plain-list {
  margin: 10px 0 0;
  padding-left: 1.2em;
}

.plain-list li + li {
  margin-top: 4px;
}

.callout {
  border-left: 4px solid var(--warm);
  background: #fff7f1;
}

.cta-band {
  display: grid;
  gap: 12px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(36, 89, 75, 0.08), rgba(36, 89, 75, 0) 44%),
    var(--surface-soft);
  border: 1px solid rgba(185, 144, 75, 0.4);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.cta-band h3 {
  margin: 0;
}

.cta-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cta-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  border: 1px solid rgba(185, 144, 75, 0.34);
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.cta-links a.secondary-link {
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid rgba(185, 144, 75, 0.48);
}

.copy-status {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-header {
    align-items: flex-start;
    position: static;
  }
}

@media (max-width: 640px) {
  .app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 18px 14px;
    justify-content: stretch;
    justify-items: stretch;
  }

  .app-header > div {
    min-width: 0;
  }

  .app-header h1 {
    font-size: 28px;
  }

  .ghost-button {
    width: 100%;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .header-actions .ghost-button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
  }

  .app-shell {
    gap: 18px;
    padding: 18px 12px 42px;
  }

  .input-surface {
    padding: 16px;
    box-shadow: var(--shadow-soft);
  }

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

  .section-heading h2 {
    font-size: 21px;
  }

  .field-grid {
    gap: 16px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
    padding: 11px 12px;
  }

  textarea {
    min-height: 148px;
  }

  .result-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .cta-links,
  .result-actions {
    display: grid;
    gap: 8px;
  }

  .date-selects {
    grid-template-columns: 1.25fr 0.9fr 0.9fr;
    gap: 7px;
  }

  .check-row {
    align-items: flex-start;
    line-height: 1.55;
  }

  .empty-state {
    min-height: 220px;
    padding: 24px 18px;
  }

  .result-header {
    gap: 10px;
    padding: 20px 18px;
  }

  .result-header h2 {
    font-size: 25px;
  }

  .result-card,
  .insight-section,
  .cta-band {
    padding: 16px;
  }

  .result-card {
    min-height: auto;
  }

  .result-card .star-name {
    font-size: 22px;
  }
}

@media (max-width: 360px) {
  .app-header h1 {
    font-size: 26px;
  }

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

  .date-selects {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .input-surface,
  .empty-state,
  .result-actions,
  .cta-band {
    display: none !important;
  }

  .app-shell {
    display: block;
    padding: 0;
    width: 100%;
  }

  .result-header {
    color: #111;
    background: #fff;
    border: 1px solid #bbb;
  }

  .result-header p {
    color: #333;
  }

  .result-grid,
  .two-column {
    grid-template-columns: 1fr 1fr;
  }
}
