/* ---------- Hero ---------- */
.hero { padding: clamp(130px, 14vw, 170px) 0 clamp(60px, 8vw, 100px); }
.hero__sub { max-width: 30ch; margin: 22px auto 30px; }
.hero__ctas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- Quiz panel (the "search opens a new world" moment) ---------- */
.play { padding-top: 40px; }
.play h2 { margin-bottom: clamp(36px, 5vw, 56px); }
.panel {
  position: relative;
  border-radius: var(--r-lg);
  background: var(--sage);
  overflow: hidden;
}
.play .panel {
  display: grid;
  grid-template-columns: 1fr minmax(0, 560px) 1fr;
  align-items: center;
  gap: clamp(16px, 2.5vw, 36px);
  padding: clamp(60px, 7vw, 96px) clamp(16px, 2.5vw, 36px);
  transform: scale(var(--ps, 1));
  transform-origin: 50% 0;
}
.tile { border-radius: 6px; display: grid; align-content: end; padding: 16px; min-height: 0; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.35); transform: translateY(var(--ty, 0)); }
.tile--sand { grid-area: 1 / 1; background: var(--sand); aspect-ratio: 3 / 4; align-self: start; align-content: space-between; }
.tile--ink { grid-area: 1 / 3; background: #151517; aspect-ratio: 4 / 5; align-self: end; color: #fff; align-content: space-between; }
.play .quiz { grid-area: 1 / 2; }
.tile__math { font-size: clamp(26px, 3vw, 44px); letter-spacing: -0.05em; font-weight: 350; color: #3b2f1d; line-height: 1.05; }
.tile__math span { color: var(--clay); }
.tile__graph { width: 100%; }
.tile__cap { font-size: 13px; opacity: 0.7; }
.play__note { max-width: 40ch; margin: 36px auto 0; }

/* ---------- Quiz card ---------- */
.quiz {
  position: relative;
  padding: 24px;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.45);
  scroll-margin-top: 120px;
}
.quiz.is-flash { animation: flash 0.9s var(--out); }
@keyframes flash { 30% { box-shadow: 0 0 0 4px var(--amber), 0 40px 80px -40px rgba(0, 0, 0, 0.45); } }

.quiz__dot { position: absolute; width: 78px; right: 22px; top: -74px; }
.tile__parabola { stroke-dasharray: 1; stroke-dashoffset: 1; animation: trace 4.5s var(--out) infinite; }
.tile__vertex { transform-box: fill-box; transform-origin: center; animation: vertex 4.5s infinite; }
@keyframes trace { 0% { stroke-dashoffset: 1; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
@keyframes vertex { 0%, 20% { transform: scale(0); } 30% { transform: scale(1.6); } 40%, 85% { transform: scale(1); } 100% { transform: scale(0); } }

.quiz__hud { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; margin-bottom: 22px; }
.quiz__bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.quiz__bar span { display: block; height: 100%; width: max(8px, var(--w, 0%)); border-radius: inherit; background: var(--ink); transition: width 0.6s var(--spring); }
.quiz__hearts { display: flex; gap: 2px; font-size: 18px; line-height: 1; color: var(--red); }
.heart { transition: transform 0.4s var(--spring), color 0.3s; }
.heart.is-lost { color: var(--hair); transform: scale(0.8); }
.quiz__xp { padding: 5px 12px; border-radius: 999px; background: var(--amber-soft); color: #8a5a0c; font-size: 13px; font-weight: 500; }
.quiz__xp b { font-weight: 600; font-variant-numeric: tabular-nums; }
.quiz__xp.pop-xp { animation: xp 0.5s var(--spring); }
@keyframes xp { 40% { transform: scale(1.3); } }

.quiz__tag { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.quiz__prompt { font-size: clamp(20px, 2vw, 24px); line-height: 1.3; letter-spacing: -0.025em; min-height: 3.9em; margin-bottom: 18px; }
.quiz__choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--hair);
  font-size: 17px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s var(--spring), background 0.2s, box-shadow 0.2s;
}
.choice:hover:not(:disabled) { background: var(--bg-2); box-shadow: inset 0 0 0 1px #cfccc6; }
.choice:active:not(:disabled) { transform: scale(0.97); }
.choice:disabled { cursor: default; }
.choice kbd { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font: 500 13px var(--font); color: var(--ink-2); background: var(--bg-2); }
.choice.is-right { background: var(--green-soft); box-shadow: inset 0 0 0 1.5px var(--green); animation: xp 0.45s var(--spring); }
.choice.is-right kbd { background: var(--green); color: #fff; }
.choice.is-wrong { background: var(--red-soft); box-shadow: inset 0 0 0 1.5px var(--red); animation: shake 0.4s; }
.choice.is-wrong kbd { background: var(--red); color: #fff; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.sheet { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; margin-top: 14px; padding: 14px 16px; border-radius: 16px; animation: rise-in 0.4s var(--spring); }
.sheet[hidden] { display: none; }
.sheet.is-right { background: var(--green-soft); }
.sheet.is-right .sheet__title { color: var(--green); }
.sheet.is-wrong { background: var(--red-soft); }
.sheet.is-wrong .sheet__title { color: var(--red); }
.sheet__title { font-weight: 600; }
.sheet__text { font-size: 15px; color: var(--ink-2); }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } }

.quiz__done { text-align: center; padding: 18px 4px 4px; animation: rise-in 0.5s var(--spring); }
.quiz__done[hidden] { display: none; }
.quiz__done-title { font-size: 30px; letter-spacing: -0.04em; }
.quiz__done-text { margin: 10px auto 22px; max-width: 36ch; color: var(--ink-2); }
.quiz__done-ctas { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

@media (max-width: 960px) {
  .play .panel { grid-template-columns: 1fr; padding-top: 100px; }
  .play .quiz { grid-area: auto; }
  .tile { display: none; }
}
@media (max-width: 480px) {
  .quiz { padding: 18px; }
  .quiz__choices, .sheet { grid-template-columns: 1fr; }
  .hero__ctas .pill { width: 100%; }
}

/* ---------- Home hero: floating photo collage (Cosmos-style) ---------- */
.hero--collage { position: relative; min-height: 100svh; display: grid; place-items: center; overflow: hidden; padding: 120px 0 110px; }
.hero__inner { position: relative; z-index: 2; }

.collage { position: absolute; inset: 0; pointer-events: none; }
.ph {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: clamp(120px, calc(var(--w) * 100vw / 1440), calc(var(--w) * 1px));
  margin: 0;
  translate: 0 -50%;
  transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotate(var(--r));
  will-change: transform;
}
.ph img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.45);
  animation: ph-in 1.2s var(--out) both, ph-float 7s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.09s + 0.15s), calc(var(--i) * -0.9s);
}
/* The veil: photos can drift anywhere, but whatever reaches the text gets blurred and faded out. */
.hero__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 34% 40% at 50% 50%, rgba(255, 255, 255, 0.92) 35%, rgba(255, 255, 255, 0.55) 65%, rgba(255, 255, 255, 0) 100%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  -webkit-mask-image: radial-gradient(ellipse 38% 44% at 50% 50%, #000 45%, transparent 100%);
  mask-image: radial-gradient(ellipse 38% 44% at 50% 50%, #000 45%, transparent 100%);
}
.ph--tutor img { object-position: 50% 20%; }
.ph__chip {
  position: absolute;
  left: 12px;
  bottom: -14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.35);
  animation: chip-in 0.7s var(--spring) both;
  animation-delay: calc(var(--i) * 0.09s + 0.9s);
}
.ph__chip--amber { background: var(--amber); color: var(--ink); }
.ph__chip--green { background: var(--green); }
.ph__chip--light { background: var(--bg); color: var(--ink); }
.ph-dot { position: absolute; z-index: 2; left: calc(50% - 31px); top: 80%; width: 62px; animation: chip-in 0.8s var(--spring) both; animation-delay: 1.2s; }
@keyframes ph-in { from { opacity: 0; transform: translateY(60px) scale(0.85); filter: blur(12px); } }
@keyframes ph-float { 50% { translate: 0 -10px; } }
@keyframes chip-in { from { opacity: 0; transform: scale(0.6) translateY(10px); } }

/* Quiz panel photo tiles */
.tile--photo { display: block; position: relative; padding: 0; margin: 0; overflow: visible; aspect-ratio: 3 / 4; background: none; box-shadow: none; }
.tile--photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 10px; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.45); }
.tile--left { grid-area: 1 / 1; align-self: start; }
.tile--right { grid-area: 1 / 3; align-self: end; }
.tile__chip { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.3; background: var(--bg); box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.4); }
.tile__chip--red { border-left: 4px solid var(--red); }
.tile__chip--amber { border-left: 4px solid var(--amber); }

@media (max-width: 860px) {
  .hero__veil { display: none; }
  .hero--collage { display: flex; flex-direction: column; min-height: 0; padding-bottom: 60px; }
  .collage { order: 2; position: relative; display: flex; gap: 12px; margin-top: 44px; padding: 0 16px 20px; width: 100%; overflow: hidden; }
  .ph { position: relative; left: auto; top: auto; flex: none; width: 150px; translate: none; transform: rotate(calc(var(--r) / 2)); }
  .ph:nth-child(n + 6), .ph-dot { display: none; }
}
