:root {
  --navy: #1e3a8a;
  --navy-dark: #172554;
  --navy-light: #dbeafe;
  --orange: #f97316;
  --orange-dark: #ea580c;
  --orange-light: #fff7ed;
  --background: #f3f4f6;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #047857;
  --success-bg: #ecfdf5;
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --radius: 18px;
  --radius-small: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Noto Sans JP", sans-serif;
  line-height: 1.7;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Header */

.app-header {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: white;
  padding: 26px 20px 18px;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.header-kicker {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  opacity: 0.75;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.8rem);
  line-height: 1.4;
}

.step-indicator {
  flex-shrink: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 700;
  font-size: 0.82rem;
}

.progress-area {
  max-width: 1180px;
  margin: 22px auto 0;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.progress-bar {
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  transition: width 0.3s ease;
}

.progress-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 7px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.68);
}

.progress-labels span:last-child {
  text-align: right;
}

.progress-labels span:nth-child(2),
.progress-labels span:nth-child(3) {
  text-align: center;
}

/* Main */

.main-container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 70px;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 26px;
}

.section-number {
  flex: 0 0 auto;
  color: var(--orange);
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

.section-heading h2 {
  margin: 2px 0 7px;
  color: var(--navy-dark);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.4;
}

.section-heading p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px !important;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow.orange {
  color: var(--orange);
}

/* Forms */

.form-card,
.preference-card {
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  gap: 24px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

.form-group {
  min-width: 0;
}

.form-group > label,
.sub-heading {
  display: block;
  margin-bottom: 9px;
  color: var(--navy-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.required {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--orange-light);
  color: var(--orange-dark);
  font-size: 0.68rem;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Choices */

.choice-grid,
.checkbox-grid {
  display: grid;
  gap: 12px;
}

.four-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.checkbox-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice-card,
.check-card {
  position: relative;
  display: flex;
  min-height: 62px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: 0.2s ease;
}

.choice-card:hover,
.check-card:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.choice-card input,
.check-card input {
  margin: 4px 10px 0 0;
  accent-color: var(--navy);
}

.choice-card:has(input:checked),
.check-card:has(input:checked) {
  border-color: var(--navy);
  background: #eff6ff;
  box-shadow: 0 0 0 1px var(--navy);
}

.choice-card strong {
  display: block;
  margin-bottom: 3px;
  color: var(--navy-dark);
  font-size: 0.91rem;
}

.choice-card small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.check-card span {
  font-size: 0.84rem;
  font-weight: 600;
}

.separated {
  margin-top: 32px;
}

/* Preference */

.preference-list {
  display: grid;
  gap: 15px;
}

.preference-card {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 2fr;
  align-items: center;
  gap: 28px;
  padding: 20px 24px;
}

.preference-title strong {
  display: block;
  color: var(--navy-dark);
}

.preference-title small {
  color: var(--muted);
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.rating-option {
  cursor: pointer;
}

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

.rating-option span {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: white;
  color: var(--muted);
  font-weight: 700;
  transition: 0.2s;
}

.rating-option input:checked + span {
  border-color: var(--navy);
  background: var(--navy);
  color: white;
}

/* Conditions */

.condition-list {
  display: grid;
}

.condition-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 260px);
  gap: 24px;
  align-items: center;
  padding: 21px 0;
  border-bottom: 1px solid var(--border);
}

.condition-row:first-child {
  padding-top: 0;
}

.condition-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.condition-row strong {
  display: block;
  color: var(--navy-dark);
}

.condition-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

/* Buttons */

.wizard-navigation,
.restart-area {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.button {
  min-height: 48px;
  min-width: 130px;
  padding: 11px 22px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.primary-button {
  margin-left: auto;
  background: var(--navy);
  color: white;
}

.secondary-button {
  border: 1px solid #d1d5db;
  background: white;
  color: var(--text);
}

.accent-button {
  margin-left: auto;
  background: var(--orange);
  color: white;
}

.message-box {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 10px;
}

.error-message {
  border: 1px solid #fecaca;
  background: var(--danger-bg);
  color: var(--danger);
}

/* Results */

.results-section {
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.results-hero {
  margin-bottom: 32px;
  padding: 32px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  color: white;
}

.results-hero h2 {
  margin: 5px 0 8px;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
}

.results-hero > p:last-child {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
}

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

.summary-card {
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: white;
}

.type-card {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.card-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.summary-card h3 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.35rem;
}

.summary-card p {
  margin: 0;
}

.result-list {
  margin: 0;
  padding-left: 20px;
}

.result-block {
  margin-top: 32px;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

.result-heading {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 25px;
}

.result-heading h3 {
  margin: 3px 0 0;
  color: var(--navy-dark);
  font-size: 1.55rem;
}

.result-heading > p {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Matrix */

.matrix-wrapper {
  position: relative;
  padding-left: 28px;
  padding-bottom: 32px;
}

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

.matrix-cell {
  min-height: 170px;
  padding: 18px;
  border-radius: 13px;
}

.matrix-cell.priority {
  background: var(--success-bg);
}

.matrix-cell.hobby {
  background: #eff6ff;
}

.matrix-cell.partner {
  background: var(--warning-bg);
}

.matrix-cell.avoid {
  background: var(--danger-bg);
}

.matrix-title {
  margin-bottom: 12px;
}

.matrix-title strong {
  display: block;
}

.matrix-title span {
  color: var(--muted);
  font-size: 0.72rem;
}

.matrix-items {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.matrix-chip {
  padding: 6px 9px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  font-size: 0.73rem;
  font-weight: 600;
}

.matrix-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.matrix-y-label {
  position: absolute;
  top: 50%;
  left: -52px;
  transform: rotate(-90deg);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.matrix-x-label {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.72rem;
}

/* Ranking */

.ranking-list {
  display: grid;
  gap: 14px;
}

.ranking-card {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 13px;
}

.ranking-card:first-child {
  border-color: #fdba74;
  background: var(--orange-light);
}

.rank-number {
  color: var(--navy);
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
}

.ranking-card:first-child .rank-number {
  color: var(--orange);
}

.ranking-content h4 {
  margin: 0 0 5px;
  color: var(--navy-dark);
  font-size: 1.03rem;
}

.ranking-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.score-circle {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 6px solid var(--navy-light);
  border-radius: 50%;
  color: var(--navy);
  font-size: 1.1rem;
  font-weight: 900;
}

/* Winner */

.winner-block {
  overflow: hidden;
  border: 0;
  background:
    radial-gradient(
      circle at top right,
      rgba(249, 115, 22, 0.11),
      transparent 30%
    ),
    white;
}

.winner-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.winner-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--orange);
  color: white;
  font-size: 0.68rem;
  font-weight: 900;
}

.winner-heading p {
  margin: 12px 0 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.winner-heading h3 {
  margin: 0;
  color: var(--navy-dark);
  font-size: clamp(1.4rem, 4vw, 2rem);
}

.winner-score {
  flex-shrink: 0;
  color: var(--orange);
  font-size: 2.7rem;
  font-weight: 900;
}

.winner-score small {
  color: var(--muted);
  font-size: 0.9rem;
}

.winner-reason {
  margin: 25px 0;
  padding-left: 16px;
  border-left: 4px solid var(--orange);
  color: #374151;
}

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

.detail-card {
  padding: 17px;
  border-radius: 11px;
  background: var(--background);
}

.detail-card span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.7rem;
}

.detail-card strong {
  color: var(--navy-dark);
  font-size: 0.88rem;
}

.first-action {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 20px;
  border-radius: 13px;
  background: var(--navy);
  color: white;
}

.first-action-icon {
  flex-shrink: 0;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  font-weight: 900;
}

.first-action small {
  color: #bfdbfe;
}

.first-action h4 {
  margin: 3px 0 0;
  font-size: 1rem;
}

.restart-area {
  justify-content: center;
  margin-top: 30px;
}

/* Responsive */

@media (max-width: 900px) {
  .four-columns,
  .checkbox-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preference-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .app-header {
    padding-inline: 16px;
  }

  .header-inner {
    display: block;
  }

  .step-indicator {
    display: inline-block;
    margin-top: 14px;
  }

  .main-container {
    width: min(100% - 24px, 1180px);
    padding-top: 30px;
  }

  .section-heading {
    gap: 12px;
  }

  .section-number {
    font-size: 1.6rem;
  }

  .two-columns,
  .four-columns,
  .checkbox-grid,
  .summary-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .condition-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .result-heading {
    display: block;
  }

  .result-heading > p {
    margin-top: 8px;
  }

  .matrix-wrapper {
    overflow-x: auto;
    padding-left: 0;
  }

  .matrix-grid {
    min-width: 650px;
  }

  .matrix-y-label {
    display: none;
  }

  .ranking-card {
    grid-template-columns: 42px 1fr;
  }

  .score-circle {
    grid-column: 2;
    width: auto;
    height: auto;
    display: block;
    border: 0;
    text-align: left;
  }

  .winner-heading {
    align-items: flex-start;
  }

  .winner-score {
    font-size: 2rem;
  }

  .progress-labels {
    font-size: 0.6rem;
  }

  .rating-options {
    gap: 5px;
  }
}