:root {
  --white: #fffefd;
  --mist: #f4effb;
  --lavender: #d8c9eb;
  --violet: #4c2369;
  --deep: #27153e;
  --ink: #32233f;
  --muted: #74687c;
  --silver: #d9d6df;
  --error: #a04456;
  --focus: #8561a8;
  --radius: 8px;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", YuMincho, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.95), transparent 30rem),
    linear-gradient(180deg, #fbf8ff 0%, #fffefd 48%, #f4effb 100%);
  font-family: var(--sans);
  line-height: 1.85;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(133,97,168,.45); outline-offset: 3px; }

.hero {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  color: var(--white);
  text-align: center;
  background-image:
    linear-gradient(180deg, rgba(47,27,70,.36), rgba(40,20,62,.72)),
    radial-gradient(circle at 50% 26%, rgba(255,255,255,.42), transparent 8rem),
    url("./assets/hero-rei.webp");
  background-size: cover;
  background-position: center;
}
.hero__inner, .section, .final-cta, .screen, .closed {
  width: min(100%, 720px);
  margin-inline: auto;
}
.eyebrow, .section__kicker {
  margin: 0 0 10px;
  color: #80649a;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.hero .eyebrow { color: rgba(255,255,255,.86); }
h1, h2, h3 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.45;
}
.screen h1,
.screen p,
.closed h1,
.closed p,
.mirror-loading p {
  white-space: pre-line;
}
h1 { font-size: clamp(2.25rem, 12vw, 4rem); text-shadow: 0 2px 18px rgba(30,12,48,.35); }
h1 span { font-size: .78em; }
h2 { color: var(--violet); font-size: clamp(1.65rem, 8vw, 2.5rem); }
h3 { color: var(--violet); font-size: 1.3rem; }
.panel h1 {
  font-size: clamp(1.62rem, 7.2vw, 2.18rem);
  line-height: 1.55;
  text-shadow: none;
}
.panel--question h1 {
  font-size: clamp(1.22rem, 5.1vw, 1.62rem);
  line-height: 1.68;
}
p { margin: 14px 0 0; }
.hero h1,
.hero__lead,
.hero__meta span,
.section h2,
.section > p,
.check-list li,
.steps li em,
details summary,
details p,
.final-cta h2,
.note {
  white-space: pre-line;
}
.steps li em {
  font-style: normal;
}
.hero [contenteditable="true"],
.section [contenteditable="true"],
.final-cta [contenteditable="true"],
.panel [contenteditable="true"],
.result-screen [contenteditable="true"],
.mirror-loading [contenteditable="true"] {
  white-space: pre-wrap;
  border-radius: 6px;
}
[contenteditable="true"]:focus {
  outline: 3px solid rgba(133,97,168,.5);
  outline-offset: 3px;
}
.edit-toolbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(92,62,119,.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,.95);
  padding: 12px;
  box-shadow: 0 14px 36px rgba(50,35,63,.18);
}
.edit-toolbar p {
  margin: 0;
  color: var(--violet);
  font-size: .86rem;
  line-height: 1.55;
}
.edit-toolbar__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.edit-toolbar__results {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.edit-toolbar .button {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  font-size: .9rem;
}
.hero__lead {
  width: min(100%, 20rem);
  margin: 22px auto 0;
  font-family: var(--serif);
  font-size: clamp(.96rem, 4.1vw, 1.14rem);
  font-weight: 400;
  line-height: 1.9;
  letter-spacing: .02em;
  text-shadow: 0 2px 12px rgba(28, 13, 43, .42);
}
.hero__meta {
  display: grid;
  gap: 8px;
  margin: 24px auto 14px;
  color: #fff;
  font-weight: 700;
}
.countdown {
  min-height: 34px;
  margin: 16px auto;
  color: var(--violet);
  font-weight: 700;
}
.hero .countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 0;
  margin: 28px auto 14px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 999px;
  background: rgba(42, 23, 65, .28);
  padding: 7px 13px;
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.45;
  text-shadow: 0 1px 8px rgba(27,12,43,.35);
  backdrop-filter: blur(2px);
}
.button {
  min-height: 48px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 13px 18px;
  text-decoration: none;
  font-weight: 700;
  line-height: 1.45;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:active { transform: translateY(1px); }
.button--primary {
  background: linear-gradient(135deg, #6b4388, #3e225f);
  color: #fff;
  box-shadow: 0 10px 24px rgba(58,31,83,.24);
}
.button--secondary {
  background: rgba(255,255,255,.76);
  border-color: rgba(92,62,119,.24);
  color: var(--violet);
}
.button--ghost {
  background: transparent;
  border-color: rgba(92,62,119,.22);
  color: var(--violet);
}
.button[disabled] { opacity: .55; cursor: not-allowed; }
.note { color: inherit; font-size: .92rem; opacity: .84; }
.hero .note {
  margin-top: 12px;
  font-size: .8rem;
  line-height: 1.7;
  opacity: .78;
  text-shadow: 0 1px 8px rgba(27,12,43,.28);
}
.section {
  padding: 58px 20px;
}
.section--tint {
  width: 100%;
  max-width: none;
  padding-inline: max(20px, calc((100vw - 720px) / 2 + 20px));
  background: rgba(244,239,251,.72);
}
.check-list, .steps {
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.check-list li, .steps li {
  position: relative;
  margin-top: 12px;
  padding-left: 30px;
}
.check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--violet);
  font-weight: 700;
}
.steps li span {
  position: absolute;
  left: 0;
  top: .25em;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--violet);
  color: #fff;
  font-size: .76rem;
  line-height: 1;
}
details {
  margin-top: 12px;
  border: 1px solid rgba(92,62,119,.18);
  border-radius: var(--radius);
  background: rgba(255,255,255,.72);
  padding: 12px 14px;
}
summary { color: var(--violet); font-weight: 700; cursor: pointer; }
.final-cta {
  padding: 66px 20px calc(72px + env(safe-area-inset-bottom));
  text-align: center;
}

.experience-shell {
  min-height: 100svh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
}
.is-editing-experience .experience-shell {
  padding-bottom: calc(150px + env(safe-area-inset-bottom));
}
.is-editing-experience .screen {
  min-height: calc(100svh - 170px);
}
.screen {
  min-height: calc(100svh - 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}
.panel {
  border: 1px solid rgba(92,62,119,.16);
  border-radius: var(--radius);
  background: rgba(255,255,255,.82);
  padding: 22px 18px;
  box-shadow: 0 18px 45px rgba(65,42,88,.08);
}
.field { margin-top: 18px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--violet);
  font-weight: 700;
}
input, textarea {
  width: 100%;
  border: 1px solid rgba(92,62,119,.26);
  border-radius: var(--radius);
  background: rgba(255,255,255,.92);
  padding: 12px 13px;
  color: var(--ink);
}
textarea { min-height: 132px; resize: vertical; }
.is-invalid {
  border-color: var(--error) !important;
  background: #fff9fa;
}
.error {
  min-height: 1.5em;
  margin-top: 6px;
  color: var(--error);
  font-size: .9rem;
}
.char-count {
  margin-top: 4px;
  text-align: right;
  color: var(--muted);
  font-size: .85rem;
}
.actions {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}
.progress-text { color: var(--muted); font-weight: 700; }
.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(92,62,119,.14);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #8d6aad, #4c2369);
}
.choice-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
.choice {
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(92,62,119,.22);
  border-radius: var(--radius);
  background: rgba(255,255,255,.78);
  padding: 13px 42px 13px 14px;
  color: var(--ink);
  text-align: left;
  position: relative;
}
.choice[aria-pressed="true"] {
  border-color: var(--violet);
  background: #f4effb;
}
.choice[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--violet);
  font-weight: 800;
}
.choice [contenteditable="true"] {
  display: block;
  white-space: pre-wrap;
}
.mirror-loading {
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,.36), transparent 7rem),
    linear-gradient(160deg, #251633 0%, #4b2a67 54%, #191128 100%);
}
.mirror-loading p {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.28rem, 6vw, 1.9rem);
  font-weight: 500;
  line-height: 1.85;
  letter-spacing: .04em;
  text-shadow: 0 2px 18px rgba(255,255,255,.18);
}
.moon {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: radial-gradient(circle, rgba(255,255,255,.78), rgba(216,201,235,.26) 48%, transparent 70%);
  box-shadow: 0 0 55px rgba(255,255,255,.25);
  animation: breathe 2.5s ease-in-out infinite;
}
.result-screen {
  width: calc(100% + 32px);
  max-width: none;
  min-height: 100svh;
  margin: -18px -16px max(-22px, calc(-1 * env(safe-area-inset-bottom)));
  padding: max(30px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  color: #fdfbff;
  background-image:
    linear-gradient(180deg, rgba(24,17,43,.84), rgba(49,27,72,.88)),
    radial-gradient(circle at 50% 10%, rgba(255,255,255,.22), transparent 13rem),
    url("./assets/result-bg.webp");
  background-size: cover;
  background-position: center;
}
.result-inner {
  width: min(100%, 720px);
  margin-inline: auto;
}
.result-screen h2, .result-screen h3, .result-screen .section__kicker { color: #fff; }
.result-block {
  border-top: 1px solid rgba(255,255,255,.18);
  padding-top: 18px;
  margin-top: 18px;
}
.summary {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255,255,255,.08);
}
.result-screen .button--secondary { background: rgba(255,255,255,.95); }
.copy-status { min-height: 1.5em; margin-top: 8px; color: #fff; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(38,25,54,.34);
}
.modal {
  width: min(100%, 420px);
  border-radius: var(--radius);
  background: #fffefd;
  padding: 22px 18px;
  box-shadow: 0 22px 60px rgba(38,25,54,.22);
}
.closed {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
  text-align: center;
  color: var(--violet);
  background:
    radial-gradient(circle at 50% 42%, rgba(255,255,255,.95), rgba(216,201,235,.4) 0 5rem, transparent 9rem),
    linear-gradient(180deg, #fffefd 0%, #f4effb 100%);
}

@keyframes breathe {
  0%, 100% { transform: scale(.98); opacity: .78; }
  50% { transform: scale(1.03); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 640px) {
  .button { width: auto; min-width: 280px; }
  .actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .actions .button--primary:first-child:last-child { grid-column: 1 / -1; }
}
