* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #ffe9f5;
  font-family: "Comic Sans MS", "Chalkboard SE", "Marker Felt", "Trebuchet MS", system-ui, sans-serif; color: #5a3a6e; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------- pick your fairy ---------- */
#select { position: fixed; inset: 0; pointer-events: none; }
#select > * { pointer-events: auto; }
.title { position: absolute; top: 18px; left: 0; right: 0; text-align: center; pointer-events: none; }
.title h1 { margin: 0; font-size: clamp(34px, 6vw, 64px); color: #fff;
  text-shadow: 0 4px 0 #ff8fc4, 0 8px 0 #c9a4ff, 0 0 24px #fff; letter-spacing: 2px; }
.title p { margin: 6px 0 0; font-size: clamp(18px, 2.4vw, 26px); color: #fff; text-shadow: 0 2px 0 #b58cff; }

#info { position: absolute; right: 4vw; top: 50%; transform: translateY(-58%); width: min(340px, 42vw);
  background: rgba(255,255,255,.86); border: 5px solid #fff; border-radius: 28px; padding: 18px 20px 20px;
  box-shadow: 0 8px 0 rgba(201,164,255,.6), 0 14px 30px rgba(120,80,160,.25); text-align: center; }
#info canvas { image-rendering: pixelated; width: 64px; height: 80px; }
#info h2 { margin: 2px 0 6px; font-size: 30px; }
#info p { margin: 6px 0; font-size: 16px; line-height: 1.35; }
#infoTraits { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.trait { padding: 3px 12px; border-radius: 99px; color: #fff; font-size: 14px; font-weight: bold; text-shadow: 0 1px 0 rgba(0,0,0,.18); }
#infoFav { font-size: 15px; opacity: .85; }
#startBtn, #againBtn { margin-top: 8px; border: 0; border-radius: 99px; padding: 12px 30px; font-size: 22px; font-weight: bold; color: #fff;
  background: linear-gradient(#ff9ed0, #ff6fb0); box-shadow: 0 5px 0 #d94b91; transition: transform .1s; }
#startBtn:hover, #againBtn:hover { transform: translateY(-2px) scale(1.04); }
#startBtn:active, #againBtn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d94b91; }

#cards { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; gap: 10px; justify-content: center; padding: 0 8px; flex-wrap: wrap; }
.card { width: 98px; padding: 8px 4px 6px; border-radius: 20px; background: rgba(255,255,255,.75); border: 4px solid #fff;
  text-align: center; font-weight: bold; font-size: 15px; color: #5a3a6e; box-shadow: 0 5px 0 rgba(0,0,0,.08); transition: transform .12s; }
.card canvas { width: 48px; height: 60px; image-rendering: pixelated; display: block; margin: 0 auto 2px; }
.card:hover { transform: translateY(-5px); }
.card.on { background: #fff; transform: translateY(-10px) scale(1.08); border-color: var(--c); box-shadow: 0 6px 0 var(--c), 0 0 22px var(--c); }

/* ---------- in the game ---------- */
#chip { position: fixed; top: 14px; left: 14px; display: flex; gap: 10px; align-items: center; padding: 8px 16px 8px 10px;
  background: rgba(255,255,255,.85); border: 4px solid #fff; border-radius: 24px; box-shadow: 0 5px 0 rgba(201,164,255,.6); }
#chip canvas { width: 42px; height: 52px; image-rendering: pixelated; }
#chip b { font-size: 20px; }
#count { font-size: 15px; margin: 2px 0 4px; }
#bar { display: flex; gap: 2px; max-width: 220px; flex-wrap: wrap; }
#bar span { width: 8px; height: 8px; border-radius: 2px; background: #e8dcf5; }
#bar span.on { background: var(--c); box-shadow: 0 0 6px var(--c); }
#musicBtn { position: fixed; top: 14px; right: 14px; border: 4px solid #fff; background: rgba(255,255,255,.85); border-radius: 99px;
  padding: 8px 16px; font-size: 15px; font-weight: bold; color: #5a3a6e; box-shadow: 0 4px 0 rgba(201,164,255,.6); }
#hint { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 8px 18px; border-radius: 99px; font-size: 14px;
  background: rgba(255,255,255,.85); border: 3px solid #fff; transition: opacity 1.5s; white-space: nowrap; max-width: 96vw; overflow: hidden; }
#hint.gone { opacity: 0; pointer-events: none; }
#goal { position: fixed; top: 84px; left: 50%; transform: translateX(-50%); padding: 8px 20px; border-radius: 99px; font-size: 18px; font-weight: bold;
  background: linear-gradient(90deg, #ffd1e8, #d9c4ff, #bfe8ff); border: 3px solid #fff; color: #5a3a6e; opacity: 0; transition: opacity .5s; pointer-events: none; text-align: center; }
#goal.show { opacity: 1; }

#bubble { position: fixed; z-index: 5; max-width: 240px; padding: 9px 14px; font-size: 17px; font-weight: bold; text-align: center; color: #5a3a6e;
  background: #fff; border: 4px solid var(--c, #ff9ed0); border-radius: 20px; pointer-events: none; transform: translate(-50%, -100%); animation: pop .25s ease-out; }
#bubble::after { content: ""; position: absolute; left: 50%; bottom: -14px; margin-left: -8px; border: 8px solid transparent; border-top-color: var(--c, #ff9ed0); }
@keyframes pop { from { opacity: 0; scale: .6; } to { opacity: 1; scale: 1; } }

#win { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,230,245,.55); z-index: 10; }
#win .box { background: #fff; border: 6px solid #ffb3da; border-radius: 32px; padding: 26px 34px; text-align: center; max-width: 440px;
  box-shadow: 0 8px 0 #c9a4ff, 0 0 40px rgba(255,255,255,.9); animation: pop .5s ease-out; }
#win h2 { margin: 0 0 8px; font-size: 32px; color: #ff6fb0; }
#win p { font-size: 18px; margin: 8px 0; }
.confetti { position: fixed; top: -20px; width: 12px; height: 12px; z-index: 11; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

@media (max-width: 760px) {
  #info { top: 80px; transform: none; right: 50%; margin-right: -45vw; width: 90vw; padding: 8px 12px; }
  #info canvas { display: none; }
  #info h2 { font-size: 22px; margin: 0; }
  .card { width: 66px; font-size: 12px; }
  .card canvas { width: 32px; height: 40px; }
}

#levelCard { position: fixed; inset: 0; z-index: 12; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .6s;
  background: linear-gradient(#6fe0cc, #b9f5a8, #fff2b8); pointer-events: none; text-align: center; }
#levelCard.on { opacity: 1; }
#levelCard h2 { margin: 0; font-size: clamp(40px, 8vw, 90px); color: #fff; text-shadow: 0 5px 0 var(--s1, #3fb86a), 0 10px 0 var(--s2, #ff9a3c); }
#levelCard p { margin: 10px 0 0; font-size: clamp(24px, 4vw, 44px); color: #fff; text-shadow: 0 3px 0 #2fbf9a; }

#stars { margin-top: 4px; font-size: 15px; font-weight: bold; color: #c98a00; }
#boostBar { height: 8px; width: 140px; margin-top: 3px; border-radius: 99px; background: #f1e6c4; overflow: hidden; }
#boostBar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffe14a, #ff9a3c); }
#boostBar.on i { box-shadow: 0 0 10px #ffb300; }
