/* ============================================================================
   YOINKY SPLOINKY — styles
   Mobile-first. Deep night-sky navy, treasure gold, a silly pink.
   You shouldn't need to touch this; the words all live in config.js.
   ========================================================================== */

:root {
  --ink:      #0e1330;   /* deep navy background */
  --ink-2:    #161d47;   /* raised panels */
  --ink-3:    #1e2760;   /* inputs, chips */
  --cream:    #fdf6e9;   /* text */
  --cream-dim:#c3c6e6;   /* quieter text */
  --gold:     #ffd166;   /* treasure */
  --gold-hot: #ffb703;
  --pink:     #ff5fa2;   /* the silly accent */
  --pink-hot: #ff2d7e;
  --mint:     #5fe3c0;   /* "correct!" */
  --bad:      #ff6b6b;
  --line:     rgba(255,255,255,.12);
  --radius:   20px;
  --shadow:   0 18px 50px rgba(0,0,0,.45);
  --display:  'Bricolage Grotesque', 'Trebuchet MS', system-ui, sans-serif;
  --hand:     'Shantell Sans', 'Comic Sans MS', 'Bricolage Grotesque', cursive;
  --body:     'Space Grotesk', system-ui, -apple-system, sans-serif;
  --ease-back: cubic-bezier(.34,1.56,.64,1);
  /* the classic hand-drawn wobbly-box radius */
  --wonky:    255px 12px 235px 15px / 15px 225px 15px 255px;
  --wonky2:   14px 240px 18px 230px / 220px 16px 240px 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  color: var(--cream);
  background:
    radial-gradient(120% 90% at 50% -10%, #24306e 0%, var(--ink) 55%) fixed;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---- starfield ----------------------------------------------------------- */
.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.4px 1.4px at 20% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.4px 1.4px at 70% 20%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.6px 1.6px at 40% 70%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.2px 1.2px at 85% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.6px 1.6px at 15% 85%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.2px 1.2px at 60% 90%, rgba(255,255,255,.45), transparent);
  opacity: .55;
}

/* ---- confetti layer ------------------------------------------------------ */
.fx { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.bit { position: fixed; top: 0; left: 0; will-change: transform, opacity; font-size: 22px; }

/* ---- the header crest ---------------------------------------------------- */
.crest {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem clamp(.9rem, 4vw, 1.4rem);
  background: rgba(14,19,48,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.crest[hidden] { display: none; }
.crest__mark {
  font-size: 1.5rem; line-height: 1; background: none; border: none;
  cursor: pointer; filter: drop-shadow(0 0 10px rgba(255,209,102,.5));
}
.crest__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .25rem; }
.crest__rank {
  font-family: var(--display); font-weight: 800; font-size: .95rem;
  color: var(--gold); line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crest__dots { display: flex; gap: 5px; }
.crest__dots i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3); border: 1px solid var(--line); display: block;
  transition: background .3s, transform .3s var(--ease-back);
}
.crest__dots i.is-done { background: var(--gold); border-color: var(--gold-hot); }
.crest__dots i.is-here { background: var(--pink); border-color: var(--pink-hot); transform: scale(1.35); }
.crest__reset {
  background: none; border: 1px solid var(--line); color: var(--cream-dim);
  font-family: var(--body); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
  padding: .35rem .6rem; border-radius: 999px; cursor: pointer;
}
.crest__reset:hover { color: var(--cream); border-color: var(--pink); }

/* ---- screens ------------------------------------------------------------- */
#app {
  position: relative; z-index: 1; flex: 1;
  width: 100%; max-width: 34rem; margin: 0 auto;
  padding: clamp(1.4rem, 6vw, 2.6rem) clamp(1.1rem, 5vw, 1.6rem) 3rem;
  display: flex; flex-direction: column; justify-content: center;
}
.screen { animation: rise .5s var(--ease-back) both; }
.screen[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---- intro --------------------------------------------------------------- */
.intro { text-align: center; }
.intro__eyebrow {
  font-size: .8rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cream-dim); margin-bottom: .4rem;
}
.intro__title {
  font-family: var(--display); font-weight: 800; line-height: .95;
  font-size: clamp(2.8rem, 15vw, 4.6rem);
  color: var(--gold);
  text-shadow: 0 2px 0 var(--gold-hot), 0 14px 40px rgba(255,183,3,.35);
  margin-bottom: 1.2rem;
}
.intro__seal, .finale__seal {
  width: 92px; height: 92px; margin: 0 auto 1.3rem;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--pink), var(--pink-hot));
  box-shadow: 0 0 0 6px rgba(255,95,162,.18), var(--shadow);
  font-size: 2.6rem;
  animation: bob 3.5s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.intro__blurb {
  color: var(--cream-dim); font-size: 1.02rem; margin-bottom: 1.2rem;
  text-align: left;
}
.intro__blurb p + p { margin-top: .7rem; }
.intro__countdown {
  display: inline-block; margin-bottom: 1.4rem; padding: .4rem .9rem;
  border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line);
  font-size: .85rem; color: var(--gold);
}
.intro__foot { margin-top: 1rem; font-size: .78rem; color: var(--cream-dim); opacity: .8; }

/* ---- buttons ------------------------------------------------------------- */
.btn {
  font-family: var(--display); font-weight: 800; font-size: 1rem;
  color: var(--ink); background: linear-gradient(180deg, var(--gold), var(--gold-hot));
  border: none; border-radius: 999px; cursor: pointer;
  padding: .85rem 1.6rem; box-shadow: var(--shadow);
  transition: transform .18s var(--ease-back), filter .2s;
}
.btn:hover { transform: translateY(-2px) scale(1.02); filter: brightness(1.05); }
.btn:active { transform: translateY(0) scale(.97); }
.btn--big { font-size: 1.15rem; padding: 1rem 2rem; }
a.btn { text-decoration: none; display: inline-block; }

/* ---- a stop -------------------------------------------------------------- */
.stop__count {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--pink); font-weight: 500; margin-bottom: .5rem;
}
.stop__area {
  font-family: var(--display); font-weight: 800; font-size: 1.35rem;
  color: var(--gold); line-height: 1.15; margin-bottom: 1rem;
}
.stop__riddle {
  font-size: 1.12rem; line-height: 1.65; white-space: pre-line;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.3rem;
}

/* ---- the guess form ------------------------------------------------------ */
.guess { display: flex; gap: .5rem; margin-bottom: .3rem; }
.guess__input {
  flex: 1; min-width: 0;
  font-family: var(--body); font-size: 1.05rem; color: var(--cream);
  background: var(--ink-3); border: 2px solid var(--line); border-radius: 14px;
  padding: .8rem 1rem;
}
.guess__input::placeholder { color: rgba(255,255,255,.35); }
.guess__input:focus { outline: none; border-color: var(--pink); }
.guess__go { padding: .8rem 1.1rem; font-size: .95rem; white-space: nowrap; }
.guess__verdict {
  min-height: 1.5em; font-weight: 500; margin: .5rem 0 1rem; text-align: center;
}
.guess__verdict.is-bad { color: var(--bad); }
.guess__verdict.is-good { color: var(--mint); }
.shake { animation: shake .4s; }
@keyframes shake {
  25% { transform: translateX(-7px); } 75% { transform: translateX(7px); }
}

/* ---- hints --------------------------------------------------------------- */
.hints { text-align: center; }
.hints__ask {
  background: none; border: 1px dashed var(--line); color: var(--cream-dim);
  font-family: var(--body); font-size: .85rem; padding: .5rem 1rem;
  border-radius: 999px; cursor: pointer;
}
.hints__ask:hover { color: var(--cream); border-color: var(--pink); }
.hints__ask[hidden] { display: none; }
.hints__list { list-style: none; margin: 1rem 0 0; display: grid; gap: .6rem; }
.hints__list li {
  background: var(--ink-2); border: 1px solid var(--line); border-left: 3px solid var(--pink);
  border-radius: 12px; padding: .7rem .9rem; font-size: .92rem; text-align: left;
  color: var(--cream-dim); animation: rise .4s var(--ease-back) both;
}

/* ---- sealed / waiting ---------------------------------------------------- */
.wait { text-align: center; }
.wait__seal {
  width: 84px; height: 84px; margin: 0 auto 1.3rem;
  display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a4790, var(--ink-3));
  box-shadow: 0 0 0 6px rgba(95,227,192,.14), var(--shadow);
  font-size: 2.3rem; animation: bob 4s ease-in-out infinite;
}
.wait__eyebrow {
  font-size: .72rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--mint); margin-bottom: .5rem;
}
.wait__title {
  font-family: var(--display); font-weight: 800; font-size: 1.7rem;
  color: var(--gold); line-height: 1.15; margin-bottom: 1rem;
}
.wait__when {
  display: inline-block; margin-bottom: 1.2rem; padding: .45rem 1rem;
  border-radius: 999px; background: var(--ink-2); border: 1px solid var(--line);
  font-weight: 500; color: var(--mint);
}
.wait__body {
  font-size: 1.05rem; line-height: 1.65; white-space: pre-line;
  color: var(--cream-dim); text-align: left; max-width: 30rem; margin: 0 auto;
}
.wait__body p + p { margin-top: .7rem; }

/* ---- reward -------------------------------------------------------------- */
.reward { text-align: center; }
.reward__badge {
  font-family: var(--display); font-weight: 800; font-size: 1rem;
  letter-spacing: .1em; text-transform: uppercase; color: var(--mint);
  margin-bottom: .5rem;
}
.reward__rank {
  font-family: var(--display); font-weight: 800; font-size: 1.9rem;
  color: var(--gold); line-height: 1.1; margin-bottom: 1.3rem;
}
.reward__fact {
  font-size: 1.08rem; line-height: 1.6; white-space: pre-line;
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; text-align: left;
}

/* ---- finale -------------------------------------------------------------- */
.finale { text-align: center; }
.finale__seal {
  background: radial-gradient(circle at 40% 35%, var(--gold), var(--gold-hot));
  box-shadow: 0 0 0 6px rgba(255,209,102,.2), var(--shadow);
}
.finale__title { color: var(--cream-dim); font-size: 1rem; margin-bottom: .4rem; }
.finale__rank {
  font-family: var(--display); font-weight: 800; line-height: 1.05;
  font-size: clamp(1.7rem, 8vw, 2.6rem); color: var(--gold);
  text-shadow: 0 12px 34px rgba(255,183,3,.3); margin-bottom: 1.3rem;
}
.finale__body {
  font-size: 1.08rem; line-height: 1.7; white-space: pre-line;
  color: var(--cream); margin-bottom: 1.5rem; text-align: left;
}
.finale__sign {
  margin-top: 1.4rem; white-space: pre-line; font-style: italic; color: var(--cream-dim);
}
#finale-btn { margin-bottom: .5rem; }
#finale-btn[hidden] { display: none; }

/* ---- footer -------------------------------------------------------------- */
.site-foot {
  position: relative; z-index: 1; text-align: center;
  padding: 1.4rem 1rem calc(1.4rem + env(safe-area-inset-bottom));
  font-size: .72rem; color: var(--cream-dim); opacity: .6;
}

/* ============================================================================
   ROUGH AROUND THE EDGES — the scrapbook / hand-drawn pass
   ========================================================================== */

/* scattered doodles behind everything */
.doodles { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.doodles span {
  position: absolute; left: var(--x); top: var(--y);
  font-size: clamp(1.6rem, 7vw, 2.6rem); transform: rotate(var(--r));
  opacity: .16; filter: saturate(1.2);
}

/* a wobbly little toast */
.toast {
  position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 140%) rotate(-1.5deg); z-index: 80;
  background: var(--gold); color: #201400; font-family: var(--hand); font-weight: 700;
  padding: .7rem 1.15rem; border: 3px solid #201400; border-radius: var(--wonky);
  box-shadow: 4px 4px 0 rgba(0,0,0,.4); max-width: 88vw; text-align: center;
  transition: transform .35s var(--ease-back), opacity .3s; opacity: 0;
}
.toast.is-up { transform: translate(-50%, 0) rotate(-1.5deg); opacity: 1; }

/* the ♪ music toggle — a little sticker, bottom-right */
.music{
  position:fixed; right:.8rem; bottom:calc(.8rem + env(safe-area-inset-bottom)); z-index:70;
  display:flex; align-items:center; gap:.35rem;
  font-family:var(--hand); font-weight:700; font-size:.85rem; color:#201400;
  background:var(--gold); border:3px solid #201400; border-radius:var(--wonky);
  box-shadow:3px 3px 0 rgba(0,0,0,.4); padding:.45rem .75rem; cursor:pointer;
  transition:transform .15s var(--ease-back), background .25s;
}
.music[hidden]{ display:none; }
.music:hover{ transform:translateY(-2px) rotate(-2deg); }
.music:active{ transform:translateY(1px) scale(.96); }
.music.is-playing{ background:var(--mint); }
.music__ico{ font-size:1.05rem; line-height:1; }
.music.hint{ animation:musicpulse 1.6s ease-in-out 3; }
@keyframes musicpulse{ 50%{ transform:scale(1.09) rotate(-3deg); } }
/* the actual player is present but out of the way */
#music-mount{ position:fixed; right:0; bottom:0; width:1px; height:1px; opacity:.01; overflow:hidden; pointer-events:none; z-index:0; }

/* the big title, given a jaunty tilt */
.intro__title { transform: rotate(-2.5deg); }
.intro__eyebrow { font-family: var(--hand); font-weight: 600; }

/* hand-drawn borders + tilt on the panels */
.intro__seal, .stop__riddle, .reward__fact, .finale__body,
.wait__body, .guess__input {
  border-radius: var(--wonky) !important;
}
.stop__riddle { transform: rotate(-1deg); border-width: 2px; }
.reward__fact { transform: rotate(1deg); }
.stop__area, .reward__rank, .wait__title, .trail__title { font-family: var(--hand); }

/* chunky sticker buttons */
.btn {
  border: 3px solid #201400; border-radius: var(--wonky);
  box-shadow: 4px 4px 0 rgba(0,0,0,.45); transform: rotate(-1deg);
  font-family: var(--hand);
}
.btn:hover { transform: rotate(-1deg) translateY(-2px) scale(1.02); }
.btn:active { transform: rotate(-1deg) translateY(1px) scale(.98); box-shadow: 2px 2px 0 rgba(0,0,0,.45); }
.guess__go { transform: rotate(1.5deg); }

.guess__input { border-width: 3px; }

.hints__ask { font-family: var(--hand); }

/* ============================================================================
   THE STEPPING-STONE TRAIL
   ========================================================================== */
.trail__title {
  text-align: center; color: var(--gold); font-weight: 700;
  font-size: 1.15rem; margin: 1.6rem 0 .3rem; transform: rotate(-1.5deg);
}
.trail {
  list-style: none; position: relative; margin: .5rem auto 1.6rem; padding: 1.2rem 0;
  max-width: 22rem;
}
/* the winding dotted path down the middle */
.trail::before {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0;
  border-left: 4px dashed rgba(255,209,102,.35); transform: translateX(-50%);
  z-index: 0;
}
.stone {
  position: relative; z-index: 1; width: 60%;
  margin: .55rem 0; padding: .7rem .5rem .6rem;
  display: flex; flex-direction: column; align-items: center; gap: .1rem; text-align: center;
  background: var(--ink-2); color: var(--cream);
  border: 3px solid #201400; border-radius: var(--wonky);
  box-shadow: 4px 4px 0 rgba(0,0,0,.4);
}
.stone:nth-child(odd)  { margin-right: auto; transform: rotate(-3deg); }
.stone:nth-child(even) { margin-left: auto;  transform: rotate(3deg); }
.stone:nth-child(3n)   { border-radius: var(--wonky2); }
.stone__no {
  position: absolute; top: -12px; left: -12px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--pink); color: #2a0016; font-family: var(--hand); font-weight: 700;
  border: 3px solid #201400; border-radius: 50%; box-shadow: 2px 2px 0 rgba(0,0,0,.4);
  transform: rotate(-8deg);
}
.stone__face { font-size: 1.7rem; line-height: 1; }
.stone__tag {
  font-family: var(--hand); font-size: .74rem; font-weight: 600;
  color: var(--cream-dim); line-height: 1.15;
}
/* states */
.stone.is-done  { background: linear-gradient(160deg, #2c245e, #241a49); border-color: var(--gold-hot); }
.stone.is-done .stone__tag { color: var(--gold); }
.stone.is-open, .stone.is-next {
  background: linear-gradient(160deg, #3a2350, #2a1740);
  border-color: var(--pink); animation: pulse 2.4s ease-in-out infinite;
}
.stone.is-open .stone__tag, .stone.is-next .stone__tag { color: var(--pink); }
.stone.is-tappable { cursor: pointer; }
.stone.is-tappable:hover { transform: scale(1.05) rotate(0deg); }
.stone.is-locked { opacity: .68; }
@keyframes pulse {
  50% { box-shadow: 4px 4px 0 rgba(0,0,0,.4), 0 0 22px rgba(255,95,162,.5); }
}

/* the royal markers riding a stone */
.royals {
  position: absolute; top: -40px; left: 50%; transform: translateX(-50%);
  display: flex; gap: .35rem; z-index: 3;
}
.royal {
  background: none; border: none; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  animation: hover 2.8s ease-in-out infinite;
}
.royal:last-child { animation-delay: .4s; }
.royal b {
  font-family: var(--hand); font-size: .6rem; color: var(--cream);
  margin-top: -2px; text-shadow: 0 1px 2px #000;
}
.crown { width: 30px; height: auto; filter: drop-shadow(1px 2px 1px rgba(0,0,0,.5)); }
.c-body { fill: var(--gold); stroke: #6b4700; stroke-width: 1.6; stroke-linejoin: round; }
.c-band { fill: var(--gold-hot); stroke: #6b4700; stroke-width: 1.6; }
.c-cross { stroke: var(--gold); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.c-jewel { fill: var(--pink-hot); }
.c-jewel--pink { fill: var(--pink-hot); }
.c-pearl { fill: #fff; stroke: #c9a24a; stroke-width: 1; }
@keyframes hover { 50% { transform: translateY(-5px) rotate(-4deg); } }
.wobble { animation: wob .5s; }
@keyframes wob { 20% { transform: rotate(-14deg) scale(1.2); } 60% { transform: rotate(12deg) scale(1.2); } }

/* the whole app doing a "yoink" */
.yoinked { animation: yoink .5s var(--ease-back); }
@keyframes yoink {
  20% { transform: translateY(-14px) rotate(-1.5deg) scale(1.02); }
  45% { transform: translateX(10px) rotate(1.5deg); }
  70% { transform: translateX(-8px) rotate(-1deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
