/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --bg-from:   #eef2ff;
  --bg-mid:    #faf5ff;
  --bg-to:     #fdf2f8;

  --card:      rgba(255, 255, 255, 0.92);
  --card-border: rgba(255, 255, 255, 0.85);

  --text:      #1e1b2e;
  --muted:     #6b7280;

  --primary:   #7c3aed;
  --primary-2: #db2777;

  --accent-core:   #818cf8;
  --accent-love:   #f472b6;
  --accent-night:  #a78bfa;
  --accent-work:   #38bdf8;
  --accent-compat: #34d399;

  --radius-card: 22px;
  --radius-btn:  14px;

  --shadow-card: 0 8px 32px rgba(100, 80, 160, 0.10), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 32px rgba(124, 58, 237, 0.15);
}

/* ── Reset ─────────────────────────────────────────────────── */
* { box-sizing: border-box; }

/* ── Base ──────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: linear-gradient(150deg, var(--bg-from) 0%, var(--bg-mid) 45%, var(--bg-to) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────────────── */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

/* ── Header ────────────────────────────────────────────────── */
.app__header {
  text-align: center;
  padding: 20px 0 8px;
}

.app__header h1 {
  margin: 0 0 6px;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.3s ease-out both;
}

@media (min-width: 640px) {
  .card { padding: 28px 28px; }
}

/* ── Progress ──────────────────────────────────────────────── */
.progress-wrap {
  margin-bottom: 4px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #e9e4f8;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #818cf8 0%, #c084fc 55%, #fb7185 100%);
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Question ──────────────────────────────────────────────── */
.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.55;
  margin: 20px 0 16px;
  letter-spacing: -0.01em;
}

/* ── Answer buttons ────────────────────────────────────────── */
.answers {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  text-align: left;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  padding: 13px 16px;
  border-radius: var(--radius-btn);
  font-size: 0.97rem;
  font-family: inherit;
  line-height: 1.45;
  color: var(--text);
  cursor: pointer;
  border-left: 4px solid transparent;
  transition: background 0.16s ease, border-color 0.16s ease,
              transform 0.16s ease, box-shadow 0.16s ease;
}

.answer-btn:hover {
  background: #f5f3ff;
  border-color: #a78bfa;
  border-left-color: #a78bfa;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12);
}

.answer-btn:active {
  transform: scale(0.98) translateY(0);
  box-shadow: none;
}

.answer-btn:focus-visible {
  outline: 2px solid #a78bfa;
  outline-offset: 2px;
}

/* ── Utility ───────────────────────────────────────────────── */
.hidden { display: none; }

/* ── Result screen ─────────────────────────────────────────── */
#result-screen {
  animation: fadeInUp 0.35s ease-out both;
}

#result-screen h2 {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

/* ── Hybrid badge ──────────────────────────────────────────── */
.hybrid-badge {
  display: block;
  text-align: center;
  margin: 0 auto 16px;
  width: fit-content;
  background: linear-gradient(135deg, #fde68a, #fca5a5);
  color: #7c2d12;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* ── Result card ───────────────────────────────────────────── */
.result-card {
  display: grid;
  gap: 16px;
  align-items: center;
  margin: 0 0 20px;
  padding: 20px;
  background: linear-gradient(135deg, #faf5ff 0%, #fdf2f8 100%);
  border-radius: 18px;
  border-top: 3px solid;
  border-image: linear-gradient(90deg, var(--primary), var(--primary-2)) 1;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

@media (min-width: 640px) {
  .result-card { grid-template-columns: 240px 1fr; }
}

.result-card img {
  width: 100%;
  max-height: 65vh;
  border-radius: 12px;
  object-fit: contain;
  background: #ede9f6;
}

.image-help {
  margin: 8px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.88rem;
}

/* Primary / secondary names */
.small {
  color: var(--muted);
  margin: 0 0 4px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

#primary-name {
  margin: 0 0 4px;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-title {
  margin: 4px 0 12px;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

/* ── Result grid ───────────────────────────────────────────── */
.result-grid {
  display: grid;
  gap: 10px;
}

@media (min-width: 500px) {
  .result-grid { grid-template-columns: 1fr 1fr; }
  .result-grid .rs--core { grid-column: 1 / -1; }
}

/* Base section */
.rs {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-left: 4px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
}

.rs h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.rs p {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--text);
}

#result-compatibility {
  white-space: pre-line;
}

/* Color variants */
.rs--core   { border-left-color: var(--accent-core);   }
.rs--love   { border-left-color: var(--accent-love);   }
.rs--night  { border-left-color: var(--accent-night);  }
.rs--work   { border-left-color: var(--accent-work);   }
.rs--compat { border-left-color: var(--accent-compat); }

.rs--core   h4 { color: var(--accent-core);   }
.rs--love   h4 { color: #e11d78;              }
.rs--night  h4 { color: var(--accent-night);  }
.rs--work   h4 { color: #0284c7;              }
.rs--compat h4 { color: #059669;              }

/* ── AI mix table ──────────────────────────────────────────── */
.ai-mix {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid rgba(124, 58, 237, 0.12);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(245, 243, 255, 0.72));
}

.ai-mix__header {
  margin-bottom: 12px;
}

.ai-mix__header h3 {
  margin: 0 0 4px;
  font-size: 1.14rem;
  line-height: 1.35;
}

.ai-mix__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.ai-mix__list {
  display: grid;
  gap: 10px;
}

.ai-mix__item {
  display: grid;
  gap: 7px;
  padding: 10px 11px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-mix__item--primary,
.ai-mix__item--secondary {
  border-color: color-mix(in srgb, var(--type-color) 36%, rgba(15, 23, 42, 0.06));
  background: color-mix(in srgb, var(--type-color) 8%, rgba(255, 255, 255, 0.9));
}

.ai-mix__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-mix__name-wrap {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ai-mix__name {
  color: color-mix(in srgb, var(--type-color) 78%, var(--text));
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}

.ai-mix__ratio {
  flex: 0 0 auto;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.ai-mix__badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: color-mix(in srgb, var(--type-color) 75%, #111827);
  font-size: 0.68rem;
  font-weight: 800;
}

.ai-mix__badge--primary {
  background: linear-gradient(135deg, #fde68a, #fca5a5);
  color: #7c2d12;
}

.ai-mix__track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.92);
}

.ai-mix__fill {
  width: var(--mix-percent);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--type-color) 82%, white), var(--type-color));
}

.ai-mix__comment {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: #4b5563;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.65;
}

/* ── Type library ──────────────────────────────────────────── */
.type-library {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.type-library__header {
  margin-bottom: 12px;
}

.type-library__header h3 {
  margin: 0 0 4px;
  font-size: 1.14rem;
  line-height: 1.35;
}

.type-library__header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.type-library__list {
  display: grid;
  gap: 10px;
}

.type-card {
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 6px 18px rgba(100, 80, 160, 0.08);
}

.type-card[open] {
  border-color: color-mix(in srgb, var(--type-color) 44%, rgba(0, 0, 0, 0.06));
}

.type-card__summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(116px, 38%) 1fr 24px;
  gap: 12px;
  align-items: center;
  min-height: 94px;
  padding: 10px;
  cursor: pointer;
  list-style: none;
}

.type-card__summary::-webkit-details-marker {
  display: none;
}

.type-card__summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--type-color) 70%, white);
  outline-offset: -3px;
}

.type-card__media {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 5 / 2;
  border-radius: 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--type-color) 18%, white), #fff);
}

.type-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.type-card__fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  color: color-mix(in srgb, var(--type-color) 72%, #111827);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.type-card__image + .type-card__fallback {
  display: none;
}

.type-card--no-image .type-card__fallback {
  display: grid;
}

.type-card__badges {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: calc(100% - 16px);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #312e81;
  font-size: 0.7rem;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.type-badge--self {
  color: #7c2d12;
}

.type-badge--best {
  color: #065f46;
}

.type-card__meta {
  min-width: 0;
}

.type-card__name {
  display: block;
  color: color-mix(in srgb, var(--type-color) 82%, var(--text));
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}

.type-card__title {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.5;
}

.type-card__affordance {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--type-color) 12%, white);
  color: color-mix(in srgb, var(--type-color) 70%, #111827);
  font-size: 1rem;
  font-weight: 800;
  transition: transform 0.16s ease;
}

.type-card[open] .type-card__affordance {
  transform: rotate(180deg);
}

.type-card__body {
  display: grid;
  gap: 8px;
  padding: 0 10px 12px;
}

.type-card__text-block {
  padding: 11px 12px;
  border-left: 3px solid color-mix(in srgb, var(--type-color) 48%, #d8b4fe);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.82);
}

.type-card__text-block h5 {
  margin: 0 0 4px;
  color: color-mix(in srgb, var(--type-color) 75%, #4c1d95);
  font-size: 0.76rem;
  line-height: 1.4;
}

.type-card__text-block p {
  margin: 0;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.7;
}

@media (max-width: 420px) {
  .type-card__summary {
    grid-template-columns: 1fr 26px;
    gap: 9px;
  }

  .type-card__media {
    grid-column: 1 / -1;
    aspect-ratio: 2.5 / 1;
  }
}

/* ── Restart button ────────────────────────────────────────── */
.restart-btn {
  margin-top: 20px;
  width: 100%;
  border: none;
  padding: 14px;
  border-radius: var(--radius-btn);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

.restart-btn:hover {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.3);
}

.restart-btn:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* ── Bug / danger badges ───────────────────────────────────── */
.result-bug {
  margin: 8px 0 0;
  color: #9a3412;
  font-size: 0.88rem;
  line-height: 1.6;
}

.result-bug::before {
  content: "バグ: ";
  font-weight: 700;
}

.danger-badge {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 0.83rem;
  font-weight: 600;
}

/* ── Disclaimer ────────────────────────────────────────────── */
.disclaimer {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.85);
  border: 1px solid #e9e9ef;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.75;
}

.disclaimer--result {
  margin-top: 14px;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  max-width: 720px;
  margin: 16px auto 0;
  padding: 0 16px 32px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.75;
}

.site-footer h2 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.site-footer p { margin: 4px 0; }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Hero banner ─────────────────────────────────────────────── */
.hero-banner {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  border-radius: 24px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.72) 42%, rgba(255, 255, 255, 0.18) 100%),
    url("../assets/banners/hero-banner.png") center / cover no-repeat,
    linear-gradient(135deg, #eef2ff 0%, #fdf2f8 100%);
  box-shadow: var(--shadow-card);
  isolation: isolate;
}

.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% 22%, rgba(129, 140, 248, 0.22), transparent 28%),
    radial-gradient(circle at 68% 58%, rgba(244, 114, 182, 0.16), transparent 26%),
    radial-gradient(circle at 92% 68%, rgba(56, 189, 248, 0.16), transparent 24%);
  z-index: -1;
  pointer-events: none;
}

.hero-banner__copy {
  display: grid;
  align-content: center;
  min-height: 220px;
  padding: 26px 20px;
  text-align: left;
}

.hero-banner__copy h1 {
  font-size: clamp(2rem, 9vw, 3.7rem);
  line-height: 1;
  margin-bottom: 10px;
}

.hero-banner__copy p {
  color: #3f3b57;
  font-size: clamp(0.95rem, 3.4vw, 1.2rem);
  font-weight: 700;
}

@media (min-width: 640px) {
  .app__header { padding-top: 28px; }

  .hero-banner,
  .hero-banner__copy {
    min-height: 300px;
  }

  .hero-banner__copy {
    padding: 42px;
  }
}
