:root {
  --paper: #fbf3ee;
  --card: #ffffff;
  --ink: #33212a;
  --muted: #6b5560;
  --soft: #7a6870;
  --rose: #e2685a;
  --rose-deep: #b8483c;
  --peach: #f4a89a;
  --sage: #7c9885;
  --lilac: #a79bd6;
  --line: #ecdcd2;
  --blush: #fbe3da;
  --display: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@font-face {
  font-family: "Fredoka";
  src: url("/fredoka-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 0; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--ink); text-decoration: none; border-radius: 10px; }
.mark { display: block; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 1.05rem; }

.wrap { max-width: 640px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.wrap:focus, [tabindex="-1"]:focus { outline: none; }

h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); margin: 0.2rem 0 0.4rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.75rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.5rem; color: var(--rose); }
p { margin: 0 0 0.75rem; }
.lede { color: var(--muted); font-size: 1.05rem; }
.hint { color: var(--soft); font-size: 0.88rem; }
textarea { font: inherit; resize: vertical; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 14px 28px -22px rgba(51, 33, 42, 0.45);
}

.tilt-l { transform: rotate(-0.6deg); }
.tilt-r { transform: rotate(0.6deg); }

fieldset { border: 1px dashed var(--line); border-radius: 14px; padding: 1rem; margin: 0 0 1rem; }
legend { font-family: var(--display); font-weight: 600; color: var(--rose); padding: 0 0.4rem; }

.field { margin-bottom: 0.9rem; }
.field label { display: block; font-size: 0.92rem; margin-bottom: 0.3rem; }
.qa { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin-bottom: 0.75rem; }
@media (min-width: 560px) { .qa { grid-template-columns: 1.4fr 1fr; } }

input[type="text"], input[type="email"], textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
}

input:focus-visible, textarea:focus-visible { outline: 3px solid var(--rose); outline-offset: 1px; }

.prefix { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.prefix span { padding-left: 0.9rem; color: var(--soft); white-space: nowrap; }
.prefix input { border: none; padding-left: 0.15rem; }
.prefix:focus-within { outline: 3px solid var(--rose); outline-offset: 1px; }
.prefix input:focus-visible { outline: none; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--rose);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font: 700 1rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--rose-deep);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
button:active, .button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--rose-deep); }
button:focus-visible, .button:focus-visible, a:focus-visible, .brand:focus-visible { outline: 3px solid var(--sage); outline-offset: 3px; }
button:disabled { opacity: 0.55; cursor: progress; }
button.quiet, .button.quiet { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: 0 4px 0 var(--line); }
button.link { background: none; color: var(--rose-deep); box-shadow: none; padding: 0.3rem 0.2rem; text-decoration: underline; font-weight: 600; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }

.msg { margin: 0.75rem 0; padding: 0.6rem 0.9rem; border-radius: 10px; font-size: 0.92rem; }
.msg.ok { background: #e6f0e2; color: #2b4a24; }
.msg.err { background: #fbe0d6; color: #8a3418; }
.msg.note { background: #eef1e6; color: #3e4f42; }

.working { display: flex; align-items: center; gap: 0.7rem; color: var(--muted); font-weight: 600; }
.pulse {
  position: relative;
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--rose);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--rose);
  animation: ring 1.4s ease-out infinite;
}
@keyframes ring { from { transform: scale(1); opacity: 0.8; } to { transform: scale(2.6); opacity: 0; } }

.waiting { text-align: center; padding: 2rem 1.25rem; }
.waiting .pulse { width: 28px; height: 28px; margin: 0.5rem auto 1.25rem; }
.waiting .elapsed { font-variant-numeric: tabular-nums; color: var(--soft); font-size: 0.9rem; }

.avatar { display: block; width: 112px; height: 112px; margin: 0 auto 0.5rem; }
.bob { animation: bob 3.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.hello { text-align: center; }

.questions { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.questions li { background: var(--blush); border-radius: 12px; padding: 0.55rem 0.8rem; margin-bottom: 0.45rem; }

.level-pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rose);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.carousel {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0.25rem 0.25rem 0.75rem;
  margin: 0 -0.25rem;
  -webkit-overflow-scrolling: touch;
}
.carousel:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
.slide {
  flex: 0 0 86%;
  scroll-snap-align: center;
  border-radius: 16px;
  overflow: hidden;
  background: var(--blush);
  aspect-ratio: 4 / 5;
}
.slide img, .slide video { width: 100%; height: 100%; object-fit: contain; display: block; }
.note { background: #fffaf3; border-left: 4px solid var(--peach); border-radius: 10px; padding: 0.75rem 1rem; white-space: pre-wrap; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: space-between; align-items: center; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: none; }
.given { color: var(--muted); font-size: 0.9rem; }

.uploads { list-style: none; padding: 0; margin: 0.5rem 0 0; font-size: 0.9rem; }
.uploads li { padding: 0.2rem 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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