:root {
  --bg: #fffaf3;
  --card: #fffdf9;
  --ink: #4d3d35;
  --muted: #8a746b;
  --soft: #f6ece3;
  --pink: #f2bfc8;
  --pink-strong: #df8fa0;
  --sage: #b7d3bd;
  --sage-strong: #7ead8b;
  --gold: #d8b56f;
  --cream: #fff6df;
  --shadow: 0 18px 48px rgba(104, 73, 56, .12);
  --line: rgba(108, 79, 62, .14);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", "YuGothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(242, 191, 200, .30), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(183, 211, 189, .32), transparent 31%),
    linear-gradient(180deg, #fffaf3 0%, #fff8ef 45%, #fffaf5 100%);
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 14px 16px calc(24px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 10px 0 12px;
  background: linear-gradient(180deg, rgba(255,250,243,.96), rgba(255,250,243,.76));
  backdrop-filter: blur(16px);
}

.brand-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .13em;
  font-size: 13px;
  color: rgba(77, 61, 53, .78);
}
.paw { color: var(--gold); font-size: 14px; }

.ghost-btn {
  border: 0;
  background: rgba(255,255,255,.62);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.screen { padding: 8px 0 28px; }
.card {
  border-radius: var(--radius-xl);
  background: rgba(255, 253, 249, .86);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.soft-card { overflow: hidden; }

.hero {
  position: relative;
  padding: 34px 24px 26px;
  text-align: center;
}
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}
.hero::before {
  width: 130px; height: 130px;
  background: rgba(242,191,200,.28);
  left: -34px; top: 20px;
}
.hero::after {
  width: 150px; height: 150px;
  background: rgba(183,211,189,.28);
  right: -42px; bottom: 52px;
}
.kicker {
  position: relative;
  z-index: 1;
  margin: 0 0 12px;
  color: var(--pink-strong);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 11vw, 64px);
  line-height: .94;
  letter-spacing: .045em;
  color: #4e3c32;
}
.lead {
  position: relative;
  z-index: 1;
  margin: 16px auto 18px;
  max-width: 340px;
  color: var(--muted);
  line-height: 1.85;
  font-size: 15px;
}
.micro-copy {
  position: relative;
  z-index: 1;
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}
.hero-animals {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  min-height: 142px;
  margin: 8px 0 0;
}
.hero-animals .animal-badge { width: 128px; max-width: 32%; }
.hero-animals .animal-badge:nth-child(2) { transform: translateY(-10px); }

.primary-btn,
.secondary-btn {
  position: relative;
  z-index: 1;
  width: 100%;
  border: 0;
  border-radius: 999px;
  min-height: 54px;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
}
.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--pink-strong), #e7a7b3);
  box-shadow: 0 14px 26px rgba(223,143,160,.25);
}
.secondary-btn {
  margin-top: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.58);
  box-shadow: inset 0 0 0 1px var(--line);
}
.secondary-btn[hidden] { display: none; }

.mini-panels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}
.mini-panels article {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.58);
  padding: 18px;
}
.mini-panels span {
  display: inline-block;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  margin-bottom: 6px;
}
.mini-panels strong { display: block; font-size: 15px; margin-bottom: 4px; }
.mini-panels p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

.progress-wrap {
  margin: 6px 0 18px;
}
.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.progress-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink-strong), var(--sage-strong));
  transition: width .28s ease;
}

.question-card {
  padding: 24px;
}
.question-card h2 {
  margin: 0 0 22px;
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1.45;
  letter-spacing: .02em;
}
.choice-list {
  display: grid;
  gap: 14px;
}
.choice-btn {
  width: 100%;
  border: 0;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.72);
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 22px rgba(111,84,72,.07);
  padding: 18px 18px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}
.choice-btn:active { transform: translateY(1px); }
.choice-mark {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-family: Georgia, serif;
}
.choice-btn.a .choice-mark { background: var(--pink-strong); }
.choice-btn.b .choice-mark { background: var(--sage-strong); }
.choice-text { font-weight: 800; line-height: 1.55; }

.quiz-footer {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.quiz-footer button { flex: 1; }

.result-card {
  padding: 26px 20px 22px;
  text-align: center;
}
.result-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.result-title {
  margin: 0;
  font-size: clamp(30px, 8.5vw, 44px);
  line-height: 1.05;
  color: #4e3c32;
  letter-spacing: .02em;
}
.result-subtitle {
  display: inline-flex;
  margin: 12px auto 18px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--pink-strong);
  background: rgba(242,191,200,.18);
  font-weight: 800;
  font-size: 13px;
}
.animal-stage {
  margin: 6px auto 16px;
  max-width: 210px;
}
.animal-stage .animal-badge { width: 100%; }
.result-desc {
  margin: 0 auto 18px;
  max-width: 380px;
  line-height: 1.85;
  color: var(--muted);
  text-align: left;
}

.meter-list { display: grid; gap: 10px; margin: 18px 0; }
.meter-row {
  display: grid;
  grid-template-columns: 86px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
}
.meter-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(232, 219, 205, .8);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--pink-strong), var(--sage-strong));
}

.info-grid { display: grid; gap: 10px; margin-top: 16px; }
.info-box {
  text-align: left;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 14px 16px;
}
.info-box h3 { margin: 0 0 5px; font-size: 13px; color: var(--pink-strong); }
.info-box p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.7; }

.compat-card {
  margin-top: 14px;
  padding: 18px;
  text-align: left;
}
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
}
.section-title h2,
.section-title h3 { margin: 0; font-size: 18px; }
.section-title span { color: var(--muted); font-size: 12px; }
.compat-list { display: grid; gap: 9px; }
.compat-item {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.62);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 10px 12px;
}
.compat-mini { width: 38px; height: 38px; }
.compat-item strong { display: block; font-size: 14px; }
.compat-item small { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.percent {
  font-family: Georgia, serif;
  font-weight: 900;
  font-size: 20px;
  color: var(--pink-strong);
}


.friend-compat {
  margin: 14px 0 4px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255,255,255,.78), rgba(248,220,226,.28));
  box-shadow: inset 0 0 0 1px var(--line);
}
.friend-compat-head h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
}
.friend-compat-head p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
.friend-select-label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.friend-select {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 42px 12px 16px;
  color: var(--ink);
  font-weight: 900;
  background:
    linear-gradient(45deg, transparent 50%, var(--pink-strong) 50%) right 18px center / 8px 8px no-repeat,
    linear-gradient(135deg, var(--pink-strong) 50%, transparent 50%) right 12px center / 8px 8px no-repeat,
    rgba(255,255,255,.88);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 18px rgba(111,84,72,.06);
}
.friend-result { margin-top: 10px; }
.friend-result-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255,255,255,.76);
  box-shadow: inset 0 0 0 1px var(--line);
}
.friend-result-visual { width: 48px; height: 48px; }
.friend-result-card strong { display: block; font-size: 14px; }
.friend-result-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.friend-percent {
  font-family: Georgia, serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--pink-strong);
}

.action-stack { display: grid; gap: 10px; margin-top: 14px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.share-card-preview {
  position: relative;
  margin: 0 auto 16px;
  width: min(100%, 360px);
  aspect-ratio: 4 / 5;
  border-radius: 30px;
  background: linear-gradient(180deg, #fffdf9, #fff6f1);
  box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  overflow: hidden;
  padding: 22px;
  text-align: center;
}
.share-card-preview::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  border: 1px solid rgba(216,181,111,.35);
  pointer-events: none;
}
.share-card-preview .share-title {
  margin: 0;
  font-family: Georgia, serif;
  letter-spacing: .12em;
  color: #4e3c32;
  font-size: 18px;
}
.share-card-preview .share-animal-name {
  margin: 10px 0 4px;
  font-weight: 900;
  font-size: 28px;
}
.share-card-preview .share-subtitle { color: var(--muted); font-weight: 700; font-size: 13px; }
.share-card-preview .animal-badge { width: 58%; margin: 16px auto 8px; }
.share-card-preview .best-mini { margin-top: 8px; font-size: 12px; line-height: 1.8; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 100;
  background: rgba(77,61,53,.92);
  color: white;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.animal-badge svg { display: block; width: 100%; height: auto; }

@media (min-width: 620px) {
  .app-shell { padding-left: 0; padding-right: 0; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .animal-badge { animation: floaty 4.8s ease-in-out infinite; }
  .hero-animals .animal-badge:nth-child(2) { animation-delay: .45s; }
  .hero-animals .animal-badge:nth-child(3) { animation-delay: .9s; }
  @keyframes floaty {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
  }
}

/* v1.4 result share fallback panel */
.share-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(77, 61, 53, .28);
  backdrop-filter: blur(10px);
}
.share-panel {
  position: relative;
  width: min(520px, 100%);
  border: 1px solid rgba(216, 181, 111, .42);
  border-radius: 28px;
  background: rgba(255, 250, 243, .98);
  box-shadow: 0 22px 70px rgba(77, 61, 53, .18);
  padding: 26px;
  color: var(--text);
}
.share-panel h2 {
  margin: 4px 0 10px;
  font-size: 28px;
  letter-spacing: .03em;
}
.share-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.7;
}
.share-panel-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(77, 61, 53, .12);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}
.share-url-label {
  display: block;
  margin: 14px 0 8px;
  font-weight: 800;
  font-size: 13px;
  color: var(--muted);
}
.share-url-box {
  box-sizing: border-box;
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid rgba(77, 61, 53, .14);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  padding: 14px;
  font: 600 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* v1.6 clearer question count */
.question-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 12px;
  padding: 16px 18px;
}
.question-status-main {
  display: grid;
  gap: 4px;
}
.question-status-label {
  color: var(--pink-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}
.question-status-main strong {
  color: var(--ink);
  font-size: clamp(22px, 6vw, 30px);
  line-height: 1.05;
  letter-spacing: .02em;
}
.question-status-sub {
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(183, 211, 189, .28);
  color: #66856d;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 900;
}
.question-card-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
}
@media (max-width: 380px) {
  .question-status { align-items: flex-start; flex-direction: column; }
}

/* v1.7 additions: animal list + deeper result */
.deep-result {
  margin-top: 20px;
  display: grid;
  gap: 10px;
  text-align: left;
}
.section-title.compact {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(108, 79, 62, .18);
}
.detail-box {
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.66);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 15px 16px;
}
.detail-box h3 {
  margin: 0 0 7px;
  font-size: 14px;
  color: var(--pink-strong);
  letter-spacing: .03em;
}
.detail-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}
.animals-page {
  padding: 28px 18px 22px;
  text-align: center;
}
.animals-title {
  margin: 0;
  font-size: clamp(31px, 9vw, 46px);
  line-height: 1.08;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: .05em;
  color: #4e3c32;
}
.animals-lead {
  margin: 14px auto 20px;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.85;
  font-size: 14px;
}
.animals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  text-align: left;
}
.animal-type-card {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 13px;
  align-items: center;
  border-radius: 24px;
  background: rgba(255,255,255,.68);
  box-shadow: inset 0 0 0 1px var(--line), 0 10px 22px rgba(111,84,72,.06);
  padding: 12px;
}
.animal-type-visual {
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
}
.animal-type-body { min-width: 0; }
.animal-type-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.animal-type-head strong {
  font-size: 15px;
  color: var(--ink);
}
.animal-type-body p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.animal-type-body small {
  display: inline-flex;
  margin-bottom: 9px;
  color: var(--sage-strong);
  font-weight: 800;
  font-size: 11px;
  line-height: 1.4;
}
.tiny-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(242,191,200,.22);
  color: var(--pink-strong);
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(223,143,160,.22);
  cursor: pointer;
}
@media (min-width: 460px) {
  .animals-grid { grid-template-columns: 1fr 1fr; }
  .animal-type-card { grid-template-columns: 72px 1fr; }
  .animal-type-visual { width: 72px; height: 72px; }
}


/* v1.8 shared result CTA */
.shared-result-cta {
  display: grid;
  gap: 12px;
  margin: 4px auto 18px;
  max-width: 420px;
  border-radius: 24px;
  padding: 16px;
  text-align: left;
  background: linear-gradient(135deg, rgba(242,191,200,.28), rgba(198,216,187,.22));
  box-shadow: inset 0 0 0 1px rgba(216,181,111,.22);
}
.shared-result-cta strong {
  display: block;
  color: #4e3c32;
  font-size: 15px;
  margin-bottom: 4px;
}
.shared-result-cta p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.shared-result-cta .primary-btn {
  min-height: 48px;
}
