@font-face {
  font-family: Fredoka;
  src: url("/suggestions/fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-stretch: 75% 125%;
  font-display: swap;
}

:root {
  --purple: #5b12b8;
  --purple-2: #8d2be0;
  --blue: #1565e0;
  --gold: #ffc21a;
  --gold-2: #ff9f0a;
  --gold-deep: #c47a00;
  --ink: #1a1a4a;
  --bg: #f6f1ff;
  --card: #fff;
  --muted: #55557a;
  --line: #e6ddf7;
  --teal: #12C9C0;
  --orange: #F7893A;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Fredoka, "Trebuchet MS", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---- Hero ---- */
.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  color: #fff;
  padding: calc(28px + var(--safe-t)) 22px 36px;
  background: linear-gradient(135deg, #5b12b8 0%, #8d2be0 52%, #1565e0 100%);
  box-shadow: 0 8px 24px rgba(40, 0, 90, .28);
}
.hero-art { position: absolute; inset: 0; pointer-events: none; }
.shape {
  position: absolute;
  border-radius: 50%;
  opacity: .18;
  background: #fff;
}
.s1 { width: 160px; height: 160px; top: -50px; left: -40px; }
.s2 { width: 110px; height: 110px; right: -30px; top: 20px; background: var(--gold); opacity: .22; }
.s3 {
  width: 70px; height: 70px; left: 18%; bottom: -20px;
  border-radius: 18px; transform: rotate(22deg);
  background: var(--teal); opacity: .28;
}
.s4 {
  width: 46px; height: 46px; right: 22%; bottom: 16px;
  border-radius: 12px; transform: rotate(-18deg);
  background: #fff; opacity: .16;
}
.spark {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 2px;
  transform: rotate(20deg);
  box-shadow: 0 0 10px rgba(255, 194, 26, .8);
  opacity: .9;
}
.k1 { top: 12px; left: 12px; }
.k2 { top: 16px; right: 14px; width: 6px; height: 6px; }
.k3 { bottom: 10px; left: 14px; background: #fff; }
.k4 { top: 10px; left: 22%; width: 5px; height: 5px; }
.k5 { bottom: 12px; right: 16px; }
.k6 { bottom: 14px; left: 40%; width: 5px; height: 5px; background: #fff; }

.eyebrow {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 700;
  color: var(--gold);
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(2.2rem, 10vw, 3rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.05;
  text-shadow: 0 3px 0 rgba(40, 0, 90, .25);
}
.lede {
  position: relative;
  z-index: 1;
  margin: 12px auto 0;
  max-width: 22em;
  font-size: 1.05rem;
  font-weight: 500;
  color: #f3e9ff;
}

main { max-width: 640px; margin: 0 auto; padding: 18px 14px 24px; }

/* ---- Cards ---- */
.card {
  background: var(--card);
  border-radius: 22px;
  padding: 16px 16px 18px;
  margin: 0 0 14px;
  box-shadow: 0 4px 14px rgba(60, 20, 120, .12);
  border: 3px solid #efe8ff;
}
.card-title, legend.card-title, label.card-title {
  display: block;
  font-weight: 700;
  font-size: 1.12rem;
  margin: 0 0 12px;
  color: var(--ink);
}
.opt { font-weight: 500; color: var(--muted); font-size: .88em; }
.card.optional .card-title { margin-top: 14px; }
.card.optional .card-title:first-child { margin-top: 0; }

textarea, input[type=text], input[type=email] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fbf9ff;
  min-height: 52px;
}
textarea { min-height: 128px; resize: vertical; }
textarea:focus, input:focus, .game-trigger:focus-visible, .send:focus-visible, .back:focus-visible, .sheet-close:focus-visible, .game-tile:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--teal) 70%, white);
  outline-offset: 2px;
}

/* ---- Game picker ---- */
.sr-select {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.game-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 2px solid var(--line);
  background: linear-gradient(#fff, #f7f3ff);
  border-radius: 16px;
  padding: 10px 12px;
  min-height: 76px;
  box-shadow: 0 3px 0 #d8ccf3;
}
.game-trigger:active { transform: translateY(2px); box-shadow: 0 1px 0 #d8ccf3; }
.game-thumb {
  width: 56px; height: 56px;
  border-radius: 12px;
  background: #efe8ff center/cover no-repeat;
  flex: none;
  box-shadow: 0 2px 6px rgba(60, 20, 120, .2);
}
.game-thumb.letter {
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.4rem; color: #fff;
  background: linear-gradient(135deg, #8d2be0, #1565e0);
}
.game-trigger-text { flex: 1; min-width: 0; }
.game-name {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}
.game-hint { display: block; margin-top: 2px; color: var(--muted); font-size: .88rem; }
.chevron { color: var(--purple); font-size: 1.2rem; flex: none; }
.other-wrap { margin-top: 14px; }
.other-wrap label { display: block; font-weight: 700; margin: 0 0 6px; }

/* ---- Stars ---- */
.stars-field { border: 0; margin: 0; padding: 0; }
.stars {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.star {
  position: relative;
  flex: 1;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 64px;
  border-radius: 16px;
  cursor: pointer;
}
.star input { position: absolute; opacity: 0; pointer-events: none; }
.star-icon {
  width: 48px; height: 48px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23ddd4f3' d='M12 2.2l3.09 6.26 6.91 1.01-5 4.87 1.18 6.88L12 17.9 5.82 21.22 7 14.34 2 9.47l6.91-1.01L12 2.2z'/></svg>") center/contain no-repeat;
  filter: drop-shadow(0 2px 0 rgba(90, 40, 160, .08));
  transition: transform .16s cubic-bezier(.2, 1.4, .3, 1), filter .16s;
}
.star.on .star-icon,
.star.preview .star-icon {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0%' stop-color='%23ffe56a'/><stop offset='45%' stop-color='%23ffc21a'/><stop offset='100%' stop-color='%23e69500'/></linearGradient></defs><path fill='url(%23g)' stroke='%23c47a00' stroke-width='.6' d='M12 2.2l3.09 6.26 6.91 1.01-5 4.87 1.18 6.88L12 17.9 5.82 21.22 7 14.34 2 9.47l6.91-1.01L12 2.2z'/><path fill='%23fff6b0' opacity='.7' d='M12 4.2l.9 1.8 1.2.2-2.1 1.2z'/></svg>");
  filter: drop-shadow(0 3px 0 #c47a00) drop-shadow(0 6px 10px rgba(200, 120, 0, .35));
}
.star.on .star-icon { animation: starpop .32s cubic-bezier(.2, 1.5, .3, 1); }
@keyframes starpop {
  0% { transform: scale(.55) rotate(-8deg); }
  70% { transform: scale(1.22) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.star-label {
  min-height: 1.4em;
  margin: 10px 0 0;
  text-align: center;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--purple);
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 500;
  font-size: .92rem;
  margin: 16px 0 0;
}
.consent input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--purple); }

/* ---- Gold send button ---- */
.send, .back {
  appearance: none;
  display: block;
  width: 100%;
  border: 0;
  border-radius: 16px;
  min-height: 60px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 21px;
  text-align: center;
  text-decoration: none;
  color: #4a2500;
  background: linear-gradient(#ffd84a, #ffb000);
  box-shadow: 0 4px 0 #c47a00, 0 6px 14px rgba(200, 120, 0, .3);
  transition: transform .08s;
}
.send:active, .back:active { transform: translateY(2px); box-shadow: 0 2px 0 #c47a00; }
.send:disabled { opacity: .7; cursor: wait; }

.msg { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.msg.err { background: #fde8e8; color: #7a1020; }

footer#site-foot {
  text-align: center;
  color: var(--muted);
  font-size: .95rem;
  padding: 8px 16px calc(28px + var(--safe-b));
}
.signoff-mini { margin: 0; font-weight: 700; color: var(--purple); font-size: 1.05rem; }
footer#site-foot a { color: var(--purple); font-weight: 700; }

/* ---- Thank-you (full-screen celebration) ---- */
.thanks {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-t)) 22px calc(28px + var(--safe-b));
  background: radial-gradient(circle at 50% 38%, #8d2be0 0%, #3a0c86 48%, #1a0848 100%);
  color: #fff;
  text-align: center;
  overflow: hidden;
}
.thanks[hidden] { display: none !important; }
.thanks-inner { position: relative; z-index: 2; max-width: 26rem; width: 100%; }
.thanks-star {
  width: 96px; height: 96px;
  margin: 0 auto 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><defs><linearGradient id='g' x1='0' y1='0' x2='0' y2='1'><stop offset='0%' stop-color='%23ffe56a'/><stop offset='50%' stop-color='%23ffc21a'/><stop offset='100%' stop-color='%23e69500'/></linearGradient></defs><path fill='url(%23g)' stroke='%23c47a00' stroke-width='.5' d='M12 2.1l3.09 6.26 6.91 1.01-5 4.87 1.18 6.88L12 17.8 5.82 21.12 7 14.24 2 9.37l6.91-1.01L12 2.1z'/></svg>") center/contain no-repeat;
  filter: drop-shadow(0 6px 0 #8a5a00) drop-shadow(0 12px 20px rgba(0,0,0,.35));
  animation: starpop .6s cubic-bezier(.2, 1.4, .3, 1);
}
.thanks h2 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 12vw, 3.4rem);
  font-weight: 700;
  line-height: 1.05;
  color: #ffd84a;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .25);
}
.thanks-body {
  margin: 0 auto 16px;
  font-size: 1.15rem;
  font-weight: 500;
  color: #f4edff;
  max-width: 22em;
}
.signoff {
  margin: 0 0 28px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffd84a;
}
.thanks .back { width: auto; margin: 0 auto; min-width: 220px; }

.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 10px;
  height: 16px;
  border-radius: 2px;
  animation: burst 1.15s cubic-bezier(.15, .7, .3, 1) forwards;
}
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

/* ---- Game sheet ---- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(20, 5, 50, .72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet[hidden] { display: none !important; }
.sheet-panel {
  background: var(--bg);
  width: 100%;
  max-width: 640px;
  max-height: min(88vh, 760px);
  border-radius: 24px 24px 0 0;
  padding: 12px 14px calc(18px + var(--safe-b));
  box-shadow: 0 -8px 30px rgba(20, 0, 60, .35);
  display: flex;
  flex-direction: column;
  animation: sheetup .28s ease-out;
}
@keyframes sheetup {
  from { transform: translateY(24px); opacity: .6; }
  to { transform: none; opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 12px;
}
.sheet-head h2 { margin: 0; font-size: 1.35rem; }
.sheet-close {
  border: 0;
  background: #efe8ff;
  color: var(--ink);
  font-weight: 700;
  border-radius: 999px;
  min-height: 44px;
  padding: 8px 16px;
}
.game-grid {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 6px;
}
.game-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  text-align: left;
  border: 3px solid #efe8ff;
  background: #fff;
  border-radius: 16px;
  padding: 8px 10px;
  min-height: 72px;
  box-shadow: 0 2px 8px rgba(60, 20, 120, .08);
}
.game-tile img, .game-tile .letter {
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 12px;
  object-fit: cover;
  background: #efe8ff;
}
.game-tile .letter {
  display: grid; place-items: center;
  font-weight: 700; font-size: 1.5rem; color: #fff;
  background: linear-gradient(135deg, #8d2be0, #1565e0);
}
.game-tile span.title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.game-tile[aria-selected="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-deep), 0 4px 12px rgba(200, 120, 0, .25);
}

.hp { position: absolute; left: -9999px; height: 0; overflow: hidden; }

body.thanks-open { overflow: hidden; }
body.sheet-open { overflow: hidden; }

@media (min-width: 640px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 24px; max-height: 80vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .confetti { display: none; }
}
