:root {
  --ink: #2a1720;
  --ink-sub: #5e4552;
  --pink: #c81e63;
  --pink-dark: #8f1145;
  --pink-mid: #ef6fa0;
  --pink-line: #f5bcd1;
  --pink-soft: #fff0f5;
  --cream: #fff7f1;
  --white: #ffffff;
  --radius: 26px;
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-weight: 500;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(circle, #ffd3e3 2.4px, transparent 2.9px),
    radial-gradient(circle, #ffe3d3 2.4px, transparent 2.9px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

.app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom));
}

.screen { display: none; flex-direction: column; gap: 18px; }
.screen.is-active { display: flex; animation: fadeIn .28s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 #ffd3e2, 0 12px 28px rgba(200, 30, 99, .10);
}

/* ---------- タイトル ---------- */
.title-card {
  position: relative;
  padding: 30px 22px 26px;
  text-align: center;
  overflow: hidden;
}
.title-card::before, .title-card::after {
  content: "♡";
  position: absolute;
  color: #ffc2d7;
  font-weight: 800;
  line-height: 1;
}
.title-card::before { top: 16px; left: 18px; font-size: 34px; transform: rotate(-14deg); }
.title-card::after { top: 54px; right: 16px; font-size: 40px; transform: rotate(12deg); }

.pill {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 16px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .04em;
}
.title {
  margin: 0;
  color: var(--pink);
  font-weight: 800;
  font-size: clamp(30px, 9.4vw, 42px);
  line-height: 1.22;
  letter-spacing: .02em;
}
.title span { display: block; }
.title span:first-child { font-size: .62em; }
.lead {
  margin: 16px 0 18px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legend li {
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--pink-line);
  background: var(--pink-soft);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
}

.start-area { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.field-label { font-size: 15px; font-weight: 800; color: var(--pink); padding-left: 4px; }
.optional {
  display: inline-block;
  margin-left: 4px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--pink-soft);
  border: 1px solid var(--pink-line);
  font-size: 12px;
  color: var(--ink-sub);
  vertical-align: 1px;
}
.text-input {
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 2px solid var(--pink-line);
  border-radius: 18px;
  background: var(--white);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.text-input::placeholder { color: #a08592; }
.text-input:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 4px rgba(200, 30, 99, .15); }

.hint { margin: 0; font-size: 13px; color: var(--ink-sub); padding-left: 4px; }
.hint.center { text-align: center; padding-left: 0; }
.start-area .btn { margin-top: 8px; }
.privacy { margin: 4px 0 0; font-size: 12px; color: var(--ink-sub); text-align: center; }

/* ---------- ボタン ---------- */
.btn {
  min-height: 56px;
  padding: 12px 20px;
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .02em;
  transition: transform .08s ease, box-shadow .08s ease, background-color .15s ease;
}
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-dark); }
.btn-primary:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--pink-dark); }
.btn-primary:disabled { background: #f1cfdc; color: #7d5566; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--pink); border: 2px solid var(--pink); box-shadow: 0 4px 0 #f5bcd1; }
.btn-ghost:active { transform: translateY(3px); box-shadow: 0 1px 0 #f5bcd1; }
.btn-x { background: #1c1418; color: #fff; box-shadow: 0 4px 0 #000; }
.btn-x:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.btn-x:disabled { background: #b9aab1; box-shadow: none; }
.btn:focus-visible, .choice:focus-visible { outline: 3px solid #ff9cc2; outline-offset: 3px; }

/* ---------- 質問 ---------- */
.progress { display: flex; align-items: center; gap: 12px; }
.progress-text {
  flex: none;
  min-width: 64px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  text-align: center;
}
.progress-bar { flex: 1; height: 12px; border-radius: 999px; background: #ffe0eb; overflow: hidden; }
.progress-fill { height: 100%; width: 10%; border-radius: 999px; background: var(--pink-mid); transition: width .3s ease; }

.q-block { position: relative; }
.q-card { padding: 22px 20px 48px; }
.q-card.pop { animation: pop .3s ease; }
@keyframes pop { from { opacity: .3; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.q-num {
  display: inline-block;
  margin: 0 0 4px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--pink-soft);
  border: 2px solid var(--pink-line);
  color: var(--pink);
  font-weight: 800;
  font-size: 14px;
}
.q-heading { margin: 4px 0 8px; font-size: 17px; font-weight: 800; color: var(--pink); }
.q-text { margin: 0; min-height: 3.2em; font-size: 20px; font-weight: 700; line-height: 1.6; color: var(--ink); word-break: normal; line-break: strict; }

.memo { position: relative; z-index: 2; margin: -28px 14px 0; }
.memo-input {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border: 2px dashed var(--pink-mid);
  border-radius: 16px;
  background: #fff5f9;
  color: var(--pink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(200, 30, 99, .10);
}
.memo-input::placeholder { color: var(--pink); opacity: 1; }
.memo-input:focus { outline: none; border-style: solid; border-color: var(--pink); background: #fff; box-shadow: 0 0 0 4px rgba(200, 30, 99, .15); }
.memo-input:focus::placeholder { color: #c99aad; }
.memo-count { display: block; margin-top: 4px; text-align: right; font-size: 12px; color: var(--ink-sub); visibility: hidden; }
.memo.is-active .memo-count { visibility: visible; }

.choices { display: flex; flex-direction: column; gap: 12px; }
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding: 10px 16px 10px 20px;
  border: 2px solid var(--pink-line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: 0 4px 0 #f8d3e0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-align: left;
  transition: background-color .15s ease, color .15s ease, transform .08s ease;
}
.choice:active { transform: translateY(2px); }
.choice .mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--pink-line);
  background: var(--pink-soft);
}
.choice .mark svg { width: 24px; height: 24px; fill: #fff; opacity: 0; transform: scale(.3); transition: transform .2s cubic-bezier(.3, 1.6, .5, 1), opacity .15s; }
.choice.is-selected { background: var(--pink); border-color: var(--pink); color: #fff; box-shadow: 0 4px 0 var(--pink-dark); }
.choice.is-selected .mark { border-color: transparent; background: transparent; }
.choice.is-selected .mark svg { opacity: 1; transform: scale(1.15); }

.q-nav { display: grid; grid-template-columns: 1fr 1.6fr; gap: 12px; margin-top: 4px; }
#next-hint { margin-top: -6px; }
#next-hint.is-hidden { visibility: hidden; }

/* ---------- 結果 ---------- */
.result-heading { margin: 4px 0 0; text-align: center; color: var(--pink); font-size: 28px; font-weight: 800; }
.result-image-wrap { padding: 10px; min-height: 240px; display: grid; place-items: center; }
.result-loading { margin: 0; color: var(--pink); font-weight: 800; }
.result-img { display: block; width: 100%; height: auto; border-radius: 16px; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-actions #btn-edit { grid-column: 1 / -1; }.note { padding: 18px 20px; border: 2px solid var(--pink-line); font-size: 14px; }
.note p { margin: 0 0 10px; }
.note-title { color: var(--pink); font-weight: 800; font-size: 16px; }
.note-link { color: var(--pink); font-weight: 800; }

/* ---------- トースト ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
